um_data_structures.c File Reference

#include <linux/types.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/random.h>
#include <asm/uaccess.h>
#include <rsbac/types.h>
#include <rsbac/aci_data_structures.h>
#include <rsbac/um_types.h>
#include <rsbac/error.h>
#include <rsbac/helpers.h>
#include <rsbac/adf.h>
#include <rsbac/aci.h>
#include <rsbac/um.h>
#include <rsbac/lists.h>
#include <rsbac/proc_fs.h>
#include <rsbac/rkmem.h>
#include <rsbac/getname.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
#include <linux/delay.h>

Go to the source code of this file.

Defines

#define EXTRA_ROOM   20
#define offset_in_page(p)   ((unsigned long)(p) & ~PAGE_MASK)

Functions

static int user_hash (rsbac_uid_t user)
static int group_hash (rsbac_gid_t group)
static int name_compare (void *data1, void *data2)
static int group_name_compare (void *data1, void *data2)
int __init rsbac_init_um (void)
int rsbac_stats_um (void)
static void new_salt (__u32 *salt_p)
int rsbac_um_hash (char *pass, __u32 salt)
int rsbac_um_get_uid (rsbac_list_ta_number_t ta_number, char *name, rsbac_uid_t *uid_p)
int rsbac_um_get_gid (rsbac_list_ta_number_t ta_number, char *name, rsbac_gid_t *gid_p)
int rsbac_um_add_user (rsbac_list_ta_number_t ta_number, rsbac_uid_t user, struct rsbac_um_user_entry_t *entry_p, char *pass, rsbac_time_t ttl)
int rsbac_um_add_group (rsbac_list_ta_number_t ta_number, rsbac_gid_t group, struct rsbac_um_group_entry_t *entry_p, char *pass, rsbac_time_t ttl)
int rsbac_um_add_gm (rsbac_list_ta_number_t ta_number, rsbac_uid_t user, rsbac_gid_t group, rsbac_time_t ttl)
int rsbac_um_mod_user (rsbac_list_ta_number_t ta_number, rsbac_uid_t user, enum rsbac_um_mod_t mod, union rsbac_um_mod_data_t *data_p)
int rsbac_um_mod_group (rsbac_list_ta_number_t ta_number, rsbac_uid_t group, enum rsbac_um_mod_t mod, union rsbac_um_mod_data_t *data_p)
int rsbac_um_get_user_item (rsbac_list_ta_number_t ta_number, rsbac_uid_t user, enum rsbac_um_mod_t mod, union rsbac_um_mod_data_t *data_p)
int rsbac_um_get_group_item (rsbac_list_ta_number_t ta_number, rsbac_gid_t group, enum rsbac_um_mod_t mod, union rsbac_um_mod_data_t *data_p)
int rsbac_um_user_exists (rsbac_list_ta_number_t ta_number, rsbac_uid_t user)
int rsbac_um_group_exists (rsbac_list_ta_number_t ta_number, rsbac_gid_t group)
int rsbac_um_remove_user (rsbac_list_ta_number_t ta_number, rsbac_uid_t user)
int rsbac_um_remove_group (rsbac_list_ta_number_t ta_number, rsbac_gid_t group)
int rsbac_um_remove_gm (rsbac_list_ta_number_t ta_number, rsbac_uid_t user, rsbac_gid_t group)
int rsbac_um_get_user_entry (rsbac_list_ta_number_t ta_number, rsbac_uid_t user, struct rsbac_um_user_entry_t *entry_p, rsbac_time_t *ttl_p)
int rsbac_um_get_next_user (rsbac_list_ta_number_t ta_number, rsbac_uid_t old_user, rsbac_uid_t *next_user_p)
int rsbac_um_get_user_list (rsbac_list_ta_number_t ta_number, rsbac_uid_t **list_pp)
int rsbac_um_get_gm_list (rsbac_list_ta_number_t ta_number, rsbac_uid_t user, rsbac_gid_t **list_pp)
int rsbac_um_get_gm_user_list (rsbac_list_ta_number_t ta_number, rsbac_gid_t group, rsbac_uid_t **list_pp)
int rsbac_um_get_group_list (rsbac_list_ta_number_t ta_number, rsbac_gid_t **list_pp)
int rsbac_um_check_pass (rsbac_uid_t uid, char *pass)
int rsbac_um_set_pass (rsbac_uid_t uid, char *pass)
int rsbac_um_set_group_pass (rsbac_gid_t gid, char *pass)
int rsbac_um_check_account (rsbac_uid_t uid)

Variables

static rsbac_list_handle_t user_handle [RSBAC_UM_NR_USER_LISTS]
static rsbac_list_handle_t group_handle [RSBAC_UM_NR_GROUP_LISTS]


Define Documentation

#define EXTRA_ROOM   20
 

Definition at line 41 of file um_data_structures.c.

Referenced by rsbac_um_get_gm_user_list(), rsbac_um_get_group_list(), and rsbac_um_get_user_list().

#define offset_in_page  )     ((unsigned long)(p) & ~PAGE_MASK)
 

Definition at line 461 of file um_data_structures.c.

Referenced by rsbac_um_hash().


Function Documentation

static int group_hash rsbac_gid_t  group  )  [inline, static]
 

Definition at line 60 of file um_data_structures.c.

References RSBAC_UM_NR_GROUP_LISTS.

Referenced by rsbac_um_add_gm(), rsbac_um_add_group(), rsbac_um_add_user(), rsbac_um_get_gm_user_list(), rsbac_um_get_group_item(), rsbac_um_group_exists(), rsbac_um_mod_group(), rsbac_um_mod_user(), rsbac_um_remove_group(), and rsbac_um_set_group_pass().

static int group_name_compare void *  data1,
void *  data2
[static]
 

Definition at line 198 of file um_data_structures.c.

References rsbac_um_group_entry_t::name, and name.

Referenced by rsbac_um_get_gid().

static int name_compare void *  data1,
void *  data2
[static]
 

Definition at line 187 of file um_data_structures.c.

References rsbac_um_user_entry_t::name, and name.

Referenced by rsbac_um_get_uid().

static void new_salt __u32 *  salt_p  )  [inline, static]
 

Definition at line 464 of file um_data_structures.c.

Referenced by rsbac_um_add_group(), rsbac_um_add_user(), rsbac_um_mod_group(), rsbac_um_mod_user(), rsbac_um_set_group_pass(), and rsbac_um_set_pass().

int __init rsbac_init_um void   ) 
 

Definition at line 227 of file um_data_structures.c.

References get_error_name(), group_handle, name, NULL, proc_rsbac_root_p, RSBAC_EREINIT, rsbac_is_initialized(), rsbac_kmalloc(), RSBAC_LIST_BACKUP, rsbac_list_lol_register(), RSBAC_LIST_PERSIST, rsbac_list_register(), RSBAC_LIST_VERSION, RSBAC_MAXNAMELEN, RSBAC_UM_GROUP_LIST_KEY, RSBAC_UM_GROUP_LIST_NAME, RSBAC_UM_GROUP_LIST_VERSION, RSBAC_UM_USER_LIST_KEY, RSBAC_UM_USER_LIST_NAME, RSBAC_UM_USER_LIST_VERSION, and user_handle.

Referenced by rsbac_do_init().

int rsbac_stats_um void   ) 
 

Definition at line 392 of file um_data_structures.c.

References A_none, rsbac_attribute_value_t::dummy, group_handle, R_GET_STATUS_DATA, rsbac_adf_request(), RSBAC_ENOTINITIALIZED, rsbac_is_initialized(), rsbac_list_count(), rsbac_list_lol_all_subcount(), rsbac_list_lol_count(), rsbac_target_id_t::scd, ST_rsbac, T_SCD, and user_handle.

int rsbac_um_add_gm rsbac_list_ta_number_t  ta_number,
rsbac_uid_t  user,
rsbac_gid_t  group,
rsbac_time_t  ttl
 

Definition at line 715 of file um_data_structures.c.

References group_handle, group_hash(), NULL, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_is_initialized(), rsbac_ta_list_exist(), rsbac_ta_list_lol_subadd_ttl(), user_handle, and user_hash().

Referenced by sys_rsbac_um_add_gm().

int rsbac_um_add_group rsbac_list_ta_number_t  ta_number,
rsbac_gid_t  group,
struct rsbac_um_group_entry_t entry_p,
char *  pass,
rsbac_time_t  ttl
 

Definition at line 658 of file um_data_structures.c.

References group_handle, group_hash(), rsbac_um_group_entry_t::name, new_salt(), rsbac_um_group_entry_t::pass, RSBAC_EEXISTS, RSBAC_EINVALIDPOINTER, RSBAC_ENOTINITIALIZED, rsbac_is_initialized(), RSBAC_NO_USER, rsbac_ta_list_add_ttl(), rsbac_ta_list_exist(), rsbac_um_get_gid(), rsbac_um_hash(), and RSBAC_UM_PASS_LEN.

Referenced by sys_rsbac_um_add_group().

int rsbac_um_add_user rsbac_list_ta_number_t  ta_number,
rsbac_uid_t  user,
struct rsbac_um_user_entry_t entry_p,
char *  pass,
rsbac_time_t  ttl
 

Definition at line 583 of file um_data_structures.c.

References rsbac_um_user_entry_t::group, group_handle, group_hash(), rsbac_um_user_entry_t::name, new_salt(), rsbac_um_user_entry_t::pass, RSBAC_EEXISTS, RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, rsbac_is_initialized(), RSBAC_NO_USER, rsbac_ta_list_exist(), rsbac_ta_list_lol_add_ttl(), rsbac_ta_list_lol_exist(), rsbac_um_get_uid(), rsbac_um_hash(), RSBAC_UM_PASS_LEN, user_handle, and user_hash().

Referenced by sys_rsbac_um_add_user().

int rsbac_um_check_account rsbac_uid_t  uid  ) 
 

Definition at line 1649 of file um_data_structures.c.

References NULL, RSBAC_EEXPIRED, RSBAC_EMUSTCHANGE, RSBAC_ENOMEM, rsbac_kfree(), rsbac_kmalloc(), rsbac_ta_list_lol_get_data_ttl(), user_handle, and user_hash().

Referenced by sys_rsbac_um_check_account(), and sys_rsbac_um_check_account_name().

int rsbac_um_check_pass rsbac_uid_t  uid,
char *  pass
 

Definition at line 1452 of file um_data_structures.c.

References NULL, RSBAC_EEXPIRED, RSBAC_EINVALIDPOINTER, RSBAC_ENOMEM, rsbac_kfree(), rsbac_kmalloc(), rsbac_ta_list_lol_get_data_ttl(), rsbac_um_hash(), RSBAC_UM_PASS_LEN, user_handle, and user_hash().

Referenced by sys_rsbac_um_auth_name(), sys_rsbac_um_auth_uid(), and sys_rsbac_um_set_pass().

int rsbac_um_get_gid rsbac_list_ta_number_t  ta_number,
char *  name,
rsbac_gid_t gid_p
 

Definition at line 562 of file um_data_structures.c.

References group_handle, group_name_compare(), RSBAC_EINVALIDPOINTER, RSBAC_ENOTFOUND, and rsbac_ta_list_get_desc().

Referenced by rsbac_um_add_group(), rsbac_um_mod_group(), and sys_rsbac_um_get_gid().

int rsbac_um_get_gm_list rsbac_list_ta_number_t  ta_number,
rsbac_uid_t  user,
rsbac_gid_t **  list_pp
 

Definition at line 1329 of file um_data_structures.c.

References NULL, rsbac_ta_list_lol_get_all_subdesc_ttl(), rsbac_ta_list_lol_subcount(), user_handle, and user_hash().

Referenced by sys_rsbac_um_get_gm_list().

int rsbac_um_get_gm_user_list rsbac_list_ta_number_t  ta_number,
rsbac_gid_t  group,
rsbac_uid_t **  list_pp
 

Definition at line 1341 of file um_data_structures.c.

References EXTRA_ROOM, group_handle, group_hash(), RSBAC_ENOMEM, RSBAC_ENOTFOUND, rsbac_min, rsbac_ta_list_exist(), rsbac_ta_list_lol_count(), rsbac_ta_list_lol_get_all_desc(), rsbac_ta_list_lol_subexist(), rsbac_vfree, rsbac_vmalloc, and user_handle.

Referenced by sys_rsbac_um_get_gm_user_list().

int rsbac_um_get_group_item rsbac_list_ta_number_t  ta_number,
rsbac_gid_t  group,
enum rsbac_um_mod_t  mod,
union rsbac_um_mod_data_t data_p
 

Definition at line 1133 of file um_data_structures.c.

References group_handle, group_hash(), NULL, RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDREQUEST, RSBAC_ENOMEM, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_is_initialized(), rsbac_kfree(), rsbac_kmalloc(), rsbac_ta_list_exist(), rsbac_ta_list_get_data_ttl(), RSBAC_UM_PASS_LEN, rsbac_um_mod_data_t::string, rsbac_um_mod_data_t::ttl, UM_name, UM_pass, and UM_ttl.

Referenced by sys_rsbac_um_get_group_item().

int rsbac_um_get_group_list rsbac_list_ta_number_t  ta_number,
rsbac_gid_t **  list_pp
 

Definition at line 1403 of file um_data_structures.c.

References EXTRA_ROOM, group_handle, RSBAC_ENOMEM, rsbac_min, rsbac_ta_list_count(), rsbac_ta_list_get_all_desc(), rsbac_vfree, and rsbac_vmalloc.

Referenced by sys_rsbac_um_get_group_list().

int rsbac_um_get_next_user rsbac_list_ta_number_t  ta_number,
rsbac_uid_t  old_user,
rsbac_uid_t next_user_p
 

Definition at line 1257 of file um_data_structures.c.

References NULL, RSBAC_ENOTFOUND, RSBAC_NO_USER, rsbac_ta_list_lol_get_next_desc(), and user_handle.

Referenced by sys_rsbac_um_get_next_user().

int rsbac_um_get_uid rsbac_list_ta_number_t  ta_number,
char *  name,
rsbac_uid_t uid_p
 

Definition at line 541 of file um_data_structures.c.

References name_compare(), RSBAC_EINVALIDPOINTER, RSBAC_ENOTFOUND, rsbac_ta_list_lol_get_desc(), and user_handle.

Referenced by rsbac_um_add_user(), rsbac_um_mod_user(), sys_rsbac_um_auth_name(), sys_rsbac_um_check_account_name(), sys_rsbac_um_get_uid(), and sys_rsbac_um_set_pass_name().

int rsbac_um_get_user_entry rsbac_list_ta_number_t  ta_number,
rsbac_uid_t  user,
struct rsbac_um_user_entry_t entry_p,
rsbac_time_t ttl_p
 

Definition at line 1248 of file um_data_structures.c.

References rsbac_ta_list_lol_get_data_ttl(), user_handle, and user_hash().

int rsbac_um_get_user_item rsbac_list_ta_number_t  ta_number,
rsbac_uid_t  user,
enum rsbac_um_mod_t  mod,
union rsbac_um_mod_data_t data_p
 

Definition at line 1043 of file um_data_structures.c.

References rsbac_um_mod_data_t::days, rsbac_um_mod_data_t::group, NULL, RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDREQUEST, RSBAC_ENOMEM, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_is_initialized(), rsbac_kfree(), rsbac_kmalloc(), rsbac_ta_list_lol_exist(), rsbac_ta_list_lol_get_data_ttl(), RSBAC_UM_PASS_LEN, rsbac_um_mod_data_t::string, rsbac_um_mod_data_t::ttl, UM_expire, UM_fullname, UM_group, UM_homedir, UM_inactive, UM_lastchange, UM_maxchange, UM_minchange, UM_name, UM_pass, UM_shell, UM_ttl, UM_warnchange, user_handle, and user_hash().

Referenced by sys_rsbac_um_get_user_item().

int rsbac_um_get_user_list rsbac_list_ta_number_t  ta_number,
rsbac_uid_t **  list_pp
 

Definition at line 1280 of file um_data_structures.c.

References EXTRA_ROOM, RSBAC_ENOMEM, rsbac_min, rsbac_ta_list_lol_count(), rsbac_ta_list_lol_get_all_desc(), rsbac_vfree, rsbac_vmalloc, and user_handle.

Referenced by sys_rsbac_um_get_user_list().

int rsbac_um_group_exists rsbac_list_ta_number_t  ta_number,
rsbac_gid_t  group
 

Definition at line 1190 of file um_data_structures.c.

References group_handle, group_hash(), and rsbac_ta_list_exist().

Referenced by rsbac_adf_request_int(), and sys_rsbac_um_group_exists().

int rsbac_um_hash char *  pass,
__u32  salt
 

Definition at line 471 of file um_data_structures.c.

References offset_in_page, RSBAC_ENOMEM, RSBAC_ENOTFOUND, rsbac_kfree(), rsbac_kmalloc(), rsbac_max, and RSBAC_UM_PASS_LEN.

Referenced by rsbac_um_add_group(), rsbac_um_add_user(), rsbac_um_check_pass(), rsbac_um_mod_group(), rsbac_um_mod_user(), rsbac_um_set_group_pass(), and rsbac_um_set_pass().

int rsbac_um_mod_group rsbac_list_ta_number_t  ta_number,
rsbac_uid_t  group,
enum rsbac_um_mod_t  mod,
union rsbac_um_mod_data_t data_p
 

Definition at line 943 of file um_data_structures.c.

References group_handle, group_hash(), new_salt(), NULL, RSBAC_EEXISTS, RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDREQUEST, RSBAC_ENOMEM, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_is_initialized(), rsbac_kfree(), rsbac_kmalloc(), rsbac_ta_list_add_ttl(), rsbac_ta_list_exist(), rsbac_ta_list_get_data_ttl(), rsbac_um_get_gid(), rsbac_um_hash(), RSBAC_UM_NAME_LEN, RSBAC_UM_PASS_LEN, rsbac_um_mod_data_t::string, rsbac_um_mod_data_t::ttl, UM_cryptpass, UM_name, UM_pass, and UM_ttl.

Referenced by sys_rsbac_um_mod_group().

int rsbac_um_mod_user rsbac_list_ta_number_t  ta_number,
rsbac_uid_t  user,
enum rsbac_um_mod_t  mod,
union rsbac_um_mod_data_t data_p
 

Definition at line 781 of file um_data_structures.c.

References rsbac_um_mod_data_t::days, rsbac_um_mod_data_t::group, group_handle, group_hash(), new_salt(), NULL, RSBAC_EEXISTS, RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDREQUEST, RSBAC_EINVALIDVALUE, RSBAC_ENOMEM, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_is_initialized(), rsbac_kfree(), rsbac_kmalloc(), rsbac_ta_list_exist(), rsbac_ta_list_lol_add_ttl(), rsbac_ta_list_lol_exist(), rsbac_ta_list_lol_get_data_ttl(), RSBAC_UM_FULLNAME_LEN, rsbac_um_get_uid(), rsbac_um_hash(), RSBAC_UM_HOMEDIR_LEN, RSBAC_UM_NAME_LEN, RSBAC_UM_PASS_LEN, RSBAC_UM_SHELL_LEN, rsbac_um_mod_data_t::string, rsbac_um_mod_data_t::ttl, UM_cryptpass, UM_expire, UM_fullname, UM_group, UM_homedir, UM_inactive, UM_lastchange, UM_maxchange, UM_minchange, UM_name, UM_pass, UM_shell, UM_ttl, UM_warnchange, user_handle, and user_hash().

Referenced by sys_rsbac_um_mod_user().

int rsbac_um_remove_gm rsbac_list_ta_number_t  ta_number,
rsbac_uid_t  user,
rsbac_gid_t  group
 

Definition at line 1219 of file um_data_structures.c.

References RSBAC_ENOTINITIALIZED, rsbac_is_initialized(), rsbac_ta_list_lol_subremove(), user_handle, and user_hash().

Referenced by sys_rsbac_um_remove_gm().

int rsbac_um_remove_group rsbac_list_ta_number_t  ta_number,
rsbac_gid_t  group
 

Definition at line 1206 of file um_data_structures.c.

References group_handle, group_hash(), RSBAC_ENOTFOUND, rsbac_ta_list_exist(), rsbac_ta_list_lol_subremove_from_all(), rsbac_ta_list_remove(), and user_handle.

Referenced by sys_rsbac_um_remove_group().

int rsbac_um_remove_user rsbac_list_ta_number_t  ta_number,
rsbac_uid_t  user
 

Definition at line 1197 of file um_data_structures.c.

References RSBAC_ENOTFOUND, rsbac_ta_list_lol_exist(), rsbac_ta_list_lol_remove(), user_handle, and user_hash().

Referenced by sys_rsbac_um_remove_user().

int rsbac_um_set_group_pass rsbac_gid_t  gid,
char *  pass
 

Definition at line 1602 of file um_data_structures.c.

References group_handle, group_hash(), new_salt(), NULL, RSBAC_ENOMEM, rsbac_kfree(), rsbac_kmalloc(), rsbac_ta_list_add_ttl(), rsbac_ta_list_get_data_ttl(), rsbac_um_hash(), and RSBAC_UM_PASS_LEN.

Referenced by sys_rsbac_um_set_group_pass().

int rsbac_um_set_pass rsbac_uid_t  uid,
char *  pass
 

Definition at line 1553 of file um_data_structures.c.

References new_salt(), NULL, RSBAC_ENOMEM, rsbac_kfree(), rsbac_kmalloc(), rsbac_ta_list_lol_add_ttl(), rsbac_ta_list_lol_get_data_ttl(), rsbac_um_hash(), RSBAC_UM_PASS_LEN, user_handle, and user_hash().

Referenced by sys_rsbac_um_set_pass().

int rsbac_um_user_exists rsbac_list_ta_number_t  ta_number,
rsbac_uid_t  user
 

Definition at line 1183 of file um_data_structures.c.

References rsbac_ta_list_lol_exist(), user_handle, and user_hash().

Referenced by rsbac_adf_request_int(), and sys_rsbac_um_user_exists().

static int user_hash rsbac_uid_t  user  )  [inline, static]
 

Definition at line 55 of file um_data_structures.c.

References RSBAC_UM_NR_USER_LISTS.

Referenced by rsbac_um_add_gm(), rsbac_um_add_user(), rsbac_um_check_account(), rsbac_um_check_pass(), rsbac_um_get_gm_list(), rsbac_um_get_user_entry(), rsbac_um_get_user_item(), rsbac_um_mod_user(), rsbac_um_remove_gm(), rsbac_um_remove_user(), rsbac_um_set_pass(), and rsbac_um_user_exists().


Variable Documentation

rsbac_list_handle_t group_handle[RSBAC_UM_NR_GROUP_LISTS] [static]
 

Definition at line 39 of file um_data_structures.c.

rsbac_list_handle_t user_handle[RSBAC_UM_NR_USER_LISTS] [static]
 

Definition at line 38 of file um_data_structures.c.

Referenced by rsbac_init_um(), rsbac_stats_um(), rsbac_um_add_gm(), rsbac_um_add_user(), rsbac_um_check_account(), rsbac_um_check_pass(), rsbac_um_get_gm_list(), rsbac_um_get_gm_user_list(), rsbac_um_get_next_user(), rsbac_um_get_uid(), rsbac_um_get_user_entry(), rsbac_um_get_user_item(), rsbac_um_get_user_list(), rsbac_um_mod_user(), rsbac_um_remove_gm(), rsbac_um_remove_group(), rsbac_um_remove_user(), rsbac_um_set_pass(), and rsbac_um_user_exists().


Generated on Fri Jun 17 09:45:30 2005 for RSBAC by  doxygen 1.4.2