* src/chpasswd.c: Added the line number when an error is reported

instead of only the username.
	* src/chpasswd.c: PAM enabled chpasswd do may change the password
	database (for the user where the password update succeeded) even
	if there were a failure for one user. Do not indicate that changes
	were ignored.
This commit is contained in:
nekral-guest 2009-05-09 13:14:37 +00:00
parent 61939960cc
commit 5c1279d803
2 changed files with 19 additions and 4 deletions

View File

@ -1,3 +1,12 @@
2009-05-07 Nicolas François <nicolas.francois@centraliens.net>
* src/chpasswd.c: Added the line number when an error is reported
instead of only the username.
* src/chpasswd.c: PAM enabled chpasswd do may change the password
database (for the user where the password update succeeded) even
if there were a failure for one user. Do not indicate that changes
were ignored.
2009-05-07 Nicolas François <nicolas.francois@centraliens.net> 2009-05-07 Nicolas François <nicolas.francois@centraliens.net>
* src/passwd.c: Exit immediately when unlocking a password would * src/passwd.c: Exit immediately when unlocking a password would

View File

@ -482,12 +482,12 @@ int main (int argc, char **argv)
non_interactive_password = newpwd; non_interactive_password = newpwd;
ret = pam_chauthtok (pamh, 0); ret = pam_chauthtok (pamh, 0);
if (ret != PAM_SUCCESS) { if (ret != PAM_SUCCESS) {
fprintf (stderr, _("chpasswd: (user %s) pam_chauthtok() failed, error:\n" fprintf (stderr, _("chpasswd: (line %d, user %s) pam_chauthtok() failed, error:\n"
" %s\n"), " %s\n"),
name, pam_strerror (pamh, ret)); line, name, pam_strerror (pamh, ret));
fprintf (stderr, fprintf (stderr,
_("chpasswd: (user %s) password unchanged\n"), _("chpasswd: (line %d, user %s) password unchanged\n"),
name); line, name);
errors++; errors++;
continue; continue;
} }
@ -582,14 +582,20 @@ int main (int argc, char **argv)
* changes to be ignored. Otherwise the file is closed, causing the * changes to be ignored. Otherwise the file is closed, causing the
* changes to be written out all at once, and then unlocked * changes to be written out all at once, and then unlocked
* afterwards. * afterwards.
*
* With PAM, it is not possible to delay the update of the
* password database.
*/ */
if (0 != errors) { if (0 != errors) {
#ifndef USE_PAM
fprintf (stderr, fprintf (stderr,
_("%s: error detected, changes ignored\n"), Prog); _("%s: error detected, changes ignored\n"), Prog);
#endif
fail_exit (1); fail_exit (1);
} }
#ifndef USE_PAM #ifndef USE_PAM
/* Save the changes */
close_files (); close_files ();
#endif #endif