summaryrefslogtreecommitdiffstats
path: root/usr.sbin/map-mbone
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-09-11 19:15:28 +0000
committerderaadt <deraadt@openbsd.org>1996-09-11 19:15:28 +0000
commitf07d649783487d2ba11dee8e79de5c017cd8a330 (patch)
tree2b1cadd791e6289e547c1b5417093b49f4e6f10e /usr.sbin/map-mbone
parentfix a typo (diff)
downloadwireguard-openbsd-f07d649783487d2ba11dee8e79de5c017cd8a330.tar.xz
wireguard-openbsd-f07d649783487d2ba11dee8e79de5c017cd8a330.zip
revoke privs at start; tested by fenner@parc.xerox.com
Diffstat (limited to 'usr.sbin/map-mbone')
-rw-r--r--usr.sbin/map-mbone/mapper.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.sbin/map-mbone/mapper.c b/usr.sbin/map-mbone/mapper.c
index 7a273d01aee..43134c69671 100644
--- a/usr.sbin/map-mbone/mapper.c
+++ b/usr.sbin/map-mbone/mapper.c
@@ -844,13 +844,16 @@ int main(argc, argv)
{
int flood = FALSE, graph = FALSE;
- setlinebuf(stderr);
-
if (geteuid() != 0) {
- fprintf(stderr, "must be root\n");
- exit(1);
+ fprintf(stderr, "map-mbone: must be root\n");
+ exit(1);
}
+ init_igmp();
+ setuid(getuid());
+
+ setlinebuf(stderr);
+
argv++, argc--;
while (argc > 0 && argv[0][0] == '-') {
switch (argv[0][1]) {
@@ -899,8 +902,6 @@ int main(argc, argv)
if (debug)
fprintf(stderr, "Debug level %u\n", debug);
- init_igmp();
-
{ /* Find a good local address for us. */
int udp;
struct sockaddr_in addr;