Blame shadow-4.11.1-useradd-stop-last-fail-log-reset.patch
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
From ebf9b232b012725d2be5e750876c7336cf1c37fd Mon Sep 17 00:00:00 2001
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
From: David Kalnischkies <david@kalnischkies.de>
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
Date: Wed, 24 Aug 2022 13:21:01 +0200
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
Subject: [PATCH] useradd: Do not reset non-existent data in {last,fail}log
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
useradd does not create the files if they don't exist, but if they exist
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
it will reset user data even if the data did not exist before creating
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
a hole and an explicitly zero'd data point resulting (especially for
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
high UIDs) in a lot of zeros ending up in containers and tarballs.
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
---
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
src/useradd.c | 6 ++++--
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
diff --git a/src/useradd.c b/src/useradd.c
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
index 6eaeb533..39a744ee 100644
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
--- a/src/useradd.c
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
+++ b/src/useradd.c
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
@@ -1996,8 +1996,9 @@ static void faillog_reset (uid_t uid)
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
struct faillog fl;
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
int fd;
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
off_t offset_uid = (off_t) (sizeof fl) * uid;
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
+ struct stat st;
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
- if (access (FAILLOG_FILE, F_OK) != 0) {
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
+ if (stat (FAILLOG_FILE, &st) != 0 || st.st_size <= offset_uid) {
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
return;
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
}
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
@@ -2033,8 +2034,9 @@ static void lastlog_reset (uid_t uid)
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
int fd;
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
off_t offset_uid = (off_t) (sizeof ll) * uid;
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
uid_t max_uid;
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
+ struct stat st;
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
- if (access (LASTLOG_FILE, F_OK) != 0) {
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
+ if (stat (LASTLOG_FILE, &st) != 0 || st.st_size <= offset_uid) {
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
return;
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
}
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
--
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
2.37.3
|
|
![](https://seccdn.libravatar.org/avatar/42a20a29562aab1c9733bfa4a0a158ef12a5cd869d4af2f5ee6c2aaa43e97519?s=16&d=retro) |
137bde0 |
|