]> granicus.if.org Git - shadow/commitdiff
* src/groupmems.c: Check the return value of gr_update().
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 30 Aug 2008 18:27:34 +0000 (18:27 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 30 Aug 2008 18:27:34 +0000 (18:27 +0000)
* src/chage.c, src/chfn.c, src/chgpasswd.c, src/chpasswd.c,
src/chsh.c, src/gpasswd.c, src/groupadd.c, src/groupmems.c,
src/groupmod.c, src/grpck.c, src/grpconv.c, src/grpunconv.c,
src/passwd.c, src/pwck.c, src/pwconv.c, src/pwunconv.c,
src/useradd.c, src/userdel.c, src/usermod.c: Harmonize the error
message sent to stderr in case of *_update () failure.
* src/chage.c, src/chsh.c, src/groupadd.c, src/passwd.c: Do not
log to syslog when pw_update() or spw_update() fail.
* src/newusers.c: Do not log specific error message to stderr when
sgr_update() fails.
* src/pwconv.c: Remove duplicated definition of Prog.

21 files changed:
ChangeLog
src/chage.c
src/chfn.c
src/chgpasswd.c
src/chpasswd.c
src/chsh.c
src/gpasswd.c
src/groupadd.c
src/groupmems.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

index 013b201462c294a00d1b6cce5de2f772d13e64a7..12efa628055f248f04cf0cd497b701114bb997cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2008-08-25  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/groupmems.c: Check the return value of gr_update().
+       * src/chage.c, src/chfn.c, src/chgpasswd.c, src/chpasswd.c,
+       src/chsh.c, src/gpasswd.c, src/groupadd.c, src/groupmems.c,
+       src/groupmod.c, src/grpck.c, src/grpconv.c, src/grpunconv.c,
+       src/passwd.c, src/pwck.c, src/pwconv.c, src/pwunconv.c,
+       src/useradd.c, src/userdel.c, src/usermod.c: Harmonize the error
+       message sent to stderr in case of *_update () failure.
+       * src/chage.c, src/chsh.c, src/groupadd.c, src/passwd.c: Do not
+       log to syslog when pw_update() or spw_update() fail.
+       * src/newusers.c: Do not log specific error message to stderr when
+       sgr_update() fails.
+       * src/pwconv.c: Remove duplicated definition of Prog.
+
 2008-08-25  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/chfn.c, src/chsh.c, src/expiry.c, src/gpasswd.c,
index 0396d293d4277a9bcd2d0d72bf25fb1a97d56a5f..f3fee24273b36bbca7559ac67f4735a199ca7b64 100644 (file)
@@ -663,8 +663,7 @@ static void update_age (const struct spwd *sp, const struct passwd *pw)
                pwent.pw_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
                if (pw_update (&pwent) == 0) {
                        fprintf (stderr,
-                                _("%s: cannot update %s\n"), Prog, pw_dbname ());
-                       SYSLOG ((LOG_WARN, "cannot update %s", pw_dbname ()));
+                                _("%s: failed to prepare the new %s entry '%s'\n"), Prog, pw_dbname (), pwent.pw_name);
                        fail_exit (E_NOPERM);
                }
        } else {
@@ -687,8 +686,7 @@ static void update_age (const struct spwd *sp, const struct passwd *pw)
 
        if (spw_update (&spwent) == 0) {
                fprintf (stderr,
-                        _("%s: cannot update %s\n"), Prog, spw_dbname ());
-               SYSLOG ((LOG_WARN, "cannot update %s", spw_dbname ()));
+                        _("%s: failed to prepare the new %s entry '%s'\n"), Prog, spw_dbname (), spwent.sp_namp);
                fail_exit (E_NOPERM);
        }
 
index 3a940d16ca51b85c82022d7c57c718cd1a3c1bf2..8e1fb8de7261204aed4c87b461c2c8b2f8a4accf 100644 (file)
@@ -475,7 +475,9 @@ static void update_gecos (const char *user, char *gecos)
         * entry as well.
         */
        if (pw_update (&pwent) == 0) {
-               fputs (_("Error updating the password entry.\n"), stderr);
+               fprintf (stderr,
+                        _("%s: failed to prepare the new %s entry\n"),
+                        Prog, pw_dbname ());
                fail_exit (E_NOPERM);
        }
 
index eec869d107238d42ffc80322dab3ebfee2a6767e..581886f938aa9cef567e99cecaceafcb55d91db5 100644 (file)
@@ -492,19 +492,23 @@ int main (int argc, char **argv)
                 */
 #ifdef SHADOWGRP
                if (NULL != sg) {
-                       ok = sgr_update (&newsg);
+                       if (sgr_update (&newsg) == 0) {
+                               fprintf (stderr,
+                                        _("%s: line %d: failed to prepare the new %s entry '%s'\n"),
+                                        Prog, line, sgr_dbname (), newsg.sg_name);
+                               errors++;
+                               continue;
+                       }
                } else
 #endif
                {
-                       ok = gr_update (&newgr);
-               }
-
-               if (0 == ok) {
-                       fprintf (stderr,
-                                _("%s: line %d: cannot update group entry\n"),
-                                Prog, line);
-                       errors++;
-                       continue;
+                       if (gr_update (&newgr) == 0) {
+                               fprintf (stderr,
+                                        _("%s: line %d: failed to prepare the new %s entry '%s'\n"),
+                                        Prog, line, gr_dbname (), newgr.gr_name);
+                               errors++;
+                               continue;
+                       }
                }
        }
 
index 5393683bf1c4a91286be00edf18a51fea0ba059a..d23a6c8de4be441edb4c718e5e67d34ac844870a 100644 (file)
@@ -479,17 +479,21 @@ int main (int argc, char **argv)
                 * other entries have been updated as well.
                 */
                if (NULL != sp) {
-                       ok = spw_update (&newsp);
+                       if (spw_update (&newsp) == 0) {
+                               fprintf (stderr,
+                                        _("%s: line %d: failed to prepare the new %s entry\n"),
+                                        Prog, line, spw_dbname ());
+                               errors++;
+                               continue;
+                       }
                } else {
-                       ok = pw_update (&newpw);
-               }
-
-               if (0 == ok) {
-                       fprintf (stderr,
-                                _("%s: line %d: cannot update password entry\n"),
-                                Prog, line);
-                       errors++;
-                       continue;
+                       if (pw_update (&newsp) == 0) {
+                               fprintf (stderr,
+                                        _("%s: line %d: failed to prepare the new %s entry\n"),
+                                        Prog, line, pw_dbname ());
+                               errors++;
+                               continue;
+                       }
                }
        }
 
index e2093cfc53f8aa2a06861c6d0a9fcb8564f008a3..da138a9d45d2927e200f00e57386f4fb0a92568d 100644 (file)
@@ -400,8 +400,8 @@ static void update_shell (const char *user, char *newshell)
         * that entry as well.
         */
        if (pw_update (&pwent) == 0) {
-               SYSLOG ((LOG_WARN, "error updating passwd entry"));
-               fputs (_("Error updating the password entry.\n"), stderr);
+               fprintf (stderr,
+                        _("%s: failed to prepare the new %s entry\n"), Prog, pw_dbname ());
                fail_exit (1);
        }
 
index 3ccd1249c9c1da31f7b6ccc2965cf44554603c0a..84b80f68874102e24a6456a70a4bedb3833968d4 100644 (file)
@@ -577,9 +577,8 @@ static void update_group (struct group *gr)
 {
        if (gr_update (gr) == 0) {
                fprintf (stderr,
-                        _("%s: cannot update entry '%s' in %s\n"),
-                        Prog, gr->gr_name, gr_dbname ());
-               SYSLOG ((LOG_WARN, "cannot update entry '%s' in %s", gr->gr_name, gr_dbname ()));
+                        _("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ());
+               SYSLOG ((LOG_WARN, "failed to prepare the new %s entry", gr_dbname ()));
 #ifdef WITH_AUDIT
                audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
                              "updating /etc/group",
@@ -589,8 +588,9 @@ static void update_group (struct group *gr)
        }
 #ifdef SHADOWGRP
        if (is_shadowgrp && (sgr_update (sg) == 0)) {
-               fprintf (stderr, _("%s: cannot update entry '%s' in %s\n"), Prog, sg->sg_name, sgr_dbname ());
-               SYSLOG ((LOG_WARN, "cannot update entry '%s' in %s", sg->sg_name, sgr_dbname ()));
+               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 ()));
 #ifdef WITH_AUDIT
                audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
                              "updating /etc/gshadow",
index de23adb3179ac58c4c37fbce25040fda137a6c42..900ac8f91d596fba686ef96cdf54669ab1f8fbd9 100644 (file)
@@ -198,8 +198,8 @@ static void grp_update (void)
         * Write out the new group file entry.
         */
        if (gr_update (&grp) == 0) {
-               fprintf (stderr, _("%s: error adding new entry '%s' in %s\n"), Prog, grp.gr_name, gr_dbname ());
-               SYSLOG ((LOG_WARN, "error adding new entry '%s' in %s", grp.gr_name, gr_dbname ()));
+               fprintf (stderr,
+                        _("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ());
                fail_exit (E_GRP_UPDATE);
        }
 #ifdef SHADOWGRP
@@ -207,8 +207,8 @@ static void grp_update (void)
         * Write out the new shadow group entries as well.
         */
        if (is_shadow_grp && (sgr_update (&sgrp) == 0)) {
-               fprintf (stderr, _("%s: error adding new entry '%s' in %s\n"), Prog, sgrp.sg_name, sgr_dbname ());
-               SYSLOG ((LOG_WARN, "error adding new entry '%s' in %s", sgrp.sg_name, sgr_dbname ()));
+               fprintf (stderr,
+                        _("%s: failed to prepare the new %s entry\n"), Prog, sgr_dbname ());
                fail_exit (E_GRP_UPDATE);
        }
 #endif                         /* SHADOWGRP */
index 7e9582018757daa6c9aab699e44198e5a18064b8..ed1d62fac3661fa3817402d74eda2b0a63a9a644 100644 (file)
@@ -284,7 +284,11 @@ int main (int argc, char **argv)
                        fail_exit (EXIT_MEMBER_EXISTS);
                }
                grp->gr_mem = add_list (grp->gr_mem, adduser);
-               gr_update (grp);
+               if (gr_update (grp) == 0) {
+                       fprintf (stderr,
+                                _("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ());
+                       fail_exit (13);
+               }
        } else if (NULL != deluser) {
                if (!is_on_list (grp->gr_mem, adduser)) {
                        fprintf (stderr,
@@ -293,10 +297,18 @@ int main (int argc, char **argv)
                        fail_exit (EXIT_NOT_MEMBER);
                }
                grp->gr_mem = del_list (grp->gr_mem, deluser);
-               gr_update (grp);
+               if (gr_update (grp) == 0) {
+                       fprintf (stderr,
+                                _("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ());
+                       fail_exit (13);
+               }
        } else if (purge) {
                grp->gr_mem[0] = NULL;
-               gr_update (grp);
+               if (gr_update (grp) == 0) {
+                       fprintf (stderr,
+                                _("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ());
+                       fail_exit (13);
+               }
        }
 
        if (gr_close () == 0) {
index c23bc5e7908f36185841e4a89038832c5b17d6d2..9ea852913c4b65572bfba3490df26bd80adbfa14 100644 (file)
@@ -258,8 +258,8 @@ static void grp_update (void)
         */
        if (gr_update (&grp) == 0) {
                fprintf (stderr,
-                        _("%s: cannot add entry '%s' to %s\n"),
-                        Prog, grp.gr_name, gr_dbname ());
+                        _("%s: failed to prepare the new %s entry '%s'\n"),
+                        Prog, gr_dbname (), grp.gr_name);
 #ifdef WITH_AUDIT
                audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
                              "adding group",
@@ -293,7 +293,9 @@ static void grp_update (void)
         * Write out the new shadow group entries as well.
         */
        if (is_shadow_grp && (sgr_update (&sgrp) == 0)) {
-               fprintf (stderr, _("%s: cannot add entry '%s' to %s\n"), Prog, sgrp.sg_name, sgr_dbname ());
+               fprintf (stderr,
+                        _("%s: failed to prepare the new %s entry '%s'\n"),
+                        Prog, sgr_dbname (), sgrp.sg_name);
 #ifdef WITH_AUDIT
                audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
                              "adding group",
@@ -645,21 +647,16 @@ void update_primary_groups (gid_t ogid, gid_t ngid)
                        lpwd = pw_locate (pwd->pw_name);
                        if (NULL == lpwd) {
                                fprintf (stderr,
-                                        _("%s: cannot change the primary group of user '%s' from %lu to %lu, since it is not in %s.\n"),
-                                        Prog, pwd->pw_name,
-                                        (unsigned long) ogid,
-                                        (unsigned long) ngid,
-                                        pw_dbname ());
+                                        _("%s: user '%s' does not exist in %s\n"),
+                                        Prog, pwd->pw_name, pw_dbname ());
                                fail_exit (E_GRP_UPDATE);
                        } else {
                                npwd = *lpwd;
                                npwd.pw_gid = ngid;
                                if (pw_update (&npwd) == 0) {
                                        fprintf (stderr,
-                                                _("%s: cannot change the primary group of user '%s' from %lu to %lu.\n"),
-                                                Prog, pwd->pw_name,
-                                                (unsigned long) ogid,
-                                                (unsigned long) ngid);
+                                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                                Prog, pw_dbname (), npwd.pw_name);
                                        fail_exit (E_GRP_UPDATE);
                                }
                        }
index 9cdd1e45d6e383888e80f10b0f451469109eabb4..ecbeb39cdde353b3c1ef1ed58fee6b7f46dc22dd 100644 (file)
@@ -592,9 +592,8 @@ static void check_grp_file (int *errors, bool *changed)
 
                                        if (sgr_update (&sg) == 0) {
                                                fprintf (stderr,
-                                                        _
-                                                        ("%s: can't update shadow entry for %s\n"),
-                                                        Prog, sg.sg_name);
+                                                        _("%s: failed to prepare the new %s entry '%s'\n"),
+                                                        Prog, sgr_dbname (), sg.sg_name);
                                                fail_exit (E_CANT_UPDATE);
                                        }
                                        /* remove password from /etc/group */
@@ -602,9 +601,8 @@ static void check_grp_file (int *errors, bool *changed)
                                        gr.gr_passwd = SHADOW_PASSWD_STRING;    /* XXX warning: const */
                                        if (gr_update (&gr) == 0) {
                                                fprintf (stderr,
-                                                        _
-                                                        ("%s: can't update entry for group %s\n"),
-                                                        Prog, gr.gr_name);
+                                                        _("%s: failed to prepare the new %s entry '%s'\n"),
+                                                        Prog, gr_dbname (), gr.gr_name);
                                                fail_exit (E_CANT_UPDATE);
                                        }
                                }
index f3dae8dba9a1b8dd477575ea61e464609ab22c14..6c889bbd4a5691794049df40d38375e20be830ee 100644 (file)
@@ -171,9 +171,8 @@ int main (int argc, char **argv)
 
                if (sgr_update (&sgent) == 0) {
                        fprintf (stderr,
-                                _
-                                ("%s: can't update shadow entry for %s\n"),
-                                Prog, sgent.sg_name);
+                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                Prog, sgr_dbname (), sgent.sg_name);
                        fail_exit (3);
                }
                /* remove password from /etc/group */
@@ -181,9 +180,8 @@ int main (int argc, char **argv)
                grent.gr_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
                if (gr_update (&grent) == 0) {
                        fprintf (stderr,
-                                _
-                                ("%s: can't update entry for group %s\n"),
-                                Prog, grent.gr_name);
+                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                Prog, gr_dbname (), grent.gr_name);
                        fail_exit (3);
                }
        }
index 8ed8db0c24bbb9828e3156f986cfab111c6b3613..e82cf1ca5846949d78558683e5774257eca7f589 100644 (file)
@@ -139,9 +139,8 @@ int main (int argc, char **argv)
                        grent.gr_passwd = sg->sg_passwd;
                        if (gr_update (&grent) == 0) {
                                fprintf (stderr,
-                                        _
-                                        ("%s: can't update entry for group %s\n"),
-                                        Prog, grent.gr_name);
+                                        _("%s: failed to prepare the new %s entry '%s'\n"),
+                                        Prog, gr_dbname (), grent.gr_name);
                                fail_exit (3);
                        }
                }
index 64ca99508573553730ae2ad1a47f8b4a9c27151a..321bb01b31ac817eb09979a61bdb075d433c855a 100644 (file)
@@ -275,9 +275,6 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid)
                sgrent.sg_mem = members;
 
                if (sgr_update (&sgrent) == 0) {
-                       fprintf (stderr,
-                                _("%s: group %s created, failure during the creation of the corresponding gshadow group\n"),
-                                Prog, grent.gr_name);
                        return -1;
                }
        }
index b4fe6da400e439938831e299336e239eb7cacdc3..8f250883791ff497ca478f23d74b5b957bd32d06 100644 (file)
@@ -555,8 +555,9 @@ static void update_noshadow (void)
        }
        npw->pw_passwd = update_crypt_pw (npw->pw_passwd);
        if (pw_update (npw) == 0) {
-               fputs (_("Error updating the password entry.\n"), stderr);
-               SYSLOG ((LOG_WARN, "error updating password entry"));
+               fprintf (stderr,
+                        _("%s: failed to prepare the new %s entry '%s'\n"),
+                        Prog, pw_dbname (), npw->pw_name);
                fail_exit (E_FAILURE);
        }
        if (pw_close () == 0) {
@@ -634,8 +635,9 @@ static void update_shadow (void)
                nsp->sp_lstchg = 0;
 
        if (spw_update (nsp) == 0) {
-               fputs (_("Error updating the password entry.\n"), stderr);
-               SYSLOG ((LOG_WARN, "error updating password entry"));
+               fprintf (stderr,
+                        _("%s: failed to prepare the new %s entry '%s'\n"),
+                        Prog, spw_dbname (), nsp->sp_namp);
                fail_exit (E_FAILURE);
        }
        if (spw_close () == 0) {
index ed6fd6c84179e699c4c0b91f0e166693f8be75ce..9d5a0c01aad0ba733ad34606c38d24543d9c889c 100644 (file)
@@ -467,8 +467,8 @@ static void check_pw_file (int *errors, bool *changed)
 
                                        if (spw_update (&sp) == 0) {
                                                fprintf (stderr,
-                                                        _("%s: can't update shadow entry for %s\n"),
-                                                        Prog, sp.sp_namp);
+                                                        _("%s: failed to prepare the new %s entry '%s'\n"),
+                                                        Prog, spw_dbname (), sp.sp_namp);
                                                exit (E_CANTUPDATE);
                                        }
                                        /* remove password from /etc/passwd */
@@ -476,8 +476,8 @@ static void check_pw_file (int *errors, bool *changed)
                                        pw.pw_passwd = SHADOW_PASSWD_STRING;    /* XXX warning: const */
                                        if (pw_update (&pw) == 0) {
                                                fprintf (stderr,
-                                                        _("%s: can't update passwd entry for %s\n"),
-                                                        Prog, pw.pw_name);
+                                                        _("%s: failed to prepare the new %s entry '%s'\n"),
+                                                        Prog, pw_dbname (), pw.pw_name);
                                                exit (E_CANTUPDATE);
                                        }
                                }
index cfa07504161b5271992fb1b334a313e60c4e10b3..ea7e64fcda405cec1611a0381c206e3aa650d85f 100644 (file)
@@ -117,7 +117,6 @@ int main (int argc, char **argv)
        struct passwd pwent;
        const struct spwd *sp;
        struct spwd spent;
-       char *Prog = argv[0];
 
        Prog = Basename (argv[0]);
 
@@ -202,9 +201,8 @@ int main (int argc, char **argv)
                spent.sp_lstchg = (long) time ((time_t *) 0) / SCALE;
                if (spw_update (&spent) == 0) {
                        fprintf (stderr,
-                                _
-                                ("%s: can't update shadow entry for %s\n"),
-                                Prog, spent.sp_namp);
+                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                Prog, spw_dbname (), spent.sp_namp);
                        fail_exit (E_FAILURE);
                }
 
@@ -213,9 +211,8 @@ int main (int argc, char **argv)
                pwent.pw_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
                if (pw_update (&pwent) == 0) {
                        fprintf (stderr,
-                                _
-                                ("%s: can't update passwd entry for %s\n"),
-                                Prog, pwent.pw_name);
+                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                Prog, pw_dbname (), pwent.pw_name);
                        fail_exit (E_FAILURE);
                }
        }
index 6481e7298a7d39df5ff36511a7c635b7b3aa175d..a727bead4c63141fb26dadcfc1e06747480bea34 100644 (file)
@@ -149,8 +149,8 @@ int main (int argc, char **argv)
                 */
                if (pw_update (&pwent) == 0) {
                        fprintf (stderr,
-                                _("%s: can't update entry for user %s\n"),
-                                Prog, pwent.pw_name);
+                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                Prog, pw_dbname (), pwent.pw_name);
                        fail_exit (3);
                }
        }
index 3030c29b6fab9485f219d62cc68d7cd34c666b58..ca79d77f3af11fbb7a8890ade3d512643503470b 100644 (file)
@@ -844,7 +844,8 @@ static void grp_update (void)
                ngrp->gr_mem = add_list (ngrp->gr_mem, user_name);
                if (gr_update (ngrp) == 0) {
                        fprintf (stderr,
-                                _("%s: error adding new group entry\n"), Prog);
+                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                Prog, gr_dbname (), ngrp->gr_name);
                        fail_exit (E_GRP_UPDATE);
                }
 #ifdef WITH_AUDIT
@@ -898,7 +899,8 @@ static void grp_update (void)
                nsgrp->sg_mem = add_list (nsgrp->sg_mem, user_name);
                if (sgr_update (nsgrp) == 0) {
                        fprintf (stderr,
-                                _("%s: error adding new entry to %s\n"), Prog, sgr_dbname ());
+                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                Prog, sgr_dbname (), nsgrp->sg_name);
                        fail_exit (E_GRP_UPDATE);
                }
 #ifdef WITH_AUDIT
@@ -1449,7 +1451,9 @@ static void grp_add (void)
         * Write out the new group file entry.
         */
        if (gr_update (&grp) == 0) {
-               fprintf (stderr, _("%s: error adding new group entry\n"), Prog);
+               fprintf (stderr,
+                        _("%s: failed to prepare the new %s entry '%s'\n"),
+                        Prog, gr_dbname (), grp.gr_name);
                fail_exit (E_GRP_UPDATE);
        }
 #ifdef  SHADOWGRP
@@ -1457,7 +1461,9 @@ static void grp_add (void)
         * Write out the new shadow group entries as well.
         */
        if (is_shadow_grp && (sgr_update (&sgrp) == 0)) {
-               fprintf (stderr, _("%s: error adding new group entry\n"), Prog);
+               fprintf (stderr,
+                        _("%s: failed to prepare the new %s entry '%s'\n"),
+                        Prog, sgr_dbname (), sgrp.sg_name);
                fail_exit (E_GRP_UPDATE);
        }
 #endif                         /* SHADOWGRP */
@@ -1559,7 +1565,8 @@ static void usr_update (void)
         */
        if (pw_update (&pwent) == 0) {
                fprintf (stderr,
-                        _("%s: error adding new password entry\n"), Prog);
+                        _("%s: failed to prepare the new %s entry '%s'\n"),
+                        Prog, pw_dbname (), pwent.pw_name);
                fail_exit (E_PW_UPDATE);
        }
 
@@ -1568,9 +1575,8 @@ static void usr_update (void)
         */
        if (is_shadow_pwd && (spw_update (&spent) == 0)) {
                fprintf (stderr,
-                        _
-                        ("%s: error adding new shadow password entry\n"),
-                        Prog);
+                        _("%s: failed to prepare the new %s entry '%s'\n"),
+                        Prog, spw_dbname (), spent.sp_namp);
 #ifdef WITH_AUDIT
                audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
                              "adding shadow password",
index dd085bb89b4fface5e68c82324c12f2a29a89fbe..58a98720330e99edfceb41ea9c1ac3011808af58 100644 (file)
@@ -168,7 +168,8 @@ static void update_groups (void)
                ngrp->gr_mem = del_list (ngrp->gr_mem, user_name);
                if (gr_update (ngrp) == 0) {
                        fprintf (stderr,
-                                _("%s: error updating group entry\n"), Prog);
+                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                Prog, gr_dbname (), ngrp->gr_name);
                        exit (E_GRP_UPDATE);
                }
 
@@ -285,7 +286,8 @@ static void update_groups (void)
 
                if (sgr_update (nsgrp) == 0) {
                        fprintf (stderr,
-                                _("%s: error updating shadow group entry\n"), Prog);
+                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                Prog, sgr_dbname (), nsgrp->sg_name);
                        exit (E_GRP_UPDATE);
                }
 #ifdef WITH_AUDIT
index c2221eb87ad76cc7ccd352c9517a63c45b500f87..fcd98149b2fa49b86c42944fd5d7a1dfa2dff5ba 100644 (file)
@@ -634,9 +634,9 @@ static void update_group (void)
                changed = false;
                if (gr_update (ngrp) == 0) {
                        fprintf (stderr,
-                                _("%s: error adding new entry '%s' in %s\n"),
-                                Prog, ngrp->gr_name, gr_dbname ());
-                       SYSLOG ((LOG_WARN, "error adding new entry '%s' in %s", ngrp->gr_name, gr_dbname ()));
+                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                Prog, gr_dbname (), ngrp->gr_name);
+                       SYSLOG ((LOG_WARN, "failed to prepare the new %s entry '%s'", gr_dbname (), ngrp->gr_name));
                        fail_exit (E_GRP_UPDATE);
                }
        }
@@ -753,10 +753,10 @@ static void update_gshadow (void)
                 */
                if (sgr_update (nsgrp) == 0) {
                        fprintf (stderr,
-                                _("%s: error adding new entry '%s' in '%s\n"),
-                                Prog, nsgrp->sg_name, sgr_dbname ());
-                       SYSLOG ((LOG_WARN, "error adding new entry '%s' in %s",
-                               nsgrp->sg_name, sgr_dbname ()));
+                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                Prog, sgr_dbname (), nsgrp->sg_name);
+                       SYSLOG ((LOG_WARN, "failed to prepare the new %s entry '%s'",
+                                sgr_dbname (), nsgrp->sg_name));
                        fail_exit (E_GRP_UPDATE);
                }
        }
@@ -1301,8 +1301,8 @@ static void usr_update (void)
            || Lflg || Uflg) {
                if (pw_update (&pwent) == 0) {
                        fprintf (stderr,
-                                _("%s: cannot add new entry '%s' in %s\n"),
-                                Prog, pwent.pw_name, pw_dbname ());
+                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                Prog, pw_dbname (), pwent.pw_name);
                        fail_exit (E_PW_UPDATE);
                }
                if (lflg && (pw_remove (user_name) == 0)) {
@@ -1315,8 +1315,8 @@ static void usr_update (void)
        if ((NULL != spwd) && (lflg || eflg || fflg || pflg || Lflg || Uflg)) {
                if (spw_update (&spent) == 0) {
                        fprintf (stderr,
-                                _("%s: cannot add new entry '%s' in %s\n"),
-                                Prog, spent.sp_namp, spw_dbname ());
+                                _("%s: failed to prepare the new %s entry '%s'\n"),
+                                Prog, spw_dbname (), spent.sp_namp);
                        fail_exit (E_PW_UPDATE);
                }
                if (lflg && (spw_remove (user_name) == 0)) {