unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Trouble w/sockets
@ 2013-03-03  3:38 mark
  2013-03-03  4:48 ` Mike Gran
  0 siblings, 1 reply; 10+ messages in thread
From: mark @ 2013-03-03  3:38 UTC (permalink / raw)
  To: guile-user


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



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-03-04 13:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-03  3:38 Trouble w/sockets mark
2013-03-03  4:48 ` Mike Gran
2013-03-03  5:36   ` mark
2013-03-03  6:35     ` Mike Gran
2013-03-03  7:29     ` Thien-Thi Nguyen
2013-03-04  4:18       ` mark.d.witmer
2013-03-04  4:38         ` mark.d.witmer
2013-03-04 10:02         ` Thien-Thi Nguyen
2013-03-03 10:36   ` Chris Vine
2013-03-04 13:29     ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).