* 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

@ -183,13 +183,13 @@ static void process_flags (int argc, char **argv)
*/
if (optind != argc) {
grp_file = argv[optind];
gr_name (grp_file);
gr_setdbname (grp_file);
use_system_grp_file = false;
}
#ifdef SHADOWGRP
if ((optind + 2) == argc) {
sgr_file = argv[optind + 1];
sgr_name (sgr_file);
sgr_setdbname (sgr_file);
is_shadow = true;
use_system_sgr_file = false;
} else if (optind == argc) {
@ -211,7 +211,7 @@ static void open_files (void)
*/
if (!read_only) {
if (gr_lock () == 0) {
fprintf (stderr, _("%s: cannot lock file %s\n"),
fprintf (stderr, _("%s: cannot lock %s\n"),
Prog, grp_file);
if (use_system_grp_file) {
SYSLOG ((LOG_WARN, "cannot lock %s", grp_file));
@ -221,7 +221,7 @@ static void open_files (void)
}
#ifdef SHADOWGRP
if (is_shadow && (sgr_lock () == 0)) {
fprintf (stderr, _("%s: cannot lock file %s\n"),
fprintf (stderr, _("%s: cannot lock %s\n"),
Prog, sgr_file);
if (use_system_sgr_file) {
SYSLOG ((LOG_WARN, "cannot lock %s", sgr_file));
@ -237,7 +237,7 @@ static void open_files (void)
* O_RDWR otherwise.
*/
if (gr_open (read_only ? O_RDONLY : O_RDWR) == 0) {
fprintf (stderr, _("%s: cannot open file %s\n"), Prog,
fprintf (stderr, _("%s: cannot open %s\n"), Prog,
grp_file);
if (use_system_grp_file) {
SYSLOG ((LOG_WARN, "cannot open %s", grp_file));
@ -247,7 +247,7 @@ static void open_files (void)
}
#ifdef SHADOWGRP
if (is_shadow && (sgr_open (read_only ? O_RDONLY : O_RDWR) == 0)) {
fprintf (stderr, _("%s: cannot open file %s\n"), Prog,
fprintf (stderr, _("%s: cannot open %s\n"), Prog,
sgr_file);
if (use_system_sgr_file) {
SYSLOG ((LOG_WARN, "cannot open %s", sgr_file));
@ -273,13 +273,13 @@ static void close_files (bool changed)
*/
if (changed) {
if (gr_close () == 0) {
fprintf (stderr, _("%s: cannot update file %s\n"),
fprintf (stderr, _("%s: failure while writing changes to %s\n"),
Prog, grp_file);
exit (E_CANT_UPDATE);
}
#ifdef SHADOWGRP
if (is_shadow && (sgr_close () == 0)) {
fprintf (stderr, _("%s: cannot update file %s\n"),
fprintf (stderr, _("%s: failure while writing changes to %s\n"),
Prog, sgr_file);
exit (E_CANT_UPDATE);
}