summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2004-04-24 23:39:25 +0000
committerAlan Coopersmith <alan.coopersmith@sun.com>2004-04-24 23:39:25 +0000
commit3aed873292424b497d9a7dcee2975b95bf5ac966 (patch)
tree07362e8cee6f8188d5adf38b129639240ead91c1
parentc6349f43193b74a3c09945f3093a871b0157ba47 (diff)
downloadxorg-lib-libX11-XACE-SELINUX-MERGE.tar.gz
XOpenDisplay should try tcp connection if local connections fail (aka Sun bug id #4624183).XACE-SELINUX-MERGE
Also includes fix from NetBSD Problem Report #25098 (Michael van Elst) (Xlib segfaults with IPv6 if compiled with HASXDMAUTH). xc/config/cf/sunLib.tmpl xc/lib/FS/Imakefile Add missing shared library dependencies for Solaris
-rw-r--r--src/ConnDis.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/ConnDis.c b/src/ConnDis.c
index 897ef5ab..126c2683 100644
--- a/src/ConnDis.c
+++ b/src/ConnDis.c
@@ -1,4 +1,4 @@
-/* $XdotOrg: lib/X11/src/ConnDis.c,v 1.2 2004-04-23 18:43:23 eich Exp $ */
+/* $XdotOrg: lib/X11/src/ConnDis.c,v 1.3 2004-04-24 23:39:25 alanc 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