summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2010-08-25 18:23:26 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2010-08-25 18:23:26 -0700
commit135338af9a141d609e07e42208b9104465346ae4 (patch)
treedb59f226a2c69cf254753d175cde5c71c6b2d373
parent96ea88d3aeae710d8fc04f23151d5b669c5e8a0c (diff)
launchd: Properly support launchd sockets in xauth
What we had in place before was a hack that always used ':0'. This change results in the bundle id being used to differentiate different connections. Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--gethost.c17
-rw-r--r--parsedpy.c3
-rw-r--r--process.c3
3 files changed, 19 insertions, 4 deletions
diff --git a/gethost.c b/gethost.c
index 3bfdb39..6b36340 100644
--- a/gethost.c
+++ b/gethost.c
@@ -280,7 +280,22 @@ struct addrlist *get_address_info (
src = buf;
len = strlen (buf);
}
- } else {
+ } else if(prefix == 0 && (strncmp (fulldpyname, "/tmp/launch", 11) == 0)) {
+ /* Use the bundle id (part preceding : in the basename) as our src id */
+ char *c;
+ strlcpy(buf, strrchr(fulldpyname, '/') + 1, sizeof(buf));
+ c = strchr(buf, ':');
+
+ /* In the legacy case with no bundle id, use the full path */
+ if(c == buf) {
+ src = fulldpyname;
+ } else {
+ *c = '\0';
+ src = buf;
+ }
+
+ len = strlen(src);
+ } else {
src = fulldpyname;
len = prefix;
}
diff --git a/parsedpy.c b/parsedpy.c
index f3501c2..478874e 100644
--- a/parsedpy.c
+++ b/parsedpy.c
@@ -162,6 +162,9 @@ parse_displayname (char *displayname,
if (!host) return False;
+ if(strncmp (host, "/tmp/launch", 11) == 0) {
+ family = FamilyLocal;
+ }
/*
* get the display number; we know that there is something after the
diff --git a/process.c b/process.c
index 48a0df0..6964974 100644
--- a/process.c
+++ b/process.c
@@ -485,9 +485,6 @@ get_displayname_auth(char *displayname, AuthList **authl)
if (cp && strncmp (cp, "/unix:", 6) == 0)
prelen = (cp - displayname);
- if (strncmp (displayname, "/tmp/launch", 11) == 0)
- displayname = strrchr(displayname, '/') + 1;
-
if (!parse_displayname (displayname + ((prelen > 0) ? prelen + 1 : 0),
&family, &host, &dpynum, &scrnum, &rest)) {
return False;