[pulseaudio-commits] r1678 - /branches/lennart/src/daemon/main.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu Aug 16 12:48:52 PDT 2007


Author: lennart
Date: Thu Aug 16 21:48:49 2007
New Revision: 1678

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1678&root=3Dpulseaudio&vi=
ew=3Drev
Log:
never stay root after startup, even if we don't have capabilites

Modified:
    branches/lennart/src/daemon/main.c

Modified: branches/lennart/src/daemon/main.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/daemon/mai=
n.c?rev=3D1678&root=3Dpulseaudio&r1=3D1677&r2=3D1678&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/daemon/main.c (original)
+++ branches/lennart/src/daemon/main.c Thu Aug 16 21:48:49 2007
@@ -336,10 +336,19 @@
 #endif
 =

     if (suid_root) {
-        if (pa_limit_caps() > 0)
-            /* We managed to drop capabilities except the needed
-             * ones. Hence we can drop the uid. */
-            pa_drop_root();
+        /* Drop all capabilities except CAP_SYS_NICE  */
+        pa_limit_caps();
+
+        /* Drop priviliges, but keep CAP_SYS_NICE */
+        pa_drop_root();
+
+        /* After dropping root, the effective set is reset, hence,
+         * let's raise it again */
+        pa_limit_caps();
+
+        /* When capabilities are not supported we will not be able to
+         * aquire RT sched anymore. But yes, that's the way it is. It
+         * is just too risky tun let PA run as root all the time. */
     }
 =

     setlocale(LC_ALL, "");
@@ -386,7 +395,7 @@
     if (conf->high_priority && conf->cmd =3D=3D PA_CMD_DAEMON)
         pa_raise_priority();
 =

-    if (suid_root) {
+    if (suid_root && conf->cmd !=3D PA_CMD_DAEMON) {
         pa_drop_caps();
         pa_drop_root();
     }




More information about the pulseaudio-commits mailing list