mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-25 06:59:52 -05:00
catch up with trunk HEAD (i.e. 2118:2213)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2214 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
106ddb9211
commit
ecf6439661
24 changed files with 545 additions and 216 deletions
|
|
@ -90,8 +90,8 @@ int pa_limit_caps(void) {
|
|||
cap_t caps;
|
||||
cap_value_t nice_cap = CAP_SYS_NICE;
|
||||
|
||||
caps = cap_init();
|
||||
pa_assert(caps);
|
||||
pa_assert_se(caps = cap_init());
|
||||
|
||||
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);
|
||||
|
|
@ -113,28 +113,15 @@ fail:
|
|||
}
|
||||
|
||||
/* Drop all capabilities, effectively becoming a normal user */
|
||||
int pa_drop_caps(void) {
|
||||
void pa_drop_caps(void) {
|
||||
cap_t caps;
|
||||
int r = -1;
|
||||
|
||||
caps = cap_init();
|
||||
pa_assert(caps);
|
||||
pa_assert_se(prctl(PR_SET_KEEPCAPS, 0, 0, 0, 0) == 0);
|
||||
|
||||
pa_assert_se(caps = cap_init());
|
||||
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));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
r = 0;
|
||||
|
||||
fail:
|
||||
pa_assert_se(cap_set_proc(caps) == 0);
|
||||
cap_free(caps);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
@ -144,9 +131,8 @@ int pa_limit_caps(void) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int pa_drop_caps(void) {
|
||||
void pa_drop_caps(void) {
|
||||
pa_drop_root();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
***/
|
||||
|
||||
void pa_drop_root(void);
|
||||
void pa_drop_caps(void);
|
||||
int pa_limit_caps(void);
|
||||
int pa_drop_caps(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ static void signal_handler(int sig) {
|
|||
|
||||
} else if (phase == PHASE_SOFT) {
|
||||
write_err("Hard CPU time limit exhausted, terminating forcibly.\n");
|
||||
_exit(1); /* Forced exit */
|
||||
abort(); /* Forced exit */
|
||||
}
|
||||
|
||||
errno = saved_errno;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
; module-idle-time = 20
|
||||
; scache-idle-time = 20
|
||||
|
||||
; dl-search-path = @PA_DLSEARCHPATH@
|
||||
; dl-search-path = (depends on architecture)
|
||||
|
||||
; default-script-file = @PA_DEFAULT_CONFIG_FILE@
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ load-sample-lazy pulse-hotplug /usr/share/sounds/startup3.wav
|
|||
#load-module module-pipe-sink
|
||||
|
||||
### Automatically load driver modules depending on the hardware available
|
||||
.ifexists @PA_DLSEARCHPATH@/module-hal-detect@PA_SOEXT@
|
||||
.ifexists module-hal-detect@PA_SOEXT@
|
||||
load-module module-hal-detect
|
||||
.else
|
||||
### Alternatively use the static hardware detection module (for systems that
|
||||
|
|
@ -46,7 +46,9 @@ load-module module-detect
|
|||
.endif
|
||||
|
||||
### Load several protocols
|
||||
.ifexists module-esound-protocol-unix@PA_SOEXT@
|
||||
load-module module-esound-protocol-unix
|
||||
.endif
|
||||
load-module module-native-protocol-unix
|
||||
|
||||
### Network access (may be configured with paprefs, so leave this commented
|
||||
|
|
@ -78,11 +80,6 @@ load-module module-suspend-on-idle
|
|||
### Load X11 bell module
|
||||
#load-module module-x11-bell sample=x11-bell
|
||||
|
||||
### Publish connection data in the X11 root window
|
||||
.ifexists @PA_DLSEARCHPATH@/module-x11-publish@PA_SOEXT@
|
||||
load-module module-x11-publish
|
||||
.endif
|
||||
|
||||
### Register ourselves in the X11 session manager
|
||||
# Deactivated by default, to avoid deadlock when PA is started as esd from gnome-session
|
||||
# Instead we load this via /etc/xdg/autostart/ and "pactl load-module" now
|
||||
|
|
@ -91,8 +88,17 @@ load-module module-x11-publish
|
|||
### Load additional modules from GConf settings. This can be configured with the paprefs tool.
|
||||
### Please keep in mind that the modules configured by paprefs might conflict with manually
|
||||
### loaded modules.
|
||||
.ifexists @PA_DLSEARCHPATH@/module-gconf@PA_SOEXT@
|
||||
.ifexists module-gconf@PA_SOEXT@
|
||||
.nofail
|
||||
load-module module-gconf
|
||||
.fail
|
||||
.endif
|
||||
|
||||
### Publish connection data in the X11 root window
|
||||
.ifexists module-x11-publish@PA_SOEXT@
|
||||
.nofail
|
||||
load-module module-x11-publish
|
||||
.fail
|
||||
.endif
|
||||
|
||||
### Make some devices default
|
||||
|
|
|
|||
|
|
@ -242,7 +242,8 @@ static int change_user(void) {
|
|||
}
|
||||
|
||||
set_env("USER", PA_SYSTEM_USER);
|
||||
set_env("LOGNAME", PA_SYSTEM_GROUP);
|
||||
set_env("USERNAME", PA_SYSTEM_USER);
|
||||
set_env("LOGNAME", PA_SYSTEM_USER);
|
||||
set_env("HOME", PA_SYSTEM_RUNTIME_PATH);
|
||||
|
||||
/* Relevant for pa_runtime_path() */
|
||||
|
|
@ -778,7 +779,7 @@ int main(int argc, char *argv[]) {
|
|||
c->disallow_module_loading = !!conf->disallow_module_loading;
|
||||
|
||||
if (r < 0 && conf->fail) {
|
||||
pa_log("failed to initialize daemon.");
|
||||
pa_log("Failed to initialize daemon.");
|
||||
#ifdef HAVE_FORK
|
||||
if (conf->daemonize)
|
||||
pa_loop_write(daemon_pipe[1], &retval, sizeof(retval), NULL);
|
||||
|
|
@ -792,16 +793,19 @@ int main(int argc, char *argv[]) {
|
|||
} else {
|
||||
|
||||
retval = 0;
|
||||
|
||||
if (c->default_sink_name &&
|
||||
pa_namereg_get(c, c->default_sink_name, PA_NAMEREG_SINK, 1) == NULL) {
|
||||
pa_log_error("%s : Default sink name (%s) does not exist in name register.", __FILE__, c->default_sink_name);
|
||||
retval = !!conf->fail;
|
||||
}
|
||||
|
||||
#ifdef HAVE_FORK
|
||||
if (conf->daemonize)
|
||||
pa_loop_write(daemon_pipe[1], &retval, sizeof(retval), NULL);
|
||||
#endif
|
||||
|
||||
if (c->default_sink_name &&
|
||||
pa_namereg_get(c, c->default_sink_name, PA_NAMEREG_SINK, 1) == NULL) {
|
||||
pa_log_error("%s : Fatal error. Default sink name (%s) does not exist in name register.", __FILE__, c->default_sink_name);
|
||||
retval = 1;
|
||||
} else {
|
||||
if (!retval) {
|
||||
pa_log_info("Daemon startup complete.");
|
||||
if (pa_mainloop_run(mainloop, &retval) < 0)
|
||||
retval = 1;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ USA.
|
|||
-->
|
||||
|
||||
<policyconfig>
|
||||
<vendor>The PulseAudio Project</vendor>
|
||||
<vendor_url>http://pulseaudio.org/</vendor_url>
|
||||
<icon_name>audio-card</icon_name>
|
||||
|
||||
<action id="org.pulseaudio.acquire-real-time">
|
||||
<description>Real-time scheduling for the PulseAudio daemon</description>
|
||||
|
|
@ -38,59 +38,6 @@
|
|||
|
||||
#include "polkit.h"
|
||||
|
||||
static pa_bool_t show_grant_dialog(const char *action_id) {
|
||||
DBusError dbus_error;
|
||||
DBusConnection *bus = NULL;
|
||||
DBusMessage *m = NULL, *reply = NULL;
|
||||
pa_bool_t r = FALSE;
|
||||
uint32_t xid = 0;
|
||||
int verdict;
|
||||
|
||||
dbus_error_init(&dbus_error);
|
||||
|
||||
if (!(bus = dbus_bus_get(DBUS_BUS_SESSION, &dbus_error))) {
|
||||
pa_log_error("Cannot connect to session bus: %s", dbus_error.message);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (!(m = dbus_message_new_method_call("org.gnome.PolicyKit", "/org/gnome/PolicyKit/Manager", "org.gnome.PolicyKit.Manager", "ShowDialog"))) {
|
||||
pa_log_error("Failed to allocate D-Bus message.");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (!(dbus_message_append_args(m, DBUS_TYPE_STRING, &action_id, DBUS_TYPE_UINT32, &xid, DBUS_TYPE_INVALID))) {
|
||||
pa_log_error("Failed to append arguments to D-Bus message.");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &dbus_error))) {
|
||||
pa_log_warn("Failed to show grant dialog: %s", dbus_error.message);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (!(dbus_message_get_args(reply, &dbus_error, DBUS_TYPE_BOOLEAN, &verdict, DBUS_TYPE_INVALID))) {
|
||||
pa_log_warn("Malformed response from grant manager: %s", dbus_error.message);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
r = !!verdict;
|
||||
|
||||
finish:
|
||||
|
||||
if (bus)
|
||||
dbus_connection_unref(bus);
|
||||
|
||||
dbus_error_free(&dbus_error);
|
||||
|
||||
if (m)
|
||||
dbus_message_unref(m);
|
||||
|
||||
if (reply)
|
||||
dbus_message_unref(reply);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int pa_polkit_check(const char *action_id) {
|
||||
int ret = -1;
|
||||
DBusError dbus_error;
|
||||
|
|
@ -161,35 +108,32 @@ int pa_polkit_check(const char *action_id) {
|
|||
|
||||
for (;;) {
|
||||
|
||||
#ifdef HAVE_POLKIT_CONTEXT_IS_CALLER_AUTHORIZED
|
||||
polkit_result = polkit_context_is_caller_authorized(context, action, caller, TRUE, &polkit_error);
|
||||
|
||||
if (polkit_error_is_set(polkit_error)) {
|
||||
pa_log_error("Could not determine whether caller is authorized: %s", polkit_error_get_error_message(polkit_error));
|
||||
goto finish;
|
||||
}
|
||||
#else
|
||||
|
||||
polkit_result = polkit_context_can_caller_do_action(context, action, caller);
|
||||
|
||||
#endif
|
||||
|
||||
if (polkit_result == POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH ||
|
||||
polkit_result == POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH_KEEP_SESSION ||
|
||||
polkit_result == POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH_KEEP_ALWAYS ||
|
||||
#ifdef POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH_ONE_SHOT
|
||||
polkit_result == POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH_ONE_SHOT ||
|
||||
#endif
|
||||
polkit_result == POLKIT_RESULT_ONLY_VIA_SELF_AUTH ||
|
||||
polkit_result == POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION ||
|
||||
polkit_result == POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS
|
||||
#ifdef POLKIT_RESULT_ONLY_VIA_SELF_AUTH_ONE_SHOT
|
||||
|| polkit_result == POLKIT_RESULT_ONLY_VIA_SELF_AUTH_ONE_SHOT
|
||||
#endif
|
||||
polkit_result == POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS ||
|
||||
polkit_result == POLKIT_RESULT_ONLY_VIA_SELF_AUTH_ONE_SHOT
|
||||
) {
|
||||
|
||||
if (show_grant_dialog(action_id))
|
||||
continue;
|
||||
if (polkit_auth_obtain(action_id, 0, getpid(), &dbus_error)) {
|
||||
polkit_result = POLKIT_RESULT_YES;
|
||||
break;
|
||||
}
|
||||
|
||||
if (dbus_error_is_set(&dbus_error)) {
|
||||
pa_log_error("Cannot obtain auth: %s", dbus_error.message);
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue