diff options
Diffstat (limited to 'app/xauth/gethost.c')
-rw-r--r-- | app/xauth/gethost.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/app/xauth/gethost.c b/app/xauth/gethost.c index 3bfdb39b6..6612bc086 100644 --- a/app/xauth/gethost.c +++ b/app/xauth/gethost.c @@ -280,7 +280,28 @@ 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; +#ifdef HAVE_STRLCPY + strlcpy(buf, strrchr(fulldpyname, '/') + 1, sizeof(buf)); +#else + strncpy(buf, strrchr(fulldpyname, '/') + 1, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; +#endif + + 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; } |