From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Leo Prikler Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Allow null bytes in UNIX sockets. Date: Sat, 15 May 2021 18:30:44 +0200 Message-ID: References: <20210329153757.16476-1-leo.priker@student.tugraz.at> <35f6804a798b3f831b1818f8b1614584060e92bf.camel@telenet.be> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20170"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.34.2 To: Maxime Devos , Leo Prikler , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sat May 15 18:32:02 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 1lhxCs-00052J-6k for guile-devel@m.gmane-mx.org; Sat, 15 May 2021 18:32:02 +0200 Original-Received: from localhost ([::1]:46218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhxCq-0002zx-Db for guile-devel@m.gmane-mx.org; Sat, 15 May 2021 12:32:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhxBm-0002vh-Vm for guile-devel@gnu.org; Sat, 15 May 2021 12:30:55 -0400 Original-Received: from mailrelay.tugraz.at ([129.27.2.202]:20568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhxBj-0000C9-Ek for guile-devel@gnu.org; Sat, 15 May 2021 12:30:54 -0400 Original-Received: from nijino.local (91-114-247-246.adsl.highway.telekom.at [91.114.247.246]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4Fj9qn0cb4z1LWp5; Sat, 15 May 2021 18:30:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4Fj9qn0cb4z1LWp5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1621096245; bh=fos6SNaGMf0lYVBwpjPVDcuM5uJfPV5rNML4Fe/mtVw=; h=Subject:From:To:Date:In-Reply-To:References:From; b=KyacFOTSR0G2BJFN3Wp2+Cx6c7Xc2eE6SGEuxCCWtIshEqFhEdv/lk/+O2Nl/0zOr Vb6LAnXkqtCOkR7hPXrd4Uaji3cttIpahSbw3SNSMYACBjlNxZbnXujXjdvxXEg1wt bG0bc67M8sb11HUtjtDh0vtd1YBTUGY2+uv2XhGo= In-Reply-To: <35f6804a798b3f831b1818f8b1614584060e92bf.camel@telenet.be> X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117 Received-SPF: pass client-ip=129.27.2.202; envelope-from=leo.prikler@student.tugraz.at; helo=mailrelay.tugraz.at X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 15 May 2021 12:31:49 -0400 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:20770 Archived-At: 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