]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
* src/pwconv.c: Fail if not called correctly.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 18 Sep 2011 17:32:04 +0000 (17:32 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 18 Sep 2011 17:32:04 +0000 (17:32 +0000)
* src/pwconv.c: At the end of main, the passwd and shadow files
are locked. No need to check before unlocking.

ChangeLog
src/pwconv.c

index 1ae91212b8a6c9905fa88a75da9157d545429be1..fa76576a10beea8d98573ea3eb31671be0c5cc84 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-18  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/pwconv.c: Fail if not called correctly.
+       * src/pwconv.c: At the end of main, the passwd and shadow files
+       are locked. No need to check before unlocking.
+
 2011-09-18  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/newusers.c: Initially set the passwd's password to '*'
index 8d004504089e20e517078e60996b547fb9c50514..e103d6e446364b383fe625a798e13f813c9b127f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 1996 - 2000, Marek Michałkiewicz
  * Copyright (c) 2002 - 2006, Tomasz Kłoczko
- * Copyright (c) 2009       , Nicolas François
+ * Copyright (c) 2009 - 2011, Nicolas François
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -124,6 +124,7 @@ int main (int argc, char **argv)
 
        if (1 != argc) {
                (void) fputs (_("Usage: pwconv\n"), stderr);
+               fail_exit (E_USAGE);
        }
        Prog = Basename (argv[0]);
 
@@ -260,20 +261,16 @@ int main (int argc, char **argv)
                /* continue */
        }
 
-       if (pw_locked) {
-               if (pw_unlock () == 0) {
-                       fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
-                       SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
-                       /* continue */
-               }
+       if (pw_unlock () == 0) {
+               fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
+               SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
+               /* continue */
        }
 
-       if (spw_locked) {
-               if (spw_unlock () == 0) {
-                       fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
-                       SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
-                       /* continue */
-               }
+       if (spw_unlock () == 0) {
+               fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
+               SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
+               /* continue */
        }
 
        nscd_flush_cache ("passwd");