If -e 0 or -f 0 are supplied but no shadow entry exists, these flags are
silently ignored. Internally, the supplied values (0) are compared with
static long values which are initially 0 as well. If they are identical,
usermod drops the flags.
This does not match usermod's manual page, which states that a missing
shadow entry is created. This is also true for any other valid command
line values, e.g. -e 1 or -f 1.
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
#define VALID(s) (!strpbrk(s, ":\n"))
+/* invalid shadow time indicating missing entry */
+#define MISSING_TIME -2
+
/*
* Structures
*/
static const char *user_selinux_range = NULL;
#endif /* WITH_SELINUX */
static char *user_newshell;
-static long user_expire;
-static long user_newexpire;
-static long user_inactive;
-static long user_newinactive;
+static long user_expire = MISSING_TIME;
+static long user_newexpire = MISSING_TIME;
+static long user_inactive = MISSING_TIME;
+static long user_newinactive = MISSING_TIME;
static long sys_ngroups;
static char **user_groups; /* NULL-terminated list */