From: Iker Pedrosa Date: Thu, 13 Jul 2023 13:24:37 +0000 (+0200) Subject: useradd: conditionally build lastlog functionality X-Git-Tag: 4.14.0-rc1~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d60595d8f2a3a54c239ee27cc1ea4643d4a27c1d;p=thirdparty%2Fshadow.git useradd: conditionally build lastlog functionality Resolves: https://github.com/shadow-maint/shadow/issues/674 Signed-off-by: Iker Pedrosa --- diff --git a/src/useradd.c b/src/useradd.c index ebfb477cd..d6766426b 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -17,7 +17,9 @@ #include #include #include +#ifdef ENABLE_LASTLOG #include +#endif /* ENABLE_LASTLOG */ #include #include #include @@ -224,7 +226,9 @@ static void open_files (void); static void open_group_files (void); static void open_shadow (void); static void faillog_reset (uid_t); +#ifdef ENABLE_LASTLOG static void lastlog_reset (uid_t); +#endif /* ENABLE_LASTLOG */ static void tallylog_reset (const char *); static void usr_update (unsigned long subuid_count, unsigned long subgid_count); static void create_home (void); @@ -956,8 +960,10 @@ static void usage (int status) (void) fputs (_(" -h, --help display this help message and exit\n"), usageout); (void) fputs (_(" -k, --skel SKEL_DIR use this alternative skeleton directory\n"), usageout); (void) fputs (_(" -K, --key KEY=VALUE override /etc/login.defs defaults\n"), usageout); +#ifdef ENABLE_LASTLOG (void) fputs (_(" -l, --no-log-init do not add the user to the lastlog and\n" " faillog databases\n"), usageout); +#endif /* ENABLE_LASTLOG */ (void) fputs (_(" -m, --create-home create the user's home directory\n"), usageout); (void) fputs (_(" -M, --no-create-home do not create the user's home directory\n"), usageout); (void) fputs (_(" -N, --no-user-group do not create a group with the same name as\n" @@ -2076,6 +2082,7 @@ static void faillog_reset (uid_t uid) } } +#ifdef ENABLE_LASTLOG static void lastlog_reset (uid_t uid) { struct lastlog ll; @@ -2121,6 +2128,7 @@ static void lastlog_reset (uid_t uid) /* continue */ } } +#endif /* ENABLE_LASTLOG */ static void tallylog_reset (const char *user_name) { @@ -2210,7 +2218,9 @@ static void usr_update (unsigned long subuid_count, unsigned long subgid_count) /* local, no need for xgetpwuid */ if ((!lflg) && (prefix_getpwuid (user_id) == NULL)) { faillog_reset (user_id); +#ifdef ENABLE_LASTLOG lastlog_reset (user_id); +#endif /* ENABLE_LASTLOG */ } /*