|
|
05ad79 |
diff -up util-linux-2.23.2/login-utils/login.c.kzak util-linux-2.23.2/login-utils/login.c
|
|
|
05ad79 |
--- util-linux-2.23.2/login-utils/login.c.kzak 2015-06-24 11:03:45.123285155 +0200
|
|
|
05ad79 |
+++ util-linux-2.23.2/login-utils/login.c 2015-06-24 11:46:19.168114438 +0200
|
|
|
05ad79 |
@@ -495,6 +495,7 @@ static void log_audit(struct login_conte
|
|
|
05ad79 |
|
|
|
05ad79 |
static void log_lastlog(struct login_context *cxt)
|
|
|
05ad79 |
{
|
|
|
05ad79 |
+ struct sigaction sa, oldsa_xfsz;
|
|
|
05ad79 |
struct lastlog ll;
|
|
|
05ad79 |
time_t t;
|
|
|
05ad79 |
int fd;
|
|
|
05ad79 |
@@ -502,9 +503,14 @@ static void log_lastlog(struct login_con
|
|
|
05ad79 |
if (!cxt->pwd)
|
|
|
05ad79 |
return;
|
|
|
05ad79 |
|
|
|
05ad79 |
+ /* lastlog is huge on systems with large UIDs, ignore SIGXFSZ */
|
|
|
05ad79 |
+ memset(&sa, 0, sizeof(sa));
|
|
|
05ad79 |
+ sa.sa_handler = SIG_IGN;
|
|
|
05ad79 |
+ sigaction(SIGXFSZ, &sa, &oldsa_xfsz);
|
|
|
05ad79 |
+
|
|
|
05ad79 |
fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0);
|
|
|
05ad79 |
if (fd < 0)
|
|
|
05ad79 |
- return;
|
|
|
05ad79 |
+ goto done;
|
|
|
05ad79 |
|
|
|
05ad79 |
if (lseek(fd, (off_t) cxt->pwd->pw_uid * sizeof(ll), SEEK_SET) == -1)
|
|
|
05ad79 |
goto done;
|
|
|
05ad79 |
@@ -542,7 +548,10 @@ static void log_lastlog(struct login_con
|
|
|
05ad79 |
if (write_all(fd, (char *)&ll, sizeof(ll)))
|
|
|
05ad79 |
warn(_("write lastlog failed"));
|
|
|
05ad79 |
done:
|
|
|
05ad79 |
- close(fd);
|
|
|
05ad79 |
+ if (fd >= 0)
|
|
|
05ad79 |
+ close(fd);
|
|
|
05ad79 |
+
|
|
|
05ad79 |
+ sigaction(SIGXFSZ, &oldsa_xfsz, NULL); /* restore original setting */
|
|
|
05ad79 |
}
|
|
|
05ad79 |
|
|
|
05ad79 |
/*
|