diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-08-05 18:38:30 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-08-05 18:38:30 -0700 |
commit | 672682ebf973f287956661a2ff5a29a83a7a9d16 (patch) | |
tree | 3da292fa2ba958986987455b9804d5e914bcba38 /os | |
parent | a8f0d32216e321b8ae6da182be9b1ea792f6e004 (diff) |
XQuartz: Now properly disable xauth checking on launchd socket and mostly fix the xinitrc / launchd race condition
Diffstat (limited to 'os')
-rw-r--r-- | os/connection.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/os/connection.c b/os/connection.c index 8c4bcdcac..4d4a623f2 100644 --- a/os/connection.c +++ b/os/connection.c @@ -669,11 +669,11 @@ ClientAuthorized(ClientPtr client, /* Allow any client to connect without authorization on a launchd socket, because it is securely created -- this prevents a race condition on launch */ - if (saddr->sa_len > 11 && saddr->sa_family == AF_UNIX && - !strncmp(saddr->sa_data, "/tmp/launch", 11)) goto done; - - auth_id = CheckAuthorization (proto_n, auth_proto, - string_n, auth_string, client, &reason); + if(trans_conn->flags | TRANS_NOXAUTH) { + auth_id = (XID) 0L; + } else { + auth_id = CheckAuthorization (proto_n, auth_proto, string_n, auth_string, client, &reason); + } if (auth_id == (XID) ~0L) { @@ -727,7 +727,6 @@ ClientAuthorized(ClientPtr client, } } priv->auth_id = auth_id; -done: priv->conn_time = 0; #ifdef XDMCP @@ -1264,12 +1263,17 @@ MakeClientGrabPervious(ClientPtr client) #ifdef XQUARTZ /* Add a fd (from launchd) to our listeners */ -_X_EXPORT void ListenOnOpenFD(int fd) { - char port[20]; +_X_EXPORT void ListenOnOpenFD(int fd, int noxauth) { + char port[256]; XtransConnInfo ciptr; - - /* Sigh for inconsistencies. */ - sprintf (port, ":%d", atoi(display)); + + if(!strncmp(getenv("DISPLAY"), "/tmp/launch", 11)) { + /* Make the path the launchd socket if our DISPLAY is set right */ + strcpy(port, getenv("DISPLAY")); + } else { + /* Just some default so things don't break and die. */ + sprintf(port, ":%d", atoi(display)); + } /* Make our XtransConnInfo * TRANS_SOCKET_LOCAL_INDEX = 5 from Xtrans.c @@ -1280,6 +1284,9 @@ _X_EXPORT void ListenOnOpenFD(int fd) { return; } + if(noxauth) + ciptr->flags = ciptr->flags | TRANS_NOXAUTH; + /* Allocate space to store it */ ListenTransFds = (int *) xrealloc(ListenTransFds, (ListenTransCount + 1) * sizeof (int)); ListenTransConns = (XtransConnInfo *) xrealloc(ListenTransConns, (ListenTransCount + 1) * sizeof (XtransConnInfo)); @@ -1294,11 +1301,11 @@ _X_EXPORT void ListenOnOpenFD(int fd) { /* Increment the count */ ListenTransCount++; - /* This *might* be needed, but it seems to be working fine without it... */ - //ResetAuthorization(); - //ResetHosts(display); + /* This *might* not be needed... /shrug */ + ResetAuthorization(); + ResetHosts(display); #ifdef XDMCP - //XdmcpReset(); + XdmcpReset(); #endif } |