From b9e6237dabc02e4b40624deb8a3244f79a66eb90 Mon Sep 17 00:00:00 2001 From: Pietro Cerutti Date: Fri, 12 Apr 2013 14:19:44 +0000 Subject: [PATCH] - Switch order of setting real uid and gid. If we set uid first, then we don't have enough privileges to set gid. This looks like a long standing bug, just recently revealed by r241852. Approved by: cognet --- usr.bin/at/privs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/at/privs.h b/usr.bin/at/privs.h index 297c2529ac4..2b0d34a19cb 100644 --- a/usr.bin/at/privs.h +++ b/usr.bin/at/privs.h @@ -99,8 +99,8 @@ gid_t real_gid, effective_gid; PRIV_START \ effective_uid = (a); \ effective_gid = (b); \ - if (setreuid((uid_t)-1, effective_uid) != 0) err(1, "setreuid failed"); \ if (setregid((gid_t)-1, effective_gid) != 0) err(1, "setregid failed"); \ + if (setreuid((uid_t)-1, effective_uid) != 0) err(1, "setreuid failed"); \ PRIV_END \ } #endif