guile-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Allow null bytes in UNIX sockets.


From: Leo Prikler
Subject: Re: [PATCH] Allow null bytes in UNIX sockets.
Date: Sat, 15 May 2021 18:30:44 +0200
User-agent: Evolution 3.34.2

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 via email to

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