diff options
author | Havoc Pennington <hp@redhat.com> | 2003-04-13 08:33:10 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2003-04-13 08:33:10 +0000 |
commit | 8aabca8dd28a113712389be51e75ea8c2fd17838 (patch) | |
tree | bd16d89beab87b7c20354b47e0698e9be06176fe /dbus | |
parent | b09b7ca33cbaa7eae4f56b9cd699c8d0283dd754 (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')
-rw-r--r-- | dbus/dbus-sysdeps.c | 24 | ||||
-rw-r--r-- | dbus/dbus-sysdeps.h | 2 |
2 files changed, 26 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 diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h index 74e0cb61..4edfe94a 100644 --- a/dbus/dbus-sysdeps.h +++ b/dbus/dbus-sysdeps.h @@ -134,6 +134,8 @@ void _dbus_credentials_from_current_process (DBusCredentials *crede dbus_bool_t _dbus_credentials_match (const DBusCredentials *expected_credentials, const DBusCredentials *provided_credentials); +dbus_bool_t _dbus_get_user_id (const DBusString *username, + dbus_uid_t *uid); dbus_bool_t _dbus_string_append_our_uid (DBusString *str); dbus_bool_t _dbus_homedir_from_username (const DBusString *username, |