client: introduce auto-connect-display= following the scheme of auto-connect-localhost=

Just connecting to a PA server just because X11's $DISPLAY is set might
be a security hole.
This commit is contained in:
Lennart Poettering 2010-01-13 22:15:52 +01:00
parent 3d6cc026e2
commit 21cbcc1a8a
5 changed files with 19 additions and 7 deletions

View 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 */