login.defs: Add LASTLOG_UID_MAX variable to limit lastlog to small uids.
As the large uids are usually provided by remote user identity and authentication service, which also provide user login tracking, there is no need to create a huge sparse file for them on every local machine. fixup! login.defs: Add LASTLOG_UID_MAX variable to limit lastlog to small uids.
This commit is contained in:
@ -1863,11 +1863,18 @@ static void lastlog_reset (uid_t uid)
|
||||
struct lastlog ll;
|
||||
int fd;
|
||||
off_t offset_uid = (off_t) (sizeof ll) * uid;
|
||||
uid_t max_uid;
|
||||
|
||||
if (access (LASTLOG_FILE, F_OK) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
max_uid = (uid_t) getdef_ulong ("LASTLOG_UID_MAX", 0xFFFFFFFFUL);
|
||||
if (uid > max_uid) {
|
||||
/* do not touch lastlog for large uids */
|
||||
return;
|
||||
}
|
||||
|
||||
memzero (&ll, sizeof (ll));
|
||||
|
||||
fd = open (LASTLOG_FILE, O_RDWR);
|
||||
|
Reference in New Issue
Block a user