diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-09-11 19:15:37 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-09-11 19:15:37 +0000 |
commit | f09f4c6aa02ea4012faa8491d629b9c8c3b77c71 (patch) | |
tree | e4f10a011c58422d098a486f61efcccea73c260a /usr.sbin | |
parent | 7021cb8f932f18e085425d77aee0302c44bb8da6 (diff) |
revoke privs at start; tested by fenner@parc.xerox.com
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/map-mbone/mapper.c | 13 | ||||
-rw-r--r-- | usr.sbin/mrinfo/mrinfo.c | 10 | ||||
-rw-r--r-- | usr.sbin/mrouted/main.c | 5 | ||||
-rw-r--r-- | usr.sbin/mtrace/mtrace.c | 10 |
4 files changed, 18 insertions, 20 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; diff --git a/usr.sbin/mrinfo/mrinfo.c b/usr.sbin/mrinfo/mrinfo.c index e8cfc4f091d..692b5250326 100644 --- a/usr.sbin/mrinfo/mrinfo.c +++ b/usr.sbin/mrinfo/mrinfo.c @@ -336,12 +336,16 @@ main(argc, argv) char *host; int curaddr; - setlinebuf(stderr); - if (geteuid() != 0) { fprintf(stderr, "mrinfo: must be root\n"); exit(1); } + + init_igmp(); + setuid(getuid()); + + setlinebuf(stderr); + argv++, argc--; while (argc > 0 && argv[0][0] == '-') { switch (argv[0][1]) { @@ -389,8 +393,6 @@ main(argc, argv) if (debug) fprintf(stderr, "Debug level %u\n", debug); - init_igmp(); - /* Check all addresses; mrouters often have unreachable interfaces */ for (curaddr = 0; hp->h_addr_list[curaddr] != NULL; curaddr++) { memcpy(&target_addr, hp->h_addr_list[curaddr], hp->h_length); diff --git a/usr.sbin/mrouted/main.c b/usr.sbin/mrouted/main.c index 7a3eaff086d..8e3bd4b1cc7 100644 --- a/usr.sbin/mrouted/main.c +++ b/usr.sbin/mrouted/main.c @@ -33,7 +33,7 @@ #ifndef lint static char rcsid[] = - "@(#) $Id: main.c,v 1.3 1995/12/19 17:48:04 deraadt Exp $"; + "@(#) $Id: main.c,v 1.4 1996/09/11 19:15:33 deraadt Exp $"; #endif extern char *configfilename; @@ -112,12 +112,11 @@ main(argc, argv) int index, block; #endif - setlinebuf(stderr); - if (geteuid() != 0) { fprintf(stderr, "must be root\n"); exit(1); } + setlinebuf(stderr); argv++, argc--; while (argc > 0 && *argv[0] == '-') { diff --git a/usr.sbin/mtrace/mtrace.c b/usr.sbin/mtrace/mtrace.c index 6f8323ad061..12ee0819ae0 100644 --- a/usr.sbin/mtrace/mtrace.c +++ b/usr.sbin/mtrace/mtrace.c @@ -52,7 +52,7 @@ #ifndef lint static char rcsid[] = - "@(#) $Id: mtrace.c,v 1.2 1995/12/14 01:46:22 deraadt Exp $"; + "@(#) $Id: mtrace.c,v 1.3 1996/09/11 19:15:36 deraadt Exp $"; #endif #include <netdb.h> @@ -1165,10 +1165,8 @@ char *argv[]; int waittime; int seed; - if (geteuid() != 0) { - fprintf(stderr, "mtrace: must be root\n"); - exit(1); - } + init_igmp(); + setuid(getuid()); argv++, argc--; if (argc == 0) goto usage; @@ -1306,8 +1304,6 @@ Usage: mtrace [-Mlnps] [-w wait] [-m max_hops] [-q nqueries] [-g gateway]\n\ exit(1); } - init_igmp(); - /* * Set useful defaults for as many parameters as possible. */ |