]> code.delx.au - pulseaudio/commitdiff
client: introduce auto-connect-display= following the scheme of auto-connect-localhost=
authorLennart Poettering <lennart@poettering.net>
Wed, 13 Jan 2010 21:15:52 +0000 (22:15 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 13 Jan 2010 21:15:52 +0000 (22:15 +0100)
Just connecting to a PA server just because X11's $DISPLAY is set might
be a security hole.

man/pulse-client.conf.5.xml.in
src/pulse/client-conf.c
src/pulse/client-conf.h
src/pulse/client.conf.in
src/pulse/context.c

index 349b51597777e8517a903f2df5b189d1584aeb4f..c2a847f3b8418ebdf7d99c230d8793610b3605d5 100644 (file)
@@ -116,6 +116,13 @@ USA.
       <opt>no</opt>.</p>
     </option>
 
+    <option>
+      <p><opt>auto-connect-display=</opt> Automatically try to connect
+      to the host X11's $DISPLAY variable is set to. The same security
+      issues apply as to <opt>auto-connect-localhost=</opt>. Defaults
+      to <opt>no</opt>.</p>
+    </option>
+
   </section>
 
   <section name="Authors">
index 6c97802b0840e20108bb1baf3f98a51a72234131..18fafe34889b76a7b39ce420ad72b6a3c88b357b 100644 (file)
@@ -63,7 +63,8 @@ static const pa_client_conf default_conf = {
     .cookie_file = NULL,
     .cookie_valid = FALSE,
     .shm_size = 0,
-    .auto_connect_localhost = FALSE
+    .auto_connect_localhost = FALSE,
+    .auto_connect_display = FALSE
 };
 
 pa_client_conf *pa_client_conf_new(void) {
@@ -107,6 +108,7 @@ int pa_client_conf_load(pa_client_conf *c, const char *filename) {
         { "enable-shm",             pa_config_parse_not_bool, &c->disable_shm, NULL },
         { "shm-size-bytes",         pa_config_parse_size,     &c->shm_size, NULL },
         { "auto-connect-localhost", pa_config_parse_bool,     &c->auto_connect_localhost, NULL },
+        { "auto-connect-display",   pa_config_parse_bool,     &c->auto_connect_display, NULL },
         { NULL,                     NULL,                     NULL, NULL },
     };
 
index 3bca8fdd7aa26055c420798b1999e2542007e18a..f281f4eba10722da262545910b8c8d9da950a5cd 100644 (file)
@@ -29,7 +29,7 @@
 
 typedef struct pa_client_conf {
     char *daemon_binary, *extra_arguments, *default_sink, *default_source, *default_server, *default_dbus_server, *cookie_file;
-    pa_bool_t autospawn, disable_shm, auto_connect_localhost;
+    pa_bool_t autospawn, disable_shm, auto_connect_localhost, auto_connect_display;
     uint8_t cookie[PA_NATIVE_COOKIE_LENGTH];
     pa_bool_t cookie_valid; /* non-zero, when cookie is valid */
     size_t shm_size;
index 090713ecb3b185b14eb6cb52e16d660a453e42b6..436747bcbd897081890c28789748631cd00e483d 100644 (file)
@@ -34,3 +34,4 @@
 ; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
 
 ; auto-connect-localhost = no
+; auto-connect-display = no
index 85b90ac7e6f35dcad21e46d791293e68ce8ac4a7..83e0dbb5514c879407f8863c50b4b5b8e6a1f3f2 100644 (file)
@@ -987,13 +987,15 @@ int pa_context_connect(
         /* Prepend in reverse order */
 
         /* Follow the X display */
-        if ((d = getenv("DISPLAY"))) {
-            d = pa_xstrndup(d, strcspn(d, ":"));
+        if (c->conf->auto_connect_display) {
+            if ((d = getenv("DISPLAY"))) {
+                d = pa_xstrndup(d, strcspn(d, ":"));
 
-            if (*d)
-                c->server_list = pa_strlist_prepend(c->server_list, d);
+                if (*d)
+                    c->server_list = pa_strlist_prepend(c->server_list, d);
 
-            pa_xfree(d);
+                pa_xfree(d);
+            }
         }
 
         /* Add TCP/IP on the localhost */