2007-07-24 Richard Hughes <richard@hughsie.com>

* dbus/dbus-sysdeps-unix.c:
(_dbus_get_standard_system_servicedirs):
* dbus/dbus-sysdeps-win.c:
Provide a way to get the standard system servicedirs, just like we do
for the session service dirs. These should be seporate, as there may
be a security issue starting up some session stuff as root.
The use-case for the same binary starting up per-system _and_
per-session is also not valid.
This commit is contained in:
Richard Hughes 2007-07-24 11:44:35 +00:00
parent 837f60ae77
commit 227c67220b
3 changed files with 79 additions and 1 deletions

View file

@ -1,3 +1,14 @@
2007-07-24 Richard Hughes <richard@hughsie.com>
* dbus/dbus-sysdeps-unix.c:
(_dbus_get_standard_system_servicedirs):
* dbus/dbus-sysdeps-win.c:
Provide a way to get the standard system servicedirs, just like we do
for the session service dirs. These should be seporate, as there may
be a security issue starting up some session stuff as root.
The use-case for the same binary starting up per-system _and_
per-session is also not valid.
2007-07-24 Richard Hughes <richard@hughsie.com>
* bus/dbus-daemon.1.in:

View file

@ -2832,6 +2832,7 @@ _dbus_read_local_machine_uuid (DBusGUID *machine_id,
}
#define DBUS_UNIX_STANDARD_SESSION_SERVICEDIR "/dbus-1/services"
#define DBUS_UNIX_STANDARD_SYSTEM_SERVICEDIR "/dbus-1/system-services"
/**
@ -2921,6 +2922,72 @@ _dbus_get_standard_session_servicedirs (DBusList **dirs)
return FALSE;
}
/**
* Returns the standard directories for a system bus to look for service
* activation files
*
* On UNIX this should be the standard xdg freedesktop.org data directories:
*
* XDG_DATA_DIRS=${XDG_DATA_DIRS-/usr/local/share:/usr/share}
*
* and
*
* DBUS_DATADIR
*
* On Windows there is no system bus and this function can return nothing.
*
* @param dirs the directory list we are returning
* @returns #FALSE on OOM
*/
dbus_bool_t
_dbus_get_standard_system_servicedirs (DBusList **dirs)
{
const char *xdg_data_dirs;
DBusString servicedir_path;
if (!_dbus_string_init (&servicedir_path))
return FALSE;
xdg_data_dirs = _dbus_getenv ("XDG_DATA_DIRS");
if (xdg_data_dirs != NULL)
{
if (!_dbus_string_append (&servicedir_path, xdg_data_dirs))
goto oom;
if (!_dbus_string_append (&servicedir_path, ":"))
goto oom;
}
else
{
if (!_dbus_string_append (&servicedir_path, "/usr/local/share:/usr/share:"))
goto oom;
}
/*
* add configured datadir to defaults
* this may be the same as an xdg dir
* however the config parser should take
* care of duplicates
*/
if (!_dbus_string_append (&servicedir_path, DBUS_DATADIR":"))
goto oom;
if (!_dbus_split_paths_and_append (&servicedir_path,
DBUS_UNIX_STANDARD_SYSTEM_SERVICEDIR,
dirs))
goto oom;
_dbus_string_free (&servicedir_path);
return TRUE;
oom:
_dbus_string_free (&servicedir_path);
return FALSE;
}
/**
* Append the absolute path of the system.conf file
* (there is no system bus on Windows so this can just

View file

@ -3054,7 +3054,7 @@ _dbus_make_file_world_readable(const DBusString *filename,
#define DBUS_STANDARD_SESSION_SERVICEDIR "/dbus-1/services"
#define DBUS_STANDARD_SYSTEM_SERVICEDIR "/dbus-1/system-services"
/**
* Returns the standard directories for a session bus to look for service