diff options
author | gahr <gahr@FreeBSD.org> | 2013-04-12 14:19:44 +0000 |
---|---|---|
committer | gahr <gahr@FreeBSD.org> | 2013-04-12 14:19:44 +0000 |
commit | b186c48188d8cd919662272950200769b7c63fff (patch) | |
tree | 57625913c5e09a8645adf933e31b7de573131cdf /usr.bin/at/privs.h | |
parent | ffb752b726ac9ae9b0234fdc2b1439463c562a0f (diff) | |
download | FreeBSD-src-b186c48188d8cd919662272950200769b7c63fff.zip FreeBSD-src-b186c48188d8cd919662272950200769b7c63fff.tar.gz |
- 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
Diffstat (limited to 'usr.bin/at/privs.h')
-rw-r--r-- | usr.bin/at/privs.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/at/privs.h b/usr.bin/at/privs.h index 297c252..2b0d34a 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 |