Skip to content

Commit

Permalink
session: Use D-Bus owner to create unique paths for sessions
Browse files Browse the repository at this point in the history
Two applications using '/foobar' as their notification path will both
end up with the same session path '/session/foobar'. When creating a
session the session path is used as the lookup key and an error is
returned if the session path already existed in the session hash
table. Fix this by using D-Bus owner information when creating the
unique session path.
  • Loading branch information
pfl committed Aug 19, 2013
1 parent d146379 commit 9857cd6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/session.c
Expand Up @@ -2085,7 +2085,8 @@ int __connman_session_create(DBusMessage *msg)
struct creation_data *creation_data = NULL;
bool user_allowed_bearers = false;
bool user_connection_type = false;
int err;
int err, i;
char *str;

owner = dbus_message_get_sender(msg);

Expand Down Expand Up @@ -2178,7 +2179,13 @@ int __connman_session_create(DBusMessage *msg)
goto err;
}

session_path = g_strdup_printf("/sessions%s", notify_path);
str = g_strdup(owner);
for (i = 0; str[i] != '\0'; i++)
if (str[i] == ':' || str[i] == '.')
str[i] = '_';
session_path = g_strdup_printf("/sessions/%s%s", str, notify_path);
g_free(str);

if (!session_path) {
err = -ENOMEM;
goto err;
Expand Down

0 comments on commit 9857cd6

Please sign in to comment.