* src/chfn.c: Merge some translated messages.

* src/groupmems.c, src/groupadd.c, src/gpasswd.c, src/chsh.c,
	src/chfn.c: Harmonize *_update() failure messages.
	* src/groupmems.c: Harmonize gr_close() failure messages.
	* src/newgrp.c: Harmonize "unknown GID" messages.
	* src/newusers.c: Move the pwd declaration to a inner block scope.
This commit is contained in:
nekral-guest 2008-08-30 18:28:24 +00:00
parent aa2fee4969
commit 8851893412
8 changed files with 41 additions and 23 deletions

View File

@ -1,4 +1,13 @@
2008-08-25 Nicolas François <nicolas.francois@centraliens.net>
2008-08-26 Nicolas François <nicolas.francois@centraliens.net>
* src/chfn.c: Merge some translated messages.
* src/groupmems.c, src/groupadd.c, src/gpasswd.c, src/chsh.c,
src/chfn.c: Harmonize *_update() failure messages.
* src/groupmems.c: Harmonize gr_close() failure messages.
* src/newgrp.c: Harmonize "unknown GID" messages.
* src/newusers.c: Move the pwd declaration to a inner block scope.
2008-08-26 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

View File

@ -190,25 +190,25 @@ static void new_fields (void)
if (may_change_field ('f')) {
change_field (fullnm, sizeof fullnm, _("Full Name"));
} else {
printf (_("\tFull Name: %s\n"), fullnm);
printf (_("\t%s: %s\n"), _("Full Name"), fullnm);
}
if (may_change_field ('r')) {
change_field (roomno, sizeof roomno, _("Room Number"));
} else {
printf (_("\tRoom Number: %s\n"), roomno);
printf (_("\t%s: %s\n"), _("Room Number"), fullnm);
}
if (may_change_field ('w')) {
change_field (workph, sizeof workph, _("Work Phone"));
} else {
printf (_("\tWork Phone: %s\n"), workph);
printf (_("\t%s: %s\n"), _("Work Phone"), fullnm);
}
if (may_change_field ('h')) {
change_field (homeph, sizeof homeph, _("Home Phone"));
} else {
printf (_("\tHome Phone: %s\n"), homeph);
printf (_("\t%s: %s\n"), _("Home Phone"), fullnm);
}
if (amroot) {
@ -476,8 +476,8 @@ static void update_gecos (const char *user, char *gecos)
*/
if (pw_update (&pwent) == 0) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry\n"),
Prog, pw_dbname ());
_("%s: failed to prepare the new %s entry '%s'\n"),
Prog, pw_dbname (), pwent.pw_name);
fail_exit (E_NOPERM);
}

View File

@ -401,7 +401,8 @@ static void update_shell (const char *user, char *newshell)
*/
if (pw_update (&pwent) == 0) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry\n"), Prog, pw_dbname ());
_("%s: failed to prepare the new %s entry '%s'\n"),
Prog, pw_dbname (), pwent.pw_name);
fail_exit (1);
}

View File

@ -577,8 +577,9 @@ static void update_group (struct group *gr)
{
if (gr_update (gr) == 0) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ());
SYSLOG ((LOG_WARN, "failed to prepare the new %s entry", gr_dbname ()));
_("%s: failed to prepare the new %s entry '%s'\n"),
Prog, gr_dbname (), gr->gr_name);
SYSLOG ((LOG_WARN, "failed to prepare the new %s entry '%s'", gr_dbname (), gr->gr_name));
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"updating /etc/group",
@ -589,8 +590,9 @@ static void update_group (struct group *gr)
#ifdef SHADOWGRP
if (is_shadowgrp && (sgr_update (sg) == 0)) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry\n"), Prog, sgr_dbname ());
SYSLOG ((LOG_WARN, "failed to prepare the new %s entry", sgr_dbname ()));
_("%s: failed to prepare the new %s entry '%s'\n"),
Prog, sgr_dbname (), sg->sg_name);
SYSLOG ((LOG_WARN, "failed to prepare the new %s entry '%s'", sgr_dbname (), sg->sg_name));
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"updating /etc/gshadow",

View File

@ -199,7 +199,8 @@ static void grp_update (void)
*/
if (gr_update (&grp) == 0) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ());
_("%s: failed to prepare the new %s entry '%s'\n"),
Prog, gr_dbname (), grp.gr_name);
fail_exit (E_GRP_UPDATE);
}
#ifdef SHADOWGRP
@ -208,7 +209,8 @@ static void grp_update (void)
*/
if (is_shadow_grp && (sgr_update (&sgrp) == 0)) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry\n"), Prog, sgr_dbname ());
_("%s: failed to prepare the new %s entry '%s'\n"),
Prog, sgr_dbname (), sgrp.sg_name);
fail_exit (E_GRP_UPDATE);
}
#endif /* SHADOWGRP */

View File

@ -286,7 +286,8 @@ int main (int argc, char **argv)
grp->gr_mem = add_list (grp->gr_mem, adduser);
if (gr_update (grp) == 0) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ());
_("%s: failed to prepare the new %s entry '%s'\n"),
Prog, gr_dbname (), grp->gr_name);
fail_exit (13);
}
} else if (NULL != deluser) {
@ -299,20 +300,22 @@ int main (int argc, char **argv)
grp->gr_mem = del_list (grp->gr_mem, deluser);
if (gr_update (grp) == 0) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ());
_("%s: failed to prepare the new %s entry '%s'\n"),
Prog, gr_dbname (), grp->gr_name);
fail_exit (13);
}
} else if (purge) {
grp->gr_mem[0] = NULL;
if (gr_update (grp) == 0) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ());
_("%s: failed to prepare the new %s entry '%s'\n"),
Prog, gr_dbname (), grp->gr_name);
fail_exit (13);
}
}
if (gr_close () == 0) {
fprintf (stderr, _("%s: failure while writing %s\n"), Prog, gr_dbname ());
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
SYSLOG ((LOG_ERR, "failure while writing %s", gr_dbname ()));
fail_exit (EXIT_GROUP_FILE);
}

View File

@ -507,10 +507,11 @@ int main (int argc, char **argv)
*/
grp = xgetgrgid (pwd->pw_gid);
if (NULL == grp) {
fprintf (stderr, _("unknown GID: %lu\n"),
(unsigned long) pwd->pw_gid);
SYSLOG ((LOG_CRIT, "unknown GID: %lu",
(unsigned long) pwd->pw_gid));
fprintf (stderr,
_("%s: GID '%lu' does not exist\n"),
Prog, (unsigned long) pwd->pw_gid);
SYSLOG ((LOG_CRIT, "GID '%lu' does not exist",
(unsigned long) pwd->pw_gid));
goto failure;
} else {
group = grp->gr_name;

View File

@ -284,7 +284,6 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid)
}
static int get_uid (const char *uid, uid_t *nuid) {
const struct passwd *pwd = NULL;
/*
* The first guess for the UID is either the numerical UID that the
@ -302,6 +301,7 @@ static int get_uid (const char *uid, uid_t *nuid) {
*nuid = (uid_t) i;
} else {
if ('\0' != uid[0]) {
const struct passwd *pwd;
/* local, no need for xgetpwnam */
pwd = getpwnam (uid);
if (NULL == pwd) {