[csw-devel] SF.net SVN: gar:[6859] csw/mgar/pkg/cswclassutils/trunk/files/ CSWcswclassutils.i.cswusergroup

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Wed Oct 14 16:04:00 CEST 2009


Revision: 6859
          http://gar.svn.sourceforge.net/gar/?rev=6859&view=rev
Author:   bdwalton
Date:     2009-10-14 14:04:00 +0000 (Wed, 14 Oct 2009)

Log Message:
-----------
cswclassutils: cswusergroup: use passwd -N on solaris 10 or newer, only munge shadow manually on 8/9

Modified Paths:
--------------
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswusergroup

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswusergroup
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswusergroup	2009-10-14 02:37:00 UTC (rev 6858)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswusergroup	2009-10-14 14:04:00 UTC (rev 6859)
@@ -80,24 +80,36 @@
       fi
 
       if [ -n "$nopass" ]; then
-	  omask=`umask`
-	  umask 0377
-	  awk 'BEGIN { FS=":"; OFS=":" } $1 == "'$user'" { $2 = "NP" } { print }' /etc/shadow > /etc/shadow.$PKGINST
-	  if [ $? -eq 0 ]; then
-	      cmp -s /etc/shadow /etc/shadow.$PKGINST
-	      if [ $? -ne 0 ]; then
-		  echo "Updating account '$user' to be no-login (NP)"
-		  chgrp sys /etc/shadow.$PKGINST
-		  cp -p /etc/shadow /etc/shadow.CSW && \
-		      mv /etc/shadow.$PKGINST /etc/shadow
-	      else
-		  rm /etc/shadow.$PKGINST
-	      fi
-	  else
-	      echo "ERROR: Setting NP for '$user' failed."
-	      rm /etc/shadow.$PKGINST
-	  fi
-	  umask $omask
+	  case "`uname -r`" in
+	      5.8|5.9)
+		  # for old solaris, we munge the shadow file manually.
+		  omask=`umask`
+		  umask 0377
+		  awk 'BEGIN { FS=":"; OFS=":" } $1 == "'$user'" { $2 = "NP" } { print }' /etc/shadow > /etc/shadow.$PKGINST
+		  if [ $? -eq 0 ]; then
+		      cmp -s /etc/shadow /etc/shadow.$PKGINST
+		      if [ $? -ne 0 ]; then
+			  echo "Updating account '$user' to be no-login (NP)"
+			  chgrp sys /etc/shadow.$PKGINST
+			  cp -p /etc/shadow /etc/shadow.CSW && \
+			      mv /etc/shadow.$PKGINST /etc/shadow
+		      else
+			  rm /etc/shadow.$PKGINST
+		      fi
+		  else
+		      echo "ERROR: Setting NP for '$user' failed."
+		      rm /etc/shadow.$PKGINST
+		  fi
+		  umask $omask
+		  ;;
+	      *)
+		  # for modern solaris, use the built-in tools
+		  passwd -N $user
+		  if [ $? -ne 0 ]; then
+		      echo "ERROR: Setting NP for '$user' failed."
+		  fi
+		  ;;
+	      esac
       fi
     else
       echo No user to create


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list