unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Leo Prikler <leo.prikler@student.tugraz.at>
To: Maxime Devos <maximedevos@telenet.be>,
	Leo Prikler <leo.priker@student.tugraz.at>,
	guile-devel@gnu.org
Subject: Re: [PATCH] Allow null bytes in UNIX sockets.
Date: Sat, 15 May 2021 18:30:44 +0200	[thread overview]
Message-ID: <c3df0093acfca32dededc7f501ac4a0f56d91dae.camel@student.tugraz.at> (raw)
In-Reply-To: <35f6804a798b3f831b1818f8b1614584060e92bf.camel@telenet.be>

Sorry for the late reply.  It appears that mail got lost in some server
and I had to manually retrieve it.

Am Montag, den 29.03.2021, 21:26 +0200 schrieb Maxime Devos:
> On Mon, 2021-03-29 at 17:37 +0200, Leo Prikler wrote:
> > The current socket address constructors all assume, that there are
> > no
> > null bytes in the socket path.  This assumption does not hold in
> > Linux,
> > which uses an initial null byte to demarcate abstract sockets and
> > ignores all further null bytes [1].
> > 
> > [1] https://www.man7.org/linux/man-pages/man7/unix.7.html
> > 
> 
> This is necessary to connect to dbus (I forgot the proper
> capitalisation)
> in some set-ups.  I tried implementing this at some point, but Guile
> crashed and I gave up.
> 
> Thank you for looking into this!  One comment below.
> 
> > [...]
> > diff --git a/test-suite/tests/00-socket.test b/test-suite/tests/00-
> > socket.test
> > index 027bd8519..5196b4b7d 100644
> > --- a/test-suite/tests/00-socket.test
> > +++ b/test-suite/tests/00-socket.test
> > @@ -128,10 +128,15 @@
> >  	       (= (sockaddr:flowinfo sa*) 1)))))
> >  
> >    (if (defined? 'AF_UNIX)
> > -      (pass-if "AF_UNIX"
> > -	(let ((sa (make-socket-address AF_UNIX "/tmp/unix-socket")))
> > -	  (and (= (sockaddr:fam sa) AF_UNIX)
> > -	       (string=? (sockaddr:path sa) "/tmp/unix-socket"))))))
> > +      (begin
> > +        (pass-if "AF_UNIX"
> > +	  (let ((sa (make-socket-address AF_UNIX "/tmp/unix-socket")))
> > +	    (and (= (sockaddr:fam sa) AF_UNIX)
> > +	         (string=? (sockaddr:path sa) "/tmp/unix-socket"))))
> > +        (pass-if "AF_UNIX abstract"
> > +          (let ((sa (make-socket-address AF_UNIX
> > "\x00/tmp/abstract-socket")))
> > +	    (and (= (sockaddr:fam sa) AF_UNIX)
> > +	         (string=? (sockaddr:path sa) "\x00/tmp/abstract-
> > socket")))))))
> 
> Shouldn't this code use $TMPDIR or some variable like that?
Those "/tmp"s already exist within Guile source, so meh.  I don't think
there's a difference with abstract sockets, since they don't exist in
the filesystem anyway.

Regards,
Leo




      reply	other threads:[~2021-05-15 16:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29 15:37 [PATCH] Allow null bytes in UNIX sockets Leo Prikler
2021-03-29 19:26 ` Maxime Devos
2021-05-15 16:30   ` Leo Prikler [this message]

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=c3df0093acfca32dededc7f501ac4a0f56d91dae.camel@student.tugraz.at \
    --to=leo.prikler@student.tugraz.at \
    --cc=guile-devel@gnu.org \
    --cc=leo.priker@student.tugraz.at \
    --cc=maximedevos@telenet.be \
    /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).