Blame SOURCES/shadow-4.1.5-2ndskip.patch

9f90df
diff -up shadow-4.1.5/src/grpconv.c.2ndskip shadow-4.1.5/src/grpconv.c
9f90df
--- shadow-4.1.5/src/grpconv.c.2ndskip	2012-06-18 13:08:34.438910815 +0200
9f90df
+++ shadow-4.1.5/src/grpconv.c	2012-06-18 13:12:51.270764552 +0200
9f90df
@@ -143,6 +143,7 @@ int main (int argc, char **argv)
9f90df
 	struct group grent;
9f90df
 	const struct sgrp *sg;
9f90df
 	struct sgrp sgent;
9f90df
+	char *np;
9f90df
 
9f90df
 	Prog = Basename (argv[0]);
9f90df
 
9f90df
@@ -184,20 +185,25 @@ int main (int argc, char **argv)
9f90df
 	 * Remove /etc/gshadow entries for groups not in /etc/group.
9f90df
 	 */
9f90df
 	(void) sgr_rewind ();
9f90df
-	while ((sg = sgr_next ()) != NULL) {
9f90df
-		if (gr_locate (sg->sg_name) != NULL) {
9f90df
-			continue;
9f90df
-		}
9f90df
-
9f90df
-		if (sgr_remove (sg->sg_name) == 0) {
9f90df
-			/*
9f90df
-			 * This shouldn't happen (the entry exists) but...
9f90df
-			 */
9f90df
-			fprintf (stderr,
9f90df
-			         _("%s: cannot remove entry '%s' from %s\n"),
9f90df
-			         Prog, sg->sg_name, sgr_dbname ());
9f90df
-			fail_exit (3);
9f90df
+	sg = sgr_next ();
9f90df
+	np=NULL;
9f90df
+	while (sg != NULL) {
9f90df
+		np = strdup(sg->sg_name);
9f90df
+		sg = sgr_next ();
9f90df
+
9f90df
+		if(gr_locate (np) == NULL) {
9f90df
+			if (sgr_remove (np) == 0) {
9f90df
+				/*
9f90df
+				 * This shouldn't happen (the entry exists) but...
9f90df
+				 */
9f90df
+				fprintf (stderr,
9f90df
+					 _("%s: cannot remove entry '%s' from %s\n"),
9f90df
+					 Prog, np, sgr_dbname ());
9f90df
+				free(np);
9f90df
+				fail_exit (3);
9f90df
+			}
9f90df
 		}
9f90df
+		free(np);
9f90df
 	}
9f90df
 
9f90df
 	/*
9f90df
diff -up shadow-4.1.5/src/pwconv.c.2ndskip shadow-4.1.5/src/pwconv.c
9f90df
--- shadow-4.1.5/src/pwconv.c.2ndskip	2012-06-18 11:23:33.938511797 +0200
9f90df
+++ shadow-4.1.5/src/pwconv.c	2012-06-18 12:57:18.396426194 +0200
9f90df
@@ -173,6 +173,7 @@ int main (int argc, char **argv)
9f90df
 	struct passwd pwent;
9f90df
 	const struct spwd *sp;
9f90df
 	struct spwd spent;
9f90df
+	char *np;
9f90df
 
9f90df
 	Prog = Basename (argv[0]);
9f90df
 
9f90df
@@ -223,20 +224,25 @@ int main (int argc, char **argv)
9f90df
 	 * Remove /etc/shadow entries for users not in /etc/passwd.
9f90df
 	 */
9f90df
 	(void) spw_rewind ();
9f90df
-	while ((sp = spw_next ()) != NULL) {
9f90df
-		if (pw_locate (sp->sp_namp) != NULL) {
9f90df
-			continue;
9f90df
-		}
9f90df
-
9f90df
-		if (spw_remove (sp->sp_namp) == 0) {
9f90df
-			/*
9f90df
-			 * This shouldn't happen (the entry exists) but...
9f90df
-			 */
9f90df
-			fprintf (stderr,
9f90df
-			         _("%s: cannot remove entry '%s' from %s\n"),
9f90df
-			         Prog, sp->sp_namp, spw_dbname ());
9f90df
-			fail_exit (E_FAILURE);
9f90df
+	sp = spw_next ();
9f90df
+	np = NULL;
9f90df
+	while (sp != NULL) {
9f90df
+		np = strdup(sp->sp_namp);
9f90df
+		sp = spw_next ();
9f90df
+
9f90df
+		if (pw_locate (np) == NULL) {
9f90df
+			if (spw_remove (np) == 0) {
9f90df
+				/*
9f90df
+				 * This shouldn't happen (the entry exists) but...
9f90df
+				 */
9f90df
+				fprintf (stderr,
9f90df
+					 _("%s: cannot remove entry '%s' from %s\n"),
9f90df
+					 Prog, np, spw_dbname ());
9f90df
+				free(np);
9f90df
+				fail_exit (E_FAILURE);
9f90df
+			}
9f90df
 		}
9f90df
+		free(np);
9f90df
 	}
9f90df
 
9f90df
 	/*