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