* src/chfn.c, src/chgpasswd.c, src/chpasswd.c, src/gpasswd.c,

src/groupadd.c, src/groupdel.c, src/groupmems.c, src/groupmod.c,
	src/grpconv.c, src/grpunconv.c, src/newusers.c, src/pwconv.c,
	src/pwunconv.c, src/useradd.c, src/userdel.c: Harmonize the name
	of the variables keeping the lock status, to match the shadow
	library prefixes.
This commit is contained in:
nekral-guest 2008-08-22 02:22:34 +00:00
parent 82ed690817
commit 82779cd336
16 changed files with 151 additions and 146 deletions

View File

@ -1,3 +1,12 @@
2008-08-17 Nicolas François <nicolas.francois@centraliens.net>
* src/chfn.c, src/chgpasswd.c, src/chpasswd.c, src/gpasswd.c,
src/groupadd.c, src/groupdel.c, src/groupmems.c, src/groupmod.c,
src/grpconv.c, src/grpunconv.c, src/newusers.c, src/pwconv.c,
src/pwunconv.c, src/useradd.c, src/userdel.c: Harmonize the name
of the variables keeping the lock status, to match the shadow
library prefixes.
2008-08-17 Nicolas François <nicolas.francois@centraliens.net>
* src/chage.c, src/chgpasswd.c, src/chpasswd.c, src/chsh.c,

View File

@ -72,7 +72,7 @@ static bool oflg = false; /* -o - set other information */
#ifdef USE_PAM
static pam_handle_t *pamh = NULL;
#endif
static bool passwd_locked = false;
static bool pw_locked = false;
/*
* External identifiers
@ -94,14 +94,14 @@ static void get_old_fields (const char *gecos);
*/
static void fail_exit (int code)
{
if (passwd_locked) {
if (pw_locked) {
if (pw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
/* continue */
}
}
passwd_locked = false;
pw_locked = false;
closelog ();
@ -442,7 +442,7 @@ static void update_gecos (const char *user, char *gecos)
Prog, pw_dbname ());
fail_exit (E_NOPERM);
}
passwd_locked = true;
pw_locked = true;
if (pw_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"), Prog, pw_dbname ());
@ -487,7 +487,7 @@ static void update_gecos (const char *user, char *gecos)
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
fail_exit (E_NOPERM);
}
passwd_locked = false; /* If we fail to unlock, do not retry */
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 ()));

View File

@ -64,9 +64,9 @@ static long sha_rounds = 5000;
#ifdef SHADOWGRP
static bool is_shadow_grp;
static bool gshadow_locked = false;
static bool sgr_locked = false;
#endif
static bool group_locked = false;
static bool gr_locked = false;
#ifdef USE_PAM
static pam_handle_t *pamh = NULL;
@ -86,7 +86,7 @@ static void close_files (void);
*/
static void fail_exit (int code)
{
if (group_locked) {
if (gr_locked) {
if (gr_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
@ -95,7 +95,7 @@ static void fail_exit (int code)
}
#ifdef SHADOWGRP
if (gshadow_locked) {
if (sgr_locked) {
if (sgr_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
@ -294,7 +294,7 @@ static void open_files (void)
Prog, gr_dbname ());
fail_exit (1);
}
group_locked = true;
gr_locked = true;
if (gr_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"), Prog, gr_dbname ());
@ -310,7 +310,7 @@ static void open_files (void)
Prog, sgr_dbname ());
fail_exit (1);
}
gshadow_locked = true;
sgr_locked = true;
if (sgr_open (O_RDWR) == 0) {
fprintf (stderr, _("%s: cannot open %s\n"),
Prog, sgr_dbname ());
@ -339,7 +339,7 @@ static void close_files (void)
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
/* continue */
}
gshadow_locked = false;
sgr_locked = false;
}
#endif
@ -355,7 +355,7 @@ static void close_files (void)
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
/* continue */
}
group_locked = false;
gr_locked = false;
}
int main (int argc, char **argv)

View File

@ -61,8 +61,8 @@ static const char *crypt_method = NULL;
static long sha_rounds = 5000;
static bool is_shadow_pwd;
static bool passwd_locked = false;
static bool shadow_locked = false;
static bool pw_locked = false;
static bool spw_locked = false;
#ifdef USE_PAM
static pam_handle_t *pamh = NULL;
@ -82,7 +82,7 @@ static void close_files (void);
*/
static void fail_exit (int code)
{
if (passwd_locked) {
if (pw_locked) {
if (pw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
@ -90,7 +90,7 @@ static void fail_exit (int code)
}
}
if (shadow_locked) {
if (spw_locked) {
if (spw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
@ -288,7 +288,7 @@ static void open_files (void)
Prog, pw_dbname ());
fail_exit (1);
}
passwd_locked = true;
pw_locked = true;
if (pw_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"), Prog, pw_dbname ());
@ -303,7 +303,7 @@ static void open_files (void)
Prog, spw_dbname ());
fail_exit (1);
}
shadow_locked = true;
spw_locked = true;
if (spw_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"),
@ -331,7 +331,7 @@ static void close_files (void)
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
}
shadow_locked = false;
spw_locked = false;
}
if (pw_close () == 0) {
@ -346,7 +346,7 @@ static void close_files (void)
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
/* continue */
}
passwd_locked = false;
pw_locked = false;
}
int main (int argc, char **argv)

View File

@ -59,9 +59,9 @@ static char *Prog;
/* Indicate if shadow groups are enabled on the system
* (/etc/gshadow present) */
static bool is_shadowgrp;
static bool gshadow_locked = false;
static bool sgr_locked = false;
#endif
static bool group_locked = false;
static bool gr_locked = false;
/* Flags set by options */
static bool aflg = false;
@ -160,7 +160,7 @@ static RETSIGTYPE catch_signals (int killed)
*/
static void fail_exit (int status)
{
if (group_locked) {
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 ()));
@ -172,7 +172,7 @@ static void fail_exit (int status)
}
}
#ifdef SHADOWGRP
if (gshadow_locked) {
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 ()));
@ -378,7 +378,7 @@ static void open_files (void)
#endif
fail_exit (1);
}
group_locked = true;
gr_locked = true;
#ifdef SHADOWGRP
if (is_shadowgrp) {
if (sgr_lock () == 0) {
@ -392,7 +392,7 @@ static void open_files (void)
#endif
fail_exit (1);
}
gshadow_locked = true;
sgr_locked = true;
}
#endif
if (gr_open (O_RDWR) == 0) {
@ -460,7 +460,7 @@ static void close_files (void)
#endif
/* continue */
}
gshadow_locked = false;
sgr_locked = false;
}
#endif
if (gr_unlock () == 0) {
@ -473,7 +473,7 @@ static void close_files (void)
#endif
/* continue */
}
group_locked = false;
gr_locked = false;
}
/*

View File

@ -83,9 +83,9 @@ static bool pflg = false; /* new encrypted password */
#ifdef SHADOWGRP
static bool is_shadow_grp;
static bool gshadow_locked = false;
static bool sgr_locked = false;
#endif
static bool group_locked = false;
static bool gr_locked = false;
#ifdef USE_PAM
@ -266,7 +266,7 @@ static void close_files (void)
#endif
/* continue */
}
group_locked = false;
gr_locked = false;
#ifdef SHADOWGRP
if (is_shadow_grp) {
if (sgr_close () == 0) {
@ -285,7 +285,7 @@ static void close_files (void)
#endif
/* continue */
}
gshadow_locked = false;
sgr_locked = false;
}
#endif /* SHADOWGRP */
}
@ -308,7 +308,7 @@ static void open_files (void)
#endif
fail_exit (E_GRP_UPDATE);
}
group_locked = true;
gr_locked = true;
if (gr_open (O_RDWR) == 0) {
fprintf (stderr, _("%s: cannot open %s\n"), Prog, gr_dbname ());
SYSLOG ((LOG_WARN, "cannot open %s", gr_dbname ()));
@ -332,7 +332,7 @@ static void open_files (void)
#endif
fail_exit (E_GRP_UPDATE);
}
gshadow_locked = true;
sgr_locked = true;
if (sgr_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"), Prog, sgr_dbname ());
@ -353,7 +353,7 @@ static void open_files (void)
*/
static void fail_exit (int code)
{
if (group_locked) {
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 ()));
@ -366,7 +366,7 @@ static void fail_exit (int code)
}
}
#ifdef SHADOWGRP
if (gshadow_locked) {
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 ()));

View File

@ -59,9 +59,9 @@ static gid_t group_id = -1;
#ifdef SHADOWGRP
static bool is_shadow_grp;
static bool gshadow_locked = false;
static bool sgr_locked = false;
#endif
static bool group_locked = false;
static bool gr_locked = false;
/*
* exit status values
@ -94,7 +94,7 @@ static void usage (void)
*/
static void fail_exit (int code)
{
if (group_locked) {
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 ()));
@ -107,7 +107,7 @@ static void fail_exit (int code)
}
}
#ifdef SHADOWGRP
if (gshadow_locked) {
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 ()));
@ -189,7 +189,7 @@ static void close_files (void)
#endif
/* continue */
}
group_locked = false;
gr_locked = false;
#ifdef SHADOWGRP
if (is_shadow_grp) {
if (sgr_close () == 0)) {
@ -208,7 +208,7 @@ static void close_files (void)
#endif
/* continue */
}
gshadow_locked = false;
sgr_locked = false;
}
#endif /* SHADOWGRP */
}
@ -226,7 +226,7 @@ static void open_files (void)
Prog, gr_dbname ());
fail_exit (E_GRP_UPDATE);
}
group_locked = true;
gr_locked = true;
if (gr_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"), Prog, gr_dbname ());
@ -241,7 +241,7 @@ static void open_files (void)
Prog, sgr_dbname ());
fail_exit (E_GRP_UPDATE);
}
gshadow_locked = true;
sgr_locked = true;
if (sgr_open (O_RDWR) == 0)) {
fprintf (stderr,
_("%s: cannot open %s\n"),

View File

@ -68,7 +68,7 @@ static bool purge = false;
static bool list = false;
static int exclusive = 0;
static char *Prog;
static bool group_locked = false;
static bool gr_locked = false;
static char *whoami (void);
static void display_members (char **members);
@ -205,7 +205,7 @@ static void check_perms (void)
static void fail_exit (int code)
{
if (group_locked) {
if (gr_locked) {
if (gr_unlock () == 0) {
fprintf (stderr,
_("%s: failed to unlock %s\n"),
@ -258,7 +258,7 @@ int main (int argc, char **argv)
Prog, gr_dbname ());
fail_exit (EXIT_GROUP_FILE);
}
group_locked = true;
gr_locked = true;
}
if (gr_open (list ? O_RDONLY : O_RDWR) == 0) {

View File

@ -68,10 +68,10 @@
*/
#ifdef SHADOWGRP
static bool is_shadow_grp;
static bool gshadow_locked = false;
static bool sgr_locked = false;
#endif /* SHADOWGRP */
static bool group_locked = false;
static bool passwd_locked = false;
static bool gr_locked = false;
static bool pw_locked = false;
static char *group_name;
static char *group_newname;
static char *group_passwd;
@ -123,7 +123,7 @@ static void usage (void)
static void fail_exit (int status)
{
if (group_locked) {
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 ()));
@ -136,7 +136,7 @@ static void fail_exit (int status)
}
}
#ifdef SHADOWGRP
if (gshadow_locked) {
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 ()));
@ -149,7 +149,7 @@ static void fail_exit (int status)
}
}
#endif /* SHADOWGRP */
if (passwd_locked) {
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 ()));
@ -525,7 +525,7 @@ static void close_files (void)
#endif
/* continue */
}
group_locked = false;
gr_locked = false;
#ifdef SHADOWGRP
if (is_shadow_grp) {
if (sgr_close () == 0)) {
@ -549,7 +549,7 @@ static void close_files (void)
#endif
/* continue */
}
gshadow_locked = false;
sgr_locked = false;
}
#endif /* SHADOWGRP */
if (gflg) {
@ -574,7 +574,7 @@ static void close_files (void)
#endif
/* continue */
}
passwd_locked = false;
pw_locked = false;
}
}
@ -591,7 +591,7 @@ static void open_files (void)
Prog, gr_dbname ());
fail_exit (E_GRP_UPDATE);
}
group_locked = true;
gr_locked = true;
if (gr_open (O_RDWR) == 0) {
fprintf (stderr, _("%s: cannot open %s\n"), Prog, gr_dbname ());
SYSLOG ((LOG_WARN, "cannot open %s", gr_dbname ()));
@ -605,7 +605,7 @@ static void open_files (void)
Prog, sgr_dbname ());
fail_exit (E_GRP_UPDATE);
}
gshadow_locked = true;
sgr_locked = true;
if (sgr_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"),
@ -622,7 +622,7 @@ static void open_files (void)
Prog, pw_dbname ());
fail_exit (E_GRP_UPDATE);
}
passwd_locked = true;
pw_locked = true;
if (pw_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"),

View File

@ -53,18 +53,18 @@
/*
* Global variables
*/
static bool group_locked = false;
static bool gshadow_locked = false;
static bool gr_locked = false;
static bool sgr_locked = false;
/* local function prototypes */
static void fail_exit (int);
static void fail_exit (int status)
{
if (group_locked) {
if (gr_locked) {
gr_unlock ();
}
if (gshadow_locked) {
if (sgr_locked) {
sgr_unlock ();
}
exit (status);
@ -88,7 +88,7 @@ int main (int argc, char **argv)
Prog, gr_dbname ());
fail_exit (5);
}
group_locked = true;
gr_locked = true;
if (gr_open (O_RDWR) == 0) {
fprintf (stderr, _("%s: cannot open %s\n"), Prog, gr_dbname ());
fail_exit (1);
@ -100,7 +100,7 @@ int main (int argc, char **argv)
Prog, sgr_dbname ());
fail_exit (5);
}
gshadow_locked = true;
sgr_locked = true;
if (sgr_open (O_CREAT | O_RDWR) == 0) {
fprintf (stderr, _("%s: cannot open %s\n"), Prog, sgr_dbname ());
fail_exit (1);

View File

@ -54,15 +54,15 @@
/*
* Global variables
*/
static bool group_locked = false;
static bool gshadow_locked = false;
static bool gr_locked = false;
static bool sgr_locked = false;
/* local function prototypes */
static void fail_exit (int status);
static void fail_exit (int status)
{
if (group_locked) {
if (gr_locked) {
if (gr_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
@ -70,7 +70,7 @@ static void fail_exit (int status)
}
}
if (gshadow_locked) {
if (sgr_locked) {
if (sgr_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
@ -102,7 +102,7 @@ int main (int argc, char **argv)
Prog, gr_dbname ());
fail_exit (5);
}
group_locked = true;
gr_locked = true;
if (gr_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"), Prog, gr_dbname ());
@ -115,7 +115,7 @@ int main (int argc, char **argv)
Prog, sgr_dbname ());
fail_exit (5);
}
gshadow_locked = true;
sgr_locked = true;
if (sgr_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"), Prog, sgr_dbname ());
@ -164,20 +164,16 @@ int main (int argc, char **argv)
fail_exit (3);
}
if (group_locked) {
if (gr_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
/* continue */
}
if (gr_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
/* continue */
}
if (gshadow_locked) {
if (sgr_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
/* continue */
}
if (sgr_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
/* continue */
}
nscd_flush_cache ("group");

View File

@ -76,11 +76,11 @@ static long sha_rounds = 5000;
static bool is_shadow;
#ifdef SHADOWGRP
static bool is_shadow_grp;
static bool gshadow_locked = false;
static bool sgr_locked = false;
#endif
static bool passwd_locked = false;
static bool group_locked = false;
static bool shadow_locked = false;
static bool pw_locked = false;
static bool gr_locked = false;
static bool spw_locked = false;
#ifdef USE_PAM
static pam_handle_t *pamh = NULL;
@ -128,21 +128,21 @@ static void usage (void)
*/
static void fail_exit (int code)
{
if (shadow_locked) {
if (spw_locked) {
if (spw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
}
}
if (passwd_locked) {
if (pw_locked) {
if (pw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
/* continue */
}
}
if (group_locked) {
if (gr_locked) {
if (gr_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
@ -150,7 +150,7 @@ static void fail_exit (int code)
}
}
#ifdef SHADOWGRP
if (gshadow_locked) {
if (sgr_locked) {
if (sgr_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
@ -613,21 +613,21 @@ static void open_files (void)
Prog, pw_dbname ());
fail_exit (1);
}
passwd_locked = true;
pw_locked = true;
if (is_shadow && (spw_lock () == 0)) {
fprintf (stderr,
_("%s: cannot lock %s; try again later.\n"),
Prog, spw_dbname ());
fail_exit (1);
}
shadow_locked = true;
spw_locked = true;
if (gr_lock () == 0) {
fprintf (stderr,
_("%s: cannot lock %s; try again later.\n"),
Prog, gr_dbname ());
fail_exit (1);
}
group_locked = true;
gr_locked = true;
#ifdef SHADOWGRP
if (is_shadow_grp && (sgr_lock () == 0)) {
fprintf (stderr,
@ -635,7 +635,7 @@ static void open_files (void)
Prog, sgr_dbname ());
fail_exit (1);
}
gshadow_locked = true;
sgr_locked = true;
#endif
if (pw_open (O_RDWR) == 0) {
@ -673,7 +673,7 @@ static void close_files (void)
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
/* continue */
}
passwd_locked = false;
pw_locked = false;
if (is_shadow) {
if (spw_close () == 0) {
@ -690,7 +690,7 @@ static void close_files (void)
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
}
shadow_locked = false;
spw_locked = false;
}
if (gr_close () == 0) {
@ -707,7 +707,7 @@ static void close_files (void)
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
/* continue */
}
group_locked = false;
gr_locked = false;
#ifdef SHADOWGRP
if (is_shadow_grp) {
@ -725,7 +725,7 @@ static void close_files (void)
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
/* continue */
}
gshadow_locked = false;
sgr_locked = false;
}
#endif
}

View File

@ -84,15 +84,15 @@
* Global variables
*/
static char *Prog;
static bool shadow_locked = false;
static bool passwd_locked = false;
static bool spw_locked = false;
static bool pw_locked = false;
/* local function prototypes */
static void fail_exit (int status);
static void fail_exit (int status)
{
if (passwd_locked) {
if (pw_locked) {
if (pw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
@ -100,7 +100,7 @@ static void fail_exit (int status)
}
}
if (shadow_locked) {
if (spw_locked) {
if (spw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
@ -131,7 +131,7 @@ int main (int argc, char **argv)
Prog, pw_dbname ());
fail_exit (E_PWDBUSY);
}
passwd_locked = true;
pw_locked = true;
if (pw_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"), Prog, pw_dbname ());
@ -144,7 +144,7 @@ int main (int argc, char **argv)
Prog, spw_dbname ());
fail_exit (E_PWDBUSY);
}
shadow_locked = true;
spw_locked = true;
if (spw_open (O_CREAT | O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"), Prog, spw_dbname ());
@ -242,7 +242,7 @@ int main (int argc, char **argv)
/* continue */
}
if (passwd_locked) {
if (pw_locked) {
if (pw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
@ -250,7 +250,7 @@ int main (int argc, char **argv)
}
}
if (shadow_locked) {
if (spw_locked) {
if (spw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));

View File

@ -48,22 +48,22 @@
* Global variables
*/
static char *Prog;
static bool shadow_locked = false;
static bool passwd_locked = false;
static bool spw_locked = false;
static bool pw_locked = false;
/* local function prototypes */
static void fail_exit (int status);
static void fail_exit (int status)
{
if (shadow_locked) {
if (spw_locked) {
if (spw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
}
}
if (passwd_locked) {
if (pw_locked) {
if (pw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
@ -97,7 +97,7 @@ int main (int argc, char **argv)
Prog, pw_dbname ());
fail_exit (5);
}
passwd_locked = true;
pw_locked = true;
if (pw_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"),
@ -111,7 +111,7 @@ int main (int argc, char **argv)
Prog, spw_dbname ());
fail_exit (5);
}
shadow_locked = true;
spw_locked = true;
if (spw_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"),

View File

@ -110,11 +110,11 @@ static bool is_shadow_pwd;
#ifdef SHADOWGRP
static bool is_shadow_grp;
static bool gshadow_locked = false;
static bool sgr_locked = false;
#endif
static bool passwd_locked = false;
static bool group_locked = false;
static bool shadow_locked = false;
static bool pw_locked = false;
static bool gr_locked = false;
static bool spw_locked = false;
static char **user_groups; /* NULL-terminated list */
static long sys_ngroups;
static bool do_grp_update = false; /* group files need to be updated */
@ -198,7 +198,7 @@ static void fail_exit (int code)
rmdir (user_home);
}
if (shadow_locked) {
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 ()));
@ -210,7 +210,7 @@ static void fail_exit (int code)
/* continue */
}
}
if (passwd_locked) {
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 ()));
@ -222,7 +222,7 @@ static void fail_exit (int code)
/* continue */
}
}
if (group_locked) {
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 ()));
@ -235,7 +235,7 @@ static void fail_exit (int code)
}
}
#ifdef SHADOWGRP
if (gshadow_locked) {
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 ()));
@ -1278,7 +1278,7 @@ static void close_files (void)
#endif
/* continue */
}
shadow_locked = false;
spw_locked = false;
}
if (pw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
@ -1290,7 +1290,7 @@ static void close_files (void)
#endif
/* continue */
}
passwd_locked = false;
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 ()));
@ -1301,7 +1301,7 @@ static void close_files (void)
#endif
/* continue */
}
group_locked = false;
gr_locked = false;
#ifdef SHADOWGRP
if (is_shadow_grp) {
if (sgr_unlock () == 0) {
@ -1314,7 +1314,7 @@ static void close_files (void)
#endif
/* continue */
}
gshadow_locked = false;
sgr_locked = false;
}
#endif
}
@ -1332,7 +1332,7 @@ static void open_files (void)
Prog, pw_dbname ());
exit (E_PW_UPDATE);
}
passwd_locked = true;
pw_locked = true;
if (pw_open (O_RDWR) == 0) {
fprintf (stderr, _("%s: cannot open %s\n"), Prog, pw_dbname ());
fail_exit (E_PW_UPDATE);
@ -1344,7 +1344,7 @@ static void open_files (void)
Prog, spw_dbname ());
fail_exit (E_PW_UPDATE);
}
shadow_locked = true;
spw_locked = true;
if (spw_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"),
@ -1362,7 +1362,7 @@ static void open_files (void)
Prog, gr_dbname ());
fail_exit (E_GRP_UPDATE);
}
group_locked = true;
gr_locked = true;
if (gr_open (O_RDWR) == 0) {
fprintf (stderr, _("%s: cannot open %s\n"), Prog, gr_dbname ());
fail_exit (E_GRP_UPDATE);
@ -1375,7 +1375,7 @@ static void open_files (void)
Prog, sgr_dbname ());
fail_exit (E_GRP_UPDATE);
}
gshadow_locked = true;
sgr_locked = true;
if (sgr_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"),

View File

@ -80,11 +80,11 @@ static bool is_shadow_pwd;
#ifdef SHADOWGRP
static bool is_shadow_grp;
static bool gshadow_locked = false;
static bool sgr_locked = false;
#endif
static bool passwd_locked = false;
static bool group_locked = false;
static bool shadow_locked = false;
static bool pw_locked = false;
static bool gr_locked = false;
static bool spw_locked = false;
/* local function prototypes */
static void usage (void);
@ -327,7 +327,7 @@ static void close_files (void)
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
/* continue */
}
passwd_locked = false;
pw_locked = false;
if (is_shadow_pwd) {
if (spw_close () == 0) {
@ -341,7 +341,7 @@ static void close_files (void)
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
}
shadow_locked = false;
spw_locked = false;
}
if (gr_close () == 0) {
@ -354,7 +354,7 @@ static void close_files (void)
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
/* continue */
}
group_locked = false;
gr_locked = false;
#ifdef SHADOWGRP
if (is_shadow_grp) {
@ -370,7 +370,7 @@ static void close_files (void)
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
/* continue */
}
gshadow_locked = false;
sgr_locked = false;
}
#endif
}
@ -380,21 +380,21 @@ static void close_files (void)
*/
static void fail_exit (int code)
{
if (passwd_locked) {
if (pw_locked) {
if (pw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
/* continue */
}
}
if (group_locked) {
if (gr_locked) {
if (gr_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
/* continue */
}
}
if (shadow_locked) {
if (spw_locked) {
if (spw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
@ -402,7 +402,7 @@ static void fail_exit (int code)
}
}
#ifdef SHADOWGRP
if (gshadow_locked) {
if (sgr_locked) {
if (sgr_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
@ -439,7 +439,7 @@ static void open_files (void)
#endif
fail_exit (E_PW_UPDATE);
}
passwd_locked = true;
pw_locked = true;
if (pw_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"), Prog, pw_dbname ());
@ -462,7 +462,7 @@ static void open_files (void)
#endif
fail_exit (E_PW_UPDATE);
}
shadow_locked = true;
spw_locked = true;
if (spw_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"),
@ -486,7 +486,7 @@ static void open_files (void)
#endif
fail_exit (E_GRP_UPDATE);
}
group_locked = true;
gr_locked = true;
if (gr_open (O_RDWR) == 0) {
fprintf (stderr, _("%s: cannot open %s\n"), Prog, gr_dbname ());
#ifdef WITH_AUDIT
@ -509,7 +509,7 @@ static void open_files (void)
#endif
fail_exit (E_GRP_UPDATE);
}
gshadow_locked= true;
sgr_locked= true;
if (sgr_open (O_RDWR) == 0) {
fprintf (stderr, _("%s: cannot open %s\n"),
Prog, sgr_dbname ());