From 132ce5cc1f510d71e890cf8f318c5b86a199ab1f Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Thu, 1 Jun 2006 21:47:28 +0000 Subject: Remove some unneeded lint goo and use setres[ug]id() instead of the setuid dance. --- usr.sbin/dvmrpd/dvmrpe.c | 10 +++------- usr.sbin/dvmrpd/rde.c | 9 +++------ 2 files changed, 6 insertions(+), 13 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/dvmrpd/dvmrpe.c b/usr.sbin/dvmrpd/dvmrpe.c index 025d9d11d65..2963e913188 100644 --- a/usr.sbin/dvmrpd/dvmrpe.c +++ b/usr.sbin/dvmrpd/dvmrpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvmrpe.c,v 1.1 2006/06/01 14:12:20 norby Exp $ */ +/* $OpenBSD: dvmrpe.c,v 1.2 2006/06/01 21:47:27 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker @@ -61,7 +61,6 @@ dvmrpe_sig_handler(int sig, short event, void *bula) /* NOTREACHED */ default: fatalx("unexpected signal"); - /* NOTREACHED */ } } @@ -78,7 +77,6 @@ dvmrpe(struct dvmrpd_conf *xconf, int pipe_parent2dvmrpe[2], switch (pid = fork()) { case -1: fatal("cannot fork"); - /* NOTREACHED */ case 0: break; default: @@ -122,10 +120,9 @@ dvmrpe(struct dvmrpd_conf *xconf, int pipe_parent2dvmrpe[2], dvmrpd_process = PROC_DVMRP_ENGINE; if (setgroups(1, &pw->pw_gid) || - setegid(pw->pw_gid) || setgid(pw->pw_gid) || - seteuid(pw->pw_uid) || setuid(pw->pw_uid)) { + setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) || + setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid)) fatal("can't drop privileges"); - } event_init(); nbr_init(NBR_HASHSIZE); @@ -216,7 +213,6 @@ dvmrpe_shutdown(void) _exit(0); } -/* imesg */ int dvmrpe_imsg_compose_parent(int type, pid_t pid, void *data, u_int16_t datalen) { diff --git a/usr.sbin/dvmrpd/rde.c b/usr.sbin/dvmrpd/rde.c index ad359830b34..f4377705d5c 100644 --- a/usr.sbin/dvmrpd/rde.c +++ b/usr.sbin/dvmrpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.1 2006/06/01 14:12:20 norby Exp $ */ +/* $OpenBSD: rde.c,v 1.2 2006/06/01 21:47:27 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker @@ -62,7 +62,6 @@ rde_sig_handler(int sig, short event, void *arg) /* NOTREACHED */ default: fatalx("unexpected signal"); - /* NOTREACHED */ } } @@ -78,7 +77,6 @@ rde(struct dvmrpd_conf *xconf, int pipe_parent2rde[2], int pipe_dvmrpe2rde[2], switch (pid = fork()) { case -1: fatal("cannot fork"); - /* NOTREACHED */ case 0: break; default: @@ -99,10 +97,9 @@ rde(struct dvmrpd_conf *xconf, int pipe_parent2rde[2], int pipe_dvmrpe2rde[2], dvmrpd_process = PROC_RDE_ENGINE; if (setgroups(1, &pw->pw_gid) || - setegid(pw->pw_gid) || setgid(pw->pw_gid) || - seteuid(pw->pw_uid) || setuid(pw->pw_uid)) { + setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) || + setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid)) fatal("can't drop privileges"); - } endpwent(); -- cgit v1.2.3