mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 09:49:18 -04:00
Add support for capsicum
This commit is contained in:
parent
a41997696e
commit
d9df368cea
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=442808
3 changed files with 34 additions and 7 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
PORTNAME= moo
|
PORTNAME= moo
|
||||||
PORTVERSION= 1.5
|
PORTVERSION= 1.5
|
||||||
|
PORTREVISION= 1
|
||||||
CATEGORIES= math
|
CATEGORIES= math
|
||||||
|
|
||||||
MAINTAINER= skreuzer@FreeBSD.org
|
MAINTAINER= skreuzer@FreeBSD.org
|
||||||
|
@ -16,6 +17,10 @@ GH_TAGNAME= ${PORTVERSION}
|
||||||
|
|
||||||
PLIST_FILES= bin/moo man/man1/moo.1.gz
|
PLIST_FILES= bin/moo man/man1/moo.1.gz
|
||||||
|
|
||||||
|
.if exists(/usr/include/sys/capsicum.h)
|
||||||
|
CFLAGS+= -DHAVE_CAPSICUM
|
||||||
|
.endif
|
||||||
|
|
||||||
MAKE_JOBS_UNSAFE= yes
|
MAKE_JOBS_UNSAFE= yes
|
||||||
|
|
||||||
do-install:
|
do-install:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
--- Makefile.orig 2017-06-01 18:24:01 UTC
|
--- Makefile.orig 2016-06-04 10:05:27 UTC
|
||||||
+++ Makefile
|
+++ Makefile
|
||||||
@@ -1,14 +1,14 @@
|
@@ -1,14 +1,14 @@
|
||||||
PROG= moo
|
PROG= moo
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
--- moo.y.orig 2016-06-04 10:05:27 UTC
|
--- moo.y.orig 2016-06-04 10:05:27 UTC
|
||||||
+++ moo.y
|
+++ moo.y
|
||||||
@@ -34,7 +34,7 @@ static int used_oct;
|
@@ -4,6 +4,11 @@
|
||||||
|
* Public domain.
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#ifdef HAVE_CAPSICUM
|
||||||
|
+#include <sys/capsicum.h>
|
||||||
|
+#include <capsicum_helpers.h>
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <err.h>
|
||||||
|
#include <errno.h>
|
||||||
|
@@ -34,7 +39,7 @@ static int used_oct;
|
||||||
|
|
||||||
static void divbyzero(void);
|
static void divbyzero(void);
|
||||||
static void printnum(int64_t);
|
static void printnum(int64_t);
|
||||||
|
@ -9,17 +21,27 @@
|
||||||
void yyerror(char *);
|
void yyerror(char *);
|
||||||
int yylex(void);
|
int yylex(void);
|
||||||
int yyparse(void);
|
int yyparse(void);
|
||||||
@@ -317,9 +317,6 @@ main(int argc, char *argv[])
|
@@ -315,10 +320,16 @@ getnum(const char *nptr)
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int ch;
|
- int ch;
|
||||||
|
+#ifdef HAVE_CAPSICUM
|
||||||
|
+ if (caph_limit_stdio() < 0)
|
||||||
|
+ err(1, "unable to limit capabilities for stdio");
|
||||||
|
|
||||||
- if (pledge("stdio tmppath", NULL) == -1)
|
- if (pledge("stdio tmppath", NULL) == -1)
|
||||||
- err(1, "pledge");
|
- err(1, "pledge");
|
||||||
-
|
+ caph_cache_catpages();
|
||||||
|
+ if (cap_enter() < 0 && errno != ENOSYS)
|
||||||
|
+ err(1, "unable to enter capability mode");
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ int ch;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "0123456789b:lsuw:")) != -1)
|
while ((ch = getopt(argc, argv, "0123456789b:lsuw:")) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
/*
|
@@ -403,9 +414,6 @@ DONEPARSING:
|
||||||
@@ -403,9 +400,6 @@ DONEPARSING:
|
|
||||||
yyin = sfp;
|
yyin = sfp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue