summaryrefslogtreecommitdiff
path: root/src/useradd.c
diff options
context:
space:
mode:
authorBalint Reczey <balint@balintreczey.hu>2022-11-10 16:24:06 +0100
committerBalint Reczey <balint@balintreczey.hu>2022-11-10 16:24:06 +0100
commit3987cc788047570ecf10707dfc8958780d85c73c (patch)
tree109724175f07436696f51b14b5abbd3f4d704d6d /src/useradd.c
parent8ead740677d19e48690d4f144ab090b83d47059f (diff)
downloadshadow-3987cc788047570ecf10707dfc8958780d85c73c.tar.gz
New upstream version 4.13+dfsg1upstream/4.13+dfsg1upstream
Diffstat (limited to 'src/useradd.c')
-rw-r--r--src/useradd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/useradd.c b/src/useradd.c
index 6eaeb533..7ea0a9c4 100644
--- a/src/useradd.c
+++ b/src/useradd.c
@@ -1996,8 +1996,9 @@ static void faillog_reset (uid_t uid)
struct faillog fl;
int fd;
off_t offset_uid = (off_t) (sizeof fl) * uid;
+ struct stat st;
- if (access (FAILLOG_FILE, F_OK) != 0) {
+ if (stat (FAILLOG_FILE, &st) != 0 || st.st_size <= offset_uid) {
return;
}
@@ -2033,8 +2034,9 @@ static void lastlog_reset (uid_t uid)
int fd;
off_t offset_uid = (off_t) (sizeof ll) * uid;
uid_t max_uid;
+ struct stat st;
- if (access (LASTLOG_FILE, F_OK) != 0) {
+ if (stat (LASTLOG_FILE, &st) != 0 || st.st_size <= offset_uid) {
return;
}
@@ -2370,7 +2372,7 @@ static void create_mail (void)
if (NULL == spool) {
return;
}
- file = alloca (strlen (prefix) + strlen (spool) + strlen (user_name) + 2);
+ file = alloca (strlen (prefix) + strlen (spool) + strlen (user_name) + 3);
if (prefix[0])
sprintf (file, "%s/%s/%s", prefix, spool, user_name);
else