]> granicus.if.org Git - shadow/commitdiff
* src/chpasswd.c: Added the line number when an error is reported
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 9 May 2009 13:14:37 +0000 (13:14 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 9 May 2009 13:14:37 +0000 (13:14 +0000)
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.

ChangeLog
src/chpasswd.c

index aba117e870dd00bf16ca3b989e233aed8a8708f1..3507e2ab4f6b77d1afbec9c92df00d021b3aeb30 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * src/passwd.c: Exit immediately when unlocking a password would
index 676b0f35042f4ba95484d66968b41c7684fb5b38..53ef8a33d3b6572452b6504349e9ecd752545a4a 100644 (file)
@@ -482,12 +482,12 @@ int main (int argc, char **argv)
                non_interactive_password = newpwd;
                ret = pam_chauthtok (pamh, 0);
                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"),
-                                        name, pam_strerror (pamh, ret));
+                                        line, name, pam_strerror (pamh, ret));
                        fprintf (stderr,
-                                _("chpasswd: (user %s) password unchanged\n"),
-                                name);
+                                _("chpasswd: (line %d, user %s) password unchanged\n"),
+                                line, name);
                        errors++;
                        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 written out all at once, and then unlocked
         * afterwards.
+        *
+        * With PAM, it is not possible to delay the update of the
+        * password database.
         */
        if (0 != errors) {
+#ifndef USE_PAM
                fprintf (stderr,
                         _("%s: error detected, changes ignored\n"), Prog);
+#endif
                fail_exit (1);
        }
 
 #ifndef USE_PAM
+       /* Save the changes */
        close_files ();
 #endif