[Pkg-shadow-commits] r3574 - in upstream/trunk: . src
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Sun Nov 13 16:24:40 UTC 2011
Author: nekral-guest
Date: 2011-11-13 16:24:39 +0000 (Sun, 13 Nov 2011)
New Revision: 3574
Modified:
upstream/trunk/ChangeLog
upstream/trunk/src/pwck.c
Log:
* src/pwck.c: Removed pw_opened.
* src/pwck.c: optind cannot be greater than argc.
* src/pwck.c: If spw_opened, then is_shadow is implicitly set.
* src/pwck.c: Do not report passwd entry without x password and a
shadow entry in --quiet mode (no interaction with the caller)
* src/pwck.c: Do not check if the last password change is in the
future if the time is set to 0.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2011-11-11 12:09:58 UTC (rev 3573)
+++ upstream/trunk/ChangeLog 2011-11-13 16:24:39 UTC (rev 3574)
@@ -1,5 +1,15 @@
2011-11-11 Nicolas François <nicolas.francois at centraliens.net>
+ * src/pwck.c: Removed pw_opened.
+ * src/pwck.c: optind cannot be greater than argc.
+ * src/pwck.c: If spw_opened, then is_shadow is implicitly set.
+ * src/pwck.c: Do not report passwd entry without x password and a
+ shadow entry in --quiet mode (no interaction with the caller)
+ * src/pwck.c: Do not check if the last password change is in the
+ future if the time is set to 0.
+
+2011-11-11 Nicolas François <nicolas.francois at centraliens.net>
+
* libmisc/root_flag.c: Drop privileges before changing root. The
--root option should not be used by regular users for suid utils.
* libmisc/root_flag.c: Improve error messages.
Modified: upstream/trunk/src/pwck.c
===================================================================
--- upstream/trunk/src/pwck.c 2011-11-11 12:09:58 UTC (rev 3573)
+++ upstream/trunk/src/pwck.c 2011-11-13 16:24:39 UTC (rev 3574)
@@ -75,7 +75,6 @@
static bool is_shadow = false;
-static bool pw_opened = false;
static bool spw_opened = false;
static bool pw_locked = false;
@@ -214,7 +213,7 @@
/*
* Make certain we have the right number of arguments
*/
- if ((argc < optind) || (argc > (optind + 2))) {
+ if (argc > (optind + 2)) {
usage (E_USAGE);
}
@@ -290,7 +289,6 @@
}
fail_exit (E_CANTOPEN);
}
- pw_opened = true;
if (is_shadow && !use_tcb) {
if (spw_open (read_only ? O_RDONLY : O_RDWR) == 0) {
fprintf (stderr, _("%s: cannot open %s\n"),
@@ -319,7 +317,7 @@
* changes to the files.
*/
if (changed) {
- if (pw_opened && pw_close () == 0) {
+ if (pw_close () == 0) {
fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, pw_dbname ());
@@ -330,8 +328,7 @@
}
fail_exit (E_CANTUPDATE);
}
- pw_opened = false;
- if (is_shadow && spw_opened && (spw_close () == 0)) {
+ if (spw_opened && (spw_close () == 0)) {
fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, spw_dbname ());
@@ -640,7 +637,9 @@
/* The passwd entry has a shadow counterpart.
* Make sure no passwords are in passwd.
*/
- if (strcmp (pwd->pw_passwd, SHADOW_PASSWD_STRING) != 0) {
+ if ( !quiet
+ && (strcmp (pwd->pw_passwd,
+ SHADOW_PASSWD_STRING) != 0)) {
printf (_("user %s has an entry in %s, but its password field in %s is not set to 'x'\n"),
pwd->pw_name, spw_dbname (), pw_dbname ());
*errors += 1;
@@ -813,11 +812,14 @@
/*
* Warn if last password change in the future. --marekm
*/
- if ( !quiet
- && (spw->sp_lstchg > (long) time ((time_t *) 0) / SCALE)) {
- printf (_("user %s: last password change in the future\n"),
- spw->sp_namp);
- *errors += 1;
+ if (!quiet) {
+ time_t t = time ((time_t *) 0);
+ if ( (t != 0)
+ && (spw->sp_lstchg > (long) t / SCALE)) {
+ printf (_("user %s: last password change in the future\n"),
+ spw->sp_namp);
+ *errors += 1;
+ }
}
}
}
More information about the Pkg-shadow-commits
mailing list