[pulseaudio-commits] r1119 - in /trunk/src/daemon: caps.c main.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Thu Jul 20 06:19:17 PDT 2006
Author: ossman
Date: Thu Jul 20 15:19:16 2006
New Revision: 1119
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1119&root=pulseaudio&view=rev
Log:
Move check for SUID into the caps functions.
Modified:
trunk/src/daemon/caps.c
trunk/src/daemon/main.c
Modified: trunk/src/daemon/caps.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/daemon/caps.c?rev=1119&root=pulseaudio&r1=1118&r2=1119&view=diff
==============================================================================
--- trunk/src/daemon/caps.c (original)
+++ trunk/src/daemon/caps.c Thu Jul 20 15:19:16 2006
@@ -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 @@
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);
@@ -105,6 +110,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);
Modified: trunk/src/daemon/main.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/daemon/main.c?rev=1119&root=pulseaudio&r1=1118&r2=1119&view=diff
==============================================================================
--- trunk/src/daemon/main.c (original)
+++ trunk/src/daemon/main.c Thu Jul 20 15:19:16 2006
@@ -328,8 +328,7 @@
setlocale(LC_ALL, "");
- if (getuid() != 0)
- pa_limit_caps();
+ pa_limit_caps();
#ifdef HAVE_GETUID
suid_root = getuid() != 0 && geteuid() == 0;
@@ -377,8 +376,7 @@
if (conf->high_priority && conf->cmd == PA_CMD_DAEMON)
pa_raise_priority();
- if (getuid() != 0)
- pa_drop_caps();
+ pa_drop_caps();
if (suid_root)
pa_drop_root();
More information about the pulseaudio-commits
mailing list