diff options
author | Thorvald Natvig <slicer@users.sourceforge.net> | 2009-02-27 15:47:30 +0300 |
---|---|---|
committer | Thorvald Natvig <slicer@users.sourceforge.net> | 2009-02-27 15:47:30 +0300 |
commit | 5d9edfb8931862319b5f46d8f4e8f1eb664b1b9f (patch) | |
tree | 71ac9509b6c94a12684535a16856ef8e65c69d77 | |
parent | a5a3a73bf148397ad672c46e2f34fdde9c02f331 (diff) |
Don't keep CAP_DAC_OVERRIDE after switching users
git-svn-id: https://mumble.svn.sourceforge.net/svnroot/mumble/trunk@1593 05730e5d-ab1b-0410-a4ac-84af385074fa
-rw-r--r-- | src/murmur/UnixMurmur.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/murmur/UnixMurmur.cpp b/src/murmur/UnixMurmur.cpp index d6fd5d6df..393b103c6 100644 --- a/src/murmur/UnixMurmur.cpp +++ b/src/murmur/UnixMurmur.cpp @@ -227,12 +227,15 @@ void UnixMurmur::setuid() { void UnixMurmur::initialcap() { #ifdef Q_OS_LINUX - cap_value_t caps[] = {CAP_DAC_OVERRIDE, CAP_SYS_NICE, CAP_SYS_RESOURCE, CAP_NET_ADMIN, CAP_SETUID, CAP_SETGID }; + cap_value_t caps[] = {CAP_SYS_NICE, CAP_SYS_RESOURCE, CAP_NET_ADMIN, CAP_SETUID, CAP_SETGID, CAP_DAC_OVERRIDE }; if (! bRoot) return; int ncap = sizeof(caps)/sizeof(cap_value_t); + + if (geteuid() != 0) + ncap--; cap_t c = cap_init(); cap_clear(c); @@ -250,7 +253,7 @@ void UnixMurmur::initialcap() { void UnixMurmur::finalcap() { #ifdef Q_OS_LINUX - cap_value_t caps[] = {CAP_DAC_OVERRIDE, CAP_SYS_NICE, CAP_NET_ADMIN }; + cap_value_t caps[] = {CAP_SYS_NICE, CAP_NET_ADMIN }; if (! bRoot) return; |