summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/bgpd.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-01-20 09:44:34 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-01-20 09:44:34 +0000
commit9068c61742ac18c0e3f18b1f8914a9544d98f1d7 (patch)
tree686d539b0fc4605c45a7cd97e4836696926f87c8 /usr.sbin/bgpd/bgpd.c
parenta0bfce05e5e241954cc05dbd8f8759c303f380c9 (diff)
check early wether user _bgpd exists so we can bail out early and nicely
prodded by theo
Diffstat (limited to 'usr.sbin/bgpd/bgpd.c')
-rw-r--r--usr.sbin/bgpd/bgpd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c
index 8bb50430b39..65f439c2db3 100644
--- a/usr.sbin/bgpd/bgpd.c
+++ b/usr.sbin/bgpd/bgpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.c,v 1.68 2004/01/17 19:35:35 claudio Exp $ */
+/* $OpenBSD: bgpd.c,v 1.69 2004/01/20 09:44:33 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -25,6 +25,7 @@
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
+#include <pwd.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -155,6 +156,10 @@ main(int argc, char *argv[])
if (geteuid())
errx(1, "need root privileges");
+ if (getpwnam(BGPD_USER) == NULL)
+ errx(1, "unknown user %s", BGPD_USER);
+ endpwent();
+
log_init(debug);
if (!debug)