summaryrefslogtreecommitdiffstats
path: root/bus/services.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2004-11-07 17:05:19 +0000
committerColin Walters <walters@verbum.org>2004-11-07 17:05:19 +0000
commitcdac3e058b922431f387351fd8ebf60a764485d1 (patch)
treea92b8fa08c2657b6339d9590be5309ff627d1512 /bus/services.c
parenta14c43cf3ab7a2636146410e52be5e421fc0aaf9 (diff)
2004-11-07 Colin Walters <walters@verbum.org>
* bus/bus.c (load_config): Break into three separate functions: process_config_first_time_only, process_config_every_time, and process_config_postinit. (process_config_every_time): Move call of bus_registry_set_service_context_table into process_config_postinit. (process_config_postinit): New function, does any processing that needs to happen late in initialization (and also on reload). (bus_context_new): Instead of calling load_config, open config parser here and call process_config_first_time_only and process_config_every_time directly. Later, after we have forked but before changing UID, invoke bus_selinux_full_init, and then call process_config_postinit. (bus_context_reload_config): As in bus_context_new, load parse file inside here, and call process_config_every_time and process_config_postinit. * bus/services.h, bus/services.c (bus_registry_set_service_context_table): Rename from bus_registry_set_sid_table. Take string hash from config parser, and convert them here into SIDs. * bus/config-parser.c (struct BusConfigParser): Have config parser only store a mapping of service->context string. (merge_service_context_hash): New function. (merge_included): Merge context string hashes instead of using bus_selinux_id_table_union. (bus_config_parser_new): Don't use bus_selinux_id_table_new; simply create a new string hash. (bus_config_parser_unref): Unref it. (start_selinux_child): Simply insert strings into hash, don't call bus_selinux_id_table_copy_over. * bus/selinux.h, bus/selinux.c (bus_selinux_id_table_union) (bus_selinux_id_table_copy_over): Delete.
Diffstat (limited to 'bus/services.c')
-rw-r--r--bus/services.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/bus/services.c b/bus/services.c
index fb27ea0f..31041c37 100644
--- a/bus/services.c
+++ b/bus/services.c
@@ -417,17 +417,33 @@ bus_registry_acquire_service (BusRegistry *registry,
return retval;
}
-void
-bus_registry_set_service_sid_table (BusRegistry *registry,
- DBusHashTable *table)
+dbus_bool_t
+bus_registry_set_service_context_table (BusRegistry *registry,
+ DBusHashTable *table)
{
- _dbus_assert (registry->service_sid_table != table);
+ DBusHashTable *new_table;
+ DBusHashIter iter;
+
+ new_table = bus_selinux_id_table_new ();
+ if (!new_table)
+ return FALSE;
+
+ _dbus_hash_iter_init (table, &iter);
+ while (_dbus_hash_iter_next (&iter))
+ {
+ const char *service = _dbus_hash_iter_get_string_key (&iter);
+ const char *context = _dbus_hash_iter_get_value (&iter);
+
+ if (!bus_selinux_id_table_insert (new_table,
+ service,
+ context))
+ return FALSE;
+ }
if (registry->service_sid_table)
_dbus_hash_table_unref (registry->service_sid_table);
-
- registry->service_sid_table = table;
- _dbus_hash_table_ref (table);
+ registry->service_sid_table = new_table;
+ return TRUE;
}
static void