doas: Use setusercontext(3) Calling setusercontext(3) makes per-user temporary storage work (see per_user_tmp in security(7) and rc.conf(5)). May as well use our reallocarray(3) instead of the bundled compat code.diff -r1.10 -r1.11 pkgsrc/security/doas/Makefile
(kim)
@@ -1,17 +1,17 @@ | @@ -1,17 +1,17 @@ | |||
1 | # $NetBSD: Makefile,v 1.10 2020/10/21 15:25:23 kim Exp $ | 1 | # $NetBSD: Makefile,v 1.11 2020/10/21 17:34:09 kim Exp $ | |
2 | 2 | |||
3 | DISTNAME= doas-6.2p4 | 3 | DISTNAME= doas-6.2p4 | |
4 | PKGREVISION= 2 | 4 | PKGREVISION= 3 | |
5 | CATEGORIES= security | 5 | CATEGORIES= security | |
6 | MASTER_SITES= ${MASTER_SITE_GITHUB:=slicer69/} | 6 | MASTER_SITES= ${MASTER_SITE_GITHUB:=slicer69/} | |
7 | 7 | |||
8 | MAINTAINER= nikita@NetBSD.org | 8 | MAINTAINER= nikita@NetBSD.org | |
9 | HOMEPAGE= https://github.com/slicer69/doas/ | 9 | HOMEPAGE= https://github.com/slicer69/doas/ | |
10 | COMMENT= Execute commands as another user | 10 | COMMENT= Execute commands as another user | |
11 | LICENSE= 2-clause-bsd AND isc AND modified-bsd | 11 | LICENSE= 2-clause-bsd AND isc AND modified-bsd | |
12 | 12 | |||
13 | USE_TOOLS+= gmake yacc | 13 | USE_TOOLS+= gmake yacc | |
14 | 14 | |||
15 | # XXX: Upstream supports only NetBSD, FreeBSD, Linux, | 15 | # XXX: Upstream supports only NetBSD, FreeBSD, Linux, | |
16 | # illumos, SmartOS, OpenIndiana. | 16 | # illumos, SmartOS, OpenIndiana. | |
17 | # Add any failing platforms as BROKEN_ON_PLATFORM. | 17 | # Add any failing platforms as BROKEN_ON_PLATFORM. |
@@ -1,6 +1,8 @@ | @@ -1,6 +1,8 @@ | |||
1 | $NetBSD: distinfo,v 1.5 2020/01/01 01:30:19 ng0 Exp $ | 1 | $NetBSD: distinfo,v 1.6 2020/10/21 17:34:09 kim Exp $ | |
2 | 2 | |||
3 | SHA1 (doas-6.2p4.tar.gz) = dd90972c3a120ae2b96432bae2c7a78c4c729166 | 3 | SHA1 (doas-6.2p4.tar.gz) = dd90972c3a120ae2b96432bae2c7a78c4c729166 | |
4 | RMD160 (doas-6.2p4.tar.gz) = a8ed8677fbffd48bf87b4fa5c6b0dd98f0c5e428 | 4 | RMD160 (doas-6.2p4.tar.gz) = a8ed8677fbffd48bf87b4fa5c6b0dd98f0c5e428 | |
5 | SHA512 (doas-6.2p4.tar.gz) = 951686a58300ab6ffcdd7b98502df832b35c43787234c52c71c42eaca9e4dbeb1c2e33e7535a9b8babdb2f38840f6cff1045f6a90fa609029590e7c1384b8a75 | 5 | SHA512 (doas-6.2p4.tar.gz) = 951686a58300ab6ffcdd7b98502df832b35c43787234c52c71c42eaca9e4dbeb1c2e33e7535a9b8babdb2f38840f6cff1045f6a90fa609029590e7c1384b8a75 | |
6 | Size (doas-6.2p4.tar.gz) = 26098 bytes | 6 | Size (doas-6.2p4.tar.gz) = 26098 bytes | |
7 | SHA1 (patch-Makefile) = 710303b7c858f0d94f0f8bdd873a87e2600f72d0 | |||
8 | SHA1 (patch-compat_compat.h) = b49d6a64f5ee6308446184891b8ece32c919b95a |
$NetBSD: patch-Makefile,v 1.1 2020/10/21 17:34:09 kim Exp $
Enable HAVE_LOGIN_CAP_H and reallocarray() on NetBSD.
--- Makefile
+++ Makefile
@@ -24,6 +24,11 @@ ifeq ($(UNAME_S),FreeBSD)
CFLAGS+=-DHAVE_LOGIN_CAP_H
LDFLAGS+=-lutil
endif
+ifeq ($(UNAME_S),NetBSD)
+ CFLAGS+=-DHAVE_LOGIN_CAP_H -D_OPENBSD_SOURCE
+ OBJECTS=doas.o env.o y.tab.o
+ LDFLAGS+=-lutil
+endif
ifeq ($(UNAME_S),SunOS)
SAFE_PATH?=/bin:/sbin:/usr/bin:/usr/sbin:$(PREFIX)/bin:$(PREFIX)/sbin
GLOBAL_PATH?=/bin:/sbin:/usr/bin:/usr/sbin:$(PREFIX)/bin:$(PREFIX)/sbin
$NetBSD: patch-compat_compat.h,v 1.1 2020/10/21 17:34:09 kim Exp $
Do not provide a prototype for reallocarray(3) on NetBSD.
--- compat/compat.h
+++ compat/compat.h
@@ -13,7 +13,9 @@ extern const char *__progname;
const char *getprogname(void);
+#if !defined(__NetBSD__)
void *reallocarray(void *optr, size_t nmemb, size_t size);
+#endif
void setprogname(const char *progname);