From: Roy Marples Date: Fri, 5 Jun 2020 12:02:32 +0000 (+0100) Subject: OpenBSD: disable setting resource limits as we have pledge. X-Git-Tag: v9.1.2~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fb47c1e60e66d646036829a02b6be82abe8df7a;p=thirdparty%2Fdhcpcd.git OpenBSD: disable setting resource limits as we have pledge. --- diff --git a/src/if.c b/src/if.c index d0012771..69a5003c 100644 --- a/src/if.c +++ b/src/if.c @@ -107,7 +107,7 @@ if_opensockets(struct dhcpcd_ctx *ctx) if (if_opensockets_os(ctx) == -1) return -1; -#ifdef PF_LINK +#ifdef IFLR_ACTIVE ctx->pf_link_fd = xsocket(PF_LINK, SOCK_DGRAM | SOCK_CLOEXEC, 0); if (ctx->pf_link_fd == -1) return -1; diff --git a/src/privsep.c b/src/privsep.c index ed01d2a8..749f00c6 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -113,7 +113,9 @@ int ps_dropprivs(struct dhcpcd_ctx *ctx) { struct passwd *pw = ctx->ps_user; +#ifndef HAVE_PLEDGE struct rlimit rzero = { .rlim_cur = 0, .rlim_max = 0 }; +#endif if (!(ctx->options & DHCPCD_FORKED)) logdebugx("chrooting to `%s' as %s", pw->pw_dir, pw->pw_name); @@ -130,6 +132,7 @@ ps_dropprivs(struct dhcpcd_ctx *ctx) return -1; } +#ifndef HAVE_PLEDGE /* Prohibit new files, sockets, etc */ if (setrlimit(RLIMIT_NOFILE, &rzero) == -1) { logerr("setrlimit RLIMIT_NOFILE"); @@ -148,6 +151,7 @@ ps_dropprivs(struct dhcpcd_ctx *ctx) logerr("setrlimit RLIMIT_NPROC"); return -1; } +#endif #endif return 0;