unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: mark@markwitmer.com
To: guile-user@gnu.org
Subject: Trouble w/sockets
Date: Sat, 02 Mar 2013 22:38:12 -0500	[thread overview]
Message-ID: <871ubxxie3.fsf@markwitmer.com> (raw)


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	other threads:[~2013-03-03  3:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-03  3:38 mark [this message]
2013-03-03  4:48 ` Trouble w/sockets 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871ubxxie3.fsf@markwitmer.com \
    --to=mark@markwitmer.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).