summaryrefslogtreecommitdiff
path: root/os/connection.c
diff options
context:
space:
mode:
authorBen Byer <bbyer@bbyer.local>2007-09-05 20:33:43 -0700
committerBen Byer <bbyer@bbyer.local>2007-09-05 20:34:25 -0700
commitbf1641b94cffa54b786e18eaeff3839d8790b9f2 (patch)
tree84d877d645b13a793053364813db46c73b74ef72 /os/connection.c
parent71c21dea748ea0dcad758679c40ee39192d170f9 (diff)
XDARWIN: Add launchd support
This adds a bit of glue to configure.ac to support launchd detection; on OS X (or other platforms which choose to implement launchd), this allows the system to automagically start the Xserver as necessary to serve clients.
Diffstat (limited to 'os/connection.c')
-rw-r--r--os/connection.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/os/connection.c b/os/connection.c
index d975f87d2..d1bc4d04e 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -74,6 +74,9 @@ SOFTWARE.
#define TRANS_SERVER
#define TRANS_REOPEN
#include <X11/Xtrans/Xtrans.h>
+#ifdef HAVE_LAUNCHD
+#include <X11/Xtrans/Xtransint.h>
+#endif
#include <errno.h>
#include <signal.h>
#include <stdio.h>
@@ -660,10 +663,21 @@ ClientAuthorized(ClientPtr client,
XID auth_id;
char *reason = NULL;
XtransConnInfo trans_conn;
+#ifdef HAVE_LAUNCHD
+ struct sockaddr *saddr;
+#endif
priv = (OsCommPtr)client->osPrivate;
trans_conn = priv->trans_conn;
+#ifdef HAVE_LAUNCHD
+ saddr = (struct sockaddr *) (trans_conn->addr);
+ /* 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;
+#endif
+
auth_id = CheckAuthorization (proto_n, auth_proto,
string_n, auth_string, client, &reason);
@@ -719,6 +733,7 @@ ClientAuthorized(ClientPtr client,
}
}
priv->auth_id = auth_id;
+ done:
priv->conn_time = 0;
#ifdef XDMCP