Blame SOURCES/shadow-4.1.5-2ndskip.patch

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