summaryrefslogtreecommitdiffstats
path: root/bus/policy.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/policy.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/policy.c')
-rw-r--r--bus/policy.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/bus/policy.c b/bus/policy.c
index ad0cfaef..7d9b4b76 100644
--- a/bus/policy.c
+++ b/bus/policy.c
@@ -253,7 +253,7 @@ bus_policy_create_client_policy (BusPolicy *policy,
*/
if (_dbus_hash_table_get_n_entries (policy->rules_by_gid) > 0)
{
- const unsigned long *groups;
+ unsigned long *groups;
int n_groups;
int i;
@@ -271,11 +271,16 @@ bus_policy_create_client_policy (BusPolicy *policy,
if (list != NULL)
{
if (!add_list_to_client (list, client))
- goto failed;
+ {
+ dbus_free (groups);
+ goto failed;
+ }
}
++i;
}
+
+ dbus_free (groups);
}
if (!dbus_connection_get_unix_user (connection, &uid))
@@ -369,15 +374,17 @@ list_allows_user (dbus_bool_t def,
}
dbus_bool_t
-bus_policy_allow_user (BusPolicy *policy,
- unsigned long uid)
+bus_policy_allow_user (BusPolicy *policy,
+ DBusUserDatabase *user_database,
+ unsigned long uid)
{
dbus_bool_t allowed;
unsigned long *group_ids;
int n_group_ids;
/* On OOM or error we always reject the user */
- if (!_dbus_get_groups (uid, &group_ids, &n_group_ids, NULL))
+ if (!_dbus_user_database_get_groups (user_database,
+ uid, &group_ids, &n_group_ids, NULL))
{
_dbus_verbose ("Did not get any groups for UID %lu\n",
uid);