XOpenDisplay says "XDM authorization key matches an existing client!"
@bgoglin
Submitted by Brice Goglin Assigned to Xorg Project Team
Description
Bug reported on the Debian BTS by Bernhard R. Link about 2 years ago, still applies to a recent git (xdm 1.1.4, Xlib 1.1.1 with XCB, Xserver 1.3-rc5).
The following code, when executed after a login with xdm, successfully opens display :0 once and then fails saying "XDM authorization key matches an existing client!" (while it is apparently supposed to successfully open/close forever).
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <X11/Xlib.h> Display *dpy; int main() { dpy = XOpenDisplay(":0"); if (dpy == NULL) { fprintf(stderr, "cannot open display :0\n"); exit(1); } fprintf(stderr, "opened display :0\n"); XCloseDisplay(dpy); execl("./test","./test", NULL); exit(0); }
It seems related to having "XDM-AUTHORIZATION-1" in the output of xauth list. Adding "DisplayManager*authName: MIT-MAGIC-COOKIE-1" makes the XDM-AUTHORIZATION-1 disappear from xauth list, and the program now works as expected.
According to the submitter, it might be related to the block of code starting at http://gitweb.freedesktop.org/?p=xorg/lib/libX11.git;a=blob;h=95a836d44662c0e1cb08862e30bfbe1e97be3bf4;hb=603c2f88d4e57ce1a3c16e8b6246866e6edd8fa8;f=src/ConnDis.c#l1139
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=292388 for details
Brice
Version: git