* 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:
@@ -83,22 +83,30 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
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 (5);
|
||||
}
|
||||
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 (1);
|
||||
}
|
||||
|
||||
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 (5);
|
||||
}
|
||||
shadow_locked = true;
|
||||
if (spw_open (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 (1);
|
||||
}
|
||||
|
||||
@@ -138,18 +146,21 @@ int main (int argc, char **argv)
|
||||
|
||||
if (spw_close () == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: can't update shadow password file\n"), Prog);
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, spw_dbname ());
|
||||
fail_exit (3);
|
||||
}
|
||||
|
||||
if (pw_close () == 0) {
|
||||
fprintf (stderr, _("%s: can't update password file\n"), Prog);
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, pw_dbname ());
|
||||
fail_exit (3);
|
||||
}
|
||||
|
||||
if (unlink (SHADOW) != 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: can't delete shadow password file\n"), Prog);
|
||||
_("%s: cannot delete %s\n"), Prog, SHADOW);
|
||||
fail_exit (3);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user