]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
* src/newusers.c: Initially set the passwd's password to '*'
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 18 Sep 2011 17:29:52 +0000 (17:29 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 18 Sep 2011 17:29:52 +0000 (17:29 +0000)
instead of 'x'. Only when it is confirmed that a shadow entry is
(will be) added, set the passwd's password to 'x'.
* src/newusers.c: An invalid line is an error. A failure needs to
be reported.

ChangeLog
src/newusers.c

index d73d55ba4ae3b9f70f0a723cddedadd2f79d0091..1ae91212b8a6c9905fa88a75da9157d545429be1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-09-18  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/newusers.c: Initially set the passwd's password to '*'
+       instead of 'x'. Only when it is confirmed that a shadow entry is
+       (will be) added, set the passwd's password to 'x'.
+       * src/newusers.c: An invalid line is an error. A failure needs to
+       be reported.
+
 2011-09-18  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/gpasswd.c: Remove log_gpasswd_success_gshadow(). Writing in
index fc90b2db8e050bb4307d52dfe41b04c34adbf0c6..f9e849999f778323f2e595a7575e0e494203ff3c 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (c) 1990 - 1993, Julianne Frances Haugh
  * Copyright (c) 1996 - 2000, Marek Michałkiewicz
  * Copyright (c) 2000 - 2006, Tomasz Kłoczko
- * Copyright (c) 2007 - 2009, Nicolas François
+ * Copyright (c) 2007 - 2011, Nicolas François
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -268,7 +268,7 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid)
                return -1;
        }
 
-       grent.gr_passwd = "x";  /* XXX warning: const */
+       grent.gr_passwd = "*";  /* XXX warning: const */
        members[0] = NULL;
        grent.gr_mem = members;
 
@@ -287,16 +287,13 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid)
        }
 #endif
 
-       if (gr_update (&grent) == 0) {
-               return -1;
-       }
-
 #ifdef SHADOWGRP
        if (is_shadow_grp) {
                struct sgrp sgrent;
                char *admins[1];
                sgrent.sg_name = grent.gr_name;
                sgrent.sg_passwd = "*"; /* XXX warning: const */
+               grent.gr_passwd  = "x"; /* XXX warning: const */
                admins[0] = NULL;
                sgrent.sg_adm = admins;
                sgrent.sg_mem = members;
@@ -307,6 +304,10 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid)
        }
 #endif
 
+       if (gr_update (&grent) == 0) {
+               return -1;
+       }
+
        return 0;
 }
 
@@ -890,6 +891,7 @@ int main (int argc, char **argv)
                if (nfields != 6) {
                        fprintf (stderr, _("%s: line %d: invalid line\n"),
                                 Prog, line);
+                       errors++
                        continue;
                }