summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-06-01 21:47:28 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-06-01 21:47:28 +0000
commit132ce5cc1f510d71e890cf8f318c5b86a199ab1f (patch)
tree4f8d817e5eeaa8ca86a8bd22c7270a8d78dba5f4 /usr.sbin
parentc9932c3bb9c0728bb312f4ae70f75cc65d3c44b3 (diff)
Remove some unneeded lint goo and use setres[ug]id() instead of the setuid
dance.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/dvmrpd/dvmrpe.c10
-rw-r--r--usr.sbin/dvmrpd/rde.c9
2 files changed, 6 insertions, 13 deletions
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 <claudio@openbsd.org>
@@ -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 <claudio@openbsd.org>
@@ -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();