Main Page | Modules | Data Structures | Directories | File List | Data Fields | Related Pages

dbus-userdb.h

00001 /* -*- mode: C; c-file-style: "gnu" -*- */
00002 /* dbus-userdb.h User database abstraction
00003  * 
00004  * Copyright (C) 2003  Red Hat, Inc.
00005  *
00006  * Licensed under the Academic Free License version 2.1
00007  * 
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  * 
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 /* DBUS_USERDB_INCLUDES_PRIVATE */
00051 
00052 DBusUserDatabase* _dbus_user_database_new           (void);
00053 DBusUserDatabase* _dbus_user_database_ref           (DBusUserDatabase     *db);
00054 void              _dbus_user_database_unref         (DBusUserDatabase     *db);
00055 dbus_bool_t       _dbus_user_database_get_groups    (DBusUserDatabase     *db,
00056                                                      dbus_uid_t            uid,
00057                                                      dbus_gid_t          **group_ids,
00058                                                      int                  *n_group_ids,
00059                                                      DBusError            *error);
00060 dbus_bool_t       _dbus_user_database_get_uid       (DBusUserDatabase     *db,
00061                                                      dbus_uid_t            uid,
00062                                                      const DBusUserInfo  **info,
00063                                                      DBusError            *error);
00064 dbus_bool_t       _dbus_user_database_get_gid       (DBusUserDatabase     *db,
00065                                                      dbus_gid_t            gid,
00066                                                      const DBusGroupInfo **info,
00067                                                      DBusError            *error);
00068 dbus_bool_t       _dbus_user_database_get_username  (DBusUserDatabase     *db,
00069                                                      const DBusString     *username,
00070                                                      const DBusUserInfo  **info,
00071                                                      DBusError            *error);
00072 dbus_bool_t       _dbus_user_database_get_groupname (DBusUserDatabase     *db,
00073                                                      const DBusString     *groupname,
00074                                                      const DBusGroupInfo **info,
00075                                                      DBusError            *error);
00076 
00077 #ifdef DBUS_USERDB_INCLUDES_PRIVATE
00078 DBusUserInfo*  _dbus_user_database_lookup       (DBusUserDatabase *db,
00079                                                  dbus_uid_t        uid,
00080                                                  const DBusString *username,
00081                                                  DBusError        *error);
00082 DBusGroupInfo* _dbus_user_database_lookup_group (DBusUserDatabase *db,
00083                                                  dbus_gid_t        gid,
00084                                                  const DBusString *groupname,
00085                                                  DBusError        *error);
00086 void           _dbus_user_info_free_allocated   (DBusUserInfo     *info);
00087 void           _dbus_group_info_free_allocated  (DBusGroupInfo    *info);
00088 #endif /* DBUS_USERDB_INCLUDES_PRIVATE */
00089 
00090 DBusUserDatabase* _dbus_user_database_get_system    (void);
00091 void              _dbus_user_database_lock_system   (void);
00092 void              _dbus_user_database_unlock_system (void);
00093 
00094 dbus_bool_t _dbus_username_from_current_process (const DBusString **username);
00095 dbus_bool_t _dbus_homedir_from_current_process  (const DBusString **homedir);
00096 dbus_bool_t _dbus_homedir_from_username         (const DBusString  *username,
00097                                                  DBusString        *homedir);
00098 dbus_bool_t _dbus_get_user_id                   (const DBusString  *username,
00099                                                  dbus_uid_t        *uid);
00100 dbus_bool_t _dbus_get_group_id                  (const DBusString  *group_name,
00101                                                  dbus_gid_t        *gid);
00102 dbus_bool_t _dbus_credentials_from_username     (const DBusString  *username,
00103                                                  DBusCredentials   *credentials);
00104 dbus_bool_t _dbus_credentials_from_uid          (dbus_uid_t         user_id,
00105                                                  DBusCredentials   *credentials);
00106 dbus_bool_t _dbus_is_console_user               (dbus_uid_t         uid,
00107                                                  DBusError         *error);
00108 
00109 dbus_bool_t _dbus_is_a_number                   (const DBusString *str, 
00110                                                  unsigned long    *num);
00111 
00112 
00113 DBUS_END_DECLS
00114 
00115 #endif /* DBUS_USERDB_H */

Generated on Fri Sep 30 19:45:37 2005 for D-BUS by  doxygen 1.4.4