From d5c03d66c052d1a089f2612e7e3e36fe645536ba Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Mon, 15 Dec 2025 10:22:17 +0100 Subject: [PATCH] newusers: Allow creation without aging information If PASS_MAX_DAYS is not set, newusers falls back to 10000 days, which is considered "unlimited" in some parts of the source tree. All other tools fall back to -1, which truely implies unlimited. Sync newusers with all other shadow tools. How to reproduce: 1. Remove or comment out PASS_MAX_DAYS from /etc/login.defs 2. Run `newusers <<< user:pass:1234:1234::/home/user:/bin/bash` 3. Check user line in /etc/shadow ``` /etc/shadow:user:HASH:19721:0:10000:7::: ``` Max days are set to 10000. Instead, this should be: ``` /etc/shadow:user:HASH:19721:0::7::: ``` Reviewed-by: Alejandro Colomar Signed-off-by: Tobias Stoeckmann --- src/newusers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/newusers.c b/src/newusers.c index 2e69f2c99..ab16a219c 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -616,8 +616,7 @@ add_passwd(struct passwd *pwd, MAYBE_UNUSED const char *password) spent.sp_lstchg = -1; } spent.sp_min = getdef_num ("PASS_MIN_DAYS", 0); - /* 10000 is infinity this week */ - spent.sp_max = getdef_num ("PASS_MAX_DAYS", 10000); + spent.sp_max = getdef_num ("PASS_MAX_DAYS", -1); spent.sp_warn = getdef_num ("PASS_WARN_AGE", -1); spent.sp_inact = -1; spent.sp_expire = -1; -- 2.47.3