diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2010-12-07 02:16:14 +0100 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2010-12-10 08:43:43 +0100 |
commit | c29637ac6b85baf49e1174d4b16efec9f12a1458 (patch) | |
tree | 12be34724a5f3f65657a8f7d6769a5ab14494c40 | |
parent | 9b79817148af490361f81b2c1a10a6e4bbc99165 (diff) |
Implements user limited session bus on Windows.
This feature is enabled by using the session bus address
"autolaunch:scope=*user" for the client and the server.
Reviewed-by: Romain Pokrzywka
-rw-r--r-- | dbus/dbus-sysdeps-win.c | 65 |
1 files changed, 21 insertions, 44 deletions
diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index cf85e096..aca52858 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -2568,30 +2568,35 @@ _dbus_get_install_root_as_hash(DBusString *out) return TRUE; } - static dbus_bool_t -_dbus_get_shm_name(DBusString *out,const char *scope) +_dbus_get_address_string (DBusString *out, const char *basestring, const char *scope) { _dbus_string_init(out); - _dbus_string_append(out,cDBusDaemonAddressInfo); + _dbus_string_append(out,basestring); if (!scope) { return TRUE; } - else if (strcmp(scope,"install-path") == 0) + else if (strcmp(scope,"*install-path") == 0 + // for 1.3 compatibility + || strcmp(scope,"install-path") == 0) { DBusString temp; - if (!_dbus_get_install_root_as_hash(&temp)) { _dbus_string_free(out); return FALSE; } + } + else if (strcmp(scope,"*user") == 0) + { _dbus_string_append(out,"-"); - _dbus_string_append(out,_dbus_string_get_const_data(&temp)); - _dbus_string_free(&temp); - return TRUE; + if (!_dbus_append_user_from_current_process(out)) + { + _dbus_string_free(out); + return FALSE; + } } else if (strlen(scope) > 0) { @@ -2599,47 +2604,19 @@ _dbus_get_shm_name(DBusString *out,const char *scope) _dbus_string_append(out,scope); return TRUE; } - else - { - return TRUE; - } + return TRUE; } static dbus_bool_t -_dbus_get_mutex_name(DBusString *out,const char *scope) +_dbus_get_shm_name (DBusString *out,const char *scope) { - _dbus_string_init(out); - _dbus_string_append(out,cDBusDaemonMutex); - - if (!scope) - { - return TRUE; - } - else if (strcmp(scope,"install-path") == 0) - { - DBusString temp; - - if (!_dbus_get_install_root_as_hash(&temp)) - { - _dbus_string_free(out); - return FALSE; - } + return _dbus_get_address_string (out,cDBusDaemonAddressInfo,scope); +} - _dbus_string_append(out,"-"); - _dbus_string_append(out,_dbus_string_get_const_data(&temp)); - _dbus_string_free(&temp); - return TRUE; - } - else if (strlen(scope) > 0) - { - _dbus_string_append(out,"-"); - _dbus_string_append(out,scope); - return TRUE; - } - else - { - return TRUE; - } +static dbus_bool_t +_dbus_get_mutex_name (DBusString *out,const char *scope) +{ + return _dbus_get_address_string (out,cDBusDaemonMutex,scope); } dbus_bool_t |