From: nekral-guest Date: Fri, 22 Aug 2008 02:22:34 +0000 (+0000) Subject: * src/chfn.c, src/chgpasswd.c, src/chpasswd.c, src/gpasswd.c, X-Git-Tag: 4.1.3~264 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82779cd33677709b917f76d5249c9b3e37a6f566;p=thirdparty%2Fshadow.git * 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. --- diff --git a/ChangeLog b/ChangeLog index a80f612af..cc04f21c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-08-17 Nicolas François + + * 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 * src/chage.c, src/chgpasswd.c, src/chpasswd.c, src/chsh.c, diff --git a/src/chfn.c b/src/chfn.c index f211b3627..d757c9e6d 100644 --- a/src/chfn.c +++ b/src/chfn.c @@ -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 ())); diff --git a/src/chgpasswd.c b/src/chgpasswd.c index 4fb02b0b8..eec869d10 100644 --- a/src/chgpasswd.c +++ b/src/chgpasswd.c @@ -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) diff --git a/src/chpasswd.c b/src/chpasswd.c index 136bf6b68..5393683bf 100644 --- a/src/chpasswd.c +++ b/src/chpasswd.c @@ -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) diff --git a/src/gpasswd.c b/src/gpasswd.c index 2a087488d..ba11e7b1f 100644 --- a/src/gpasswd.c +++ b/src/gpasswd.c @@ -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; } /* diff --git a/src/groupadd.c b/src/groupadd.c index 25e940093..0cd799d12 100644 --- a/src/groupadd.c +++ b/src/groupadd.c @@ -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 ())); diff --git a/src/groupdel.c b/src/groupdel.c index 1d10aedd2..08effa28a 100644 --- a/src/groupdel.c +++ b/src/groupdel.c @@ -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"), diff --git a/src/groupmems.c b/src/groupmems.c index 5d26977a6..7e9582018 100644 --- a/src/groupmems.c +++ b/src/groupmems.c @@ -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) { diff --git a/src/groupmod.c b/src/groupmod.c index cc31a218c..3424053cf 100644 --- a/src/groupmod.c +++ b/src/groupmod.c @@ -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"), diff --git a/src/grpconv.c b/src/grpconv.c index beb31574c..4f77bbfcc 100644 --- a/src/grpconv.c +++ b/src/grpconv.c @@ -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); diff --git a/src/grpunconv.c b/src/grpunconv.c index cb88f9d46..ea9d46340 100644 --- a/src/grpunconv.c +++ b/src/grpunconv.c @@ -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"); diff --git a/src/newusers.c b/src/newusers.c index eacfdfd61..7e3202614 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -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 } diff --git a/src/pwconv.c b/src/pwconv.c index 81478bdbc..1e751ea6b 100644 --- a/src/pwconv.c +++ b/src/pwconv.c @@ -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 ())); diff --git a/src/pwunconv.c b/src/pwunconv.c index 562c151a9..a4896577b 100644 --- a/src/pwunconv.c +++ b/src/pwunconv.c @@ -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"), diff --git a/src/useradd.c b/src/useradd.c index 83ef0769f..da8ab5c5d 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -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"), diff --git a/src/userdel.c b/src/userdel.c index 1cb8ce5ed..dd085bb89 100644 --- a/src/userdel.c +++ b/src/userdel.c @@ -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 ());