summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-sysdeps.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-04-13 08:33:10 +0000
committerHavoc Pennington <hp@redhat.com>2003-04-13 08:33:10 +0000
commit8aabca8dd28a113712389be51e75ea8c2fd17838 (patch)
treebd16d89beab87b7c20354b47e0698e9be06176fe /dbus/dbus-sysdeps.c
parentb09b7ca33cbaa7eae4f56b9cd699c8d0283dd754 (diff)
2003-04-13 Havoc Pennington <hp@pobox.com>
* bus/config-parser.c: Load up the BusPolicy and BusPolicyRules * dbus/dbus-sysdeps.c (_dbus_get_user_id): new function * bus/policy.c (bus_policy_append_mandatory_rule) (bus_policy_append_default_rule, bus_policy_append_user_rule) (bus_policy_append_group_rule): new functions
Diffstat (limited to 'dbus/dbus-sysdeps.c')
-rw-r--r--dbus/dbus-sysdeps.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c
index b941c19e..f706d08a 100644
--- a/dbus/dbus-sysdeps.c
+++ b/dbus/dbus-sysdeps.c
@@ -1478,6 +1478,30 @@ _dbus_credentials_from_username (const DBusString *username,
}
/**
+ * Gets user ID given username
+ *
+ * @param username the username
+ * @param uid return location for UID
+ * @returns #TRUE if username existed and we got the UID
+ */
+dbus_bool_t
+_dbus_get_user_id (const DBusString *username,
+ dbus_uid_t *uid)
+{
+ DBusCredentials creds;
+
+ if (!_dbus_credentials_from_username (username, &creds))
+ return FALSE;
+
+ if (creds.uid == DBUS_UID_UNSET)
+ return FALSE;
+
+ *uid = creds.uid;
+
+ return TRUE;
+}
+
+/**
* Gets the credentials corresponding to the given user ID.
*
* @param user_id the user ID