Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140092301
D1345.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
D1345.diff
View Options
Index: head/usr.bin/jot/jot.c
===================================================================
--- head/usr.bin/jot/jot.c
+++ head/usr.bin/jot/jot.c
@@ -47,8 +47,11 @@
* Author: John Kunze, Office of Comp. Affairs, UCB
*/
+#include <sys/capsicum.h>
+#include <capsicum_helpers.h>
#include <ctype.h>
#include <err.h>
+#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdint.h>
@@ -89,6 +92,7 @@
int
main(int argc, char **argv)
{
+ cap_rights_t rights;
bool have_format = false;
bool infinity = false;
bool nofinalnl = false;
@@ -105,6 +109,21 @@
long i;
long reps = REPS_DEF;
+ if (caph_limit_stdio() < 0)
+ err(1, "unable to limit rights for stdio");
+ cap_rights_init(&rights);
+ if (cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS)
+ err(1, "unable to limit rights for stdin");
+
+ /*
+ * Cache NLS data, for strerror, for err(3), before entering capability
+ * mode.
+ */
+ caph_cache_catpages();
+
+ if (cap_enter() < 0 && errno != ENOSYS)
+ err(1, "unable to enter capability mode");
+
while ((ch = getopt(argc, argv, "b:cnp:rs:w:")) != -1)
switch (ch) {
case 'b':
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 21, 3:16 AM (16 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27106117
Default Alt Text
D1345.diff (1 KB)
Attached To
Mode
D1345: Capsicum support for jot(1)
Attached
Detach File
Event Timeline
Log In to Comment