Browse Source

nfs-utils
- Made nfsnobody's uid/gid to always be a 16-bit value of -2
- change rpcuser's gid to fixed value 29

git-svn-id: http://trac.vinelinux.org/repos/projects/specs@6974 ec354946-7b23-47d6-9f5a-488ba84defc7

daisuke 12 years ago
parent
commit
c24869c089
1 changed files with 24 additions and 8 deletions
  1. 24 8
      n/nfs-utils/nfs-utils-vl.spec

+ 24 - 8
n/nfs-utils/nfs-utils-vl.spec

@@ -190,18 +190,32 @@ done
 
 /usr/sbin/useradd -r -c "RPC Service User" \
         -s /sbin/nologin -u 29 -d /var/lib/nfs rpcuser 2>/dev/null || :
-# Define the correct unsigned uid value for 32 or 64 bit archs
-%ifarch %{all_32bit_archs}
+cat /etc/group | cut -d':' -f 1 | grep --quiet nfsnobody 2>/dev/null
+if [ "$?" -eq 1 ]; then
+  /usr/sbin/groupadd -g 29 rpcuser 2>/dev/null || :
+else
+  /usr/sbin/groupmod -g 29 rpcuser 2>/dev/null || :
+fi
+
+# Using the 16-bit value of -2 for the nfsnobody uid and gid
 %define nfsnobody_uid   65534
-%else
-%define nfsnobody_uid   4294967294
-%endif
 
-# If UID 65534 (or 4294967294 64bit archs) is unassigned, create user "nfsnobody"
-cat /etc/passwd | cut -d':' -f 3 | grep --quiet %{nfsnobody_uid} 2>/dev/null
+# Create nfsnobody gid as long as it does not already exist
+cat /etc/group | cut -d':' -f 1 | grep --quiet nfsnobody 2>/dev/null
 if [ "$?" -eq 1 ]; then
-    /usr/sbin/useradd -r -c "Anonymous NFS User" \
+    /usr/sbin/groupadd -g %{nfsnobody_uid} nfsnobody 2>/dev/null || :
+else
+    /usr/sbin/groupmod -g %{nfsnobody_uid} nfsnobody 2>/dev/null || :
+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
+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 2>/dev/null || :
+else
+
+   /usr/sbin/usermod -u %{nfsnobody_uid} -g %{nfsnobody_uid} nfsnobody 2>/dev/null || :
 fi
 
 
@@ -317,6 +331,8 @@ fi
 %changelog
 * Sat Oct 20 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.6-1
 - update to 1.2.6
+- Made nfsnobody's uid/gid to always be a 16-bit value of -2
+- change rpcuser's gid to fixed value 29
 
 * Sat Jan 28 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.5-1
 - update to 1.2.5