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:
@ -1864,11 +1864,18 @@ static void update_lastlog (void)
|
||||
int fd;
|
||||
off_t off_uid = (off_t) user_id * sizeof ll;
|
||||
off_t off_newuid = (off_t) user_newid * sizeof ll;
|
||||
uid_t max_uid;
|
||||
|
||||
if (access (LASTLOG_FILE, F_OK) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
max_uid = (uid_t) getdef_ulong ("LASTLOG_MAX_UID", 0xFFFFFFFFUL);
|
||||
if (user_newid > max_uid) {
|
||||
/* do not touch lastlog for large uids */
|
||||
return;
|
||||
}
|
||||
|
||||
fd = open (LASTLOG_FILE, O_RDWR);
|
||||
|
||||
if (-1 == fd) {
|
||||
|
Reference in New Issue
Block a user