* src/useradd.c: Harmonize some error messages.

* src/userdel.c: Add log to syslog when the mail file could not be
	removed.
	* src/userdel.c: Give more context an error message (merge with
	perror()).
	* src/usermod.c: Harmonize some error messages.
This commit is contained in:
nekral-guest 2008-08-30 18:27:59 +00:00
parent d7b55ce2bb
commit aa2fee4969
5 changed files with 26 additions and 15 deletions

View File

@ -1,3 +1,12 @@
2008-08-25 Nicolas François <nicolas.francois@centraliens.net>
* src/useradd.c: Harmonize some error messages.
* src/userdel.c: Add log to syslog when the mail file could not be
removed.
* src/userdel.c: Give more context an error message (merge with
perror()).
* src/usermod.c: Harmonize some error messages.
2008-08-25 Nicolas François <nicolas.francois@centraliens.net> 2008-08-25 Nicolas François <nicolas.francois@centraliens.net>
* src/groupmems.c: Check the return value of gr_update(). * src/groupmems.c: Check the return value of gr_update().

View File

@ -481,16 +481,16 @@ int main (int argc, char **argv)
if (NULL != sp) { if (NULL != sp) {
if (spw_update (&newsp) == 0) { if (spw_update (&newsp) == 0) {
fprintf (stderr, fprintf (stderr,
_("%s: line %d: failed to prepare the new %s entry\n"), _("%s: line %d: failed to prepare the new %s entry '%s'\n"),
Prog, line, spw_dbname ()); Prog, line, spw_dbname (), newsp.sp_namp);
errors++; errors++;
continue; continue;
} }
} else { } else {
if (pw_update (&newsp) == 0) { if (pw_update (&newpw) == 0) {
fprintf (stderr, fprintf (stderr,
_("%s: line %d: failed to prepare the new %s entry\n"), _("%s: line %d: failed to prepare the new %s entry '%s'\n"),
Prog, line, pw_dbname ()); Prog, line, pw_dbname (), newpw.pw_name);
errors++; errors++;
continue; continue;
} }

View File

@ -832,8 +832,8 @@ static void grp_update (void)
ngrp = __gr_dup (grp); ngrp = __gr_dup (grp);
if (NULL == ngrp) { if (NULL == ngrp) {
fprintf (stderr, fprintf (stderr,
_("%s: Out of memory. Cannot update the group database.\n"), _("%s: Out of memory. Cannot update %s.\n"),
Prog); Prog, gr_dbname ());
fail_exit (E_GRP_UPDATE); /* XXX */ fail_exit (E_GRP_UPDATE); /* XXX */
} }
@ -1041,8 +1041,7 @@ static void process_flags (int argc, char **argv)
grp = getgr_nam_gid (optarg); grp = getgr_nam_gid (optarg);
if (NULL == grp) { if (NULL == grp) {
fprintf (stderr, fprintf (stderr,
_ _("%s: group '%s' does not exist\n"),
("%s: unknown group %s\n"),
Prog, optarg); Prog, optarg);
exit (E_NOTFOUND); exit (E_NOTFOUND);
} }

View File

@ -708,17 +708,20 @@ static void remove_mailbox (void)
fprintf (stderr, fprintf (stderr,
_("%s: %s not owned by %s, not removing\n"), _("%s: %s not owned by %s, not removing\n"),
Prog, mailfile, user_name); Prog, mailfile, user_name);
SYSLOG ((LOG_ERR, "%s not owned by %s, not removed", mailfile, strerror (errno)));
#ifdef WITH_AUDIT #ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"deleting mail file", "deleting mail file",
user_name, (unsigned int) user_id, 0); user_name, (unsigned int) user_id, 0);
#endif #endif
return; return;
} else if (i == -1) } else if (i == -1) {
return; /* mailbox doesn't exist */ return; /* mailbox doesn't exist */
}
if (unlink (mailfile) != 0) { if (unlink (mailfile) != 0) {
fprintf (stderr, _("%s: warning: can't remove "), Prog); fprintf (stderr, _("%s: warning: can't remove %s: %s"), Prog, mailfile, strerror (errno));
perror (mailfile); SYSLOG ((LOG_ERR, "Cannot remove %s: %s", mailfile, strerror (errno)));
/* continue */
} }
#ifdef WITH_AUDIT #ifdef WITH_AUDIT
else { else {

View File

@ -250,8 +250,8 @@ static int get_groups (char *list)
* string name. * string name.
*/ */
if (NULL == grp) { if (NULL == grp) {
fprintf (stderr, _("%s: unknown group %s\n"), fprintf (stderr, _("%s: group '%s' does not exist\n"),
Prog, list); Prog, list);
errors++; errors++;
} }
list = cp; list = cp;
@ -954,7 +954,7 @@ static void process_flags (int argc, char **argv)
grp = getgr_nam_gid (optarg); grp = getgr_nam_gid (optarg);
if (NULL == grp) { if (NULL == grp) {
fprintf (stderr, fprintf (stderr,
_("%s: unknown group %s\n"), _("%s: group '%s' does not exist\n"),
Prog, optarg); Prog, optarg);
exit (E_NOTFOUND); exit (E_NOTFOUND);
} }