/* returns true if good things happen, or if we get OOM */ static dbus_bool_t bus_activation_helper_oom_test (void *data, dbus_bool_t have_memory) { const char *service; DBusError error; dbus_bool_t retval; service = (const char *) data; retval = TRUE; dbus_error_init (&error); if (!run_launch_helper (service, &error)) { _DBUS_ASSERT_ERROR_IS_SET (&error); /* we failed, but a OOM is good */ if (!dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY)) { _dbus_warn ("FAILED SELF TEST: Error: %s", error.message); retval = FALSE; } dbus_error_free (&error); } else { /* we succeeded, yay! */ _DBUS_ASSERT_ERROR_IS_CLEAR (&error); } return retval; }
static dbus_bool_t launch_bus_name (const char *bus_name, BusConfigParser *parser, int alias_depth, DBusError *error) { BusDesktopFile *desktop_file; char *exec, *user, *alias; dbus_bool_t retval; exec = NULL; user = NULL; alias = NULL; retval = FALSE; /* get the correct service file for the name we are trying to activate */ desktop_file = desktop_file_for_name (parser, bus_name, error); if (desktop_file == NULL) return FALSE; /* get exec and user for service name */ if (!get_parameters_for_service (desktop_file, bus_name, &exec, &user, &alias, error)) goto finish; _dbus_verbose ("dbus-daemon-activation-helper: Name='%s'\n", bus_name); if (alias == NULL) { _dbus_verbose ("dbus-daemon-activation-helper: Exec='%s'\n", exec); _dbus_verbose ("dbus-daemon-activation-helper: User='******'\n", user); /* actually execute */ if (!exec_for_correct_user (exec, user, alias, error)) goto finish; } else { _dbus_verbose ("dbus-daemon-activation-helper: Alias='%s'\n", alias); if (alias_depth >= DBUS_ACTIVATION_MAX_ALIAS_DEPTH) { dbus_set_error (error, DBUS_ERROR_SPAWN_SETUP_FAILED, "Maximum recursion of aliased services reached."); goto finish; } /* execute the aliased service */ if (!run_launch_helper (alias, alias_depth, error)) goto finish; } retval = TRUE; finish: dbus_free (exec); dbus_free (user); dbus_free (alias); bus_desktop_file_free (desktop_file); return retval; }