diff options
Diffstat (limited to 'src/ConnDis.c')
-rw-r--r-- | src/ConnDis.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/ConnDis.c b/src/ConnDis.c index 52355b74..8bac9a03 100644 --- a/src/ConnDis.c +++ b/src/ConnDis.c @@ -1,4 +1,4 @@ -/* $XdotOrg: lib/X11/src/ConnDis.c,v 1.1.4.5 2004-03-05 13:39:06 eich Exp $ */ +/* $XdotOrg: lib/X11/src/ConnDis.c,v 1.1.4.5.4.1 2004-05-04 19:42:42 ewalsh Exp $ */ /* $Xorg: ConnDis.c,v 1.8 2001/02/09 02:03:31 xorgcvs Exp $ */ /* @@ -58,7 +58,7 @@ in this Software without prior written authorization from The Open Group. #include "Xintconn.h" -/* prototyes */ +/* prototypes */ static void GetAuthorization( XtransConnInfo trans_conn, int family, @@ -147,10 +147,10 @@ _X11TransConnectDisplay ( int connect_stat; #ifdef LOCALCONN struct utsname sys; +#endif #ifdef TCPCONN char *tcphostname = NULL; /* A place to save hostname pointer */ #endif -#endif p = display_name; @@ -283,12 +283,18 @@ _X11TransConnectDisplay ( #if defined(TCPCONN) || defined(UNIXCONN) || defined(LOCALCONN) || defined(MNX_TCPCONN) || defined(OS2PIPECONN) if (!pprotocol) { - if (!phostname) + if (!phostname) { #if defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN) pprotocol = copystring ("local", 5); +#if defined(TCPCONN) + tcphostname = copystring("localhost", 9); +#endif + } else + { #endif pprotocol = copystring ("tcp", 3); + } } #else #if defined(AMRPCCONN) @@ -325,7 +331,7 @@ _X11TransConnectDisplay ( } #endif -#if defined(LOCALCONN) && defined(TCPCONN) +#if defined(TCPCONN) connect: #endif /* @@ -339,6 +345,7 @@ _X11TransConnectDisplay ( (pdpynum ? strlen(pdpynum) : 0); if (olen > sizeof addrbuf) address = Xmalloc (olen); } + if (!address) goto bad; sprintf(address,"%s/%s:%d", pprotocol ? pprotocol : "", @@ -397,6 +404,7 @@ _X11TransConnectDisplay ( } if (address != addrbuf) Xfree (address); + address = addrbuf; if( trans_conn == NULL ) goto bad; @@ -428,6 +436,9 @@ _X11TransConnectDisplay ( if (phostname) Xfree (phostname); if (pdpynum) Xfree (pdpynum); if (pscrnum) Xfree (pscrnum); +#ifdef TCPCONN + if (tcphostname) Xfree (tcphostname); +#endif GetAuthorization(trans_conn, family, (char *) saddr, saddrlen, idisplay, auth_namep, auth_namelenp, auth_datap, auth_datalenp); @@ -442,8 +453,9 @@ _X11TransConnectDisplay ( if (saddr) free ((char *) saddr); if (pprotocol) Xfree (pprotocol); if (phostname) Xfree (phostname); + if (address && address != addrbuf) { Xfree(address); address = addrbuf; } -#if defined(LOCALCONN) && defined(TCPCONN) +#if defined(TCPCONN) if (tcphostname) { pprotocol = copystring("tcp", 3); phostname = tcphostname; @@ -580,13 +592,6 @@ _XSendClientPrefix (dpy, client, auth_proto, auth_string, prefix) #endif #ifdef SECURE_RPC -#if defined(sun) && defined(SVR4) /* && ????? */ -/* - * I'm aware this is backwards, but #define'ing PORTMAP, as suggested in the - * man pages, doesn't work either. - */ -#define authdes_seccreate authdes_create -#endif #include <rpc/rpc.h> #ifdef ultrix #include <time.h> @@ -1099,14 +1104,14 @@ GetAuthorization( /* Port number */ for (i=2; i<4; i++) xdmcp_data[j++] = ((char *)addr)[i]; - break; } else { /* Fake data to keep the data aligned. Otherwise the the server will bail about incorrect timing data */ - for (i = 0; i < 8; i++) { + for (i = 0; i < 6; i++) { xdmcp_data[j++] = 0; } } + break; } #endif /* AF_INET6 */ #ifdef AF_UNIX |