* lib/groupio.c, lib/groupio.h, lib/pwio.c, lib/pwio.h,
lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c, lib/shadowio.h: Added *_dbname() functions to retrieve the name of the databases. * lib/groupio.c, lib/groupio.h, lib/pwio.c, lib/pwio.h, lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c, lib/shadowio.h: *_name() functions renamed *setname(). * src/grpck.c, src/pwck.c: Likewise. * lib/groupio.h, lib/pwio.h, lib/sgroupio.h, lib/shadowio.h: Added the name of the arguments to the prototypes. * src/chage, src/chfn.c, src/chgpasswd.c, src/chpasswd.c, src/chsh.c, src/gpasswd.c, src/groupadd.c, src/groupdel.c, src/groupmod.c, src/grpck.c, src/grpconv.c, src/grpunconv.c, src/newusers.c, src/passwd.c, src/pwck.c, src/pwconv.c, src/pwunconv.c, src/useradd.c, src/userdel.c, src/usermod.c: Harmonize the erro & syslog messages in case of failure of the *_lock(), *_open(), *_close(), *_unlock(), *_remove() functions. * src/chgpasswd.c, src/chpasswd.c, src/usermod.c: Avoid capitalized messages. * src/chpasswd.c, src/useradd.c, src/usermod.c: Harmonize messages in case of inexistent entries. * src/usermod.c: Harmonize messages in case of already existing entries. * src/newusers.c, src/useradd.c: Simplify PAM error handling. * src/useradd.c: Report failures to unlock files (stderr, syslog, and audit). But do not fail (continue). * src/useradd.c (open_files): Do not report to syslog & audit failures to lock or open the databases. This might be harmless, and the logs were not already informed that a change was requested. * src/usermod.c: It's not the account which is unlocked, but its password.
This commit is contained in:
+16
-9
@@ -113,22 +113,26 @@ int main (int argc, char **argv)
|
||||
(void) textdomain (PACKAGE);
|
||||
|
||||
if (pw_lock () == 0) {
|
||||
fprintf (stderr, _("%s: can't lock passwd file\n"), Prog);
|
||||
fprintf (stderr,
|
||||
_("%s: cannot lock %s\n"), Prog, pw_dbname ());
|
||||
fail_exit (E_PWDBUSY);
|
||||
}
|
||||
passwd_locked = true;
|
||||
if (pw_open (O_RDWR) == 0) {
|
||||
fprintf (stderr, _("%s: can't open passwd file\n"), Prog);
|
||||
fprintf (stderr,
|
||||
_("%s: cannot open %s\n"), Prog, pw_dbname ());
|
||||
fail_exit (E_MISSING);
|
||||
}
|
||||
|
||||
if (spw_lock () == 0) {
|
||||
fprintf (stderr, _("%s: can't lock shadow file\n"), Prog);
|
||||
fprintf (stderr,
|
||||
_("%s: cannot lock %s\n"), Prog, spw_dbname ());
|
||||
fail_exit (E_PWDBUSY);
|
||||
}
|
||||
shadow_locked = true;
|
||||
if (spw_open (O_CREAT | O_RDWR) == 0) {
|
||||
fprintf (stderr, _("%s: can't open shadow file\n"), Prog);
|
||||
fprintf (stderr,
|
||||
_("%s: cannot open %s\n"), Prog, spw_dbname ());
|
||||
fail_exit (E_FAILURE);
|
||||
}
|
||||
|
||||
@@ -146,9 +150,8 @@ int main (int argc, char **argv)
|
||||
* This shouldn't happen (the entry exists) but...
|
||||
*/
|
||||
fprintf (stderr,
|
||||
_
|
||||
("%s: can't remove shadow entry for %s\n"),
|
||||
Prog, sp->sp_namp);
|
||||
_("%s: cannot remove entry '%s' from %s\n"),
|
||||
Prog, sp->sp_namp, spw_dbname ());
|
||||
fail_exit (E_FAILURE);
|
||||
}
|
||||
}
|
||||
@@ -201,11 +204,15 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
if (spw_close () == 0) {
|
||||
fprintf (stderr, _("%s: can't update shadow file\n"), Prog);
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, spw_dbname ());
|
||||
fail_exit (E_FAILURE);
|
||||
}
|
||||
if (pw_close () == 0) {
|
||||
fprintf (stderr, _("%s: can't update passwd file\n"), Prog);
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, pw_dbname ());
|
||||
fail_exit (E_FAILURE);
|
||||
}
|
||||
chmod (PASSWD_FILE "-", 0600); /* /etc/passwd- (backup file) */
|
||||
|
||||
Reference in New Issue
Block a user