#6 Do not try to create nfsnobody if the uid/gid are already present
Opened a year ago by zbyszek. Modified a year ago
rpms/ zbyszek/nfs-utils nfsnobody-update-f28  into  master

@@ -0,0 +1,32 @@ 

+ commit 5f32083c759b468f5b0cb9302e4fe2848d37cc5b

+ Author: Steve Dickson <steved@redhat.com>

+ Date:   Tue Apr 10 10:25:40 2018 -0400

+ 

+     mount.nfs: Fix auto protocol negotiation

+     

+     Commit 71b807e1 introduce a regression that

+     caused v3 not to be tried when v4 was not

+     supported by the server during auto negation.

+     

+     A check of the type in nfs_nfs_version() was

+     reverted back to only check for the "nfs4"

+     string not the "nfs" string which fixed the

+     problem.

+     

+     Signed-off-by: Steve Dickson <steved@redhat.com>

+ 

+ diff --git a/utils/mount/network.c b/utils/mount/network.c

+ index 9a2c878..e490399 100644

+ --- a/utils/mount/network.c

+ +++ b/utils/mount/network.c

+ @@ -1279,8 +1279,8 @@ nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *v

+  		}

+  	}

+  

+ -	if (!found && strncmp(type, "nfs", 3) == 0)

+ -		version_val = "4";

+ +	if (!found && strcmp(type, "nfs4") == 0)

+ +		version_val = type + 3;

+  	else if (!found)

+  		return 1;

+  	else if (i <= 2 ) {

@@ -0,0 +1,44 @@ 

+ commit 1a372a7b656ddf2be21ddad70b6c64c9d1d9d161

+ Author: Steve Dickson <steved@redhat.com>

+ Date:   Tue Apr 17 14:26:44 2018 -0400

+ 

+     nfsd: Set default minor versions

+     

+     Due to the way the kernel stores the supported

+     minor versions, when a minor is turned off,

+     via the -N flag, it can only turned back on

+     via -V flag.

+     

+     The default minor values should also enable

+     these minor versions.

+     

+     Acked-by: J. Bruce Fields <bfields@fieldses.org>

+     Signed-off-by: Steve Dickson <steved@redhat.com>

+ 

+ diff --git a/support/include/nfs/nfs.h b/support/include/nfs/nfs.h

+ index 7933ff5..b7d9e06 100644

+ --- a/support/include/nfs/nfs.h

+ +++ b/support/include/nfs/nfs.h

+ @@ -40,6 +40,7 @@ struct nfs_fh_len {

+  #define NFSCTL_TCPISSET(_cltbits)     ((_cltbits) & NFSCTL_TCPBIT) 

+  

+  #define NFSCTL_VERDEFAULT (0xc)       /* versions 3 and 4 */

+ +#define NFSCTL_MINDEFAULT (0x7)       /* minor versions 4.1 and 4.2 */

+  #define NFSCTL_VERSET(_cltbits, _v)   ((_cltbits) |= (1 << ((_v) - 1))) 

+  #define NFSCTL_MINORSET(_cltbits, _v)   ((_cltbits) |= (1 << (_v)))

+  #define NFSCTL_UDPSET(_cltbits)       ((_cltbits) |= NFSCTL_UDPBIT)

+ diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c

+ index f41a2de..2303a5d 100644

+ --- a/utils/nfsd/nfsd.c

+ +++ b/utils/nfsd/nfsd.c

+ @@ -65,8 +65,8 @@ main(int argc, char **argv)

+  	int hcounter = 0;

+  	struct conf_list *hosts;

+  	int	socket_up = 0;

+ -	unsigned int minorvers = 0;

+ -	unsigned int minorversset = 0;

+ +	unsigned int minorvers = NFSCTL_MINDEFAULT;

+ +	unsigned int minorversset = NFSCTL_MINDEFAULT;

+  	unsigned int minormask = 0;

+  	unsigned int versbits = NFSCTL_VERDEFAULT;

+  	unsigned int protobits = NFSCTL_PROTODEFAULT;

The added file is too large to be shown here, see it at: nfs-utils-2.3.2-rc1.patch
file modified
+35 -28

@@ -2,11 +2,11 @@ 

  Name: nfs-utils

  URL: http://linux-nfs.org/

  Version: 2.3.1

- Release: 5%{?dist}

+ Release: 9.rc1%{?dist}

  Epoch: 1

  

  # group all 32bit related archs

- %define all_32bit_archs i386 i486 i586 i686 athlon ppc sparcv9

+ %global all_32bit_archs i386 i486 i586 i686 athlon ppc sparcv9

  

  Source0: https://www.kernel.org/pub/linux/utils/nfs-utils/%{version}/%{name}-%{version}.tar.xz

  Source1: id_resolver.conf

@@ -15,6 +15,10 @@ 

  Source4: lockd.conf

  Source5: 24-nfs-server.conf

  

+ Patch001: nfs-utils-2.3.2-rc1.patch

+ Patch002: nfs-utils-2.3.1-mount-auto-v3.patch

+ Patch003: nfs-utils-2.3.1-mount-setdefault-minor.patch

+ 

  Patch100: nfs-utils-1.2.1-statdpath-man.patch

  Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch

  Patch102: nfs-utils-1.2.5-idmap-errmsg.patch

@@ -103,23 +107,11 @@ 

  find -name \*.py -exec sed -r -i '1s|^#!\s*/usr/bin.*python.*|#!%{__python3}|' {} \;

  

  %build

- 

- %ifarch s390 s390x sparcv9 sparc64

- PIE="-fPIE"

- %else

- PIE="-fpie"

- %endif

- export PIE

- 

  sh -x autogen.sh

- 

- CFLAGS="`echo $RPM_OPT_FLAGS $ARCH_OPT_FLAGS $PIE -D_FILE_OFFSET_BITS=64`"

- 

- %define _statdpath /var/lib/nfs/statd

+ %global _statdpath /var/lib/nfs/statd

  %configure \

-     CFLAGS="$CFLAGS" \

-     CPPFLAGS="$DEFINES" \

-     LDFLAGS="-pie" \

+     CFLAGS="%{build_cflags} -D_FILE_OFFSET_BITS=64" \

+     LDFLAGS="%{build_ldflags}" \

      --enable-mountconfig \

      --enable-ipv6 \

  	--with-statdpath=%{_statdpath} \

@@ -131,7 +123,7 @@ 

  %make_build all

  

  %install

- %define _pkgdir %{_prefix}/lib/systemd

+ %global _pkgdir %{_prefix}/lib/systemd

  

  rm -rf $RPM_BUILD_ROOT/*

  

@@ -192,7 +184,7 @@ 

      fi

  done

  

- %define rpcuser_uid 29

+ %global rpcuser_uid 29

  # Create rpcuser gid as long as it does not already exist

  cat /etc/group | cut -d':' -f 1 | grep --quiet rpcuser 2>/dev/null

  if [ "$?" -eq 1 ]; then

@@ -211,24 +203,23 @@ 

  fi 

  

  # Using the 16-bit value of -2 for the nfsnobody uid and gid

- %define nfsnobody_uid	65534

+ %global nfsnobody_uid	65534

+ 

+ # Nowadays 'nobody/65534' user/group are included in setup rpm. But on

+ # systems installed previously, nobody/99 might be present, with user

+ # 65534 missing. Let's create nfsnobody/65534 in that case.

  

  # Create nfsnobody gid as long as it does not already exist

- cat /etc/group | cut -d':' -f 1 | grep --quiet nfsnobody 2>/dev/null

+ cat /etc/group | cut -d':' -f 3 | grep --quiet %{nfsnobody_uid} 2>/dev/null

  if [ "$?" -eq 1 ]; then

      /usr/sbin/groupadd -g %{nfsnobody_uid} nfsnobody >/dev/null 2>&1 || :

- else

-     /usr/sbin/groupmod -g %{nfsnobody_uid} nfsnobody >/dev/null 2>&1 || :

  fi

  

  # Create nfsnobody uid as long as it does not already exist.

- cat /etc/passwd | cut -d':' -f 1 | grep --quiet nfsnobody 2>/dev/null

+ cat /etc/passwd | cut -d':' -f 3 | grep --quiet %{nfsnobody_uid} 2>/dev/null

  if [ $? -eq 1 ]; then

      /usr/sbin/useradd -l -c "Anonymous NFS User" -r -g %{nfsnobody_uid} \

  		-s /sbin/nologin -u %{nfsnobody_uid} -d /var/lib/nfs nfsnobody >/dev/null 2>&1 || :

- else

- 

-    /usr/sbin/usermod -u %{nfsnobody_uid} -g %{nfsnobody_uid} nfsnobody >/dev/null 2>&1 || :

  fi

  

  %post

@@ -256,7 +247,7 @@ 

  /bin/systemctl --system daemon-reload >/dev/null 2>&1 || :

  

  %triggerin -- nfs-utils > 1:2.1.1-3

- /bin/systemctl try-restart gssproxy

+ /bin/systemctl try-restart gssproxy || :

  

  %files

  %config(noreplace) /etc/sysconfig/nfs

@@ -319,6 +310,22 @@ 

  %{_libdir}/libnfsidmap.so

  

  %changelog

+ * Tue May 15 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1:2.3.1-9.rc1

+ - Only try to create nfsnobody if the uid/gid are not found (#1488897)

+ 

+ * Thu May  3 2018 Steve Dickson <steved@redhat.com> 2.3.1-8.rc1

+ - nfsd: Set default minor versions (bz 1570066)

+ 

+ * Wed Apr 11 2018 Steve Dickson <steved@redhat.com> 2.3.1-7.rc1

+ - mount.nfs: Fix auto protocol negotiation (bz 1565310)

+ 

+ * Mon Apr  9 2018 Steve Dickson <steved@redhat.com> 2.3.1-6.rc1

+ - Stop failing when systemctl try-restart gssproxy fails (bz 1552976)

+ - Use Fedora build flags (bz 1548679)

+ 

+ * Fri Mar  2 2018 Steve Dickson <steved@redhat.com> 2.3.1-5.rc1

+ - Updated to latest upstream RC release: nfs-utils-2-3-2-rc1

+ 

  * Wed Feb 14 2018 Kevin Fenzi <kevin@scrye.com> - 1:2.3.1-5

  - Rebuild for new libevent