diff options
author | Egbert Eich <eich@freedesktop.org> | 2013-08-14 22:11:06 +0200 |
---|---|---|
committer | Dr. Tilmann Bubeck <t.bubeck@reinform.de> | 2013-10-06 15:06:07 +0200 |
commit | 1555fff4ab458d7d4053f1ea6b74c3e14a65ad63 (patch) | |
tree | f6903285b2a086f7a0e184d07e6d8f7e459ad3b4 /process.c | |
parent | 10cbe2ed2a96582e7ee9fa5cfe6f8f69a3a4e4d4 (diff) | |
download | xorg-app-xauth-1555fff4ab458d7d4053f1ea6b74c3e14a65ad63.tar.gz |
Make matching algorithm mimic XauGet*AuthByAddr
Xlib (xcb) uses XauGetBestAuthByAddr() when looking for an
authorization. 'xauth [n]list $DISPLAY' used a slightly
stricter algorithm which doesn't find a possible authorization
for cases where either the family is set to FamilyWild or
address the address length is 0.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -1066,11 +1066,15 @@ eq_auth(Xauth *a, Xauth *b) static int match_auth_dpy(register Xauth *a, register Xauth *b) { - return ((a->family == b->family && - a->address_length == b->address_length && - a->number_length == b->number_length && - memcmp(a->address, b->address, a->address_length) == 0 && - memcmp(a->number, b->number, a->number_length) == 0) ? 1 : 0); + if (a->family != FamilyWild && b->family != FamilyWild && + (a->family != b->family || a->address_length != b->address_length || + memcmp(a->address, b->address, a->address_length) != 0)) + return 0; + if (a->number_length != 0 && b->number_length != 0 && + (a->number_length != b->number_length || + memcmp(a->number, b->number, a->number_length) != 0)) + return 0; + return 1; } /* return non-zero iff display and authorization type are the same */ |