mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
Move check for SUID into the caps functions.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1119 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
8d2dc9c4d1
commit
57d8a315ea
2 changed files with 11 additions and 4 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_SYS_CAPABILITY_H
|
||||
#include <sys/capability.h>
|
||||
|
|
@ -80,6 +81,10 @@ int pa_limit_caps(void) {
|
|||
cap_t caps;
|
||||
cap_value_t nice_cap = CAP_SYS_NICE;
|
||||
|
||||
/* Only drop caps when called SUID */
|
||||
if (getuid() != 0)
|
||||
return 0;
|
||||
|
||||
caps = cap_init();
|
||||
assert(caps);
|
||||
|
||||
|
|
@ -106,6 +111,10 @@ int pa_drop_caps(void) {
|
|||
cap_t caps;
|
||||
int r = -1;
|
||||
|
||||
/* Only drop caps when called SUID */
|
||||
if (getuid() != 0)
|
||||
return 0;
|
||||
|
||||
caps = cap_init();
|
||||
assert(caps);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue