+2007-07-24 Richard Hughes <richard@hughsie.com>
+
+ * bus/activation.c: (bus_activation_entry_unref),
+ (update_desktop_file_entry):
+ Add the concept of, and read the value of user from the desktop file.
+ The user string is not required unless we are using system activation.
+
2007-07-24 Richard Hughes <richard@hughsie.com>
* bus/activation.c:
int refcount;
char *name;
char *exec;
+ char *user;
unsigned long mtime;
BusServiceDirectory *s_dir;
char *filename;
dbus_free (entry->name);
dbus_free (entry->exec);
+ dbus_free (entry->user);
dbus_free (entry->filename);
dbus_free (entry);
BusDesktopFile *desktop_file,
DBusError *error)
{
- char *name, *exec;
+ char *name, *exec, *user;
BusActivationEntry *entry;
DBusStat stat_buf;
DBusString file_path;
+ DBusError tmp_error;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
name = NULL;
exec = NULL;
+ user = NULL;
entry = NULL;
+ dbus_error_init (&tmp_error);
+
if (!_dbus_string_init (&file_path))
{
BUS_SET_OOM (error);
error))
goto failed;
+ /* user is not _required_ unless we are using system activation */
+ if (!bus_desktop_file_get_string (desktop_file,
+ DBUS_SERVICE_SECTION,
+ DBUS_SERVICE_USER,
+ &user, &tmp_error))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
+ /* if we got OOM, then exit */
+ if (dbus_error_has_name (&tmp_error, DBUS_ERROR_NO_MEMORY))
+ {
+ dbus_move_error (&tmp_error, error);
+ goto failed;
+ }
+ else
+ {
+ /* if we have error because we didn't find anything then continue */
+ dbus_error_free (&tmp_error);
+ dbus_free (user);
+ user = NULL;
+ }
+ }
+ _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
+
entry = _dbus_hash_table_lookup_string (s_dir->entries,
_dbus_string_get_const_data (filename));
if (entry == NULL) /* New file */
entry->name = name;
entry->exec = exec;
+ entry->user = user;
entry->refcount = 1;
entry->s_dir = s_dir;
dbus_free (entry->name);
dbus_free (entry->exec);
+ dbus_free (entry->user);
entry->name = name;
entry->exec = exec;
+ entry->user = user;
if (!_dbus_hash_table_insert_string (activation->entries,
entry->name, bus_activation_entry_ref(entry)))
{
failed:
dbus_free (name);
dbus_free (exec);
+ dbus_free (user);
_dbus_string_free (&file_path);
if (entry)