[Pkg-shadow-commits] r3142 - in upstream/trunk: . lib src
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Thu Mar 18 09:21:30 UTC 2010
Author: nekral-guest
Date: 2010-03-18 09:21:27 +0000 (Thu, 18 Mar 2010)
New Revision: 3142
Modified:
upstream/trunk/ChangeLog
upstream/trunk/lib/shadowio.c
upstream/trunk/src/chage.c
upstream/trunk/src/pwck.c
upstream/trunk/src/useradd.c
upstream/trunk/src/userdel.c
upstream/trunk/src/usermod.c
upstream/trunk/src/vipw.c
Log:
* src/userdel.c, src/usermod.c, src/vipw.c, src/useradd.c,
src/pwck.c, src/chage.c, lib/shadowio.c: Explicitly use the
SHADOWTCB_FAILURE return code instead of 0 or implicit conversion
to booleans.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2010-03-18 09:01:04 UTC (rev 3141)
+++ upstream/trunk/ChangeLog 2010-03-18 09:21:27 UTC (rev 3142)
@@ -1,3 +1,10 @@
+2010-03-17 Nicolas François <nicolas.francois at centraliens.net>
+
+ * src/userdel.c, src/usermod.c, src/vipw.c, src/useradd.c,
+ src/pwck.c, src/chage.c, lib/shadowio.c: Explicitly use the
+ SHADOWTCB_FAILURE return code instead of 0 or implicit conversion
+ to booleans.
+
2010-03-18 Paweł Hajdan, Jr. <phajdan.jr at gentoo.org>
* src/pwck.c: Add support for TCB.
Modified: upstream/trunk/lib/shadowio.c
===================================================================
--- upstream/trunk/lib/shadowio.c 2010-03-18 09:01:04 UTC (rev 3141)
+++ upstream/trunk/lib/shadowio.c 2010-03-18 09:21:27 UTC (rev 3142)
@@ -132,14 +132,14 @@
return commonio_lock (&shadow_db);
#ifdef WITH_TCB
}
- if (shadowtcb_drop_priv () == 0) {
+ if (shadowtcb_drop_priv () == SHADOWTCB_FAILURE) {
return 0;
}
if (lckpwdf_tcb (shadow_db.filename) == 0) {
shadow_db.locked = 1;
retval = 1;
}
- if (shadowtcb_gain_priv () == 0) {
+ if (shadowtcb_gain_priv () == SHADOWTCB_FAILURE) {
return 0;
}
return retval;
@@ -152,13 +152,13 @@
#ifdef WITH_TCB
bool use_tcb = getdef_bool ("USE_TCB");
- if (use_tcb && (shadowtcb_drop_priv () == 0)) {
+ if (use_tcb && (shadowtcb_drop_priv () == SHADOWTCB_FAILURE)) {
return 0;
}
#endif /* WITH_TCB */
retval = commonio_open (&shadow_db, mode);
#ifdef WITH_TCB
- if (use_tcb && (shadowtcb_gain_priv () == 0)) {
+ if (use_tcb && (shadowtcb_gain_priv () == SHADOWTCB_FAILURE)) {
return 0;
}
#endif /* WITH_TCB */
@@ -196,13 +196,13 @@
#ifdef WITH_TCB
bool use_tcb = getdef_bool ("USE_TCB");
- if (use_tcb && (shadowtcb_drop_priv () == 0)) {
+ if (use_tcb && (shadowtcb_drop_priv () == SHADOWTCB_FAILURE)) {
return 0;
}
#endif /* WITH_TCB */
retval = commonio_close (&shadow_db);
#ifdef WITH_TCB
- if (use_tcb && (shadowtcb_gain_priv () == 0)) {
+ if (use_tcb && (shadowtcb_gain_priv () == SHADOWTCB_FAILURE)) {
return 0;
}
#endif /* WITH_TCB */
@@ -219,14 +219,14 @@
return commonio_unlock (&shadow_db);
#ifdef WITH_TCB
}
- if (shadowtcb_drop_priv () == 0) {
+ if (shadowtcb_drop_priv () == SHADOWTCB_FAILURE) {
return 0;
}
if (ulckpwdf_tcb () == 0) {
shadow_db.locked = 0;
retval = 1;
}
- if (shadowtcb_gain_priv () == 0) {
+ if (shadowtcb_gain_priv () == SHADOWTCB_FAILURE) {
return 0;
}
return retval;
Modified: upstream/trunk/src/chage.c
===================================================================
--- upstream/trunk/src/chage.c 2010-03-18 09:01:04 UTC (rev 3141)
+++ upstream/trunk/src/chage.c 2010-03-18 09:21:27 UTC (rev 3142)
@@ -857,13 +857,14 @@
STRFCPY (user_name, pw->pw_name);
#ifdef WITH_TCB
- if (!shadowtcb_set_user(pw->pw_name))
- fail_exit(E_NOPERM);
+ if (shadowtcb_set_user (pw->pw_name) == SHADOWTCB_FAILURE) {
+ fail_exit (E_NOPERM);
+ }
#endif
user_uid = pw->pw_uid;
sp = spw_locate (argv[optind]);
- get_defaults(sp);
+ get_defaults (sp);
/*
* Print out the expiration fields if the user has requested the
Modified: upstream/trunk/src/pwck.c
===================================================================
--- upstream/trunk/src/pwck.c 2010-03-18 09:01:04 UTC (rev 3141)
+++ upstream/trunk/src/pwck.c 2010-03-18 09:21:27 UTC (rev 3142)
@@ -469,12 +469,12 @@
if (is_shadow) {
#ifdef WITH_TCB
if (getdef_bool("USE_TCB")) {
- if (!shadowtcb_set_user (pwd->pw_name)) {
+ if (shadowtcb_set_user (pwd->pw_name) == SHADOWTCB_FAILURE) {
printf(_("no tcb directory for %s\n"), pwd->pw_name);
printf(_("create tcb directory for %s?"), pwd->pw_name);
*errors += 1;
if (yes_or_no (read_only)) {
- if (!shadowtcb_create(pwd->pw_name, pwd->pw_uid)) {
+ if (shadowtcb_create(pwd->pw_name, pwd->pw_uid) == SHADOWTCB_FAILURE) {
*errors += 1;
printf(_("failed to create tcb directory for %s\n"), pwd->pw_name);
continue;
Modified: upstream/trunk/src/useradd.c
===================================================================
--- upstream/trunk/src/useradd.c 2010-03-18 09:01:04 UTC (rev 3141)
+++ upstream/trunk/src/useradd.c 2010-03-18 09:21:27 UTC (rev 3142)
@@ -2003,7 +2003,7 @@
#ifdef WITH_TCB
if (getdef_bool ("USE_TCB")) {
- if (shadowtcb_create (user_name, user_id) == 0) {
+ if (shadowtcb_create (user_name, user_id) == SHADOWTCB_FAILURE) {
fprintf (stderr,
_("%s: Failed to create tcb directory for %s\n"),
Prog, user_name);
Modified: upstream/trunk/src/userdel.c
===================================================================
--- upstream/trunk/src/userdel.c 2010-03-18 09:01:04 UTC (rev 3141)
+++ upstream/trunk/src/userdel.c 2010-03-18 09:21:27 UTC (rev 3142)
@@ -757,7 +757,7 @@
return 1;
}
snprintf (buf, buflen, TCB_DIR "/%s", user_name);
- if (shadowtcb_drop_priv () == 0) {
+ if (shadowtcb_drop_priv () == SHADOWTCB_FAILURE) {
fprintf (stderr, _("%s: Cannot drop privileges: %s\n"),
Prog, strerror (errno));
shadowtcb_gain_priv ();
@@ -776,7 +776,7 @@
}
shadowtcb_gain_priv ();
free (buf);
- if (shadowtcb_remove (user_name) == 0) {
+ if (shadowtcb_remove (user_name) == SHADOWTCB_FAILURE) {
fprintf (stderr, _("%s: Cannot remove tcb files for %s: %s\n"),
Prog, user_name, strerror (errno));
ret = 1;
@@ -906,7 +906,7 @@
user_home = xstrdup (pwd->pw_dir);
}
#ifdef WITH_TCB
- if (shadowtcb_set_user (user_name) == 0) {
+ if (shadowtcb_set_user (user_name) == SHADOWTCB_FAILURE) {
exit (E_NOTFOUND);
}
#endif /* WITH_TCB */
Modified: upstream/trunk/src/usermod.c
===================================================================
--- upstream/trunk/src/usermod.c 2010-03-18 09:01:04 UTC (rev 3141)
+++ upstream/trunk/src/usermod.c 2010-03-18 09:21:27 UTC (rev 3142)
@@ -1774,8 +1774,9 @@
#endif /* ACCT_TOOLS_SETUID */
#ifdef WITH_TCB
- if (!shadowtcb_set_user (user_name))
+ if (shadowtcb_set_user (user_name) == SHADOWTCB_FAILURE) {
exit (E_PW_UPDATE);
+ }
#endif
/*
@@ -1794,7 +1795,7 @@
#ifdef WITH_TCB
if ( (lflg || uflg)
- && (!shadowtcb_move (user_newname, user_newid)) ) {
+ && (shadowtcb_move (user_newname, user_newid) == SHADOWTCB_FAILURE) ) {
exit (E_PW_UPDATE);
}
#endif
Modified: upstream/trunk/src/vipw.c
===================================================================
--- upstream/trunk/src/vipw.c 2010-03-18 09:01:04 UTC (rev 3141)
+++ upstream/trunk/src/vipw.c 2010-03-18 09:21:27 UTC (rev 3142)
@@ -209,7 +209,7 @@
&& (errno != EEXIST)) {
vipwexit (_("failed to create scratch directory"), errno, 1);
}
- if (shadowtcb_drop_priv () == 0) {
+ if (shadowtcb_drop_priv () == SHADOWTCB_FAILURE) {
vipwexit (_("failed to drop privileges"), errno, 1);
}
snprintf (fileedit, sizeof fileedit,
@@ -245,7 +245,7 @@
}
#endif /* WITH_SELINUX */
#ifdef WITH_TCB
- if (tcb_mode && (shadowtcb_gain_priv () == 0)) {
+ if (tcb_mode && (shadowtcb_gain_priv () == SHADOWTCB_FAILURE)) {
vipwexit (_("failed to gain privileges"), errno, 1);
}
#endif /* WITH_TCB */
@@ -254,7 +254,7 @@
}
filelocked = true;
#ifdef WITH_TCB
- if (tcb_mode && (shadowtcb_drop_priv () == 0)) {
+ if (tcb_mode && (shadowtcb_drop_priv () == SHADOWTCB_FAILURE)) {
vipwexit (_("failed to drop privileges"), errno, 1);
}
#endif /* WITH_TCB */
@@ -268,7 +268,7 @@
vipwexit (file, 1, 1);
}
#ifdef WITH_TCB
- if (tcb_mode && (shadowtcb_gain_priv () == 0))
+ if (tcb_mode && (shadowtcb_gain_priv () == SHADOWTCB_FAILURE))
vipwexit (_("failed to gain privileges"), errno, 1);
#endif /* WITH_TCB */
if (create_backup_file (f, fileedit, &st1) != 0) {
@@ -354,7 +354,7 @@
if (unlink (fileedit) != 0) {
vipwexit (_("failed to unlink scratch file"), errno, 1);
}
- if (shadowtcb_drop_priv () == 0) {
+ if (shadowtcb_drop_priv () == SHADOWTCB_FAILURE) {
vipwexit (_("failed to drop privileges"), errno, 1);
}
if (stat (file, &st1) != 0) {
@@ -392,8 +392,9 @@
#ifdef WITH_TCB
if (tcb_mode) {
free (to_rename);
- if (shadowtcb_gain_priv () == 0)
+ if (shadowtcb_gain_priv () == SHADOWTCB_FAILURE) {
vipwexit (_("failed to gain privileges"), errno, 1);
+ }
}
#endif /* WITH_TCB */
@@ -474,7 +475,7 @@
if (editshadow) {
#ifdef WITH_TCB
if (getdef_bool ("USE_TCB") && (NULL != user)) {
- if (shadowtcb_set_user (user) == 0) {
+ if (shadowtcb_set_user (user) == SHADOWTCB_FAILURE) {
fprintf (stderr,
_("%s: failed to find tcb directory for %s\n"),
progname, user);
More information about the Pkg-shadow-commits
mailing list