guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble w/sockets


From: mark
Subject: Trouble w/sockets
Date: Sat, 02 Mar 2013 22:38:12 -0500

Hi all,

I've made lots of progress on my Guile xcb code and it talks to the X
server now, send requests, receive replies and so forth.

However, if the X server requires authentication, there's trouble. I'm
able to send the authentication method's name over the socket that
connects to the X server, but as soon as I try to send the first byte of
the authentication value, Guile crashes.

This code should hopefully reproduce the issue (assuming you're on a
little-endian system and have an X server listening at the given
socket). The segment of data starting with 77 is the authentication
method's name; then there's an equally long sequence of zeros and the
remaining numbers are the authentication value and some more padding.

(define sock (socket AF_UNIX SOCK_STREAM 0))
(connect sock (make-socket-address AF_UNIX "/tmp/.X11-unix/X0"))
(for-each      
  (lambda (b)
    (write-char (integer->char b) sock))
      '(108 0 11 0 0 0 18 0 16 0 0 0 77 73 84 45 77 65 71 73 67 45 67 79
      79 75 73 69 45 49 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 243 236 56
      103 158 249 237 124 101 131 158 31 63 251 239 7 0 0 0 0 0 0 0 0 0
      0 0 0 0 0 0 0))

This will obviously be the wrong authentication data for anyone else's X
server; however, even if X closes the socket prematurely (not that it's
supposed to, but it might), Guile shouldn't just crash, should it?

Thanks

-- 
Mark Witmer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]