[pulseaudio-commits] r1676 - /branches/lennart/src/daemon/caps.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Thu Aug 16 12:44:51 PDT 2007
Author: lennart
Date: Thu Aug 16 21:44:51 2007
New Revision: 1676
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1676&root=3Dpulseaudio&vi=
ew=3Drev
Log:
Keep CAP_SYS_NICE not only in PERMITTED but also in EFFECTIVE capset
Modified:
branches/lennart/src/daemon/caps.c
Modified: branches/lennart/src/daemon/caps.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/daemon/cap=
s.c?rev=3D1676&root=3Dpulseaudio&r1=3D1675&r2=3D1676&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/caps.c (original)
+++ branches/lennart/src/daemon/caps.c Thu Aug 16 21:44:51 2007
@@ -26,11 +26,11 @@
#include <config.h>
#endif
=
-#include <assert.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
+#include <pulsecore/macro.h>
=
#ifdef HAVE_SYS_CAPABILITY_H
#include <sys/capability.h>
@@ -60,7 +60,7 @@
if (uid =3D=3D 0 || geteuid() !=3D 0)
return;
=
- pa_log_info("dropping root rights.");
+ pa_log_info("Dropping root priviliges.");
=
#if defined(HAVE_SETRESUID)
setresuid(uid, uid, uid);
@@ -88,8 +88,9 @@
cap_value_t nice_cap =3D CAP_SYS_NICE;
=
caps =3D cap_init();
- assert(caps);
+ pa_assert(caps);
cap_clear(caps);
+ cap_set_flag(caps, CAP_EFFECTIVE, 1, &nice_cap, CAP_SET);
cap_set_flag(caps, CAP_PERMITTED, 1, &nice_cap, CAP_SET);
=
if (cap_set_proc(caps) < 0)
@@ -98,7 +99,7 @@
if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0)
goto fail;
=
- pa_log_info("dropped capabilities successfully.");
+ pa_log_info("Dropped capabilities successfully.");
=
r =3D 1;
=
@@ -114,14 +115,14 @@
int r =3D -1;
=
caps =3D cap_init();
- assert(caps);
+ pa_assert(caps);
=
cap_clear(caps);
=
prctl(PR_SET_KEEPCAPS, 0, 0, 0, 0);
=
if (cap_set_proc(caps) < 0) {
- pa_log("failed to drop capabilities: %s", pa_cstrerror(errno));
+ pa_log("Failed to drop capabilities: %s", pa_cstrerror(errno));
goto fail;
}
=
More information about the pulseaudio-commits
mailing list