From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxime Devos Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Allow null bytes in UNIX sockets. Date: Mon, 29 Mar 2021 21:26:19 +0200 Message-ID: <35f6804a798b3f831b1818f8b1614584060e92bf.camel@telenet.be> References: <20210329153757.16476-1-leo.priker@student.tugraz.at> Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-DmHK+x78caL16i4uD8Us" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5266"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.34.2 To: Leo Prikler , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Mon Mar 29 21:26:40 2021 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lQxX6-0001FU-04 for guile-devel@m.gmane-mx.org; Mon, 29 Mar 2021 21:26:40 +0200 Original-Received: from localhost ([::1]:47216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lQxX5-000701-08 for guile-devel@m.gmane-mx.org; Mon, 29 Mar 2021 15:26:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lQxWr-0006zf-0T for guile-devel@gnu.org; Mon, 29 Mar 2021 15:26:25 -0400 Original-Received: from andre.telenet-ops.be ([2a02:1800:120:4::f00:15]:33400) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lQxWp-0006wm-8M for guile-devel@gnu.org; Mon, 29 Mar 2021 15:26:24 -0400 Original-Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by andre.telenet-ops.be with bizsmtp id mKSL240020mfAB401KSLDA; Mon, 29 Mar 2021 21:26:20 +0200 In-Reply-To: <20210329153757.16476-1-leo.priker@student.tugraz.at> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1617045980; bh=7+STipwur1riXY3o6wC6gEeUVyEZSx8NGxT+mBHcUPI=; h=Subject:From:To:Date:In-Reply-To:References; b=Z2JWMafLOvU+VfLl78UoOFZGtZYTg3k4VY9jD0de1s5uQfHIhRtcMciJaUSdGoIlc WOOY6vYDHoQmaCv1vIkK4ioEO1//hTk5F1xa8eU6am0dUqIgs7/UrJj+MufAkDTJlj xcvdlc5TxiKSZkDyW/razOiooY+QoAmN+MJ3+KACLw0ebHRzh1Kq7eEjq9ULOUajxa 09XTLOgufcP/iNb/7r8KvYhv9DN5+qwTleeg6e2QkrXbGRXpcFCAyEgCcYoXyzq9G0 YLNw8uK9TwynVLkj9t2o0eZQR6HR5K6mD9lZmWb6XHnpwtcXnw0o/JHB7PBUlhHxBm XoMJPxxkCrzuw== Received-SPF: pass client-ip=2a02:1800:120:4::f00:15; envelope-from=maximedevos@telenet.be; helo=andre.telenet-ops.be X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20718 Archived-At: --=-DmHK+x78caL16i4uD8Us Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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]. >=20 > [1] https://www.man7.org/linux/man-pages/man7/unix.7.html >=20 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 @@ > (=3D (sockaddr:flowinfo sa*) 1))))) > =20 > (if (defined? 'AF_UNIX) > - (pass-if "AF_UNIX" > - (let ((sa (make-socket-address AF_UNIX "/tmp/unix-socket"))) > - (and (=3D (sockaddr:fam sa) AF_UNIX) > - (string=3D? (sockaddr:path sa) "/tmp/unix-socket")))))) > + (begin > + (pass-if "AF_UNIX" > + (let ((sa (make-socket-address AF_UNIX "/tmp/unix-socket"))) > + (and (=3D (sockaddr:fam sa) AF_UNIX) > + (string=3D? (sockaddr:path sa) "/tmp/unix-socket")))) > + (pass-if "AF_UNIX abstract" > + (let ((sa (make-socket-address AF_UNIX "\x00/tmp/abstract-sock= et"))) > + (and (=3D (sockaddr:fam sa) AF_UNIX) > + (string=3D? (sockaddr:path sa) "\x00/tmp/abstract-socket")))))= )) Shouldn't this code use $TMPDIR or some variable like that? Greetings, Maxime. --=-DmHK+x78caL16i4uD8Us Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYIADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYGIp2xccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7pCLAP9/3hzpIELz4rdkvuDasVcIQNqq MOFICnr8qgdv7z0t5wD+Nh1ZFU9fGIFeGZUKUIaaoZah+AoetloKWRnskH2pKgw= =H0/Q -----END PGP SIGNATURE----- --=-DmHK+x78caL16i4uD8Us--