* 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.
This commit is contained in:
15
ChangeLog
15
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>
|
2008-08-25 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* src/chfn.c, src/chsh.c, src/expiry.c, src/gpasswd.c,
|
* src/chfn.c, src/chsh.c, src/expiry.c, src/gpasswd.c,
|
||||||
|
@@ -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 */
|
pwent.pw_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
|
||||||
if (pw_update (&pwent) == 0) {
|
if (pw_update (&pwent) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: cannot update %s\n"), Prog, pw_dbname ());
|
_("%s: failed to prepare the new %s entry '%s'\n"), Prog, pw_dbname (), pwent.pw_name);
|
||||||
SYSLOG ((LOG_WARN, "cannot update %s", pw_dbname ()));
|
|
||||||
fail_exit (E_NOPERM);
|
fail_exit (E_NOPERM);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -687,8 +686,7 @@ static void update_age (const struct spwd *sp, const struct passwd *pw)
|
|||||||
|
|
||||||
if (spw_update (&spwent) == 0) {
|
if (spw_update (&spwent) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: cannot update %s\n"), Prog, spw_dbname ());
|
_("%s: failed to prepare the new %s entry '%s'\n"), Prog, spw_dbname (), spwent.sp_namp);
|
||||||
SYSLOG ((LOG_WARN, "cannot update %s", spw_dbname ()));
|
|
||||||
fail_exit (E_NOPERM);
|
fail_exit (E_NOPERM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -475,7 +475,9 @@ static void update_gecos (const char *user, char *gecos)
|
|||||||
* entry as well.
|
* entry as well.
|
||||||
*/
|
*/
|
||||||
if (pw_update (&pwent) == 0) {
|
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);
|
fail_exit (E_NOPERM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -492,19 +492,23 @@ int main (int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
#ifdef SHADOWGRP
|
#ifdef SHADOWGRP
|
||||||
if (NULL != sg) {
|
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
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ok = gr_update (&newgr);
|
if (gr_update (&newgr) == 0) {
|
||||||
}
|
fprintf (stderr,
|
||||||
|
_("%s: line %d: failed to prepare the new %s entry '%s'\n"),
|
||||||
if (0 == ok) {
|
Prog, line, gr_dbname (), newgr.gr_name);
|
||||||
fprintf (stderr,
|
errors++;
|
||||||
_("%s: line %d: cannot update group entry\n"),
|
continue;
|
||||||
Prog, line);
|
}
|
||||||
errors++;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -479,17 +479,21 @@ int main (int argc, char **argv)
|
|||||||
* other entries have been updated as well.
|
* other entries have been updated as well.
|
||||||
*/
|
*/
|
||||||
if (NULL != sp) {
|
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 {
|
} else {
|
||||||
ok = pw_update (&newpw);
|
if (pw_update (&newsp) == 0) {
|
||||||
}
|
fprintf (stderr,
|
||||||
|
_("%s: line %d: failed to prepare the new %s entry\n"),
|
||||||
if (0 == ok) {
|
Prog, line, pw_dbname ());
|
||||||
fprintf (stderr,
|
errors++;
|
||||||
_("%s: line %d: cannot update password entry\n"),
|
continue;
|
||||||
Prog, line);
|
}
|
||||||
errors++;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -400,8 +400,8 @@ static void update_shell (const char *user, char *newshell)
|
|||||||
* that entry as well.
|
* that entry as well.
|
||||||
*/
|
*/
|
||||||
if (pw_update (&pwent) == 0) {
|
if (pw_update (&pwent) == 0) {
|
||||||
SYSLOG ((LOG_WARN, "error updating passwd entry"));
|
fprintf (stderr,
|
||||||
fputs (_("Error updating the password entry.\n"), stderr);
|
_("%s: failed to prepare the new %s entry\n"), Prog, pw_dbname ());
|
||||||
fail_exit (1);
|
fail_exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -577,9 +577,8 @@ static void update_group (struct group *gr)
|
|||||||
{
|
{
|
||||||
if (gr_update (gr) == 0) {
|
if (gr_update (gr) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: cannot update entry '%s' in %s\n"),
|
_("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ());
|
||||||
Prog, gr->gr_name, gr_dbname ());
|
SYSLOG ((LOG_WARN, "failed to prepare the new %s entry", gr_dbname ()));
|
||||||
SYSLOG ((LOG_WARN, "cannot update entry '%s' in %s", gr->gr_name, gr_dbname ()));
|
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||||
"updating /etc/group",
|
"updating /etc/group",
|
||||||
@@ -589,8 +588,9 @@ static void update_group (struct group *gr)
|
|||||||
}
|
}
|
||||||
#ifdef SHADOWGRP
|
#ifdef SHADOWGRP
|
||||||
if (is_shadowgrp && (sgr_update (sg) == 0)) {
|
if (is_shadowgrp && (sgr_update (sg) == 0)) {
|
||||||
fprintf (stderr, _("%s: cannot update entry '%s' in %s\n"), Prog, sg->sg_name, sgr_dbname ());
|
fprintf (stderr,
|
||||||
SYSLOG ((LOG_WARN, "cannot update entry '%s' in %s", sg->sg_name, sgr_dbname ()));
|
_("%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
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||||
"updating /etc/gshadow",
|
"updating /etc/gshadow",
|
||||||
|
@@ -198,8 +198,8 @@ static void grp_update (void)
|
|||||||
* Write out the new group file entry.
|
* Write out the new group file entry.
|
||||||
*/
|
*/
|
||||||
if (gr_update (&grp) == 0) {
|
if (gr_update (&grp) == 0) {
|
||||||
fprintf (stderr, _("%s: error adding new entry '%s' in %s\n"), Prog, grp.gr_name, gr_dbname ());
|
fprintf (stderr,
|
||||||
SYSLOG ((LOG_WARN, "error adding new entry '%s' in %s", grp.gr_name, gr_dbname ()));
|
_("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ());
|
||||||
fail_exit (E_GRP_UPDATE);
|
fail_exit (E_GRP_UPDATE);
|
||||||
}
|
}
|
||||||
#ifdef SHADOWGRP
|
#ifdef SHADOWGRP
|
||||||
@@ -207,8 +207,8 @@ static void grp_update (void)
|
|||||||
* Write out the new shadow group entries as well.
|
* Write out the new shadow group entries as well.
|
||||||
*/
|
*/
|
||||||
if (is_shadow_grp && (sgr_update (&sgrp) == 0)) {
|
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 ());
|
fprintf (stderr,
|
||||||
SYSLOG ((LOG_WARN, "error adding new entry '%s' in %s", sgrp.sg_name, sgr_dbname ()));
|
_("%s: failed to prepare the new %s entry\n"), Prog, sgr_dbname ());
|
||||||
fail_exit (E_GRP_UPDATE);
|
fail_exit (E_GRP_UPDATE);
|
||||||
}
|
}
|
||||||
#endif /* SHADOWGRP */
|
#endif /* SHADOWGRP */
|
||||||
|
@@ -284,7 +284,11 @@ int main (int argc, char **argv)
|
|||||||
fail_exit (EXIT_MEMBER_EXISTS);
|
fail_exit (EXIT_MEMBER_EXISTS);
|
||||||
}
|
}
|
||||||
grp->gr_mem = add_list (grp->gr_mem, adduser);
|
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) {
|
} else if (NULL != deluser) {
|
||||||
if (!is_on_list (grp->gr_mem, adduser)) {
|
if (!is_on_list (grp->gr_mem, adduser)) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
@@ -293,10 +297,18 @@ int main (int argc, char **argv)
|
|||||||
fail_exit (EXIT_NOT_MEMBER);
|
fail_exit (EXIT_NOT_MEMBER);
|
||||||
}
|
}
|
||||||
grp->gr_mem = del_list (grp->gr_mem, deluser);
|
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) {
|
} else if (purge) {
|
||||||
grp->gr_mem[0] = NULL;
|
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) {
|
if (gr_close () == 0) {
|
||||||
|
@@ -258,8 +258,8 @@ static void grp_update (void)
|
|||||||
*/
|
*/
|
||||||
if (gr_update (&grp) == 0) {
|
if (gr_update (&grp) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: cannot add entry '%s' to %s\n"),
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
Prog, grp.gr_name, gr_dbname ());
|
Prog, gr_dbname (), grp.gr_name);
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||||
"adding group",
|
"adding group",
|
||||||
@@ -293,7 +293,9 @@ static void grp_update (void)
|
|||||||
* Write out the new shadow group entries as well.
|
* Write out the new shadow group entries as well.
|
||||||
*/
|
*/
|
||||||
if (is_shadow_grp && (sgr_update (&sgrp) == 0)) {
|
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
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||||
"adding group",
|
"adding group",
|
||||||
@@ -645,21 +647,16 @@ void update_primary_groups (gid_t ogid, gid_t ngid)
|
|||||||
lpwd = pw_locate (pwd->pw_name);
|
lpwd = pw_locate (pwd->pw_name);
|
||||||
if (NULL == lpwd) {
|
if (NULL == lpwd) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: cannot change the primary group of user '%s' from %lu to %lu, since it is not in %s.\n"),
|
_("%s: user '%s' does not exist in %s\n"),
|
||||||
Prog, pwd->pw_name,
|
Prog, pwd->pw_name, pw_dbname ());
|
||||||
(unsigned long) ogid,
|
|
||||||
(unsigned long) ngid,
|
|
||||||
pw_dbname ());
|
|
||||||
fail_exit (E_GRP_UPDATE);
|
fail_exit (E_GRP_UPDATE);
|
||||||
} else {
|
} else {
|
||||||
npwd = *lpwd;
|
npwd = *lpwd;
|
||||||
npwd.pw_gid = ngid;
|
npwd.pw_gid = ngid;
|
||||||
if (pw_update (&npwd) == 0) {
|
if (pw_update (&npwd) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: cannot change the primary group of user '%s' from %lu to %lu.\n"),
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
Prog, pwd->pw_name,
|
Prog, pw_dbname (), npwd.pw_name);
|
||||||
(unsigned long) ogid,
|
|
||||||
(unsigned long) ngid);
|
|
||||||
fail_exit (E_GRP_UPDATE);
|
fail_exit (E_GRP_UPDATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
src/grpck.c
10
src/grpck.c
@@ -592,9 +592,8 @@ static void check_grp_file (int *errors, bool *changed)
|
|||||||
|
|
||||||
if (sgr_update (&sg) == 0) {
|
if (sgr_update (&sg) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
("%s: can't update shadow entry for %s\n"),
|
Prog, sgr_dbname (), sg.sg_name);
|
||||||
Prog, sg.sg_name);
|
|
||||||
fail_exit (E_CANT_UPDATE);
|
fail_exit (E_CANT_UPDATE);
|
||||||
}
|
}
|
||||||
/* remove password from /etc/group */
|
/* 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 */
|
gr.gr_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
|
||||||
if (gr_update (&gr) == 0) {
|
if (gr_update (&gr) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
("%s: can't update entry for group %s\n"),
|
Prog, gr_dbname (), gr.gr_name);
|
||||||
Prog, gr.gr_name);
|
|
||||||
fail_exit (E_CANT_UPDATE);
|
fail_exit (E_CANT_UPDATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -171,9 +171,8 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (sgr_update (&sgent) == 0) {
|
if (sgr_update (&sgent) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
("%s: can't update shadow entry for %s\n"),
|
Prog, sgr_dbname (), sgent.sg_name);
|
||||||
Prog, sgent.sg_name);
|
|
||||||
fail_exit (3);
|
fail_exit (3);
|
||||||
}
|
}
|
||||||
/* remove password from /etc/group */
|
/* remove password from /etc/group */
|
||||||
@@ -181,9 +180,8 @@ int main (int argc, char **argv)
|
|||||||
grent.gr_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
|
grent.gr_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
|
||||||
if (gr_update (&grent) == 0) {
|
if (gr_update (&grent) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
("%s: can't update entry for group %s\n"),
|
Prog, gr_dbname (), grent.gr_name);
|
||||||
Prog, grent.gr_name);
|
|
||||||
fail_exit (3);
|
fail_exit (3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -139,9 +139,8 @@ int main (int argc, char **argv)
|
|||||||
grent.gr_passwd = sg->sg_passwd;
|
grent.gr_passwd = sg->sg_passwd;
|
||||||
if (gr_update (&grent) == 0) {
|
if (gr_update (&grent) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
("%s: can't update entry for group %s\n"),
|
Prog, gr_dbname (), grent.gr_name);
|
||||||
Prog, grent.gr_name);
|
|
||||||
fail_exit (3);
|
fail_exit (3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -275,9 +275,6 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid)
|
|||||||
sgrent.sg_mem = members;
|
sgrent.sg_mem = members;
|
||||||
|
|
||||||
if (sgr_update (&sgrent) == 0) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
src/passwd.c
10
src/passwd.c
@@ -555,8 +555,9 @@ static void update_noshadow (void)
|
|||||||
}
|
}
|
||||||
npw->pw_passwd = update_crypt_pw (npw->pw_passwd);
|
npw->pw_passwd = update_crypt_pw (npw->pw_passwd);
|
||||||
if (pw_update (npw) == 0) {
|
if (pw_update (npw) == 0) {
|
||||||
fputs (_("Error updating the password entry.\n"), stderr);
|
fprintf (stderr,
|
||||||
SYSLOG ((LOG_WARN, "error updating password entry"));
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
|
Prog, pw_dbname (), npw->pw_name);
|
||||||
fail_exit (E_FAILURE);
|
fail_exit (E_FAILURE);
|
||||||
}
|
}
|
||||||
if (pw_close () == 0) {
|
if (pw_close () == 0) {
|
||||||
@@ -634,8 +635,9 @@ static void update_shadow (void)
|
|||||||
nsp->sp_lstchg = 0;
|
nsp->sp_lstchg = 0;
|
||||||
|
|
||||||
if (spw_update (nsp) == 0) {
|
if (spw_update (nsp) == 0) {
|
||||||
fputs (_("Error updating the password entry.\n"), stderr);
|
fprintf (stderr,
|
||||||
SYSLOG ((LOG_WARN, "error updating password entry"));
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
|
Prog, spw_dbname (), nsp->sp_namp);
|
||||||
fail_exit (E_FAILURE);
|
fail_exit (E_FAILURE);
|
||||||
}
|
}
|
||||||
if (spw_close () == 0) {
|
if (spw_close () == 0) {
|
||||||
|
@@ -467,8 +467,8 @@ static void check_pw_file (int *errors, bool *changed)
|
|||||||
|
|
||||||
if (spw_update (&sp) == 0) {
|
if (spw_update (&sp) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: can't update shadow entry for %s\n"),
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
Prog, sp.sp_namp);
|
Prog, spw_dbname (), sp.sp_namp);
|
||||||
exit (E_CANTUPDATE);
|
exit (E_CANTUPDATE);
|
||||||
}
|
}
|
||||||
/* remove password from /etc/passwd */
|
/* 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 */
|
pw.pw_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
|
||||||
if (pw_update (&pw) == 0) {
|
if (pw_update (&pw) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: can't update passwd entry for %s\n"),
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
Prog, pw.pw_name);
|
Prog, pw_dbname (), pw.pw_name);
|
||||||
exit (E_CANTUPDATE);
|
exit (E_CANTUPDATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
src/pwconv.c
11
src/pwconv.c
@@ -117,7 +117,6 @@ int main (int argc, char **argv)
|
|||||||
struct passwd pwent;
|
struct passwd pwent;
|
||||||
const struct spwd *sp;
|
const struct spwd *sp;
|
||||||
struct spwd spent;
|
struct spwd spent;
|
||||||
char *Prog = argv[0];
|
|
||||||
|
|
||||||
Prog = Basename (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;
|
spent.sp_lstchg = (long) time ((time_t *) 0) / SCALE;
|
||||||
if (spw_update (&spent) == 0) {
|
if (spw_update (&spent) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
("%s: can't update shadow entry for %s\n"),
|
Prog, spw_dbname (), spent.sp_namp);
|
||||||
Prog, spent.sp_namp);
|
|
||||||
fail_exit (E_FAILURE);
|
fail_exit (E_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,9 +211,8 @@ int main (int argc, char **argv)
|
|||||||
pwent.pw_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
|
pwent.pw_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
|
||||||
if (pw_update (&pwent) == 0) {
|
if (pw_update (&pwent) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
("%s: can't update passwd entry for %s\n"),
|
Prog, pw_dbname (), pwent.pw_name);
|
||||||
Prog, pwent.pw_name);
|
|
||||||
fail_exit (E_FAILURE);
|
fail_exit (E_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -149,8 +149,8 @@ int main (int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if (pw_update (&pwent) == 0) {
|
if (pw_update (&pwent) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: can't update entry for user %s\n"),
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
Prog, pwent.pw_name);
|
Prog, pw_dbname (), pwent.pw_name);
|
||||||
fail_exit (3);
|
fail_exit (3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -844,7 +844,8 @@ static void grp_update (void)
|
|||||||
ngrp->gr_mem = add_list (ngrp->gr_mem, user_name);
|
ngrp->gr_mem = add_list (ngrp->gr_mem, user_name);
|
||||||
if (gr_update (ngrp) == 0) {
|
if (gr_update (ngrp) == 0) {
|
||||||
fprintf (stderr,
|
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);
|
fail_exit (E_GRP_UPDATE);
|
||||||
}
|
}
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
@@ -898,7 +899,8 @@ static void grp_update (void)
|
|||||||
nsgrp->sg_mem = add_list (nsgrp->sg_mem, user_name);
|
nsgrp->sg_mem = add_list (nsgrp->sg_mem, user_name);
|
||||||
if (sgr_update (nsgrp) == 0) {
|
if (sgr_update (nsgrp) == 0) {
|
||||||
fprintf (stderr,
|
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);
|
fail_exit (E_GRP_UPDATE);
|
||||||
}
|
}
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
@@ -1449,7 +1451,9 @@ static void grp_add (void)
|
|||||||
* Write out the new group file entry.
|
* Write out the new group file entry.
|
||||||
*/
|
*/
|
||||||
if (gr_update (&grp) == 0) {
|
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);
|
fail_exit (E_GRP_UPDATE);
|
||||||
}
|
}
|
||||||
#ifdef SHADOWGRP
|
#ifdef SHADOWGRP
|
||||||
@@ -1457,7 +1461,9 @@ static void grp_add (void)
|
|||||||
* Write out the new shadow group entries as well.
|
* Write out the new shadow group entries as well.
|
||||||
*/
|
*/
|
||||||
if (is_shadow_grp && (sgr_update (&sgrp) == 0)) {
|
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);
|
fail_exit (E_GRP_UPDATE);
|
||||||
}
|
}
|
||||||
#endif /* SHADOWGRP */
|
#endif /* SHADOWGRP */
|
||||||
@@ -1559,7 +1565,8 @@ static void usr_update (void)
|
|||||||
*/
|
*/
|
||||||
if (pw_update (&pwent) == 0) {
|
if (pw_update (&pwent) == 0) {
|
||||||
fprintf (stderr,
|
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);
|
fail_exit (E_PW_UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1568,9 +1575,8 @@ static void usr_update (void)
|
|||||||
*/
|
*/
|
||||||
if (is_shadow_pwd && (spw_update (&spent) == 0)) {
|
if (is_shadow_pwd && (spw_update (&spent) == 0)) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
("%s: error adding new shadow password entry\n"),
|
Prog, spw_dbname (), spent.sp_namp);
|
||||||
Prog);
|
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||||
"adding shadow password",
|
"adding shadow password",
|
||||||
|
@@ -168,7 +168,8 @@ static void update_groups (void)
|
|||||||
ngrp->gr_mem = del_list (ngrp->gr_mem, user_name);
|
ngrp->gr_mem = del_list (ngrp->gr_mem, user_name);
|
||||||
if (gr_update (ngrp) == 0) {
|
if (gr_update (ngrp) == 0) {
|
||||||
fprintf (stderr,
|
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);
|
exit (E_GRP_UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,7 +286,8 @@ static void update_groups (void)
|
|||||||
|
|
||||||
if (sgr_update (nsgrp) == 0) {
|
if (sgr_update (nsgrp) == 0) {
|
||||||
fprintf (stderr,
|
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);
|
exit (E_GRP_UPDATE);
|
||||||
}
|
}
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
|
@@ -634,9 +634,9 @@ static void update_group (void)
|
|||||||
changed = false;
|
changed = false;
|
||||||
if (gr_update (ngrp) == 0) {
|
if (gr_update (ngrp) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: error adding new entry '%s' in %s\n"),
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
Prog, ngrp->gr_name, gr_dbname ());
|
Prog, gr_dbname (), ngrp->gr_name);
|
||||||
SYSLOG ((LOG_WARN, "error adding new entry '%s' in %s", ngrp->gr_name, gr_dbname ()));
|
SYSLOG ((LOG_WARN, "failed to prepare the new %s entry '%s'", gr_dbname (), ngrp->gr_name));
|
||||||
fail_exit (E_GRP_UPDATE);
|
fail_exit (E_GRP_UPDATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -753,10 +753,10 @@ static void update_gshadow (void)
|
|||||||
*/
|
*/
|
||||||
if (sgr_update (nsgrp) == 0) {
|
if (sgr_update (nsgrp) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: error adding new entry '%s' in '%s\n"),
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
Prog, nsgrp->sg_name, sgr_dbname ());
|
Prog, sgr_dbname (), nsgrp->sg_name);
|
||||||
SYSLOG ((LOG_WARN, "error adding new entry '%s' in %s",
|
SYSLOG ((LOG_WARN, "failed to prepare the new %s entry '%s'",
|
||||||
nsgrp->sg_name, sgr_dbname ()));
|
sgr_dbname (), nsgrp->sg_name));
|
||||||
fail_exit (E_GRP_UPDATE);
|
fail_exit (E_GRP_UPDATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1301,8 +1301,8 @@ static void usr_update (void)
|
|||||||
|| Lflg || Uflg) {
|
|| Lflg || Uflg) {
|
||||||
if (pw_update (&pwent) == 0) {
|
if (pw_update (&pwent) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: cannot add new entry '%s' in %s\n"),
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
Prog, pwent.pw_name, pw_dbname ());
|
Prog, pw_dbname (), pwent.pw_name);
|
||||||
fail_exit (E_PW_UPDATE);
|
fail_exit (E_PW_UPDATE);
|
||||||
}
|
}
|
||||||
if (lflg && (pw_remove (user_name) == 0)) {
|
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 ((NULL != spwd) && (lflg || eflg || fflg || pflg || Lflg || Uflg)) {
|
||||||
if (spw_update (&spent) == 0) {
|
if (spw_update (&spent) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: cannot add new entry '%s' in %s\n"),
|
_("%s: failed to prepare the new %s entry '%s'\n"),
|
||||||
Prog, spent.sp_namp, spw_dbname ());
|
Prog, spw_dbname (), spent.sp_namp);
|
||||||
fail_exit (E_PW_UPDATE);
|
fail_exit (E_PW_UPDATE);
|
||||||
}
|
}
|
||||||
if (lflg && (spw_remove (user_name) == 0)) {
|
if (lflg && (spw_remove (user_name) == 0)) {
|
||||||
|
Reference in New Issue
Block a user