From bf1641b94cffa54b786e18eaeff3839d8790b9f2 Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Wed, 5 Sep 2007 20:33:43 -0700 Subject: 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. --- os/connection.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'os') 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 +#ifdef HAVE_LAUNCHD +#include +#endif #include #include #include @@ -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 -- cgit v1.2.3