* 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.
This commit is contained in:
nekral-guest 2011-09-18 17:32:04 +00:00
parent 7b0116c5b4
commit 4ce849a5ed
2 changed files with 16 additions and 13 deletions

View File

@ -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> 2011-09-18 Nicolas François <nicolas.francois@centraliens.net>
* src/newusers.c: Initially set the passwd's password to '*' * src/newusers.c: Initially set the passwd's password to '*'

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 1996 - 2000, Marek Michałkiewicz * Copyright (c) 1996 - 2000, Marek Michałkiewicz
* Copyright (c) 2002 - 2006, Tomasz Kłoczko * Copyright (c) 2002 - 2006, Tomasz Kłoczko
* Copyright (c) 2009 , Nicolas François * Copyright (c) 2009 - 2011, Nicolas François
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -124,6 +124,7 @@ int main (int argc, char **argv)
if (1 != argc) { if (1 != argc) {
(void) fputs (_("Usage: pwconv\n"), stderr); (void) fputs (_("Usage: pwconv\n"), stderr);
fail_exit (E_USAGE);
} }
Prog = Basename (argv[0]); Prog = Basename (argv[0]);
@ -260,20 +261,16 @@ int main (int argc, char **argv)
/* continue */ /* continue */
} }
if (pw_locked) { if (pw_unlock () == 0) {
if (pw_unlock () == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); /* continue */
/* continue */
}
} }
if (spw_locked) { if (spw_unlock () == 0) {
if (spw_unlock () == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); /* continue */
/* continue */
}
} }
nscd_flush_cache ("passwd"); nscd_flush_cache ("passwd");