Blame SOURCES/shadow-4.1.5-2ndskip.patch

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