Blame SOURCES/0001-X11-Add-xauthority-parameter.patch

6142c0
From 2bb1f0dbd0772ba57ede8837c2f3856b4e7198c0 Mon Sep 17 00:00:00 2001
6142c0
From: Wim Taymans <wtaymans@redhat.com>
6142c0
Date: Thu, 12 Sep 2019 09:49:40 +0200
6142c0
Subject: [PATCH 1/3] X11: Add xauthority parameter
6142c0
6142c0
Add an xauthority parameter and use it in the startup script.
6142c0
6142c0
Based on patch by Alexander Kurtz <kurtz.alex@googlemail.com>
6142c0
---
6142c0
 src/daemon/start-pulseaudio-x11.in        | 6 +++---
6142c0
 src/modules/x11/module-x11-bell.c         | 8 ++++++++
6142c0
 src/modules/x11/module-x11-cork-request.c | 8 ++++++++
6142c0
 src/modules/x11/module-x11-publish.c      | 8 ++++++++
6142c0
 src/modules/x11/module-x11-xsmp.c         | 8 ++++++++
6142c0
 5 files changed, 35 insertions(+), 3 deletions(-)
6142c0
6142c0
diff --git a/src/daemon/start-pulseaudio-x11.in b/src/daemon/start-pulseaudio-x11.in
6142c0
index 15c79e187..2afa88563 100755
6142c0
--- a/src/daemon/start-pulseaudio-x11.in
6142c0
+++ b/src/daemon/start-pulseaudio-x11.in
6142c0
@@ -22,14 +22,14 @@ set -e
6142c0
 
6142c0
 if [ x"$DISPLAY" != x ] ; then
6142c0
 
6142c0
-    @PACTL_BINARY@ load-module module-x11-publish "display=$DISPLAY" > /dev/null
6142c0
-    @PACTL_BINARY@ load-module module-x11-cork-request "display=$DISPLAY" > /dev/null
6142c0
+    @PACTL_BINARY@ load-module module-x11-publish "display=$DISPLAY xauthority=$XAUTHORITY" > /dev/null
6142c0
+    @PACTL_BINARY@ load-module module-x11-cork-request "display=$DISPLAY xauthority=$XAUTHORITY" > /dev/null
6142c0
 
6142c0
     if [ x"$KDE_FULL_SESSION" = x"true" ]; then
6142c0
        @PACTL_BINARY@ load-module module-device-manager "do_routing=1" > /dev/null
6142c0
     fi
6142c0
 
6142c0
     if [ x"$SESSION_MANAGER" != x ] ; then
6142c0
-	@PACTL_BINARY@ load-module module-x11-xsmp "display=$DISPLAY session_manager=$SESSION_MANAGER" > /dev/null
6142c0
+	@PACTL_BINARY@ load-module module-x11-xsmp "display=$DISPLAY xauthority=$XAUTHORITY session_manager=$SESSION_MANAGER" > /dev/null
6142c0
     fi
6142c0
 fi
6142c0
diff --git a/src/modules/x11/module-x11-bell.c b/src/modules/x11/module-x11-bell.c
6142c0
index 7b2be57bf..ec63c672f 100644
6142c0
--- a/src/modules/x11/module-x11-bell.c
6142c0
+++ b/src/modules/x11/module-x11-bell.c
6142c0
@@ -46,6 +46,7 @@ static const char* const valid_modargs[] = {
6142c0
     "sink",
6142c0
     "sample",
6142c0
     "display",
6142c0
+    "xauthority",
6142c0
     NULL
6142c0
 };
6142c0
 
6142c0
@@ -127,6 +128,13 @@ int pa__init(pa_module*m) {
6142c0
     u->sink_name = pa_xstrdup(pa_modargs_get_value(ma, "sink", NULL));
6142c0
     u->x11_client = NULL;
6142c0
 
6142c0
+    if (pa_modargs_get_value(ma, "xauthority", NULL)) {
6142c0
+        if (setenv("XAUTHORITY", pa_modargs_get_value(ma, "xauthority", NULL), 1)) {
6142c0
+            pa_log("setenv() for $XAUTHORITY failed");
6142c0
+            goto fail;
6142c0
+        }
6142c0
+    }
6142c0
+
6142c0
     if (!(u->x11_wrapper = pa_x11_wrapper_get(m->core, pa_modargs_get_value(ma, "display", NULL))))
6142c0
         goto fail;
6142c0
 
6142c0
diff --git a/src/modules/x11/module-x11-cork-request.c b/src/modules/x11/module-x11-cork-request.c
6142c0
index 5c76711f2..966907109 100644
6142c0
--- a/src/modules/x11/module-x11-cork-request.c
6142c0
+++ b/src/modules/x11/module-x11-cork-request.c
6142c0
@@ -48,6 +48,7 @@ PA_MODULE_USAGE("display=<X11 display>");
6142c0
 
6142c0
 static const char* const valid_modargs[] = {
6142c0
     "display",
6142c0
+    "xauthority",
6142c0
     NULL
6142c0
 };
6142c0
 
6142c0
@@ -130,6 +131,13 @@ int pa__init(pa_module *m) {
6142c0
     m->userdata = u = pa_xnew0(struct userdata, 1);
6142c0
     u->module = m;
6142c0
 
6142c0
+    if (pa_modargs_get_value(ma, "xauthority", NULL)) {
6142c0
+        if (setenv("XAUTHORITY", pa_modargs_get_value(ma, "xauthority", NULL), 1)) {
6142c0
+            pa_log("setenv() for $XAUTHORITY failed");
6142c0
+            goto fail;
6142c0
+        }
6142c0
+    }
6142c0
+
6142c0
     if (!(u->x11_wrapper = pa_x11_wrapper_get(m->core, pa_modargs_get_value(ma, "display", NULL))))
6142c0
         goto fail;
6142c0
 
6142c0
diff --git a/src/modules/x11/module-x11-publish.c b/src/modules/x11/module-x11-publish.c
6142c0
index 553b3417e..fcf306bef 100644
6142c0
--- a/src/modules/x11/module-x11-publish.c
6142c0
+++ b/src/modules/x11/module-x11-publish.c
6142c0
@@ -58,6 +58,7 @@ static const char* const valid_modargs[] = {
6142c0
     "sink",
6142c0
     "source",
6142c0
     "cookie",
6142c0
+    "xauthority",
6142c0
     NULL
6142c0
 };
6142c0
 
6142c0
@@ -158,6 +159,13 @@ int pa__init(pa_module*m) {
6142c0
     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)))
6142c0
         goto fail;
6142c0
 
6142c0
+    if (pa_modargs_get_value(ma, "xauthority", NULL)) {
6142c0
+        if (setenv("XAUTHORITY", pa_modargs_get_value(ma, "xauthority", NULL), 1)) {
6142c0
+            pa_log("setenv() for $XAUTHORITY failed");
6142c0
+            goto fail;
6142c0
+        }
6142c0
+    }
6142c0
+
6142c0
     if (!(u->x11_wrapper = pa_x11_wrapper_get(m->core, pa_modargs_get_value(ma, "display", NULL))))
6142c0
         goto fail;
6142c0
 
6142c0
diff --git a/src/modules/x11/module-x11-xsmp.c b/src/modules/x11/module-x11-xsmp.c
6142c0
index 29737c531..8f1d46ad3 100644
6142c0
--- a/src/modules/x11/module-x11-xsmp.c
6142c0
+++ b/src/modules/x11/module-x11-xsmp.c
6142c0
@@ -48,6 +48,7 @@ static bool ice_in_use = false;
6142c0
 static const char* const valid_modargs[] = {
6142c0
     "session_manager",
6142c0
     "display",
6142c0
+    "xauthority",
6142c0
     NULL
6142c0
 };
6142c0
 
6142c0
@@ -141,6 +142,13 @@ int pa__init(pa_module*m) {
6142c0
         goto fail;
6142c0
     }
6142c0
 
6142c0
+    if (pa_modargs_get_value(ma, "xauthority", NULL)) {
6142c0
+        if (setenv("XAUTHORITY", pa_modargs_get_value(ma, "xauthority", NULL), 1)) {
6142c0
+            pa_log("setenv() for $XAUTHORITY failed");
6142c0
+            goto fail;
6142c0
+        }
6142c0
+    }
6142c0
+
6142c0
     if (!(u->x11 = pa_x11_wrapper_get(m->core, pa_modargs_get_value(ma, "display", NULL))))
6142c0
         goto fail;
6142c0
 
6142c0
-- 
6142c0
2.21.0
6142c0