diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2005-05-02 02:26:36 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2005-05-02 02:26:36 +0000 |
commit | 2da213a15d6db3d71af4f7378f5a2f92854d3b02 (patch) | |
tree | b3cf2d9ba043ebf2d2781c4346ffeaa5f1dc550a | |
parent | 5504d0a8ea4485658c4a709aa5907dab61f8be31 (diff) |
use setres[ug]id for privilege dropping; ok norby@
-rw-r--r-- | usr.sbin/ospfd/ospfe.c | 7 | ||||
-rw-r--r-- | usr.sbin/ospfd/rde.c | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/usr.sbin/ospfd/ospfe.c b/usr.sbin/ospfd/ospfe.c index a3b5688417d..ca245f4bef9 100644 --- a/usr.sbin/ospfd/ospfe.c +++ b/usr.sbin/ospfd/ospfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfe.c,v 1.17 2005/04/25 11:31:50 claudio Exp $ */ +/* $OpenBSD: ospfe.c,v 1.18 2005/05/02 02:26:35 djm Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -118,10 +118,9 @@ ospfe(struct ospfd_conf *xconf, int pipe_parent2ospfe[2], int pipe_ospfe2rde[2], ospfd_process = PROC_OSPF_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(); diff --git a/usr.sbin/ospfd/rde.c b/usr.sbin/ospfd/rde.c index 7caa67025f1..b33ed1e5a6f 100644 --- a/usr.sbin/ospfd/rde.c +++ b/usr.sbin/ospfd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.12 2005/04/12 09:54:59 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.13 2005/05/02 02:26:35 djm Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -110,10 +110,9 @@ rde(struct ospfd_conf *xconf, int pipe_parent2rde[2], int pipe_ospfe2rde[2], ospfd_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(); |