doas: Use setusercontext(3) on NetBSD

Calling setusercontext(3) makes per-user temporary storage work (see
per_user_tmp in security(7) and rc.conf(5)).

May as well also use reallocarray(3) from libc instead of the bundled
compat code.
This commit is contained in:
Kimmo Suominen 2020-10-21 20:37:51 +03:00
parent 6f6d40fa69
commit ca5d5ec8bb
2 changed files with 7 additions and 0 deletions

View file

@ -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

View file

@ -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);