[arch-commits] Commit in nbd/trunk (0001-server_trim_whitespace.patch PKGBUILD)

Christian Hesse eworm at archlinux.org
Wed Mar 18 07:26:53 UTC 2020


    Date: Wednesday, March 18, 2020 @ 07:26:53
  Author: eworm
Revision: 600439

upgpkg: nbd 3.20-2

fix whitespaces in authorization file (FS#62664)

Added:
  nbd/trunk/0001-server_trim_whitespace.patch
Modified:
  nbd/trunk/PKGBUILD

-----------------------------------+
 0001-server_trim_whitespace.patch |   42 ++++++++++++++++++++++++++++++++++++
 PKGBUILD                          |   10 +++++++-
 2 files changed, 51 insertions(+), 1 deletion(-)

Added: 0001-server_trim_whitespace.patch
===================================================================
--- 0001-server_trim_whitespace.patch	                        (rev 0)
+++ 0001-server_trim_whitespace.patch	2020-03-18 07:26:53 UTC (rev 600439)
@@ -0,0 +1,42 @@
+From 6cabf9af2310282ace4208ae6f3f4d874dbf3e88 Mon Sep 17 00:00:00 2001
+From: Jonathan Liu <net147 at gmail.com>
+Date: Sun, 15 Mar 2020 18:10:51 +1100
+Subject: [PATCH] server: trim whitespace from lines in authorization file
+
+The netmask line can fail to parse when passed to getaddrinfo if it
+contains whitespace such as newline when using glibc 2.29 and later.
+This results in clients being denied access even though their IP
+address is listed in the authorization file.
+
+Signed-off-by: Jonathan Liu <net147 at gmail.com>
+Signed-off-by: Wouter Verhelst <w at uter.be>
+---
+ nbdsrv.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/nbdsrv.c b/nbdsrv.c
+index b4fa8000..168d425b 100644
+--- a/nbdsrv.c
++++ b/nbdsrv.c
+@@ -127,6 +127,7 @@ int authorized_client(CLIENT *opts) {
+   
+ 	while (fgets(line,LINELEN,f)!=NULL) {
+ 		char* pos;
++		char* endpos;
+ 		/* Drop comments */
+ 		if((pos = strchr(line, '#'))) {
+ 			*pos = '\0';
+@@ -140,7 +141,12 @@ int authorized_client(CLIENT *opts) {
+ 		if(!(*pos)) {
+ 			continue;
+ 		}
+-		if(address_matches(line, (struct sockaddr*)&opts->clientaddr, NULL)) {
++		/* Trim trailing whitespace */
++		endpos = pos;
++		while ((*endpos) && !isspace(*endpos))
++			endpos++;
++		*endpos = '\0';
++		if(address_matches(pos, (struct sockaddr*)&opts->clientaddr, NULL)) {
+ 			fclose(f);
+ 			return 1;
+ 		}

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-03-18 07:26:03 UTC (rev 600438)
+++ PKGBUILD	2020-03-18 07:26:53 UTC (rev 600439)
@@ -5,7 +5,7 @@
 
 pkgname=nbd
 pkgver=3.20
-pkgrel=1
+pkgrel=2
 pkgdesc='tools for network block devices, allowing you to use remote block devices over TCP/IP'
 arch=('x86_64')
 url='https://nbd.sourceforge.io/'
@@ -13,14 +13,22 @@
 depends=('glib2' 'gnutls')
 backup=('etc/nbd-server/config')
 source=("https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.xz"
+        '0001-server_trim_whitespace.patch'
         'config'
         'nbd.service'
         'sysusers_nbd.conf')
 sha256sums=('e0e1b3538ab7ae5accf56180afd1a9887d415b98d21223b8ad42592b4af7d6cd'
+            '2ce3e596fba1464a50557354a898e8f6a7d6a140f303867e577026e90686d7d5'
             'ee2e9fbbeb8a8b9b71d16b6f32eb41788f6def9d00cc4a47897ed3cb97cdde7c'
             '1b1add55d82d7623eabf7ff3dfec15c1fbe3c340fa74160df3d60e91eb1c71ba'
             '3fd98fe87d0b31b82126dc669f00355865f58fae81af3fccbc0d06504baef6cd')
 
+prepare() {
+  cd "${srcdir}/${pkgname}-${pkgver}"
+
+  patch -Np1 < ../0001-server_trim_whitespace.patch
+}
+
 build() {
   cd "${srcdir}/${pkgname}-${pkgver}"
 



More information about the arch-commits mailing list