summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-06-29 17:29:16 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-08-05 14:39:52 +0100
commit20e2dc7c74cd1e1232db56e4655de264d17aae6f (patch)
treea0d7ce1292e6a0c7ca979d5f8327d659c346757f
parentba2892396a6a3cfae7482e7d42d0a491eb2e723a (diff)
downloaddbus-20e2dc7c74cd1e1232db56e4655de264d17aae6f.tar.gz
_dbus_server_new_for_domain_socket: don't try to unlink abstract sockets
Our abstract socket names look like filenames (/tmp/dbus-MwozdykBNK or whatever), so if we incorrectly unlink the abstract socket name, in highly unlikely circumstances we could accidentally unlink a non-abstract socket belonging to another process! Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38656 Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
-rw-r--r--dbus/dbus-server-unix.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/dbus/dbus-server-unix.c b/dbus/dbus-server-unix.c
index 70ad9654..130f66ec 100644
--- a/dbus/dbus-server-unix.c
+++ b/dbus/dbus-server-unix.c
@@ -251,11 +251,18 @@ _dbus_server_new_for_domain_socket (const char *path,
goto failed_0;
}
- path_copy = _dbus_strdup (path);
- if (path_copy == NULL)
+ if (abstract)
{
- dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
- goto failed_0;
+ path_copy = NULL;
+ }
+ else
+ {
+ path_copy = _dbus_strdup (path);
+ if (path_copy == NULL)
+ {
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+ goto failed_0;
+ }
}
listen_fd = _dbus_listen_unix_socket (path, abstract, error);
@@ -273,7 +280,8 @@ _dbus_server_new_for_domain_socket (const char *path,
goto failed_2;
}
- _dbus_server_socket_own_filename(server, path_copy);
+ if (path_copy != NULL)
+ _dbus_server_socket_own_filename(server, path_copy);
_dbus_string_free (&address);