[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] X11: Add xauthority parameter
Tanu Kaskinen
gitlab at gitlab.freedesktop.org
Thu Nov 21 13:02:58 UTC 2019
Tanu Kaskinen pushed to branch master at PulseAudio / pulseaudio
Commits:
c7a55174 by Wim Taymans at 2019-11-21T12:44:09Z
X11: Add xauthority parameter
Add an xauthority parameter and use it in the startup script.
Apparently on some systems the X authentication cookie is not stored in
~/.Xauthority but in some dynamic location pointed to by the XAUTHORITY
environment variable. The environment variable therefore needs to be set
in the PulseAudio daemon environment in order to have access to the X
server from the PulseAudio daemon, but the variable is not necessarily
set when starting PulseAudio. For example, systemd starts PulseAudio
outside the X session. The start-pulseaudio-x11 script is run in the
X session, so it has the environment variable available, and can pass it
to the X modules, which then can set the variable in the daemon
environment.
RedHat bug: https://bugzilla.redhat.com/show_bug.cgi?id=1723065
Debian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593746
Based on patch by Alexander Kurtz <kurtz.alex at googlemail.com>
- - - - -
5 changed files:
- src/daemon/start-pulseaudio-x11.in
- src/modules/x11/module-x11-bell.c
- src/modules/x11/module-x11-cork-request.c
- src/modules/x11/module-x11-publish.c
- src/modules/x11/module-x11-xsmp.c
Changes:
=====================================
src/daemon/start-pulseaudio-x11.in
=====================================
@@ -19,8 +19,8 @@ set -e
if [ x"$DISPLAY" != x ] ; then
- @PACTL_BINARY@ load-module module-x11-publish "display=$DISPLAY" > /dev/null
- @PACTL_BINARY@ load-module module-x11-cork-request "display=$DISPLAY" > /dev/null
+ @PACTL_BINARY@ load-module module-x11-publish "display=$DISPLAY xauthority=$XAUTHORITY" > /dev/null
+ @PACTL_BINARY@ load-module module-x11-cork-request "display=$DISPLAY xauthority=$XAUTHORITY" > /dev/null
# KDE plasma versions older than 5.17.0 use module-device-manager's routing API.
# Check for current plasma version and load module if it's necessary.
@@ -32,6 +32,6 @@ if [ x"$DISPLAY" != x ] ; then
fi
if [ x"$SESSION_MANAGER" != x ] ; then
- @PACTL_BINARY@ load-module module-x11-xsmp "display=$DISPLAY session_manager=$SESSION_MANAGER" > /dev/null
+ @PACTL_BINARY@ load-module module-x11-xsmp "display=$DISPLAY xauthority=$XAUTHORITY session_manager=$SESSION_MANAGER" > /dev/null
fi
fi
=====================================
src/modules/x11/module-x11-bell.c
=====================================
@@ -44,6 +44,7 @@ static const char* const valid_modargs[] = {
"sink",
"sample",
"display",
+ "xauthority",
NULL
};
@@ -125,6 +126,13 @@ int pa__init(pa_module*m) {
u->sink_name = pa_xstrdup(pa_modargs_get_value(ma, "sink", NULL));
u->x11_client = NULL;
+ if (pa_modargs_get_value(ma, "xauthority", NULL)) {
+ if (setenv("XAUTHORITY", pa_modargs_get_value(ma, "xauthority", NULL), 1)) {
+ pa_log("setenv() for $XAUTHORITY failed");
+ goto fail;
+ }
+ }
+
if (!(u->x11_wrapper = pa_x11_wrapper_get(m->core, pa_modargs_get_value(ma, "display", NULL))))
goto fail;
=====================================
src/modules/x11/module-x11-cork-request.c
=====================================
@@ -46,6 +46,7 @@ PA_MODULE_USAGE("display=<X11 display>");
static const char* const valid_modargs[] = {
"display",
+ "xauthority",
NULL
};
@@ -128,6 +129,13 @@ int pa__init(pa_module *m) {
m->userdata = u = pa_xnew0(struct userdata, 1);
u->module = m;
+ if (pa_modargs_get_value(ma, "xauthority", NULL)) {
+ if (setenv("XAUTHORITY", pa_modargs_get_value(ma, "xauthority", NULL), 1)) {
+ pa_log("setenv() for $XAUTHORITY failed");
+ goto fail;
+ }
+ }
+
if (!(u->x11_wrapper = pa_x11_wrapper_get(m->core, pa_modargs_get_value(ma, "display", NULL))))
goto fail;
=====================================
src/modules/x11/module-x11-publish.c
=====================================
@@ -56,6 +56,7 @@ static const char* const valid_modargs[] = {
"sink",
"source",
"cookie",
+ "xauthority",
NULL
};
@@ -156,6 +157,13 @@ int pa__init(pa_module*m) {
if (!(u->auth_cookie = pa_auth_cookie_get(m->core, pa_modargs_get_value(ma, "cookie", PA_NATIVE_COOKIE_FILE), true, PA_NATIVE_COOKIE_LENGTH)))
goto fail;
+ if (pa_modargs_get_value(ma, "xauthority", NULL)) {
+ if (setenv("XAUTHORITY", pa_modargs_get_value(ma, "xauthority", NULL), 1)) {
+ pa_log("setenv() for $XAUTHORITY failed");
+ goto fail;
+ }
+ }
+
if (!(u->x11_wrapper = pa_x11_wrapper_get(m->core, pa_modargs_get_value(ma, "display", NULL))))
goto fail;
=====================================
src/modules/x11/module-x11-xsmp.c
=====================================
@@ -46,6 +46,7 @@ static bool ice_in_use = false;
static const char* const valid_modargs[] = {
"session_manager",
"display",
+ "xauthority",
NULL
};
@@ -139,6 +140,13 @@ int pa__init(pa_module*m) {
goto fail;
}
+ if (pa_modargs_get_value(ma, "xauthority", NULL)) {
+ if (setenv("XAUTHORITY", pa_modargs_get_value(ma, "xauthority", NULL), 1)) {
+ pa_log("setenv() for $XAUTHORITY failed");
+ goto fail;
+ }
+ }
+
if (!(u->x11 = pa_x11_wrapper_get(m->core, pa_modargs_get_value(ma, "display", NULL))))
goto fail;
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/c7a55174dc5b087cdd96524530aa10ed1d39968e
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/c7a55174dc5b087cdd96524530aa10ed1d39968e
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20191121/320d62fb/attachment-0001.html>
More information about the pulseaudio-commits
mailing list