00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef DBUS_USERDB_H
00025 #define DBUS_USERDB_H
00026
00027 #include <dbus/dbus-sysdeps.h>
00028
00029 DBUS_BEGIN_DECLS
00030
00031 typedef struct DBusUserDatabase DBusUserDatabase;
00032
00033 #ifdef DBUS_USERDB_INCLUDES_PRIVATE
00034 #include <dbus/dbus-hash.h>
00035
00039 struct DBusUserDatabase
00040 {
00041 int refcount;
00043 DBusHashTable *users;
00044 DBusHashTable *groups;
00045 DBusHashTable *users_by_name;
00046 DBusHashTable *groups_by_name;
00048 };
00049
00050 #endif
00051
00052 DBusUserDatabase* _dbus_user_database_new (void);
00053 DBusUserDatabase* _dbus_user_database_ref (DBusUserDatabase *db);
00054 void _dbus_user_database_flush (DBusUserDatabase *db);
00055 void _dbus_user_database_unref (DBusUserDatabase *db);
00056 dbus_bool_t _dbus_user_database_get_groups (DBusUserDatabase *db,
00057 dbus_uid_t uid,
00058 dbus_gid_t **group_ids,
00059 int *n_group_ids,
00060 DBusError *error);
00061 dbus_bool_t _dbus_user_database_get_uid (DBusUserDatabase *db,
00062 dbus_uid_t uid,
00063 const DBusUserInfo **info,
00064 DBusError *error);
00065 dbus_bool_t _dbus_user_database_get_gid (DBusUserDatabase *db,
00066 dbus_gid_t gid,
00067 const DBusGroupInfo **info,
00068 DBusError *error);
00069 dbus_bool_t _dbus_user_database_get_username (DBusUserDatabase *db,
00070 const DBusString *username,
00071 const DBusUserInfo **info,
00072 DBusError *error);
00073 dbus_bool_t _dbus_user_database_get_groupname (DBusUserDatabase *db,
00074 const DBusString *groupname,
00075 const DBusGroupInfo **info,
00076 DBusError *error);
00077
00078 #ifdef DBUS_USERDB_INCLUDES_PRIVATE
00079 DBusUserInfo* _dbus_user_database_lookup (DBusUserDatabase *db,
00080 dbus_uid_t uid,
00081 const DBusString *username,
00082 DBusError *error);
00083 DBusGroupInfo* _dbus_user_database_lookup_group (DBusUserDatabase *db,
00084 dbus_gid_t gid,
00085 const DBusString *groupname,
00086 DBusError *error);
00087 void _dbus_user_info_free_allocated (DBusUserInfo *info);
00088 void _dbus_group_info_free_allocated (DBusGroupInfo *info);
00089 #endif
00090
00091 DBusUserDatabase* _dbus_user_database_get_system (void);
00092 void _dbus_user_database_lock_system (void);
00093 void _dbus_user_database_unlock_system (void);
00094
00095 dbus_bool_t _dbus_username_from_current_process (const DBusString **username);
00096 dbus_bool_t _dbus_homedir_from_current_process (const DBusString **homedir);
00097 dbus_bool_t _dbus_homedir_from_username (const DBusString *username,
00098 DBusString *homedir);
00099 dbus_bool_t _dbus_get_user_id (const DBusString *username,
00100 dbus_uid_t *uid);
00101 dbus_bool_t _dbus_get_group_id (const DBusString *group_name,
00102 dbus_gid_t *gid);
00103 dbus_bool_t _dbus_credentials_from_username (const DBusString *username,
00104 DBusCredentials *credentials);
00105 dbus_bool_t _dbus_credentials_from_uid (dbus_uid_t user_id,
00106 DBusCredentials *credentials);
00107 dbus_bool_t _dbus_is_console_user (dbus_uid_t uid,
00108 DBusError *error);
00109
00110 dbus_bool_t _dbus_is_a_number (const DBusString *str,
00111 unsigned long *num);
00112
00113
00114 DBUS_END_DECLS
00115
00116 #endif