Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109024198
D8001.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D8001.diff
View Options
Index: head/usr.bin/last/last.c
===================================================================
--- head/usr.bin/last/last.c
+++ head/usr.bin/last/last.c
@@ -40,8 +40,11 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/capsicum.h>
+#include <sys/queue.h>
#include <sys/stat.h>
+#include <capsicum_helpers.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
@@ -56,7 +59,6 @@
#include <timeconv.h>
#include <unistd.h>
#include <utmpx.h>
-#include <sys/queue.h>
#define NO 0 /* false/no */
#define YES 1 /* true/yes */
@@ -176,6 +178,19 @@
usage();
}
+ if (caph_limit_stdio() < 0)
+ err(1, "can't limit stdio rights");
+
+ caph_cache_catpages();
+ caph_cache_tzdata();
+
+ /* Cache UTX database. */
+ if (setutxdb(UTXDB_LOG, file) != 0)
+ err(1, "%s", file != NULL ? file : "(default utx db)");
+
+ if (cap_enter() < 0 && errno != ENOSYS)
+ err(1, "cap_enter");
+
if (sflag && width == 8) usage();
if (argc) {
@@ -213,8 +228,6 @@
(void)time(&t);
/* Load the last entries from the file. */
- if (setutxdb(UTXDB_LOG, file) != 0)
- err(1, "%s", file);
while ((ut = getutxent()) != NULL) {
if (amount % 128 == 0) {
buf = realloc(buf, (amount + 128) * sizeof *ut);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 31, 6:58 PM (18 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16368820
Default Alt Text
D8001.diff (1 KB)
Attached To
Mode
D8001: Capsicumify last(1)
Attached
Detach File
Event Timeline
Log In to Comment