* 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:
nekral-guest
2008-08-06 15:57:31 +00:00
parent b0fe7d3a0b
commit 7fc596fb8a
29 changed files with 703 additions and 528 deletions

View File

@@ -352,16 +352,16 @@ static void update_shell (const char *user, char *newshell)
* the password file. Get a lock on the file and open it.
*/
if (pw_lock () == 0) {
SYSLOG ((LOG_WARN, "can't lock /etc/passwd"));
SYSLOG ((LOG_WARN, "cannot lock %s", pw_dbname ()));
closelog ();
fputs (_("Cannot lock the password file; try again later.\n"),
stderr);
fprintf (stderr, _("%s: cannot lock %s; try again later.\n"),
Prog, pw_dbname ());
exit (1);
}
if (pw_open (O_RDWR) == 0) {
SYSLOG ((LOG_ERR, "can't open /etc/passwd"));
SYSLOG ((LOG_ERR, "cannot open %s", pw_dbname ()));
closelog ();
fputs (_("Cannot open the password file.\n"), stderr);
fprintf (stderr, _("%s: cannot open %s\n"), Prog, pw_dbname ());
pw_unlock ();
exit (1);
}
@@ -376,7 +376,8 @@ static void update_shell (const char *user, char *newshell)
if (NULL == pw) {
pw_unlock ();
fprintf (stderr,
_("%s: %s not found in /etc/passwd\n"), Prog, user);
_("%s: user '%s' does not exist in %s\n"),
Prog, user, pw_dbname ());
exit (1);
}
@@ -403,16 +404,17 @@ static void update_shell (const char *user, char *newshell)
* Changes have all been made, so commit them and unlock the file.
*/
if (pw_close () == 0) {
SYSLOG ((LOG_ERR, "can't rewrite /etc/passwd"));
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
closelog ();
fputs (_("Cannot commit password file changes.\n"), stderr);
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ());
pw_unlock ();
exit (1);
}
if (pw_unlock () == 0) {
SYSLOG ((LOG_ERR, "can't unlock /etc/passwd"));
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
closelog ();
fputs (_("Cannot unlock the password file.\n"), stderr);
fprintf (stderr,
_("%s: failed to unlock %s\n"), Prog, pw_dbname ());
exit (1);
}
}
@@ -459,7 +461,7 @@ int main (int argc, char **argv)
pw = xgetpwnam (user);
if (NULL == pw) {
fprintf (stderr,
_("%s: unknown user %s\n"), Prog, user);
_("%s: user '%s' does not exist\n"), Prog, user);
exit (1);
}
} else {