diff options
Diffstat (limited to 'usr.sbin/bgpd/rde.c')
-rw-r--r-- | usr.sbin/bgpd/rde.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index 76bfc7a9a76..e67c3e631c6 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.303 2010/11/30 15:33:06 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.304 2010/12/23 17:41:40 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -18,6 +18,8 @@ #include <sys/types.h> #include <sys/socket.h> +#include <sys/time.h> +#include <sys/resource.h> #include <errno.h> #include <ifaddrs.h> @@ -156,6 +158,7 @@ pid_t rde_main(int pipe_m2r[2], int pipe_s2r[2], int pipe_m2s[2], int pipe_s2rctl[2], int debug) { + struct rlimit rl; pid_t pid; struct passwd *pw; struct pollfd *pfd = NULL; @@ -185,6 +188,12 @@ rde_main(int pipe_m2r[2], int pipe_s2r[2], int pipe_m2s[2], int pipe_s2rctl[2], setproctitle("route decision engine"); bgpd_process = PROC_RDE; + if (getrlimit(RLIMIT_DATA, &rl) == -1) + fatal("getrlimit"); + rl.rlim_cur = rl.rlim_max; + if (setrlimit(RLIMIT_DATA, &rl) == -1) + fatal("setrlimit"); + if (setgroups(1, &pw->pw_gid) || setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) || setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid)) |