* src/chfn.c: Do not exit on pw_unlock failures.
* src/grpconv.c, src/grpunconv.c, src/pwconv.c, src/pwunconv.c, src/vipw.c: Open syslog with the right identification name. * src/vipw.c: Log unlock errors to syslog. * src/vipw.c: Log edits to syslog. * src/chage.c, src/chfn.c, src/chsh.c, src/gpasswd.c, src/groupadd.c, src/groupdel.c, src/groupmod.c, src/grpconv.c, src/grpunconv.c, src/passwd.c, src/pwck.c, src/pwunconv.c, src/useradd.c, src/usermod.c: Harmonize the syslog levels. Failure to close or unlock are errors. Failure to open files are warnings.
This commit is contained in:
parent
c9119dc6bb
commit
a3be8ff055
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
2008-08-20 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* src/chfn.c: Do not exit on pw_unlock failures.
|
||||
* src/grpconv.c, src/grpunconv.c, src/pwconv.c, src/pwunconv.c,
|
||||
src/vipw.c: Open syslog with the right identification name.
|
||||
* src/vipw.c: Log unlock errors to syslog.
|
||||
* src/vipw.c: Log edits to syslog.
|
||||
* src/chage.c, src/chfn.c, src/chsh.c, src/gpasswd.c,
|
||||
src/groupadd.c, src/groupdel.c, src/groupmod.c, src/grpconv.c,
|
||||
src/grpunconv.c, src/passwd.c, src/pwck.c, src/pwunconv.c,
|
||||
src/useradd.c, src/usermod.c: Harmonize the syslog levels. Failure
|
||||
to close or unlock are errors. Failure to open files are warnings.
|
||||
|
||||
2008-08-20 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* src/newusers.c: Open syslog with the right identification name.
|
||||
|
10
src/chage.c
10
src/chage.c
@ -572,7 +572,7 @@ static void open_files (bool readonly)
|
||||
}
|
||||
if (pw_open (readonly ? O_RDONLY: O_RDWR) == 0) {
|
||||
fprintf (stderr, _("%s: cannot open %s\n"), Prog, pw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "cannot open %s", pw_dbname ()));
|
||||
SYSLOG ((LOG_WARN, "cannot open %s", pw_dbname ()));
|
||||
fail_exit (E_NOPERM);
|
||||
}
|
||||
|
||||
@ -594,7 +594,7 @@ static void open_files (bool readonly)
|
||||
if (spw_open (readonly ? O_RDONLY: O_RDWR) == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: cannot open %s\n"), Prog, spw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "cannot open %s", spw_dbname ()));
|
||||
SYSLOG ((LOG_WARN, "cannot open %s", spw_dbname ()));
|
||||
fail_exit (E_NOPERM);
|
||||
}
|
||||
}
|
||||
@ -664,7 +664,7 @@ static void update_age (const struct spwd *sp, const struct passwd *pw)
|
||||
if (pw_update (&pwent) == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: cannot update %s\n"), Prog, pw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "cannot update %s", pw_dbname ()));
|
||||
SYSLOG ((LOG_WARN, "cannot update %s", pw_dbname ()));
|
||||
fail_exit (E_NOPERM);
|
||||
}
|
||||
} else {
|
||||
@ -688,7 +688,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_ERR, "cannot update %s", spw_dbname ()));
|
||||
SYSLOG ((LOG_WARN, "cannot update %s", spw_dbname ()));
|
||||
fail_exit (E_NOPERM);
|
||||
}
|
||||
|
||||
@ -808,7 +808,7 @@ int main (int argc, char **argv)
|
||||
fprintf (stderr,
|
||||
_("%s: the shadow password file is not present\n"),
|
||||
Prog);
|
||||
SYSLOG ((LOG_ERR, "can't find the shadow password file"));
|
||||
SYSLOG ((LOG_WARN, "can't find the shadow password file"));
|
||||
closelog ();
|
||||
exit (E_SHADOW_NOTFOUND);
|
||||
}
|
||||
|
@ -487,12 +487,12 @@ static void update_gecos (const char *user, char *gecos)
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
|
||||
fail_exit (E_NOPERM);
|
||||
}
|
||||
pw_locked = false; /* If we fail to unlock, do not retry */
|
||||
if (pw_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
|
||||
fail_exit (E_NOPERM);
|
||||
/* continue */
|
||||
}
|
||||
pw_locked = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -370,7 +370,7 @@ static void update_shell (const char *user, char *newshell)
|
||||
pw_locked = true;
|
||||
if (pw_open (O_RDWR) == 0) {
|
||||
fprintf (stderr, _("%s: cannot open %s\n"), Prog, pw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "cannot open %s", pw_dbname ()));
|
||||
SYSLOG ((LOG_WARN, "cannot open %s", pw_dbname ()));
|
||||
fail_exit (1);
|
||||
}
|
||||
|
||||
@ -400,7 +400,7 @@ static void update_shell (const char *user, char *newshell)
|
||||
* that entry as well.
|
||||
*/
|
||||
if (pw_update (&pwent) == 0) {
|
||||
SYSLOG ((LOG_ERR, "error updating passwd entry"));
|
||||
SYSLOG ((LOG_WARN, "error updating passwd entry"));
|
||||
fputs (_("Error updating the password entry.\n"), stderr);
|
||||
fail_exit (1);
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ static void fail_exit (int status)
|
||||
if (gr_locked) {
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking group file",
|
||||
@ -176,7 +176,7 @@ static void fail_exit (int status)
|
||||
if (sgr_locked) {
|
||||
if (sgr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking gshadow file",
|
||||
@ -441,7 +441,7 @@ static void close_files (void)
|
||||
{
|
||||
if (gr_close () == 0) {
|
||||
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"rewriting /etc/group",
|
||||
@ -453,7 +453,7 @@ static void close_files (void)
|
||||
if (is_shadowgrp) {
|
||||
if (sgr_close () == 0) {
|
||||
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"rewriting /etc/gshadow",
|
||||
@ -463,7 +463,7 @@ static void close_files (void)
|
||||
}
|
||||
if (sgr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking gshadow file",
|
||||
@ -476,7 +476,7 @@ static void close_files (void)
|
||||
#endif
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking group file",
|
||||
@ -649,7 +649,7 @@ static void get_group (struct group *gr)
|
||||
|
||||
if (gr_close () == 0) {
|
||||
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"closing /etc/group",
|
||||
@ -701,7 +701,7 @@ static void get_group (struct group *gr)
|
||||
if (sgr_close () == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"closing /etc/gshadow",
|
||||
|
@ -253,12 +253,12 @@ static void close_files (void)
|
||||
{
|
||||
if (gr_close () == 0) {
|
||||
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking group file",
|
||||
@ -272,12 +272,12 @@ static void close_files (void)
|
||||
if (sgr_close () == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
if (sgr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking gshadow file",
|
||||
@ -356,7 +356,7 @@ static void fail_exit (int code)
|
||||
if (gr_locked) {
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking group file",
|
||||
@ -369,7 +369,7 @@ static void fail_exit (int code)
|
||||
if (sgr_locked) {
|
||||
if (sgr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking gshadow file",
|
||||
|
@ -97,7 +97,7 @@ static void fail_exit (int code)
|
||||
if (gr_locked) {
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking group file",
|
||||
@ -110,7 +110,7 @@ static void fail_exit (int code)
|
||||
if (sgr_locked) {
|
||||
if (sgr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking gshadow file",
|
||||
@ -176,12 +176,12 @@ static void close_files (void)
|
||||
|
||||
if (gr_close () == 0) {
|
||||
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking group file",
|
||||
@ -195,12 +195,12 @@ static void close_files (void)
|
||||
if (sgr_close () == 0)) {
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
if (sgr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking gshadow file",
|
||||
|
@ -126,7 +126,7 @@ static void fail_exit (int status)
|
||||
if (gr_locked) {
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking group file",
|
||||
@ -139,7 +139,7 @@ static void fail_exit (int status)
|
||||
if (sgr_locked) {
|
||||
if (sgr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking gshadow file",
|
||||
@ -152,7 +152,7 @@ static void fail_exit (int status)
|
||||
if (pw_locked) {
|
||||
if (pw_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", pw_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking passwd file",
|
||||
@ -322,7 +322,7 @@ static void grp_update (void)
|
||||
#endif
|
||||
if (nflg) {
|
||||
SYSLOG ((LOG_INFO, "change group '%s' to '%s'",
|
||||
group_name, group_newname));
|
||||
group_name, group_newname));
|
||||
}
|
||||
|
||||
if (gflg) {
|
||||
@ -507,7 +507,7 @@ static void close_files (void)
|
||||
{
|
||||
if (gr_close () == 0) {
|
||||
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"rewrite group file",
|
||||
@ -517,7 +517,7 @@ static void close_files (void)
|
||||
}
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking group file",
|
||||
@ -531,7 +531,7 @@ static void close_files (void)
|
||||
if (sgr_close () == 0)) {
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"rewrite gshadow file",
|
||||
@ -541,7 +541,7 @@ static void close_files (void)
|
||||
}
|
||||
if (sgr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking gshadow file",
|
||||
@ -556,7 +556,7 @@ static void close_files (void)
|
||||
if (pw_close () == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"), Prog, pw_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", pw_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"rewrite passwd file",
|
||||
@ -566,7 +566,7 @@ static void close_files (void)
|
||||
}
|
||||
if (pw_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", pw_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking passwd file",
|
||||
|
@ -92,6 +92,8 @@ int main (int argc, char **argv)
|
||||
(void) bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
(void) textdomain (PACKAGE);
|
||||
|
||||
OPENLOG ("grpconv");
|
||||
|
||||
if (gr_lock () == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: cannot lock %s; try again later.\n"),
|
||||
@ -188,12 +190,14 @@ int main (int argc, char **argv)
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
|
||||
fail_exit (3);
|
||||
}
|
||||
if (gr_close () == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
|
||||
fail_exit (3);
|
||||
}
|
||||
if (sgr_unlock () == 0) {
|
||||
|
@ -92,6 +92,8 @@ int main (int argc, char **argv)
|
||||
(void) bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
(void) textdomain (PACKAGE);
|
||||
|
||||
OPENLOG ("grpunconv");
|
||||
|
||||
if (sgr_file_present () == 0) {
|
||||
exit (0); /* no /etc/gshadow, nothing to do */
|
||||
}
|
||||
@ -147,6 +149,7 @@ int main (int argc, char **argv)
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
|
||||
fail_exit (3);
|
||||
}
|
||||
|
||||
@ -154,6 +157,7 @@ int main (int argc, char **argv)
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
|
||||
fail_exit (3);
|
||||
}
|
||||
|
||||
@ -161,6 +165,7 @@ int main (int argc, char **argv)
|
||||
fprintf (stderr,
|
||||
_("%s: cannot delete %s\n"),
|
||||
Prog, SGROUP_FILE);
|
||||
SYSLOG ((LOG_ERR, "cannot delete %s", SGROUP_FILE));
|
||||
fail_exit (3);
|
||||
}
|
||||
|
||||
|
@ -539,7 +539,7 @@ static void update_noshadow (void)
|
||||
fprintf (stderr,
|
||||
_("%s: cannot open %s\n"),
|
||||
Prog, pw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "cannot open %s", pw_dbname ()));
|
||||
SYSLOG ((LOG_WARN, "cannot open %s", pw_dbname ()));
|
||||
fail_exit (E_MISSING);
|
||||
}
|
||||
pw = pw_locate (name);
|
||||
@ -556,7 +556,7 @@ 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_ERR, "error updating password entry"));
|
||||
SYSLOG ((LOG_WARN, "error updating password entry"));
|
||||
fail_exit (E_FAILURE);
|
||||
}
|
||||
if (pw_close () == 0) {
|
||||
@ -588,7 +588,7 @@ static void update_shadow (void)
|
||||
spw_locked = true;
|
||||
if (spw_open (O_RDWR) == 0) {
|
||||
fprintf (stderr, _("%s: cannot open %s\n"), Prog, spw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "cannot open %s", spw_dbname ()));
|
||||
SYSLOG ((LOG_WARN, "cannot open %s", spw_dbname ()));
|
||||
fail_exit (E_FAILURE);
|
||||
}
|
||||
sp = spw_locate (name);
|
||||
@ -635,7 +635,7 @@ static void update_shadow (void)
|
||||
|
||||
if (spw_update (nsp) == 0) {
|
||||
fputs (_("Error updating the password entry.\n"), stderr);
|
||||
SYSLOG ((LOG_ERR, "error updating password entry"));
|
||||
SYSLOG ((LOG_WARN, "error updating password entry"));
|
||||
fail_exit (E_FAILURE);
|
||||
}
|
||||
if (spw_close () == 0) {
|
||||
|
@ -253,13 +253,13 @@ static void close_files (bool changed)
|
||||
if (pw_close () == 0) {
|
||||
fprintf (stderr, _("%s: failure while writing changes to %s\n"),
|
||||
Prog, pwd_file);
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", pwd_file));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pwd_file));
|
||||
fail_exit (E_CANTUPDATE);
|
||||
}
|
||||
if (is_shadow && (spw_close () == 0)) {
|
||||
fprintf (stderr, _("%s: failure while writing changes to %s\n"),
|
||||
Prog, spw_file);
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", spw_file));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_file));
|
||||
fail_exit (E_CANTUPDATE);
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +125,8 @@ int main (int argc, char **argv)
|
||||
(void) bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
(void) textdomain (PACKAGE);
|
||||
|
||||
OPENLOG ("pwconv");
|
||||
|
||||
if (pw_lock () == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: cannot lock %s; try again later.\n"),
|
||||
|
@ -86,6 +86,8 @@ int main (int argc, char **argv)
|
||||
(void) bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
(void) textdomain (PACKAGE);
|
||||
|
||||
OPENLOG ("pwunconv");
|
||||
|
||||
if (!spw_file_present ()) {
|
||||
/* shadow not installed, do nothing */
|
||||
exit (0);
|
||||
@ -157,6 +159,7 @@ int main (int argc, char **argv)
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, spw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ()));
|
||||
fail_exit (3);
|
||||
}
|
||||
|
||||
@ -164,12 +167,14 @@ int main (int argc, char **argv)
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, pw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
|
||||
fail_exit (3);
|
||||
}
|
||||
|
||||
if (unlink (SHADOW) != 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: cannot delete %s\n"), Prog, SHADOW);
|
||||
SYSLOG ((LOG_ERR, "cannot delete %s", SHADOW));
|
||||
fail_exit (3);
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ static void fail_exit (int code)
|
||||
if (spw_locked) {
|
||||
if (spw_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", spw_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking shadow file",
|
||||
@ -213,7 +213,7 @@ static void fail_exit (int code)
|
||||
if (pw_locked) {
|
||||
if (pw_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", pw_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking passwd file",
|
||||
@ -225,7 +225,7 @@ static void fail_exit (int code)
|
||||
if (gr_locked) {
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking group file",
|
||||
@ -238,7 +238,7 @@ static void fail_exit (int code)
|
||||
if (sgr_locked) {
|
||||
if (sgr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking gshadow file",
|
||||
@ -1241,20 +1241,20 @@ static void close_files (void)
|
||||
{
|
||||
if (pw_close () == 0) {
|
||||
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", pw_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
|
||||
fail_exit (E_PW_UPDATE);
|
||||
}
|
||||
if (is_shadow_pwd && (spw_close () == 0)) {
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"), Prog, spw_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", spw_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ()));
|
||||
fail_exit (E_PW_UPDATE);
|
||||
}
|
||||
if (do_grp_update) {
|
||||
if (gr_close () == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
#ifdef SHADOWGRP
|
||||
@ -1262,7 +1262,7 @@ static void close_files (void)
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failure while writing changes to %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
#endif
|
||||
@ -1270,7 +1270,7 @@ static void close_files (void)
|
||||
if (is_shadow_pwd) {
|
||||
if (spw_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", spw_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking shadow file",
|
||||
@ -1282,7 +1282,7 @@ static void close_files (void)
|
||||
}
|
||||
if (pw_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", pw_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking passwd file",
|
||||
@ -1293,7 +1293,7 @@ static void close_files (void)
|
||||
pw_locked = false;
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking group file",
|
||||
@ -1306,7 +1306,7 @@ static void close_files (void)
|
||||
if (is_shadow_grp) {
|
||||
if (sgr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||
"unlocking gshadow file",
|
||||
|
@ -636,7 +636,7 @@ static void update_group (void)
|
||||
fprintf (stderr,
|
||||
_("%s: error adding new entry '%s' in %s\n"),
|
||||
Prog, ngrp->gr_name, gr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "error adding new entry '%s' in %s", ngrp->gr_name, gr_dbname ()));
|
||||
SYSLOG ((LOG_WARN, "error adding new entry '%s' in %s", ngrp->gr_name, gr_dbname ()));
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
}
|
||||
@ -755,7 +755,7 @@ static void update_gshadow (void)
|
||||
fprintf (stderr,
|
||||
_("%s: error adding new entry '%s' in '%s\n"),
|
||||
Prog, nsgrp->sg_name, sgr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "error adding new entry '%s' in %s",
|
||||
SYSLOG ((LOG_WARN, "error adding new entry '%s' in %s",
|
||||
nsgrp->sg_name, sgr_dbname ()));
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
|
@ -144,6 +144,7 @@ static void vipwexit (const char *msg, int syserr, int ret)
|
||||
if (filelocked) {
|
||||
if ((*unlock) () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), progname, fileeditname);
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", fileeditname));
|
||||
/* continue */
|
||||
}
|
||||
}
|
||||
@ -276,8 +277,10 @@ vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
|
||||
|
||||
if ((*file_unlock) () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), progname, fileeditname);
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", fileeditname));
|
||||
/* continue */
|
||||
}
|
||||
SYSLOG ((LOG_INFO, "file %s edited", fileeditname));
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
@ -293,6 +296,8 @@ int main (int argc, char **argv)
|
||||
progname = ((a = strrchr (*argv, '/')) ? a + 1 : *argv);
|
||||
do_vipw = (strcmp (progname, "vigr") != 0);
|
||||
|
||||
OPENLOG (do_vipw ? "vipw" : "vigr");
|
||||
|
||||
{
|
||||
/*
|
||||
* Parse the command line options.
|
||||
|
Loading…
Reference in New Issue
Block a user