summaryrefslogtreecommitdiff
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2006-03-06 10:45:58 +0000
committerDamien Miller <djm@cvs.openbsd.org>2006-03-06 10:45:58 +0000
commitbc2cb0af87ca7084b9523e760d68aad4217276f8 (patch)
tree61c35eb64e2d68f77ce6b3ce477f0c18eea079fd /sbin/dhclient
parent5803ed8cfde384a9de032eaa23f79772700350bd (diff)
convert permanent privilege revocation to use setresuid/setresgid;
ok henning@
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/dhclient.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 06c71dd2f4d..36a7fa5dc5f 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.81 2005/10/26 15:42:04 henning Exp $ */
+/* $OpenBSD: dhclient.c,v 1.82 2006/03/06 10:45:56 djm Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -363,10 +363,12 @@ main(int argc, char *argv[])
if (chdir("/") == -1)
error("chdir(\"/\")");
- if (setgroups(1, &pw->pw_gid) ||
- setegid(pw->pw_gid) || setgid(pw->pw_gid) ||
- seteuid(pw->pw_uid) || setuid(pw->pw_uid))
- error("can't drop privileges: %m");
+ if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) == -1)
+ error("setresgid");
+ if (setgroups(1, &pw->pw_gid) == -1)
+ error("setgroups");
+ if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) == -1)
+ error("setresuid");
endpwent();