summaryrefslogtreecommitdiffstats
path: root/bus/bus.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-04-17 00:46:36 +0000
committerHavoc Pennington <hp@redhat.com>2003-04-17 00:46:36 +0000
commit7c022a80c9b8c5b085514ea49f983c0489e945ab (patch)
tree51d671c0bcbd9438ea3266f1d045c6d10033cd80 /bus/bus.c
parent4b45f17965f3262eb9b3bb49c015af79781c6882 (diff)
2003-04-15 Havoc Pennington <hp@pobox.com>
* bus/bus.c: create and keep around a shared DBusUserDatabase object. * bus/connection.c (bus_connection_get_groups): don't cache groups for user in the connection object, since user database object now does that.
Diffstat (limited to 'bus/bus.c')
-rw-r--r--bus/bus.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/bus/bus.c b/bus/bus.c
index 7b7ea6f1..385b3714 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -44,6 +44,7 @@ struct BusContext
BusActivation *activation;
BusRegistry *registry;
BusPolicy *policy;
+ DBusUserDatabase *user_database;
int activation_timeout; /**< How long to wait for an activation to time out */
int auth_timeout; /**< How long to wait for an authentication to time out */
int max_completed_connections; /**< Max number of authorized connections */
@@ -371,6 +372,13 @@ bus_context_new (const DBusString *config_file,
* DOS all the other users.
*/
context->max_completed_connections = 1024;
+
+ context->user_database = _dbus_user_database_new ();
+ if (context->user_database == NULL)
+ {
+ BUS_SET_OOM (error);
+ goto failed;
+ }
context->loop = _dbus_loop_new ();
if (context->loop == NULL)
@@ -733,6 +741,8 @@ bus_context_unref (BusContext *context)
dbus_free (context->pidfile);
}
+ _dbus_user_database_unref (context->user_database);
+
dbus_free (context);
server_data_slot_unref ();
@@ -776,11 +786,19 @@ bus_context_get_loop (BusContext *context)
return context->loop;
}
+DBusUserDatabase*
+bus_context_get_user_database (BusContext *context)
+{
+ return context->user_database;
+}
+
dbus_bool_t
bus_context_allow_user (BusContext *context,
unsigned long uid)
{
- return bus_policy_allow_user (context->policy, uid);
+ return bus_policy_allow_user (context->policy,
+ context->user_database,
+ uid);
}
BusClientPolicy*