[Pkg-shadow-commits] r1430 - in upstream/trunk: . src

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Tue Nov 20 20:59:42 UTC 2007


Author: nekral-guest
Date: 2007-11-20 20:59:42 +0000 (Tue, 20 Nov 2007)
New Revision: 1430

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/chgpasswd.c
Log:
If the shadow group file is not present, do not try to locate the group
entry from /etc/gshadow, and set the password in /etc/group.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2007-11-20 20:00:16 UTC (rev 1429)
+++ upstream/trunk/ChangeLog	2007-11-20 20:59:42 UTC (rev 1430)
@@ -1,5 +1,11 @@
 2007-11-20  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* src/chgpasswd.c: If the shadow group file is not present, do not
+	try to locate the group entry from /etc/gshadow, and set the
+	password in /etc/group.
+
+2007-11-20  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* libmisc/obscure.c, libmisc/salt.c, src/passwd.c: Match DES, MD5,
 	SHA256, and SHA512 exactly (not only the first 3/6 chars).
 	* libmisc/salt.c (SHA_salt_rounds): Set rounds to the specified

Modified: upstream/trunk/src/chgpasswd.c
===================================================================
--- upstream/trunk/src/chgpasswd.c	2007-11-20 20:00:16 UTC (rev 1429)
+++ upstream/trunk/src/chgpasswd.c	2007-11-20 20:59:42 UTC (rev 1430)
@@ -116,6 +116,9 @@
 #endif
 
 	const struct group *gr;
+#ifndef SHADOWGRP
+	struct group newgr;
+#endif
 	int errors = 0;
 	int line = 0;
 	int ok;
@@ -124,9 +127,6 @@
 	pam_handle_t *pamh = NULL;
 	int retval;
 #endif
-#ifndef SHADOWGRP
-	struct group newgr;
-#endif
 
 	Prog = Basename (argv[0]);
 
@@ -336,7 +336,10 @@
 			continue;
 		}
 #ifdef SHADOWGRP
-		sg = sgr_locate (name);
+		if (is_shadow_grp)
+			sg = sgr_locate (name);
+		else
+			sg = NULL;
 #endif
 
 		/*
@@ -345,12 +348,15 @@
 		 * date is set to the current date.
 		 */
 #ifdef SHADOWGRP
-		newsg = *sg;
-		newsg.sg_passwd = cp;
-#else
-		newgr = *gr;
-		newgr.gr_passwd = cp;
+		if (sg) {
+			newsg = *sg;
+			newsg.sg_passwd = cp;
+		} else
 #endif
+		{
+			newgr = *gr;
+			newgr.gr_passwd = cp;
+		}
 
 		/* 
 		 * The updated password file entry is then put back and will
@@ -358,10 +364,11 @@
 		 * other entries have been updated as well.
 		 */
 #ifdef SHADOWGRP
-		ok = sgr_update (&newsg);
-#else
-		ok = gr_update (&newgr);
+		if (sg)
+			ok = sgr_update (&newsg);
+		else
 #endif
+			ok = gr_update (&newgr);
 
 		if (!ok) {
 			fprintf (stderr,




More information about the Pkg-shadow-commits mailing list