pledge(2) urlview:

rpath: read config file
tty: the interface it's based on curses so it needs to do operations on tty
proc/exec: this is needed to actually launch the external program after
selecting the link

OK jca@ after his suggestions
This commit is contained in:
mestre 2016-03-21 17:41:52 +00:00
parent b607cfeb16
commit fb9a514f5c
2 changed files with 18 additions and 5 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.26 2015/10/09 12:48:22 jasper Exp $ # $OpenBSD: Makefile,v 1.27 2016/03/21 17:41:52 mestre Exp $
COMMENT= curses-based URL ripper COMMENT= curses-based URL ripper
DISTNAME= urlview-0.9 DISTNAME= urlview-0.9
REVISION= 6 REVISION= 7
CATEGORIES= textproc CATEGORIES= textproc
MASTER_SITES= ftp://ftp.fu-berlin.de/pub/unix/mail/mutt/contrib/ \ MASTER_SITES= ftp://ftp.fu-berlin.de/pub/unix/mail/mutt/contrib/ \
ftp://ftp.gbnet.net/pub/mutt-international/contrib/ ftp://ftp.gbnet.net/pub/mutt-international/contrib/
@ -23,6 +23,7 @@ RUN_DEPENDS= devel/xdg-utils
FLAVORS= slang FLAVORS= slang
FLAVOR?= FLAVOR?=
# uses pledge()
.if ${FLAVOR:Mslang} .if ${FLAVOR:Mslang}
WANTLIB+= slang curses m WANTLIB+= slang curses m
LIB_DEPENDS= devel/libslang LIB_DEPENDS= devel/libslang

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-urlview_c,v 1.3 2009/12/23 22:04:18 jasper Exp $ $OpenBSD: patch-urlview_c,v 1.4 2016/03/21 17:41:52 mestre Exp $
--- urlview.c.orig Tue Jul 4 12:14:30 2000 --- urlview.c.orig Tue Jul 4 11:14:30 2000
+++ urlview.c Sun Jan 29 15:41:28 2006 +++ urlview.c Mon Mar 21 12:38:33 2016
@@ -46,9 +46,11 @@ @@ -46,9 +46,11 @@
#include <rx/rxposix.h> #include <rx/rxposix.h>
#endif #endif
@ -14,3 +14,15 @@ $OpenBSD: patch-urlview_c,v 1.3 2009/12/23 22:04:18 jasper Exp $
#define OFFSET 2 #define OFFSET 2
#define PAGELEN (LINES - 1 - OFFSET) #define PAGELEN (LINES - 1 - OFFSET)
@@ -187,6 +189,11 @@ int main (int argc, char **argv)
pw = getpwuid (getuid ());
snprintf (buf, sizeof (buf), "%s/.urlview", pw->pw_dir);
+
+ if (pledge("stdio rpath tty proc exec", NULL) == -1) {
+ perror("pledge");
+ exit(1);
+ }
/*** Check for users rc-file ***/
if (stat (buf,&stat_buf) == -1)