summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTanu Kaskinen <ext-tanu.kaskinen@nokia.com>2010-03-17 13:35:01 +0200
committerTanu Kaskinen <ext-tanu.kaskinen@nokia.com>2010-05-10 14:08:55 +0300
commita976db7c49f1f44b7ca7104be12568f49c40943c (patch)
treefd8bcf7bc0bc63acc451d3e2666e0eaaee6ae085
parent2dcf378741cb69242a53a673ed170d6233551a98 (diff)
dbus: Make it possible to allow remote connections from outside localhost.
-rw-r--r--src/modules/dbus/module-dbus-protocol.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/modules/dbus/module-dbus-protocol.c b/src/modules/dbus/module-dbus-protocol.c
index acc6ca04..010732b8 100644
--- a/src/modules/dbus/module-dbus-protocol.c
+++ b/src/modules/dbus/module-dbus-protocol.c
@@ -48,7 +48,8 @@
PA_MODULE_DESCRIPTION("D-Bus interface");
PA_MODULE_USAGE(
"access=local|remote|local,remote "
- "tcp_port=<port number>");
+ "tcp_port=<port number> "
+ "tcp_listen=<hostname>");
PA_MODULE_LOAD_ONCE(TRUE);
PA_MODULE_AUTHOR("Tanu Kaskinen");
PA_MODULE_VERSION(PACKAGE_VERSION);
@@ -68,6 +69,7 @@ struct userdata {
pa_bool_t local_access;
pa_bool_t remote_access;
uint32_t tcp_port;
+ char *tcp_listen;
struct server *local_server;
struct server *tcp_server;
@@ -95,6 +97,7 @@ struct connection {
static const char* const valid_modargs[] = {
"access",
"tcp_port",
+ "tcp_listen",
NULL
};
@@ -452,7 +455,7 @@ static struct server *start_tcp_server(struct userdata *u) {
pa_assert(u);
- address = pa_sprintf_malloc("tcp:host=127.0.0.1,port=%u", u->tcp_port);
+ address = pa_sprintf_malloc("tcp:host=%s,port=%u", u->tcp_listen, u->tcp_port);
s = start_server(u, address, SERVER_TYPE_TCP); /* May return NULL */
@@ -537,6 +540,8 @@ int pa__init(pa_module *m) {
goto fail;
}
+ u->tcp_listen = pa_xstrdup(pa_modargs_get_value(ma, "tcp_listen", "0.0.0.0"));
+
if (u->local_access && !(u->local_server = start_local_server(u))) {
pa_log("Starting the local D-Bus server failed.");
goto fail;
@@ -602,6 +607,7 @@ void pa__done(pa_module *m) {
if (u->dbus_protocol)
pa_dbus_protocol_unref(u->dbus_protocol);
+ pa_xfree(u->tcp_listen);
pa_xfree(u);
m->userdata = NULL;
}