Do not call the TIOCSETVERAUTH ioctl with a negative number of seconds.
Also cap the max number of seconds at 3600 to avoid getting EINVAL from TIOCSETVERAUTH.
This commit is contained in:
@@ -868,7 +868,12 @@ timestamp_update(void *vcookie, struct passwd *pw)
|
|||||||
int fd = open(_PATH_TTY, O_RDWR);
|
int fd = open(_PATH_TTY, O_RDWR);
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
int secs = def_timestamp_timeout.tv_sec;
|
int secs = def_timestamp_timeout.tv_sec;
|
||||||
ioctl(fd, TIOCSETVERAUTH, &secs);
|
if (secs > 0) {
|
||||||
|
if (secs > 3600)
|
||||||
|
secs = 3600; /* OpenBSD limitation */
|
||||||
|
if (ioctl(fd, TIOCSETVERAUTH, &secs) != 0)
|
||||||
|
sudo_warn("TIOCSETVERAUTH");
|
||||||
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user