This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MIT-MAGIC-COOKIE-1 problem


Sam Edge wrote:
> 
> I'd be grateful if someone could point me to information about getting
> xauth working with Cygwin/XFree86 at all.
> 
> Particularly, how do I generate a file suitable for the "-auth"
> parameter of XWin.exe? The documentation I've been able to find all
> relies on xdm setting things up and doesn't really explain exactly
> what it does. (xdm itself won't run because it expects to be root and
> it creates files with colons in their names.)
> 
> I've tried generating a file using xauth but no matter what I do the
> server refuses connections if the file is non-zero in size but allows
> any access if it's empty.
> 

Sam,

See below for how we currently do it. You can cook up your own recipe
based on these few lines. Mind you, I'm not pretending that this method
is in any way "cryptographically" secure as it simply computes an MD5
checksum based on the computer name and current date, as you can see.

Another good source of info is your (Linux) system's "startx" shell
script.

Note, the following code assumes that the environment variables
XAUTHORITY and DISPLAY are respectively set to "path to .Xauthority
file" and ":0".

# Generate X authorization (MIT-MAGIC-COOKIEs) data for the
# local display to enable access via tcp on both the local
# loopback i/f (127.0.0.1) and the network i/f, as well as
# via UNIX-domain sockets.

rm -f "$XAUTHORITY" "$XAUTHORITY-c" "$XAUTHORITY-l"

mcookie=`echo "$COMPUTERNAME\`date\`" | md5sum | sed
's/[[:space:]].*//'`

xauth -f "$XAUTHORITY" -v add "$DISPLAY" . "$mcookie"
xauth -f "$XAUTHORITY" -v add "127.0.0.1$DISPLAY" . "$mcookie"
xauth -f "$XAUTHORITY" -v add "$COMPUTERNAME$DISPLAY" . "$mcookie"

Peter


*********************************************************************************
This email and any files transmitted with it may be legally privileged 
and confidential.  If you are not the intended recipient of this email,
you must not disclose or use the information contained in it.  If you 
have received this email in error, please notify us by return email and 
permanently delete the document.
*********************************************************************************


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]