lists.h File Reference

#include <linux/init.h>
#include <linux/vmalloc.h>
#include <rsbac/rkmem.h>

Go to the source code of this file.

Defines

#define RSBAC_LIST_VERSION   3
#define RSBAC_LIST_MAX_FILENAME   15
#define RSBAC_LIST_MAX_AGE_LIMIT   (3600 * 24 * 366 * 10)
#define RSBAC_LIST_MAX_ITEM_SIZE   (RSBAC_MAX_KMALLOC - 64)
#define RSBAC_LIST_PERSIST   1
#define RSBAC_LIST_IGNORE_OLD   2
#define RSBAC_LIST_IGNORE_UNSUPP_VERSION   4
#define RSBAC_LIST_NO_WRITE   8
#define RSBAC_LIST_BACKUP   16
#define RSBAC_LIST_DEF_DATA   32
#define RSBAC_LIST_DEF_SUBDATA   64

Typedefs

typedef void * rsbac_list_handle_t
typedef __u32 rsbac_list_key_t
typedef int rsbac_list_compare_function_t (void *desc1, void *desc2)
typedef int rsbac_list_data_compare_function_t (void *data1, void *data2)
typedef int rsbac_list_conv_function_t (void *old_desc, void *old_data, void *new_desc, void *new_data)
typedef rsbac_list_conv_function_trsbac_list_get_conv_t (rsbac_version_t old_version)

Functions

int rsbac_list_compare_u32 (void *desc1, void *desc2)
rsbac_version_t rsbac_list_version (void)
int rsbac_list_register (rsbac_version_t ds_version, rsbac_list_handle_t *handle_p, struct rsbac_list_info_t *info_p, u_int flags, rsbac_list_compare_function_t *compare, rsbac_list_get_conv_t *get_conv, void *def_data, char *name, kdev_t device)
int rsbac_list_lol_register (rsbac_version_t ds_version, rsbac_list_handle_t *handle_p, struct rsbac_list_lol_info_t *info_p, u_int flags, rsbac_list_compare_function_t *compare, rsbac_list_compare_function_t *subcompare, rsbac_list_get_conv_t *get_conv, rsbac_list_get_conv_t *get_subconv, void *def_data, void *def_subdata, char *name, kdev_t device)
int rsbac_list_destroy (rsbac_list_handle_t *handle_p, rsbac_list_key_t key)
int rsbac_list_lol_destroy (rsbac_list_handle_t *handle_p, rsbac_list_key_t key)
int rsbac_list_detach (rsbac_list_handle_t *handle_p, rsbac_list_key_t key)
int rsbac_list_lol_detach (rsbac_list_handle_t *handle_p, rsbac_list_key_t key)
int rsbac_list_no_write (rsbac_list_handle_t handle, rsbac_list_key_t key, rsbac_boolean_t no_write)
int rsbac_list_lol_no_write (rsbac_list_handle_t handle, rsbac_list_key_t key, rsbac_boolean_t no_write)
int rsbac_list_check (rsbac_list_handle_t handle, int correct)
int rsbac_list_lol_check (rsbac_list_handle_t handle, int correct)
int rsbac_list_add (rsbac_list_handle_t handle, void *desc, void *data)
int rsbac_ta_list_add_ttl (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, rsbac_time_t ttl, void *desc, void *data)
int rsbac_list_add_ttl (rsbac_list_handle_t handle, rsbac_time_t ttl, void *desc, void *data)
int rsbac_ta_list_lol_subadd_ttl (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, rsbac_time_t ttl, void *desc, void *subdesc, void *subdata)
int rsbac_list_lol_subadd (rsbac_list_handle_t handle, void *desc, void *subdesc, void *subdata)
int rsbac_list_lol_subadd_ttl (rsbac_list_handle_t handle, rsbac_time_t ttl, void *desc, void *subdesc, void *subdata)
int rsbac_list_lol_add (rsbac_list_handle_t handle, void *desc, void *data)
int rsbac_ta_list_lol_add_ttl (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, rsbac_time_t ttl, void *desc, void *data)
int rsbac_list_lol_add_ttl (rsbac_list_handle_t handle, rsbac_time_t ttl, void *desc, void *data)
int rsbac_ta_list_remove (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc)
int rsbac_list_remove (rsbac_list_handle_t handle, void *desc)
int rsbac_ta_list_remove_all (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle)
int rsbac_list_remove_all (rsbac_list_handle_t handle)
int rsbac_ta_list_lol_subremove (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc, void *subdesc)
int rsbac_list_lol_subremove (rsbac_list_handle_t handle, void *desc, void *subdesc)
int rsbac_ta_list_lol_subremove_from_all (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *subdesc)
int rsbac_list_lol_subremove_from_all (rsbac_list_handle_t handle, void *subdesc)
int rsbac_ta_list_lol_subremove_all (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc)
int rsbac_list_lol_subremove_all (rsbac_list_handle_t handle, void *desc)
int rsbac_ta_list_lol_remove (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc)
int rsbac_list_lol_remove (rsbac_list_handle_t handle, void *desc)
int rsbac_ta_list_lol_remove_all (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle)
int rsbac_list_lol_remove_all (rsbac_list_handle_t handle)
int rsbac_list_get_data (rsbac_list_handle_t handle, void *desc, void *data)
int rsbac_ta_list_get_data_ttl (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, rsbac_time_t *ttl_p, void *desc, void *data)
int rsbac_list_get_data_ttl (rsbac_list_handle_t handle, rsbac_time_t *ttl_p, void *desc, void *data)
int rsbac_list_lol_get_subdata (rsbac_list_handle_t handle, void *desc, void *subdesc, void *subdata)
int rsbac_ta_list_lol_get_subdata_ttl (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, rsbac_time_t *ttl_p, void *desc, void *subdesc, void *subdata)
int rsbac_list_lol_get_subdata_ttl (rsbac_list_handle_t handle, rsbac_time_t *ttl_p, void *desc, void *subdesc, void *subdata)
int rsbac_list_lol_get_data (rsbac_list_handle_t handle, void *desc, void *data)
int rsbac_ta_list_lol_get_data_ttl (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, rsbac_time_t *ttl_p, void *desc, void *data)
int rsbac_list_lol_get_data_ttl (rsbac_list_handle_t handle, rsbac_time_t *ttl_p, void *desc, void *data)
int rsbac_ta_list_get_desc (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc, void *data, rsbac_list_data_compare_function_t compare)
int rsbac_list_get_desc (rsbac_list_handle_t handle, void *desc, void *data, rsbac_list_data_compare_function_t compare)
int rsbac_ta_list_lol_get_desc (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc, void *data, rsbac_list_data_compare_function_t compare)
int rsbac_list_lol_get_desc (rsbac_list_handle_t handle, void *desc, void *data, rsbac_list_data_compare_function_t compare)
int rsbac_ta_list_get_max_desc (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc)
int rsbac_list_get_max_desc (rsbac_list_handle_t handle, void *desc)
int rsbac_ta_list_get_next_desc (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *old_desc, void *next_desc)
int rsbac_list_get_next_desc (rsbac_list_handle_t handle, void *old_desc, void *next_desc)
int rsbac_ta_list_lol_get_next_desc (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *old_desc, void *next_desc)
int rsbac_list_lol_get_next_desc (rsbac_list_handle_t handle, void *old_desc, void *next_desc)
int rsbac_ta_list_exist (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc)
int rsbac_list_exist (rsbac_list_handle_t handle, void *desc)
int rsbac_ta_list_lol_subexist (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc, void *subdesc)
int rsbac_list_lol_subexist (rsbac_list_handle_t handle, void *desc, void *subdesc)
int rsbac_ta_list_lol_exist (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc)
int rsbac_list_lol_exist (rsbac_list_handle_t handle, void *desc)
int rsbac_ta_list_lol_subexist_compare (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc, void *subdesc, rsbac_list_compare_function_t compare)
int rsbac_list_lol_subexist_compare (rsbac_list_handle_t handle, void *desc, void *subdesc, rsbac_list_compare_function_t compare)
long rsbac_ta_list_count (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle)
long rsbac_list_count (rsbac_list_handle_t handle)
long rsbac_ta_list_lol_subcount (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc)
long rsbac_list_lol_subcount (rsbac_list_handle_t handle, void *desc)
long rsbac_ta_list_lol_all_subcount (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle)
long rsbac_list_lol_all_subcount (rsbac_list_handle_t handle)
long rsbac_ta_list_lol_count (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle)
long rsbac_list_lol_count (rsbac_list_handle_t handle)
long rsbac_ta_list_get_all_desc (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void **array_p)
long rsbac_list_get_all_desc (rsbac_list_handle_t handle, void **array_p)
long rsbac_list_lol_get_all_subdesc (rsbac_list_handle_t handle, void *desc, void **array_p)
long rsbac_ta_list_lol_get_all_subdesc_ttl (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc, void **array_p, rsbac_time_t **ttl_array_p)
long rsbac_list_lol_get_all_subdesc_ttl (rsbac_list_handle_t handle, void *desc, void **array_p, rsbac_time_t **ttl_array_p)
long rsbac_ta_list_lol_get_all_desc (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void **array_p)
long rsbac_list_lol_get_all_desc (rsbac_list_handle_t handle, void **array_p)
long rsbac_ta_list_get_all_data (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void **array_p)
long rsbac_list_get_all_data (rsbac_list_handle_t handle, void **array_p)
long rsbac_ta_list_lol_get_all_subdata (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc, void **array_p)
long rsbac_list_lol_get_all_subdata (rsbac_list_handle_t handle, void *desc, void **array_p)
long rsbac_ta_list_lol_get_all_data (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void **array_p)
long rsbac_list_lol_get_all_data (rsbac_list_handle_t handle, void **array_p)
int rsbac_list_get_item_size (rsbac_list_handle_t handle)
int rsbac_list_lol_get_subitem_size (rsbac_list_handle_t handle)
int rsbac_list_lol_get_item_size (rsbac_list_handle_t handle)
long rsbac_list_get_all_items (rsbac_list_handle_t handle, void **array_p)
long rsbac_ta_list_get_all_items_ttl (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void **array_p, rsbac_time_t **ttl_array_p)
long rsbac_list_get_all_items_ttl (rsbac_list_handle_t handle, void **array_p, rsbac_time_t **ttl_array_p)
long rsbac_list_lol_get_all_subitems (rsbac_list_handle_t handle, void *desc, void **array_p)
long rsbac_ta_list_lol_get_all_subitems_ttl (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void *desc, void **array_p, rsbac_time_t **ttl_array_p)
long rsbac_list_lol_get_all_subitems_ttl (rsbac_list_handle_t handle, void *desc, void **array_p, rsbac_time_t **ttl_array_p)
long rsbac_ta_list_lol_get_all_items (rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle, void **array_p)
long rsbac_list_lol_get_all_items (rsbac_list_handle_t handle, void **array_p)


Define Documentation

#define RSBAC_LIST_BACKUP   16
 

Definition at line 51 of file lists.h.

Referenced by init_module(), register_dev_lists(), register_user_lists(), rsbac_init_acl(), rsbac_init_pm(), rsbac_init_rc(), rsbac_init_um(), rsbac_list_destroy(), rsbac_list_detach(), rsbac_list_lol_destroy(), rsbac_list_lol_detach(), rsbac_list_lol_register(), and rsbac_list_register().

#define RSBAC_LIST_DEF_DATA   32
 

Definition at line 57 of file lists.h.

Referenced by acl_register_fd_lists(), auth_register_fd_lists(), create_lol_reg(), create_reg(), mac_register_fd_lists(), register_dev_lists(), register_fd_lists(), register_ipc_lists(), register_process_lists(), register_user_lists(), rsbac_check_lists(), rsbac_init_acl(), rsbac_init_auth(), rsbac_init_debug(), rsbac_init_mac(), rsbac_init_rc(), rsbac_list_lol_check(), rsbac_ta_list_lol_subadd_ttl(), rsbac_ta_list_lol_subremove(), and rsbac_ta_list_lol_subremove_all().

#define RSBAC_LIST_DEF_SUBDATA   64
 

Definition at line 62 of file lists.h.

Referenced by create_lol_reg(), and rsbac_init_rc().

#define RSBAC_LIST_IGNORE_OLD   2
 

Definition at line 39 of file lists.h.

Referenced by read_list(), and read_lol_list().

#define RSBAC_LIST_IGNORE_UNSUPP_VERSION   4
 

Definition at line 45 of file lists.h.

Referenced by read_list(), and read_lol_list().

#define RSBAC_LIST_MAX_AGE_LIMIT   (3600 * 24 * 366 * 10)
 

Definition at line 27 of file lists.h.

Referenced by rsbac_list_lol_register(), rsbac_list_register(), rsbac_ta_list_add_ttl(), rsbac_ta_list_lol_add_ttl(), and rsbac_ta_list_lol_subadd_ttl().

#define RSBAC_LIST_MAX_FILENAME   15
 

Definition at line 24 of file lists.h.

Referenced by create_lol_reg(), create_reg(), fill_buffer(), fill_lol_buffer(), lookup_lol_reg_name(), and lookup_reg_name().

#define RSBAC_LIST_MAX_ITEM_SIZE   (RSBAC_MAX_KMALLOC - 64)
 

Definition at line 30 of file lists.h.

Referenced by rsbac_list_lol_register(), and rsbac_list_register().

#define RSBAC_LIST_NO_WRITE   8
 

Definition at line 48 of file lists.h.

Referenced by create_lol_reg(), and create_reg().

#define RSBAC_LIST_PERSIST   1
 

Definition at line 36 of file lists.h.

Referenced by acl_register_fd_lists(), auth_register_fd_lists(), init_module(), mac_register_fd_lists(), register_dev_lists(), register_fd_lists(), register_user_lists(), rsbac_check_lists(), rsbac_init_acl(), rsbac_init_debug(), rsbac_init_pm(), rsbac_init_rc(), rsbac_init_um(), rsbac_list_destroy(), rsbac_list_detach(), rsbac_list_init(), rsbac_list_lol_destroy(), rsbac_list_lol_detach(), rsbac_list_lol_register(), and rsbac_list_register().

#define RSBAC_LIST_VERSION   3
 

Definition at line 18 of file lists.h.

Referenced by acl_register_fd_lists(), auth_register_fd_lists(), init_module(), mac_register_fd_lists(), register_dev_lists(), register_fd_lists(), register_ipc_lists(), register_process_lists(), register_user_lists(), rsbac_init_acl(), rsbac_init_auth(), rsbac_init_debug(), rsbac_init_mac(), rsbac_init_pm(), rsbac_init_rc(), rsbac_init_um(), rsbac_list_init(), rsbac_list_lol_register(), rsbac_list_register(), and rsbac_list_version().


Typedef Documentation

typedef int rsbac_list_compare_function_t(void *desc1, void *desc2)
 

Definition at line 73 of file lists.h.

typedef int rsbac_list_conv_function_t(void *old_desc, void *old_data, void *new_desc, void *new_data)
 

Definition at line 89 of file lists.h.

typedef int rsbac_list_data_compare_function_t(void *data1, void *data2)
 

Definition at line 84 of file lists.h.

typedef rsbac_list_conv_function_t* rsbac_list_get_conv_t(rsbac_version_t old_version)
 

Definition at line 98 of file lists.h.

typedef void* rsbac_list_handle_t
 

Definition at line 20 of file lists.h.

typedef __u32 rsbac_list_key_t
 

Definition at line 21 of file lists.h.


Function Documentation

int rsbac_list_add rsbac_list_handle_t  handle,
void *  desc,
void *  data
 

Definition at line 7099 of file gen_lists.c.

References RSBAC_LIST_TTL_KEEP, and rsbac_ta_list_add_ttl().

Referenced by need_overwrite_func(), register_user_lists(), request_func(), rsbac_adf_log_switch(), rsbac_do_init(), rsbac_init(), rsbac_init_acl(), rsbac_init_rc(), rsbac_kthread_notify(), set_attr_func(), syscall_func(), and write_func().

07103   {
07104     return rsbac_ta_list_add_ttl(0, handle, RSBAC_LIST_TTL_KEEP, desc, data);
07105   }

int rsbac_list_add_ttl rsbac_list_handle_t  handle,
rsbac_time_t  ttl,
void *  desc,
void *  data
 

Definition at line 7087 of file gen_lists.c.

References rsbac_ta_list_add_ttl().

Referenced by set_attr_fd().

07092   {
07093     return rsbac_ta_list_add_ttl(0, handle, ttl, desc, data);
07094   }

int rsbac_list_check rsbac_list_handle_t  handle,
int  correct
 

Definition at line 5651 of file gen_lists.c.

References rsbac_list_reg_item_t::count, rsbac_list_info_t::data_size, rsbac_list_reg_item_t::def_data, rsbac_list_info_t::desc_size, rsbac_list_reg_item_t::device, rsbac_list_reg_item_t::dirty, do_remove_item(), rsbac_list_reg_item_t::head, rsbac_list_reg_item_t::info, list_initialized, rsbac_list_reg_item_t::lock, rsbac_list_reg_head_t::lock, rsbac_list_item_t::max_age, rsbac_list_reg_item_t::name, rsbac_list_item_t::next, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, rsbac_printk(), rsbac_list_reg_item_t::self, and TRUE.

05654   {
05655     struct rsbac_list_reg_item_t * list;
05656     struct rsbac_list_item_t     * item_p;
05657     struct rsbac_list_item_t     * next_item_p;
05658     u_long lock_flags;
05659     u_long rlock_flags;
05660     u_long tmp_count;
05661 
05662     if(!handle)
05663       return -RSBAC_EINVALIDVALUE;
05664     if(!list_initialized)
05665       return -RSBAC_ENOTINITIALIZED;
05666 
05667     list = (struct rsbac_list_reg_item_t *) handle;
05668     if(!list || (list->self != list))
05669       return -RSBAC_EINVALIDVALUE;
05670 
05671     rsbac_read_lock(&reg_head.lock, &rlock_flags);
05672 #ifdef CONFIG_RSBAC_DEBUG
05673     if(rsbac_debug_lists)
05674       rsbac_printk(KERN_DEBUG "rsbac_list_check: checking list %s.\n",
05675              list->name);
05676 #endif
05677     rsbac_write_lock(&list->lock, &lock_flags);
05678     tmp_count = 0;
05679     item_p = list->head;
05680     while(item_p)
05681       {
05682         if(   (   item_p->max_age
05683                && (item_p->max_age <= RSBAC_CURRENT_TIME)
05684               )
05685            || (   list->def_data
05686                && !memcmp(((char *) item_p) + sizeof(*item_p) + list->info.desc_size,
05687                           list->def_data,
05688                           list->info.data_size)
05689               )
05690           )
05691           {
05692             next_item_p = item_p->next;
05693             do_remove_item(list, item_p);
05694             item_p = next_item_p;
05695             list->dirty = TRUE;
05696           }
05697         else
05698           {
05699             tmp_count++;
05700             item_p = item_p->next;
05701           }
05702       }
05703     if(tmp_count != list->count)
05704       {
05705         if(correct)
05706           {
05707             rsbac_printk(KERN_WARNING
05708                          "rsbac_list_check(): correcting count mismatch for list %s on device %02u:%02u - was %u, counted %lu!\n",
05709                          list->name, RSBAC_MAJOR(list->device), RSBAC_MINOR(list->device), list->count, tmp_count);
05710             list->count = tmp_count;
05711             list->dirty = TRUE;
05712           }
05713         else
05714           {
05715             rsbac_printk(KERN_WARNING
05716                          "rsbac_list_check(): count mismatch for list %s on device %02u:%02u - is %u, counted %lu!\n",
05717                          list->name, RSBAC_MAJOR(list->device), RSBAC_MINOR(list->device), list->count, tmp_count);
05718           }
05719       }
05720     rsbac_write_unlock(&list->lock, &lock_flags);
05721     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
05722     return 0;
05723   }

int rsbac_list_compare_u32 void *  desc1,
void *  desc2
 

Definition at line 5055 of file gen_lists.c.

Referenced by acl_register_fd_lists(), auth_register_fd_lists(), mac_register_fd_lists(), register_fd_lists(), register_process_lists(), register_user_lists(), rsbac_init_acl(), rsbac_init_pm(), rsbac_init_rc(), and rsbac_list_init().

05056   {
05057     if( *((__u32*) desc1) < *((__u32*) desc2))
05058       return -1;
05059     return( *((__u32*) desc1) != *((__u32*) desc2));
05060   }

long rsbac_list_count rsbac_list_handle_t  handle  ) 
 

Definition at line 9533 of file gen_lists.c.

References rsbac_ta_list_count().

Referenced by register_user_lists(), rsbac_check_acl(), rsbac_init_acl(), rsbac_init_rc(), rsbac_stats(), rsbac_stats_acl(), rsbac_stats_pm(), rsbac_stats_rc(), and rsbac_stats_um().

09534   {
09535     return rsbac_ta_list_count(0, handle);
09536   }

int rsbac_list_destroy rsbac_list_handle_t handle_p,
rsbac_list_key_t  key
 

Definition at line 6297 of file gen_lists.c.

References rsbac_list_reg_item_t::flags, rsbac_list_reg_item_t::info, rsbac_list_info_t::key, list_initialized, rsbac_list_reg_head_t::lock, lookup_reg(), rsbac_list_reg_item_t::name, NULL, proc_rsbac_backup_p, remove_reg(), RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, RSBAC_LIST_BACKUP, RSBAC_LIST_PERSIST, and rsbac_printk().

06298   {
06299     struct rsbac_list_reg_item_t * reg_item_p;
06300     u_long lock_flags;
06301     int err = 0;
06302 
06303     if(!handle_p)
06304       return -RSBAC_EINVALIDPOINTER;
06305     if(!*handle_p)
06306       return -RSBAC_EINVALIDVALUE;
06307     if(!list_initialized)
06308       return -RSBAC_ENOTINITIALIZED;
06309 
06310     rsbac_write_lock(&reg_head.lock, &lock_flags);
06311     reg_item_p = lookup_reg((struct rsbac_list_reg_item_t *) *handle_p);
06312     if(!reg_item_p)
06313       {
06314         rsbac_write_unlock(&reg_head.lock, &lock_flags);
06315         rsbac_printk(KERN_WARNING "rsbac_list_destroy: destroying list failed due to invalid handle!\n");
06316         return -RSBAC_EINVALIDVALUE;
06317       }
06318     if(reg_item_p->info.key != key)
06319       {
06320         rsbac_write_unlock(&reg_head.lock, &lock_flags);
06321         rsbac_printk(KERN_WARNING "rsbac_list_destroy: destroying list %s denied due to invalid key!\n",
06322                reg_item_p->name);
06323         return -EPERM;
06324       }
06325 #ifdef CONFIG_RSBAC_DEBUG
06326     if(rsbac_debug_lists)
06327       {
06328         rsbac_printk(KERN_DEBUG "rsbac_list_destroy: destroying list %s.\n",
06329                reg_item_p->name);
06330       }
06331 #endif
06332 #if defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS)
06333     /* delete proc entry, if it exists */
06334     if(   (reg_item_p->flags & RSBAC_LIST_BACKUP)
06335        && reg_item_p->proc_entry_p
06336       )
06337       {
06338         remove_proc_entry(reg_item_p->name, proc_rsbac_backup_p);
06339         reg_item_p->proc_entry_p = NULL;
06340       }
06341 #endif
06342 
06343 #if 0
06344     if(reg_item_p->flags & RSBAC_LIST_PERSIST)
06345       err = unlink_list(reg_item_p);
06346 #endif
06347 
06348     remove_reg(reg_item_p);
06349     *handle_p = NULL; 
06350     rsbac_write_unlock(&reg_head.lock, &lock_flags);
06351     return err;
06352   }

int rsbac_list_detach rsbac_list_handle_t handle_p,
rsbac_list_key_t  key
 

Definition at line 6419 of file gen_lists.c.

References rsbac_list_write_item_t::buflen, rsbac_list_write_head_t::count, rsbac_list_reg_item_t::dirty, FALSE, fill_buffer(), rsbac_list_reg_item_t::flags, rsbac_list_write_head_t::head, rsbac_list_reg_item_t::info, rsbac_list_info_t::key, list_initialized, rsbac_list_reg_head_t::lock, lookup_reg(), rsbac_list_reg_item_t::name, rsbac_list_reg_item_t::no_write, NULL, proc_rsbac_backup_p, remove_reg(), RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, RSBAC_ENOTWRITABLE, RSBAC_LIST_BACKUP, RSBAC_LIST_PERSIST, rsbac_list_write_buffers(), rsbac_printk(), rsbac_list_write_head_t::tail, rsbac_list_write_head_t::total, and TRUE.

Referenced by aci_detach_fd_lists(), cleanup_module(), and init_module().

06420   {
06421     struct rsbac_list_reg_item_t * reg_item_p;
06422     u_long lock_flags;
06423     int err = 0;
06424 
06425     if(!handle_p)
06426       return -RSBAC_EINVALIDPOINTER;
06427     if(!*handle_p)
06428       return -RSBAC_EINVALIDVALUE;
06429     if(!list_initialized)
06430       return -RSBAC_ENOTINITIALIZED;
06431 
06432     rsbac_read_lock(&reg_head.lock, &lock_flags);
06433     reg_item_p = lookup_reg((struct rsbac_list_reg_item_t *) *handle_p);
06434     if(!reg_item_p)
06435       {
06436         rsbac_read_unlock(&reg_head.lock, &lock_flags);
06437         rsbac_printk(KERN_WARNING "rsbac_list_detach: detaching list failed due to invalid handle!\n");
06438         return -RSBAC_EINVALIDVALUE;
06439       }
06440     if(reg_item_p->info.key != key)
06441       {
06442         rsbac_read_unlock(&reg_head.lock, &lock_flags);
06443         rsbac_printk(KERN_WARNING "rsbac_list_detach: detaching list %s denied due to invalid key %u!\n",
06444                reg_item_p->name,
06445                key);
06446         return -EPERM;
06447       }
06448 #if defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS)
06449     /* delete proc entry, if it exists */
06450     if(   (reg_item_p->flags & RSBAC_LIST_BACKUP)
06451        && reg_item_p->proc_entry_p
06452       )
06453       {
06454         remove_proc_entry(reg_item_p->name, proc_rsbac_backup_p);
06455         reg_item_p->proc_entry_p = NULL;
06456       }
06457 #endif
06458 #ifndef CONFIG_RSBAC_NO_WRITE
06459     /* final write, if dirty etc. */
06460     if(   (reg_item_p->flags & RSBAC_LIST_PERSIST)
06461        && reg_item_p->dirty
06462        && !reg_item_p->no_write
06463       )
06464       {
06465         struct rsbac_list_write_head_t       write_head;
06466         struct rsbac_list_write_item_t     * write_item_p;
06467 
06468         reg_item_p->dirty = FALSE;
06469         err = fill_buffer(reg_item_p, &write_item_p);
06470         if(!err)
06471           {
06472             write_head.head = write_item_p;
06473             write_head.tail = write_item_p;
06474             write_head.total = write_item_p->buflen;
06475             write_head.count = 1;
06476             rsbac_read_unlock(&reg_head.lock, &lock_flags);
06477             rsbac_list_write_buffers(write_head, TRUE);
06478           }
06479         else
06480           {
06481             rsbac_read_unlock(&reg_head.lock, &lock_flags);
06482             if(err != -RSBAC_ENOTWRITABLE)
06483               {
06484                 rsbac_printk(KERN_WARNING
06485                        "rsbac_list_detach(): fill_buffer() for list %s returned error %i\n",
06486                        reg_item_p->name, err);
06487               }
06488           }
06489       }
06490     else
06491       rsbac_read_unlock(&reg_head.lock, &lock_flags);
06492 #else
06493     rsbac_read_unlock(&reg_head.lock, &lock_flags);
06494 #endif
06495     /* disable handle */
06496     *handle_p = NULL; 
06497     /* too bad that the list might have been changed again - we do not care anymore */
06498     rsbac_write_lock(&reg_head.lock, &lock_flags);
06499     remove_reg(reg_item_p);
06500     rsbac_write_unlock(&reg_head.lock, &lock_flags);
06501     return err;
06502   }

int rsbac_list_exist rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 9058 of file gen_lists.c.

References rsbac_ta_list_exist().

Referenced by init_module(), rsbac_check_acl(), and rsbac_init_rc().

09061   {
09062     return rsbac_ta_list_exist(0, handle, desc);
09063   }

long rsbac_list_get_all_data rsbac_list_handle_t  handle,
void **  array_p
 

Definition at line 10039 of file gen_lists.c.

References rsbac_ta_list_get_all_data().

10042   {
10043     return rsbac_ta_list_get_all_data(0, handle, array_p);
10044   }

long rsbac_list_get_all_desc rsbac_list_handle_t  handle,
void **  array_p
 

Definition at line 9659 of file gen_lists.c.

References rsbac_ta_list_get_all_desc().

09662   {
09663     return rsbac_ta_list_get_all_desc(0, handle, array_p);
09664   }

long rsbac_list_get_all_items rsbac_list_handle_t  handle,
void **  array_p
 

Definition at line 10494 of file gen_lists.c.

References NULL, and rsbac_ta_list_get_all_items_ttl().

10495   {
10496     return rsbac_ta_list_get_all_items_ttl(0, handle, array_p, NULL);
10497   }

long rsbac_list_get_all_items_ttl rsbac_list_handle_t  handle,
void **  array_p,
rsbac_time_t **  ttl_array_p
 

Definition at line 10483 of file gen_lists.c.

References rsbac_ta_list_get_all_items_ttl().

10487   {
10488     return rsbac_ta_list_get_all_items_ttl(0, handle, array_p, ttl_array_p);
10489   }

int rsbac_list_get_data rsbac_list_handle_t  handle,
void *  desc,
void *  data
 

Definition at line 8320 of file gen_lists.c.

References NULL, and rsbac_ta_list_get_data_ttl().

Referenced by init_module(), rsbac_do_init(), rsbac_init(), and rsbac_init_debug().

08321   {
08322     return rsbac_ta_list_get_data_ttl(0, handle, NULL, desc, data);
08323   }

int rsbac_list_get_data_ttl rsbac_list_handle_t  handle,
rsbac_time_t ttl_p,
void *  desc,
void *  data
 

Definition at line 8309 of file gen_lists.c.

References rsbac_ta_list_get_data_ttl().

08313   {
08314     return rsbac_ta_list_get_data_ttl(0, handle, ttl_p, desc, data);
08315   }

int rsbac_list_get_desc rsbac_list_handle_t  handle,
void *  desc,
void *  data,
rsbac_list_data_compare_function_t  compare
 

Definition at line 8901 of file gen_lists.c.

References rsbac_ta_list_get_desc().

Referenced by rsbac_rc_get_boot_role().

08906   {
08907     return rsbac_ta_list_get_desc(0, handle, desc, data, compare);
08908   }

int rsbac_list_get_item_size rsbac_list_handle_t  handle  ) 
 

Definition at line 10287 of file gen_lists.c.

References rsbac_list_info_t::data_size, rsbac_list_info_t::desc_size, rsbac_list_reg_item_t::info, list_initialized, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, and rsbac_list_reg_item_t::self.

10288   {
10289     struct rsbac_list_reg_item_t * list;
10290 
10291     if(!handle)
10292       return -RSBAC_EINVALIDVALUE;
10293     if(!list_initialized)
10294       return -RSBAC_ENOTINITIALIZED;
10295 
10296     list = (struct rsbac_list_reg_item_t *) handle;
10297     if(list->self != list)
10298       return -RSBAC_EINVALIDVALUE;
10299     return list->info.desc_size + list->info.data_size;
10300   }

int rsbac_list_get_max_desc rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 8643 of file gen_lists.c.

References rsbac_ta_list_get_max_desc().

Referenced by rsbac_init_acl().

08644   {
08645     return rsbac_ta_list_get_max_desc(0, handle, desc);
08646   }

int rsbac_list_get_next_desc rsbac_list_handle_t  handle,
void *  old_desc,
void *  next_desc
 

Definition at line 8728 of file gen_lists.c.

References rsbac_ta_list_get_next_desc().

08729   {
08730     return rsbac_ta_list_get_next_desc(0, handle, old_desc, next_desc);
08731   }

int rsbac_list_lol_add rsbac_list_handle_t  handle,
void *  desc,
void *  data
 

Definition at line 7482 of file gen_lists.c.

References RSBAC_LIST_TTL_KEEP, and rsbac_ta_list_lol_add_ttl().

Referenced by rsbac_init_acl(), rsbac_init_rc(), rsbac_pm_pp_intersec(), and rsbac_pm_pp_union().

07486   {
07487     return rsbac_ta_list_lol_add_ttl(0, handle, RSBAC_LIST_TTL_KEEP, desc, data);
07488   }

int rsbac_list_lol_add_ttl rsbac_list_handle_t  handle,
rsbac_time_t  ttl,
void *  desc,
void *  data
 

Definition at line 7470 of file gen_lists.c.

References rsbac_ta_list_lol_add_ttl().

07475   {
07476     return rsbac_ta_list_lol_add_ttl(0, handle, ttl, desc, data);
07477   }

long rsbac_list_lol_all_subcount rsbac_list_handle_t  handle  ) 
 

Definition at line 9442 of file gen_lists.c.

References rsbac_ta_list_lol_all_subcount().

Referenced by rsbac_stats_acl(), rsbac_stats_auth(), rsbac_stats_mac(), rsbac_stats_pm(), and rsbac_stats_um().

09443   {
09444     return rsbac_ta_list_lol_all_subcount(0, handle);
09445   }

int rsbac_list_lol_check rsbac_list_handle_t  handle,
int  correct
 

Definition at line 5728 of file gen_lists.c.

References rsbac_list_lol_reg_item_t::count, rsbac_list_lol_item_t::count, rsbac_list_lol_info_t::data_size, rsbac_list_lol_reg_item_t::def_data, rsbac_list_lol_reg_item_t::def_subdata, rsbac_list_lol_info_t::desc_size, rsbac_list_lol_reg_item_t::device, do_remove_lol_item(), do_remove_lol_subitem(), rsbac_list_lol_reg_item_t::flags, rsbac_list_lol_reg_item_t::head, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, rsbac_list_item_t::max_age, rsbac_list_lol_item_t::max_age, rsbac_list_lol_reg_item_t::name, rsbac_list_item_t::next, rsbac_list_lol_item_t::next, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, RSBAC_LIST_DEF_DATA, rsbac_printk(), rsbac_list_lol_reg_item_t::self, rsbac_list_lol_info_t::subdata_size, and rsbac_list_lol_info_t::subdesc_size.

05731   {
05732     struct rsbac_list_lol_reg_item_t * lol_list;
05733     struct rsbac_list_lol_item_t     * lol_item_p;
05734     struct rsbac_list_lol_item_t     * next_lol_item_p;
05735     struct rsbac_list_item_t         * lol_subitem_p;
05736     struct rsbac_list_item_t         * next_lol_subitem_p;
05737     u_long lock_flags;
05738     u_long rlock_flags;
05739     u_long tmp_count;
05740     u_long tmp_subcount;
05741 
05742     if(!handle)
05743       return -RSBAC_EINVALIDVALUE;
05744     if(!list_initialized)
05745       return -RSBAC_ENOTINITIALIZED;
05746 
05747     lol_list = (struct rsbac_list_lol_reg_item_t *) handle;
05748     if(!lol_list || (lol_list->self != lol_list))
05749       return -RSBAC_EINVALIDVALUE;
05750 
05751     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
05752 #ifdef CONFIG_RSBAC_DEBUG
05753     if(rsbac_debug_lists)
05754       rsbac_printk(KERN_DEBUG "rsbac_list_lol_check: checking list %s.\n",
05755              lol_list->name);
05756 #endif
05757     rsbac_write_lock(&lol_list->lock, &lock_flags);
05758     tmp_count = 0;
05759     lol_item_p = lol_list->head;
05760     while(lol_item_p)
05761       {
05762         if(   (   lol_item_p->max_age
05763                && (lol_item_p->max_age <= RSBAC_CURRENT_TIME)
05764               )
05765            || (   lol_list->def_data
05766                && !lol_item_p->count
05767                && !memcmp(((char *) lol_item_p) + sizeof(*lol_item_p) + lol_list->info.desc_size,
05768                           lol_list->def_data,
05769                           lol_list->info.data_size)
05770               )
05771            || (   !lol_list->info.data_size
05772                && (lol_list->flags & RSBAC_LIST_DEF_DATA)
05773                && !lol_item_p->count
05774               )
05775           )
05776           {
05777             next_lol_item_p = lol_item_p->next;
05778             do_remove_lol_item(lol_list, lol_item_p);
05779             lol_item_p = next_lol_item_p;
05780           }
05781         else
05782           {
05783             tmp_count++;
05784             tmp_subcount = 0;
05785             lol_subitem_p = lol_item_p->head;
05786             while(lol_subitem_p)
05787               {
05788                 if(   (   lol_subitem_p->max_age
05789                        && (lol_subitem_p->max_age <= RSBAC_CURRENT_TIME)
05790                       )
05791                    || (   lol_list->def_subdata
05792                        && !memcmp(((char *) lol_subitem_p) + sizeof(*lol_subitem_p) + lol_list->info.subdesc_size,
05793                                   lol_list->def_subdata,
05794                                   lol_list->info.subdata_size)
05795                       )
05796                   )
05797                   {
05798                     next_lol_subitem_p = lol_subitem_p->next;
05799                     do_remove_lol_subitem(lol_item_p, lol_subitem_p);
05800                     lol_subitem_p = next_lol_subitem_p;
05801                   }
05802                 else
05803                   {
05804                     tmp_subcount++;
05805                     lol_subitem_p = lol_subitem_p->next;
05806                   }
05807               }
05808             if(tmp_subcount != lol_item_p->count)
05809               {
05810                 if(correct)
05811                   {
05812                      rsbac_printk(KERN_WARNING
05813                                   "rsbac_list_lol_check(): correcting count mismatch for list of lists %s sublist on %02u:%02u - was %lu, counted %lu!\n",
05814                                   lol_list->name, RSBAC_MAJOR(lol_list->device), RSBAC_MINOR(lol_list->device), lol_item_p->count, tmp_subcount);
05815                     lol_item_p->count = tmp_subcount;
05816                   }
05817                 else
05818                   {
05819                     rsbac_printk(KERN_WARNING
05820                                  "rsbac_list_lol_check(): count mismatch for list of lists %s sublist on %02u:%02u - is %lu, counted %lu!\n",
05821                                  lol_list->name, RSBAC_MAJOR(lol_list->device), RSBAC_MINOR(lol_list->device), lol_item_p->count, tmp_subcount);
05822                   }
05823               }
05824             lol_item_p = lol_item_p->next;
05825           }
05826       }
05827     if(tmp_count != lol_list->count)
05828       {
05829         if(correct)
05830           {
05831             rsbac_printk(KERN_WARNING
05832                          "rsbac_list_lol_check(): correcting count mismatch for list of lists %s on %02u:%02u - was %u, counted %lu!\n",
05833                          lol_list->name, RSBAC_MAJOR(lol_list->device), RSBAC_MINOR(lol_list->device), lol_list->count, tmp_count);
05834             lol_list->count = tmp_count;
05835           }
05836         else
05837           {
05838             rsbac_printk(KERN_WARNING
05839                          "rsbac_list_lol_check(): count mismatch for list of lists %s on %02u:%02u - is %u, counted %lu!\n",
05840                          lol_list->name, RSBAC_MAJOR(lol_list->device), RSBAC_MINOR(lol_list->device), lol_list->count, tmp_count);
05841           }
05842       }
05843     rsbac_write_unlock(&lol_list->lock, &lock_flags);
05844     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
05845     return 0;
05846   }

long rsbac_list_lol_count rsbac_list_handle_t  handle  ) 
 

Definition at line 9491 of file gen_lists.c.

References rsbac_ta_list_lol_count().

Referenced by rsbac_check_acl(), rsbac_init_acl(), rsbac_stats_acl(), rsbac_stats_auth(), rsbac_stats_mac(), rsbac_stats_pm(), and rsbac_stats_um().

09492   {
09493     return rsbac_ta_list_lol_count(0, handle);
09494   }

int rsbac_list_lol_destroy rsbac_list_handle_t handle_p,
rsbac_list_key_t  key
 

Definition at line 6357 of file gen_lists.c.

References rsbac_list_lol_reg_item_t::flags, rsbac_list_lol_reg_item_t::info, rsbac_list_lol_info_t::key, list_initialized, rsbac_list_lol_reg_head_t::lock, lookup_lol_reg(), rsbac_list_lol_reg_item_t::name, NULL, proc_rsbac_backup_p, remove_lol_reg(), RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, RSBAC_LIST_BACKUP, RSBAC_LIST_PERSIST, and rsbac_printk().

06358   {
06359     struct rsbac_list_lol_reg_item_t * reg_item_p;
06360     u_long lock_flags;
06361     int err = 0;
06362 
06363     if(!handle_p)
06364       return -RSBAC_EINVALIDPOINTER;
06365     if(!*handle_p)
06366       return -RSBAC_EINVALIDVALUE;
06367     if(!list_initialized)
06368       return -RSBAC_ENOTINITIALIZED;
06369 
06370     rsbac_write_lock(&lol_reg_head.lock, &lock_flags);
06371     reg_item_p = lookup_lol_reg((struct rsbac_list_lol_reg_item_t *) *handle_p);
06372     if(!reg_item_p)
06373       {
06374         rsbac_write_unlock(&lol_reg_head.lock, &lock_flags);
06375         rsbac_printk(KERN_WARNING "rsbac_list_lol_destroy: destroying list failed due to invalid handle!\n");
06376         return -RSBAC_EINVALIDVALUE;
06377       }
06378     if(reg_item_p->info.key != key)
06379       {
06380         rsbac_write_unlock(&lol_reg_head.lock, &lock_flags);
06381         rsbac_printk(KERN_WARNING "rsbac_list_lol_destroy: destroying list %s denied due to invalid key %u!\n",
06382                reg_item_p->name,
06383                key);
06384         return -EPERM;
06385       }
06386 #ifdef CONFIG_RSBAC_DEBUG
06387     if(rsbac_debug_lists)
06388       {
06389         rsbac_printk(KERN_DEBUG "rsbac_list_lol_destroy: destroying list %s.\n",
06390                reg_item_p->name);
06391       }
06392 #endif
06393 #if defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS)
06394     /* delete proc entry, if it exists */
06395     if(   (reg_item_p->flags & RSBAC_LIST_BACKUP)
06396        && reg_item_p->proc_entry_p
06397       )
06398       {
06399         remove_proc_entry(reg_item_p->name, proc_rsbac_backup_p);
06400         reg_item_p->proc_entry_p = NULL;
06401       }
06402 #endif
06403 #if 0
06404     if(reg_item_p->flags & RSBAC_LIST_PERSIST)
06405       err = unlink_lol_list(reg_item_p);
06406 #endif
06407 
06408     remove_lol_reg(reg_item_p);
06409     *handle_p = NULL; 
06410     rsbac_write_unlock(&lol_reg_head.lock, &lock_flags);
06411     return err;
06412   }

int rsbac_list_lol_detach rsbac_list_handle_t handle_p,
rsbac_list_key_t  key
 

Definition at line 6507 of file gen_lists.c.

References rsbac_list_lol_write_item_t::buflen, rsbac_list_lol_write_head_t::count, rsbac_list_lol_reg_item_t::dirty, FALSE, fill_lol_buffer(), rsbac_list_lol_reg_item_t::flags, rsbac_list_lol_write_head_t::head, rsbac_list_lol_reg_item_t::info, rsbac_list_lol_info_t::key, list_initialized, rsbac_list_lol_reg_head_t::lock, lookup_lol_reg(), rsbac_list_lol_reg_item_t::name, rsbac_list_lol_reg_item_t::no_write, NULL, proc_rsbac_backup_p, remove_lol_reg(), RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, RSBAC_ENOTWRITABLE, RSBAC_LIST_BACKUP, RSBAC_LIST_PERSIST, rsbac_list_write_lol_buffers(), rsbac_printk(), rsbac_list_lol_write_head_t::tail, rsbac_list_lol_write_head_t::total, and TRUE.

Referenced by acl_detach_fd_lists(), auth_detach_fd_lists(), and mac_detach_fd_lists().

06508   {
06509     struct rsbac_list_lol_reg_item_t * reg_item_p;
06510     u_long lock_flags;
06511     int err = 0;
06512 
06513     if(!handle_p)
06514       return -RSBAC_EINVALIDPOINTER;
06515     if(!*handle_p)
06516       return -RSBAC_EINVALIDVALUE;
06517     if(!list_initialized)
06518       return -RSBAC_ENOTINITIALIZED;
06519 
06520     rsbac_read_lock(&lol_reg_head.lock, &lock_flags);
06521     reg_item_p = lookup_lol_reg((struct rsbac_list_lol_reg_item_t *) *handle_p);
06522     if(!reg_item_p)
06523       {
06524         rsbac_read_unlock(&lol_reg_head.lock, &lock_flags);
06525         rsbac_printk(KERN_WARNING "rsbac_list_lol_detach: detaching list failed due to invalid handle!\n");
06526         return -RSBAC_EINVALIDVALUE;
06527       }
06528     if(reg_item_p->info.key != key)
06529       {
06530         rsbac_read_unlock(&lol_reg_head.lock, &lock_flags);
06531         rsbac_printk(KERN_WARNING "rsbac_list_lol_detach: detaching list %s denied due to invalid key %u!\n",
06532                reg_item_p->name,
06533                key);
06534         return -EPERM;
06535       }
06536 #if defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS)
06537     /* delete proc entry, if it exists */
06538     if(   (reg_item_p->flags & RSBAC_LIST_BACKUP)
06539        && reg_item_p->proc_entry_p
06540       )
06541       {
06542         remove_proc_entry(reg_item_p->name, proc_rsbac_backup_p);
06543         reg_item_p->proc_entry_p = NULL;
06544       }
06545 #endif
06546 #ifndef CONFIG_RSBAC_NO_WRITE
06547     /* final write, if dirty etc. */
06548     if(   (reg_item_p->flags & RSBAC_LIST_PERSIST)
06549        && reg_item_p->dirty
06550        && !reg_item_p->no_write
06551       )
06552       {
06553         struct rsbac_list_lol_write_head_t       write_head;
06554         struct rsbac_list_lol_write_item_t     * write_item_p;
06555 
06556         reg_item_p->dirty = FALSE;
06557         err = fill_lol_buffer(reg_item_p, &write_item_p);
06558         if(!err)
06559           {
06560             write_head.head = write_item_p;
06561             write_head.tail = write_item_p;
06562             write_head.total = write_item_p->buflen;
06563             write_head.count = 1;
06564             rsbac_read_unlock(&lol_reg_head.lock, &lock_flags);
06565             rsbac_list_write_lol_buffers(write_head, TRUE);
06566           }
06567         else
06568           {
06569             rsbac_read_unlock(&lol_reg_head.lock, &lock_flags);
06570             if(err != -RSBAC_ENOTWRITABLE)
06571               {
06572                 rsbac_printk(KERN_WARNING
06573                        "rsbac_list_lol_detach(): fill_buffer() for list %s returned error %i\n",
06574                        reg_item_p->name, err);
06575               }
06576           }
06577       }
06578     else
06579       rsbac_read_unlock(&lol_reg_head.lock, &lock_flags);
06580 #else
06581     rsbac_read_unlock(&lol_reg_head.lock, &lock_flags);
06582 #endif
06583     /* disable handle */
06584     *handle_p = NULL; 
06585     /* too bad that the list might have been changed again - we do not care anymore */
06586     rsbac_write_lock(&lol_reg_head.lock, &lock_flags);
06587     remove_lol_reg(reg_item_p);
06588     rsbac_write_unlock(&lol_reg_head.lock, &lock_flags);
06589     return err;
06590   }

int rsbac_list_lol_exist rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 9306 of file gen_lists.c.

References rsbac_ta_list_lol_exist().

Referenced by rsbac_pm_pp_intersec(), rsbac_pm_pp_subset(), rsbac_pm_pp_superset(), and rsbac_pm_pp_union().

09309   {
09310     return rsbac_ta_list_lol_exist(0, handle, desc);
09311   }

long rsbac_list_lol_get_all_data rsbac_list_handle_t  handle,
void **  array_p
 

Definition at line 10275 of file gen_lists.c.

References rsbac_ta_list_lol_get_all_data().

10278   {
10279     return rsbac_ta_list_lol_get_all_data(0, handle, array_p);
10280   }

long rsbac_list_lol_get_all_desc rsbac_list_handle_t  handle,
void **  array_p
 

Definition at line 9905 of file gen_lists.c.

References rsbac_ta_list_lol_get_all_desc().

Referenced by rsbac_check_acl(), and rsbac_init_rc().

09906   {
09907     return rsbac_ta_list_lol_get_all_desc(0, handle, array_p);
09908   }

long rsbac_list_lol_get_all_items rsbac_list_handle_t  handle,
void **  array_p
 

Definition at line 10735 of file gen_lists.c.

References rsbac_ta_list_lol_get_all_items().

10738   {
10739     return rsbac_ta_list_lol_get_all_items(0, handle, array_p);
10740   }

long rsbac_list_lol_get_all_subdata rsbac_list_handle_t  handle,
void *  desc,
void **  array_p
 

Definition at line 10143 of file gen_lists.c.

References rsbac_ta_list_lol_get_all_subdata().

10147   {
10148     return rsbac_ta_list_lol_get_all_subdata(0, handle, desc, array_p);
10149   }

long rsbac_list_lol_get_all_subdesc rsbac_list_handle_t  handle,
void *  desc,
void **  array_p
 

Definition at line 9784 of file gen_lists.c.

References NULL, and rsbac_ta_list_lol_get_all_subdesc_ttl().

Referenced by rsbac_check_acl(), rsbac_pm_pp_intersec(), rsbac_pm_pp_subset(), rsbac_pm_pp_superset(), and rsbac_pm_pp_union().

09785   {
09786     return rsbac_ta_list_lol_get_all_subdesc_ttl(0, handle,
09787                                                  desc, array_p, NULL);
09788   }

long rsbac_list_lol_get_all_subdesc_ttl rsbac_list_handle_t  handle,
void *  desc,
void **  array_p,
rsbac_time_t **  ttl_array_p
 

Definition at line 9768 of file gen_lists.c.

References rsbac_ta_list_lol_get_all_subdesc_ttl().

Referenced by copy_fp_cap_set_item(), copy_fp_tru_set_item(), copy_pp_cap_set_item_handle(), and copy_pp_tru_set_item_handle().

09773   {
09774     return rsbac_ta_list_lol_get_all_subdesc_ttl(0,
09775                                                  handle,
09776                                                  desc,
09777                                                  array_p,
09778                                                  ttl_array_p);
09779   }

long rsbac_list_lol_get_all_subitems rsbac_list_handle_t  handle,
void *  desc,
void **  array_p
 

Definition at line 10614 of file gen_lists.c.

References NULL, and rsbac_ta_list_lol_get_all_subitems_ttl().

10615   {
10616     return rsbac_ta_list_lol_get_all_subitems_ttl(0, handle, desc,
10617                                                   array_p, NULL);
10618   }

long rsbac_list_lol_get_all_subitems_ttl rsbac_list_handle_t  handle,
void *  desc,
void **  array_p,
rsbac_time_t **  ttl_array_p
 

Definition at line 10601 of file gen_lists.c.

References rsbac_ta_list_lol_get_all_subitems_ttl().

10606   {
10607     return rsbac_ta_list_lol_get_all_subitems_ttl(0, handle, desc,
10608                                                   array_p, ttl_array_p);
10609   }

int rsbac_list_lol_get_data rsbac_list_handle_t  handle,
void *  desc,
void *  data
 

Definition at line 8571 of file gen_lists.c.

References NULL, and rsbac_ta_list_lol_get_data_ttl().

08574   {
08575     return rsbac_ta_list_lol_get_data_ttl(0, handle, NULL, desc, data);
08576   }

int rsbac_list_lol_get_data_ttl rsbac_list_handle_t  handle,
rsbac_time_t ttl_p,
void *  desc,
void *  data
 

Definition at line 8560 of file gen_lists.c.

References rsbac_ta_list_lol_get_data_ttl().

08564   {
08565     return rsbac_ta_list_lol_get_data_ttl(0, handle, ttl_p, desc, data);
08566   }

int rsbac_list_lol_get_desc rsbac_list_handle_t  handle,
void *  desc,
void *  data,
rsbac_list_data_compare_function_t  compare
 

Definition at line 8982 of file gen_lists.c.

References rsbac_ta_list_lol_get_desc().

08987   {
08988     return rsbac_ta_list_lol_get_desc(0, handle, desc, data, compare);
08989   }

int rsbac_list_lol_get_item_size rsbac_list_handle_t  handle  ) 
 

Definition at line 10323 of file gen_lists.c.

References rsbac_list_lol_info_t::data_size, rsbac_list_lol_info_t::desc_size, rsbac_list_lol_reg_item_t::info, list_initialized, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, and rsbac_list_lol_reg_item_t::self.

10324   {
10325     struct rsbac_list_lol_reg_item_t * list;
10326 
10327     if(!handle)
10328       return -RSBAC_EINVALIDVALUE;
10329     if(!list_initialized)
10330       return -RSBAC_ENOTINITIALIZED;
10331 
10332     list = (struct rsbac_list_lol_reg_item_t *) handle;
10333     if(list->self != list)
10334       return -RSBAC_EINVALIDVALUE;
10335     return list->info.desc_size + list->info.data_size;
10336   }

int rsbac_list_lol_get_next_desc rsbac_list_handle_t  handle,
void *  old_desc,
void *  next_desc
 

Definition at line 8813 of file gen_lists.c.

References rsbac_ta_list_lol_get_next_desc().

08817   {
08818     return rsbac_ta_list_lol_get_next_desc(0, handle, old_desc, next_desc);
08819   }

int rsbac_list_lol_get_subdata rsbac_list_handle_t  handle,
void *  desc,
void *  subdesc,
void *  subdata
 

Definition at line 8455 of file gen_lists.c.

References NULL, and rsbac_ta_list_lol_get_subdata_ttl().

Referenced by rsbac_rc_check_comp().

08460   {
08461     return rsbac_ta_list_lol_get_subdata_ttl(0, handle, NULL, desc, subdesc, subdata);
08462   }

int rsbac_list_lol_get_subdata_ttl rsbac_list_handle_t  handle,
rsbac_time_t ttl_p,
void *  desc,
void *  subdesc,
void *  subdata
 

Definition at line 8441 of file gen_lists.c.

References rsbac_ta_list_lol_get_subdata_ttl().

08447   {
08448     return rsbac_ta_list_lol_get_subdata_ttl(0, handle,
08449                                              ttl_p, desc, subdesc, subdata);
08450   }

int rsbac_list_lol_get_subitem_size rsbac_list_handle_t  handle  ) 
 

Definition at line 10305 of file gen_lists.c.

References rsbac_list_lol_reg_item_t::info, list_initialized, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, rsbac_list_lol_reg_item_t::self, rsbac_list_lol_info_t::subdata_size, and rsbac_list_lol_info_t::subdesc_size.

Referenced by rsbac_rc_copy_role().

10306   {
10307     struct rsbac_list_lol_reg_item_t * list;
10308 
10309     if(!handle)
10310       return -RSBAC_EINVALIDVALUE;
10311     if(!list_initialized)
10312       return -RSBAC_ENOTINITIALIZED;
10313 
10314     list = (struct rsbac_list_lol_reg_item_t *) handle;
10315     if(list->self != list)
10316       return -RSBAC_EINVALIDVALUE;
10317     return list->info.subdesc_size + list->info.subdata_size;
10318   }

int rsbac_list_lol_no_write rsbac_list_handle_t  handle,
rsbac_list_key_t  key,
rsbac_boolean_t  no_write
 

Definition at line 6635 of file gen_lists.c.

References FALSE, rsbac_list_lol_reg_item_t::info, rsbac_list_lol_info_t::key, list_initialized, rsbac_list_lol_reg_head_t::lock, lookup_lol_reg(), rsbac_list_lol_reg_item_t::name, rsbac_list_lol_reg_item_t::no_write, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, rsbac_printk(), and TRUE.

06636   {
06637     struct rsbac_list_lol_reg_item_t * reg_item_p;
06638     u_long lock_flags;
06639 
06640     if(   !handle
06641        || (   (no_write != FALSE )
06642            && (no_write != TRUE )
06643           )
06644       )
06645       return -RSBAC_EINVALIDVALUE;
06646     if(!list_initialized)
06647       return -RSBAC_ENOTINITIALIZED;
06648 
06649     rsbac_read_lock(&lol_reg_head.lock, &lock_flags);
06650     reg_item_p = lookup_lol_reg((struct rsbac_list_lol_reg_item_t *) handle);
06651     if(!reg_item_p)
06652       {
06653         rsbac_read_unlock(&lol_reg_head.lock, &lock_flags);
06654         rsbac_printk(KERN_WARNING "rsbac_list_lol_no_write: setting no_write for list denied due to invalid handle!\n");
06655         return -RSBAC_EINVALIDVALUE;
06656       }
06657     if(reg_item_p->info.key != key)
06658       {
06659         rsbac_read_unlock(&lol_reg_head.lock, &lock_flags);
06660         rsbac_printk(KERN_WARNING "rsbac_list_lol_no_write: setting no_write for list %s denied due to invalid key %u!\n",
06661                reg_item_p->name,
06662                key);
06663         return -EPERM;
06664       }
06665     reg_item_p->no_write = no_write;
06666     rsbac_read_unlock(&lol_reg_head.lock, &lock_flags);
06667     return 0;
06668   }

int rsbac_list_lol_register rsbac_version_t  ds_version,
rsbac_list_handle_t handle_p,
struct rsbac_list_lol_info_t info_p,
u_int  flags,
rsbac_list_compare_function_t compare,
rsbac_list_compare_function_t subcompare,
rsbac_list_get_conv_t get_conv,
rsbac_list_get_conv_t get_subconv,
void *  def_data,
void *  def_subdata,
char *  name,
kdev_t  device
 

Definition at line 6108 of file gen_lists.c.

References add_lol_reg(), clear_lol_reg(), create_lol_reg(), rsbac_list_lol_info_t::data_size, rsbac_list_lol_info_t::desc_size, get_error_name(), rsbac_list_lol_info_t::key, list_initialized, rsbac_list_reg_head_t::lock, rsbac_list_lol_reg_head_t::lock, lookup_lol_reg_name(), lookup_reg_name(), rsbac_list_lol_info_t::max_age, rsbac_list_lol_reg_item_t::name, NULL, proc_rsbac_backup_p, read_lol_list(), RSBAC_ECOULDNOTADDITEM, RSBAC_EEXISTS, RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDVALUE, RSBAC_EINVALIDVERSION, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_kfree(), rsbac_kmalloc(), RSBAC_LIST_BACKUP, RSBAC_LIST_MAX_AGE_LIMIT, RSBAC_LIST_MAX_ITEM_SIZE, RSBAC_LIST_PERSIST, RSBAC_LIST_VERSION, RSBAC_MAXNAMELEN, rsbac_printk(), rsbac_root_dev, rsbac_list_lol_info_t::subdata_size, rsbac_list_lol_info_t::subdesc_size, and rsbac_list_lol_info_t::version.

Referenced by acl_register_fd_lists(), auth_register_fd_lists(), mac_register_fd_lists(), rsbac_init_acl(), rsbac_init_auth(), rsbac_init_mac(), rsbac_init_pm(), rsbac_init_rc(), and rsbac_init_um().

06121   {
06122     struct rsbac_list_lol_reg_item_t * reg_item_p;
06123     struct rsbac_list_lol_reg_item_t * new_reg_item_p;
06124     u_long lock_flags;
06125     int    err = 0;
06126 
06127     if(ds_version != RSBAC_LIST_VERSION)
06128       return -RSBAC_EINVALIDVERSION;
06129     if(!handle_p)
06130       return -RSBAC_EINVALIDPOINTER;
06131     *handle_p = NULL;
06132     if(!info_p->key || !info_p->version || !info_p->desc_size)
06133       return -RSBAC_EINVALIDVALUE;
06134     if(info_p->max_age > RSBAC_LIST_MAX_AGE_LIMIT)
06135       return -RSBAC_EINVALIDVALUE;
06136     if(info_p->desc_size + info_p->data_size > RSBAC_LIST_MAX_ITEM_SIZE)
06137       return -RSBAC_EINVALIDVALUE;
06138     if(info_p->subdesc_size + info_p->subdata_size > RSBAC_LIST_MAX_ITEM_SIZE)
06139       return -RSBAC_EINVALIDVALUE;
06140     if(!list_initialized)
06141       return -RSBAC_ENOTINITIALIZED;
06142     if(name)
06143       {
06144         struct rsbac_list_reg_item_t     * std_reg_item_p;
06145 
06146         rsbac_read_lock(&lol_reg_head.lock, &lock_flags);
06147         reg_item_p = lookup_lol_reg_name(name, device);
06148         rsbac_read_unlock(&lol_reg_head.lock, &lock_flags);
06149         if(reg_item_p)
06150           {
06151 #ifdef CONFIG_RSBAC_DEBUG
06152             if(rsbac_debug_lists)
06153               {
06154                 rsbac_printk(KERN_DEBUG "rsbac_list_lol_register: list name %s already exists on device %02u:%02u!\n",
06155                        name, RSBAC_MAJOR(device), RSBAC_MINOR(device));
06156               }
06157 #endif
06158             return -RSBAC_EEXISTS;
06159           }
06160         rsbac_read_lock(&reg_head.lock, &lock_flags);
06161         std_reg_item_p = lookup_reg_name(name, device);
06162         rsbac_read_unlock(&reg_head.lock, &lock_flags);
06163         if(std_reg_item_p)
06164           {
06165 #ifdef CONFIG_RSBAC_DEBUG
06166             if(rsbac_debug_lists)
06167               {
06168                 rsbac_printk(KERN_DEBUG "rsbac_list_register: list name %s already exists on device %02u:%02u!\n",
06169                        name, RSBAC_MAJOR(device), RSBAC_MINOR(device));
06170               }
06171 #endif
06172             return -RSBAC_EEXISTS;
06173           }
06174       }
06175     else
06176       if(flags & RSBAC_LIST_PERSIST)
06177         {
06178           rsbac_printk(KERN_WARNING
06179                  "rsbac_list_lol_register: trial to register persistent list of lists without name.\n");
06180           return -RSBAC_EINVALIDVALUE;
06181         }
06182 
06183     if(flags & RSBAC_LIST_PERSIST)
06184       {
06185         if(RSBAC_IS_AUTO_DEV(device))
06186           device = rsbac_root_dev;
06187         if(!RSBAC_MAJOR(device))
06188           flags &= ~RSBAC_LIST_PERSIST;
06189       }
06190 
06191 #ifdef CONFIG_RSBAC_DEBUG
06192     if(rsbac_debug_lists)
06193       {
06194         rsbac_printk(KERN_DEBUG "rsbac_list_lol_register: registering list of lists %s.\n",
06195                name);
06196       }
06197 #endif
06198     new_reg_item_p = create_lol_reg(info_p, flags, compare, subcompare,
06199                                     get_conv, get_subconv,
06200                                     def_data, def_subdata,
06201                                     name, device);
06202     if(!new_reg_item_p)
06203       {
06204         return -RSBAC_ECOULDNOTADDITEM;
06205       }
06206     /* Restore from disk */
06207     if(flags & RSBAC_LIST_PERSIST)
06208       {
06209 #ifdef CONFIG_RSBAC_DEBUG
06210         if(rsbac_debug_lists)
06211           {
06212             rsbac_printk(KERN_DEBUG "rsbac_list_lol_register: restoring list %s from device %02u:%02u.\n",
06213                    name, RSBAC_MAJOR(device), RSBAC_MINOR(device));
06214           }
06215 #endif
06216         err = read_lol_list(new_reg_item_p);
06217         /* not found is no error */
06218         if(err == -RSBAC_ENOTFOUND)
06219           err = 0;
06220         else
06221         if(err)
06222           {
06223 #ifdef CONFIG_RSBAC_DEBUG
06224             if(rsbac_debug_lists)
06225               {
06226                 char * tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
06227 
06228                 if(tmp)
06229                   {
06230                     get_error_name(tmp, err);
06231                     rsbac_printk(KERN_DEBUG "rsbac_list_lol_register: restoring list %s from device %02u:%02u failed with error %s, unregistering list.\n",
06232                            name,
06233                            RSBAC_MAJOR(device),RSBAC_MINOR(device),
06234                            tmp);
06235                     rsbac_kfree(tmp);
06236                   }
06237               }
06238 #endif
06239             clear_lol_reg(new_reg_item_p);
06240             return err;
06241           }
06242 #ifdef CONFIG_RSBAC_DEBUG
06243         else
06244           {
06245             if(rsbac_debug_lists)
06246               {
06247                 rsbac_printk(KERN_DEBUG "rsbac_list_lol_register: restoring list %s from device %02u:%02u was successful.\n",
06248                        name,
06249                        RSBAC_MAJOR(device),RSBAC_MINOR(device));
06250               }
06251           }
06252 #endif
06253       }
06254 
06255     rsbac_write_lock(&lol_reg_head.lock, &lock_flags);
06256     reg_item_p = add_lol_reg(new_reg_item_p);
06257     rsbac_write_unlock(&lol_reg_head.lock, &lock_flags);
06258     if(!reg_item_p)
06259       {
06260         rsbac_printk(KERN_WARNING
06261                "rsbac_list_lol_register: inserting list %s failed!\n",
06262                name);
06263         /* cleanup */
06264         clear_lol_reg(new_reg_item_p);
06265         return -RSBAC_ECOULDNOTADDITEM;
06266       }
06267 
06268     /* finish */
06269 #if defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS)
06270     /* create proc entry, if requested */
06271     if(flags & RSBAC_LIST_BACKUP)
06272       {
06273         reg_item_p->proc_entry_p = create_proc_entry(reg_item_p->name,
06274                                                      S_IFREG | S_IRUGO,
06275                                                      proc_rsbac_backup_p);
06276         if(reg_item_p->proc_entry_p)
06277           {
06278             reg_item_p->proc_entry_p->read_proc = lol_backup_proc_read;
06279             reg_item_p->proc_entry_p->data = reg_item_p;
06280           }
06281       }
06282     else
06283       {
06284         reg_item_p->proc_entry_p = NULL;
06285       }
06286 #endif
06287     *handle_p = reg_item_p;
06288     return err;
06289   }

int rsbac_list_lol_remove rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 8110 of file gen_lists.c.

References rsbac_ta_list_lol_remove().

Referenced by copy_fp_cap_set_item(), copy_fp_tru_set_item(), copy_pp_cap_set_item_handle(), copy_pp_tru_set_item_handle(), and rsbac_check_acl().

08113   {
08114     return rsbac_ta_list_lol_remove(0, handle, desc);
08115   }

int rsbac_list_lol_remove_all rsbac_list_handle_t  handle  ) 
 

Definition at line 8206 of file gen_lists.c.

References rsbac_ta_list_lol_remove_all().

08207   {
08208     return rsbac_ta_list_lol_remove_all(0, handle);
08209   }

int rsbac_list_lol_subadd rsbac_list_handle_t  handle,
void *  desc,
void *  subdesc,
void *  subdata
 

Definition at line 7320 of file gen_lists.c.

References RSBAC_LIST_TTL_KEEP, and rsbac_ta_list_lol_subadd_ttl().

Referenced by rsbac_auth_p_capset_member(), rsbac_init_acl(), rsbac_init_rc(), rsbac_pm_pp_intersec(), and rsbac_pm_pp_union().

07325   {
07326     return rsbac_ta_list_lol_subadd_ttl(0, handle, RSBAC_LIST_TTL_KEEP, desc, subdesc, subdata);
07327   }

int rsbac_list_lol_subadd_ttl rsbac_list_handle_t  handle,
rsbac_time_t  ttl,
void *  desc,
void *  subdesc,
void *  subdata
 

Definition at line 7307 of file gen_lists.c.

References rsbac_ta_list_lol_subadd_ttl().

Referenced by copy_fp_cap_set_item(), copy_fp_tru_set_item(), copy_pp_cap_set_item_handle(), and copy_pp_tru_set_item_handle().

07313   {
07314     return rsbac_ta_list_lol_subadd_ttl(0, handle, ttl, desc, subdesc, subdata);
07315   }

long rsbac_list_lol_subcount rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 9377 of file gen_lists.c.

References rsbac_ta_list_lol_subcount().

Referenced by rsbac_pm_pp_only().

09380   {
09381     return rsbac_ta_list_lol_subcount(0, handle, desc);
09382   }

int rsbac_list_lol_subexist rsbac_list_handle_t  handle,
void *  desc,
void *  subdesc
 

Definition at line 9142 of file gen_lists.c.

References rsbac_ta_list_lol_subexist().

Referenced by rsbac_init_rc(), rsbac_mac_p_truset_member(), rsbac_pm_pp_intersec(), rsbac_pm_pp_only(), rsbac_pm_pp_subset(), rsbac_pm_pp_superset(), rsbac_rc_check_comp(), and rsbac_ta_list_lol_subexist_compare().

09146   {
09147     return rsbac_ta_list_lol_subexist(0, handle, desc, subdesc);
09148   }

int rsbac_list_lol_subexist_compare rsbac_list_handle_t  handle,
void *  desc,
void *  subdesc,
rsbac_list_compare_function_t  compare
 

Definition at line 9230 of file gen_lists.c.

References rsbac_ta_list_lol_subexist_compare().

Referenced by rsbac_auth_p_capset_member().

09235   {
09236     return rsbac_ta_list_lol_subexist_compare(0, handle,
09237                                               desc, subdesc, compare);
09238   }

int rsbac_list_lol_subremove rsbac_list_handle_t  handle,
void *  desc,
void *  subdesc
 

Definition at line 7811 of file gen_lists.c.

References rsbac_ta_list_lol_subremove().

Referenced by rsbac_check_acl(), and rsbac_pm_pp_intersec().

07815   {
07816     return rsbac_ta_list_lol_subremove(0, handle, desc, subdesc);
07817   }

int rsbac_list_lol_subremove_all rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 8022 of file gen_lists.c.

References rsbac_ta_list_lol_subremove_all().

08023   {
08024     return rsbac_ta_list_lol_subremove_all(0, handle, desc);
08025   }

int rsbac_list_lol_subremove_from_all rsbac_list_handle_t  handle,
void *  subdesc
 

Definition at line 7910 of file gen_lists.c.

References rsbac_ta_list_lol_subremove_from_all().

07913   {
07914     return rsbac_ta_list_lol_subremove_from_all(0, handle, subdesc);
07915   }

int rsbac_list_no_write rsbac_list_handle_t  handle,
rsbac_list_key_t  key,
rsbac_boolean_t  no_write
 

Definition at line 6597 of file gen_lists.c.

References FALSE, rsbac_list_reg_item_t::info, rsbac_list_info_t::key, list_initialized, rsbac_list_reg_head_t::lock, lookup_reg(), rsbac_list_reg_item_t::name, rsbac_list_reg_item_t::no_write, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, rsbac_printk(), and TRUE.

06598   {
06599     struct rsbac_list_reg_item_t * reg_item_p;
06600     u_long lock_flags;
06601 
06602     if(   !handle
06603        || (   (no_write != FALSE )
06604            && (no_write != TRUE )
06605           )
06606       )
06607       return -RSBAC_EINVALIDVALUE;
06608     if(!list_initialized)
06609       return -RSBAC_ENOTINITIALIZED;
06610 
06611     rsbac_read_lock(&reg_head.lock, &lock_flags);
06612     reg_item_p = lookup_reg((struct rsbac_list_reg_item_t *) handle);
06613     if(!reg_item_p)
06614       {
06615         rsbac_read_unlock(&reg_head.lock, &lock_flags);
06616         rsbac_printk(KERN_WARNING "rsbac_list_no_write: setting no_write for list denied due to invalid handle!\n");
06617         return -RSBAC_EINVALIDVALUE;
06618       }
06619     if(reg_item_p->info.key != key)
06620       {
06621         rsbac_read_unlock(&reg_head.lock, &lock_flags);
06622         rsbac_printk(KERN_WARNING "rsbac_list_no_write: setting no_write for list %s denied due to invalid key %u!\n",
06623                reg_item_p->name,
06624                key);
06625         return -EPERM;
06626       }
06627     reg_item_p->no_write = no_write;
06628     rsbac_read_unlock(&reg_head.lock, &lock_flags);
06629     return 0;
06630   }

int rsbac_list_register rsbac_version_t  ds_version,
rsbac_list_handle_t handle_p,
struct rsbac_list_info_t info_p,
u_int  flags,
rsbac_list_compare_function_t compare,
rsbac_list_get_conv_t get_conv,
void *  def_data,
char *  name,
kdev_t  device
 

Definition at line 5886 of file gen_lists.c.

References add_reg(), clear_reg(), create_reg(), rsbac_list_info_t::data_size, rsbac_list_info_t::desc_size, get_error_name(), rsbac_list_info_t::key, list_initialized, rsbac_list_lol_reg_head_t::lock, rsbac_list_reg_head_t::lock, lookup_lol_reg_name(), lookup_reg_name(), rsbac_list_info_t::max_age, rsbac_list_reg_item_t::name, NULL, proc_rsbac_backup_p, read_list(), RSBAC_ECOULDNOTADDITEM, RSBAC_EEXISTS, RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDVALUE, RSBAC_EINVALIDVERSION, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_kfree(), rsbac_kmalloc(), RSBAC_LIST_BACKUP, RSBAC_LIST_MAX_AGE_LIMIT, RSBAC_LIST_MAX_ITEM_SIZE, RSBAC_LIST_PERSIST, RSBAC_LIST_VERSION, RSBAC_MAXNAMELEN, rsbac_printk(), rsbac_root_dev, and rsbac_list_info_t::version.

Referenced by init_module(), register_dev_lists(), register_fd_lists(), register_ipc_lists(), register_process_lists(), register_user_lists(), rsbac_init_acl(), rsbac_init_debug(), rsbac_init_pm(), rsbac_init_rc(), rsbac_init_um(), and rsbac_list_init().

05896   {
05897     struct rsbac_list_reg_item_t     * reg_item_p;
05898     struct rsbac_list_reg_item_t     * new_reg_item_p;
05899     u_long lock_flags;
05900     int    err = 0;
05901 
05902     if(ds_version != RSBAC_LIST_VERSION)
05903       {
05904         if(name)
05905           {
05906             rsbac_printk(KERN_WARNING
05907                    "rsbac_list_register: wrong ds_version %u for list %s, expected %u!\n",
05908                    ds_version,
05909                    name,
05910                    RSBAC_LIST_VERSION);
05911           }
05912         return -RSBAC_EINVALIDVERSION;
05913       }
05914     if(!handle_p || !info_p)
05915       return -RSBAC_EINVALIDPOINTER;
05916     *handle_p = NULL;
05917     if(!info_p->key || !info_p->version || !info_p->desc_size)
05918       return -RSBAC_EINVALIDVALUE;
05919     if(info_p->max_age > RSBAC_LIST_MAX_AGE_LIMIT)
05920       return -RSBAC_EINVALIDVALUE;
05921     if(info_p->desc_size + info_p->data_size > RSBAC_LIST_MAX_ITEM_SIZE)
05922       return -RSBAC_EINVALIDVALUE;
05923     if(!list_initialized)
05924       return -RSBAC_ENOTINITIALIZED;
05925     if(name)
05926       {
05927         struct rsbac_list_lol_reg_item_t * lol_reg_item_p;
05928 
05929         rsbac_read_lock(&reg_head.lock, &lock_flags);
05930         reg_item_p = lookup_reg_name(name, device);
05931         rsbac_read_unlock(&reg_head.lock, &lock_flags);
05932         if(reg_item_p)
05933           {
05934 #ifdef CONFIG_RSBAC_DEBUG
05935             if(rsbac_debug_lists)
05936               {
05937                 rsbac_printk(KERN_DEBUG "rsbac_list_register: list name %s already exists on device %02u:%02u!\n",
05938                        name, RSBAC_MAJOR(device), RSBAC_MINOR(device));
05939               }
05940 #endif
05941             return -RSBAC_EEXISTS;
05942           }
05943         rsbac_read_lock(&lol_reg_head.lock, &lock_flags);
05944         lol_reg_item_p = lookup_lol_reg_name(name, device);
05945         rsbac_read_unlock(&lol_reg_head.lock, &lock_flags);
05946         if(lol_reg_item_p)
05947           {
05948 #ifdef CONFIG_RSBAC_DEBUG
05949             if(rsbac_debug_lists)
05950               {
05951                 rsbac_printk(KERN_DEBUG "rsbac_list_register: list name %s already exists on device %02u:%02u!\n",
05952                        name, RSBAC_MAJOR(device), RSBAC_MINOR(device));
05953               }
05954 #endif
05955             return -RSBAC_EEXISTS;
05956           }
05957       }
05958     else
05959       if(flags & RSBAC_LIST_PERSIST)
05960         {
05961           rsbac_printk(KERN_WARNING
05962                  "rsbac_list_register: trial to register persistent list without name.\n");
05963           return -RSBAC_EINVALIDVALUE;
05964         }
05965 
05966     if(flags & RSBAC_LIST_PERSIST)
05967       {
05968         if(RSBAC_IS_AUTO_DEV(device))
05969           device = rsbac_root_dev;
05970         if(!RSBAC_MAJOR(device))
05971           flags &= ~RSBAC_LIST_PERSIST;
05972       }
05973 
05974 #ifdef CONFIG_RSBAC_DEBUG
05975     if(rsbac_debug_lists)
05976       {
05977         rsbac_printk(KERN_DEBUG "rsbac_list_register: registering list %s for device %02u:%02u.\n",
05978                name, RSBAC_MAJOR(device),RSBAC_MINOR(device));
05979       }
05980 #endif
05981     new_reg_item_p = create_reg(info_p, flags, compare, get_conv, def_data, name, device);
05982     if(!new_reg_item_p)
05983       {
05984         return -RSBAC_ECOULDNOTADDITEM;
05985       }
05986     /* Restore from disk, but only for real device mounts */
05987     if(   (flags & RSBAC_LIST_PERSIST)
05988        && RSBAC_MAJOR(device)
05989       )
05990       {
05991 #ifdef CONFIG_RSBAC_DEBUG
05992         if(rsbac_debug_lists)
05993           {
05994             rsbac_printk(KERN_DEBUG "rsbac_list_register: restoring list %s from device %02u:%02u.\n",
05995                    name, RSBAC_MAJOR(device), RSBAC_MINOR(device));
05996           }
05997 #endif
05998         err = read_list(new_reg_item_p);
05999         /* not found is no error */
06000         if(err == -RSBAC_ENOTFOUND)
06001           err = 0;
06002         else
06003         if(err)
06004           {
06005 #ifdef CONFIG_RSBAC_DEBUG
06006             if(rsbac_debug_lists)
06007               {
06008                 char * tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
06009 
06010                 if(tmp)
06011                   {
06012                     get_error_name(tmp, err);
06013                     rsbac_printk(KERN_DEBUG "rsbac_list_register: restoring list %s from device %02u:%02u failed with error %s, unregistering list.\n",
06014                            name,
06015                            RSBAC_MAJOR(device),RSBAC_MINOR(device),
06016                            tmp);
06017                     rsbac_kfree(tmp);
06018                   }
06019               }
06020 #endif
06021             clear_reg(new_reg_item_p);
06022             return err;
06023           }
06024 #ifdef CONFIG_RSBAC_DEBUG
06025         else
06026           {
06027             if(rsbac_debug_lists)
06028               {
06029                 rsbac_printk(KERN_DEBUG "rsbac_list_register: restoring list %s from device %02u:%02u was successful.\n",
06030                        name,
06031                        RSBAC_MAJOR(device),RSBAC_MINOR(device));
06032               }
06033           }
06034 #endif
06035       }
06036 
06037     rsbac_write_lock(&reg_head.lock, &lock_flags);
06038     reg_item_p = add_reg(new_reg_item_p);
06039     rsbac_write_unlock(&reg_head.lock, &lock_flags);
06040     if(!reg_item_p)
06041       {
06042         rsbac_printk(KERN_WARNING
06043                "rsbac_list_register: inserting list %s failed!\n",
06044                name);
06045         /* cleanup */
06046         clear_reg(new_reg_item_p);
06047         return -RSBAC_ECOULDNOTADDITEM;
06048       }
06049 
06050     /* finish */
06051 #if defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS)
06052     /* create proc entry, if requested */
06053     if(flags & RSBAC_LIST_BACKUP)
06054       {
06055         reg_item_p->proc_entry_p = create_proc_entry(reg_item_p->name,
06056                                                      S_IFREG | S_IRUGO,
06057                                                      proc_rsbac_backup_p);
06058         if(reg_item_p->proc_entry_p)
06059           {
06060             reg_item_p->proc_entry_p->read_proc = backup_proc_read;
06061             reg_item_p->proc_entry_p->data = reg_item_p;
06062           }
06063       }
06064     else
06065       {
06066         reg_item_p->proc_entry_p = NULL;
06067       }
06068 #endif
06069     *handle_p = reg_item_p;
06070     return err;
06071   }

int rsbac_list_remove rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 7574 of file gen_lists.c.

References rsbac_ta_list_remove().

07577   {
07578     return rsbac_ta_list_remove(0, handle, desc);
07579   }

int rsbac_list_remove_all rsbac_list_handle_t  handle  ) 
 

Definition at line 7670 of file gen_lists.c.

References rsbac_ta_list_remove_all().

07671   {
07672     return rsbac_ta_list_remove_all(0, handle);
07673   }

rsbac_version_t rsbac_list_version void   ) 
 

Definition at line 5854 of file gen_lists.c.

References RSBAC_LIST_VERSION.

05855   {
05856     return RSBAC_LIST_VERSION;
05857   }

int rsbac_ta_list_add_ttl rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
rsbac_time_t  ttl,
void *  desc,
void *  data
 

Definition at line 6952 of file gen_lists.c.

References add_item(), rsbac_list_info_t::data_size, rsbac_list_reg_item_t::def_data, rsbac_list_info_t::desc_size, rsbac_list_reg_item_t::dirty, do_remove_item(), rsbac_list_reg_item_t::info, list_initialized, rsbac_list_reg_item_t::lock, rsbac_list_reg_head_t::lock, lookup_item(), rsbac_list_item_t::max_age, RSBAC_EBUSY, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, RSBAC_LIST_MAX_AGE_LIMIT, RSBAC_LIST_TTL_KEEP, rsbac_ta_list_exist(), rsbac_list_reg_item_t::self, touch, and TRUE.

Referenced by rsbac_acl_add_group(), rsbac_acl_add_to_acl_entry(), rsbac_acl_change_group(), rsbac_acl_remove_from_acl_entry(), rsbac_acl_set_acl_entry(), rsbac_list_add(), rsbac_list_add_ttl(), rsbac_pm_add_target(), rsbac_pm_set_data(), rsbac_rc_copy_role(), rsbac_rc_copy_type(), rsbac_rc_set_item(), rsbac_um_add_group(), rsbac_um_mod_group(), rsbac_um_set_group_pass(), set_attr_dev(), set_attr_fd(), set_attr_ipc(), set_attr_process(), and set_attr_user().

06958   {
06959     struct rsbac_list_reg_item_t * list;
06960     struct rsbac_list_item_t     * item_p;
06961     u_long lock_flags, rlock_flags;
06962 
06963     if(!handle || !desc)
06964       return -RSBAC_EINVALIDVALUE;
06965     if(!list_initialized)
06966       return -RSBAC_ENOTINITIALIZED;
06967 
06968     list = (struct rsbac_list_reg_item_t *) handle;
06969     if(!list || (list->self != list))
06970       return -RSBAC_EINVALIDVALUE;
06971 
06972 #ifdef CONFIG_RSBAC_LIST_TRANS
06973     if(ta_number && !rsbac_ta_list_exist(0, ta_handle, &ta_number))
06974       return -RSBAC_EINVALIDTRANSACTION;
06975 #endif
06976 
06977     rsbac_read_lock(&reg_head.lock, &rlock_flags);
06978     if(list->info.data_size && !data)
06979       {
06980         rsbac_read_unlock(&reg_head.lock, &rlock_flags);
06981         return -RSBAC_EINVALIDVALUE;
06982       }
06983 
06984 /*
06985 #ifdef CONFIG_RSBAC_DEBUG
06986     if(rsbac_debug_lists)
06987       rsbac_printk(KERN_DEBUG "rsbac_ta_list_add_ttl: adding to list %s.\n",
06988              list->name);
06989 #endif
06990 */
06991     if(ttl && (ttl != RSBAC_LIST_TTL_KEEP))
06992       {
06993         if(ttl > RSBAC_LIST_MAX_AGE_LIMIT)
06994           ttl = RSBAC_LIST_MAX_AGE_LIMIT;
06995         ttl += RSBAC_CURRENT_TIME;
06996       }
06997     rsbac_write_lock(&list->lock, &lock_flags);
06998 
06999 #ifdef CONFIG_RSBAC_LIST_TRANS
07000     if(!ta_number)
07001 #endif
07002       {
07003         item_p = lookup_item(list, desc);
07004         if(item_p)
07005           { /* exists -> update data, if any */
07006             if(ttl != RSBAC_LIST_TTL_KEEP)
07007               item_p->max_age = ttl;
07008             if(data && list->info.data_size)
07009               {
07010                 if(   list->def_data
07011                    && !item_p->max_age
07012                    && !memcmp(list->def_data, data, list->info.data_size)
07013                   )
07014                   do_remove_item(list, item_p);
07015                 else
07016                   memcpy(((char *) item_p) + sizeof(*item_p) + list->info.desc_size,
07017                          data, list->info.data_size);
07018               }
07019           }
07020         else
07021           {
07022             if(ttl == RSBAC_LIST_TTL_KEEP)
07023               ttl = 0;
07024             if(   !list->def_data
07025                || memcmp(list->def_data, data, list->info.data_size)
07026               )
07027               add_item(list, ttl, desc, data);
07028           }
07029         touch(list);
07030         list->dirty = TRUE;
07031       }
07032 #ifdef CONFIG_RSBAC_LIST_TRANS
07033     if(   list->ta_copied
07034        || ta_number
07035       )
07036       {
07037         if(!list->ta_copied)
07038           ta_copy(ta_number, list);
07039         else
07040           if(ta_number)
07041             {
07042               if(list->ta_copied != ta_number)
07043                 {
07044                   rsbac_write_unlock(&list->lock, &lock_flags);
07045                   rsbac_read_unlock(&reg_head.lock, &rlock_flags);
07046                   return -RSBAC_EBUSY;
07047                 }
07048             }
07049           else
07050             ta_number = list->ta_copied;
07051         item_p = ta_lookup_item(ta_number, list, desc);
07052         if(item_p)
07053           { /* exists -> update data, if any */
07054             if(ttl != RSBAC_LIST_TTL_KEEP)
07055               item_p->max_age = ttl;
07056             if(data && list->info.data_size)
07057               {
07058                 if(   list->def_data
07059                    && !item_p->max_age
07060                    && !memcmp(list->def_data, data, list->info.data_size)
07061                   )
07062                   ta_do_remove_item(list, item_p);
07063                 else
07064                   memcpy(((char *) item_p) + sizeof(*item_p) + list->info.desc_size,
07065                          data, list->info.data_size);
07066               }
07067           }
07068         else
07069           {
07070             if(ttl == RSBAC_LIST_TTL_KEEP)
07071               ttl = 0;
07072             if(   !list->def_data
07073                || memcmp(list->def_data, data, list->info.data_size)
07074               )
07075               ta_add_item(ta_number, list, ttl, desc, data);
07076           }
07077       }
07078 #endif
07079     rsbac_write_unlock(&list->lock, &lock_flags);
07080     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
07081     return 0;
07082   }

long rsbac_ta_list_count rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle
 

Definition at line 9499 of file gen_lists.c.

References rsbac_list_reg_item_t::count, list_initialized, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), and rsbac_list_reg_item_t::self.

Referenced by rsbac_list_count(), rsbac_rc_get_list(), rsbac_ta_list_all_dev(), rsbac_ta_list_all_group(), rsbac_ta_list_all_user(), and rsbac_um_get_group_list().

09502   {
09503     struct rsbac_list_reg_item_t * list;
09504 
09505     if(!handle)
09506       return -RSBAC_EINVALIDVALUE;
09507     if(!list_initialized)
09508       return -RSBAC_ENOTINITIALIZED;
09509 
09510     list = (struct rsbac_list_reg_item_t *) handle;
09511     if(list->self != list)
09512       return -RSBAC_EINVALIDVALUE;
09513 
09514 #ifdef CONFIG_RSBAC_LIST_TRANS
09515     if(ta_number)
09516       {
09517         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
09518           return -RSBAC_EINVALIDTRANSACTION;
09519       }
09520 #endif
09521 
09522 #ifdef CONFIG_RSBAC_LIST_TRANS
09523     if(ta_number && (list->ta_copied == ta_number))
09524       return list->ta_count;
09525     else
09526 #endif
09527     return list->count;
09528   }

int rsbac_ta_list_exist rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 8995 of file gen_lists.c.

References FALSE, list_initialized, rsbac_list_reg_item_t::lock, rsbac_list_reg_head_t::lock, lookup_item(), rsbac_list_item_t::max_age, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, rsbac_ta_list_exist(), rsbac_list_reg_item_t::self, and TRUE.

Referenced by rsbac_acl_add_group(), rsbac_acl_add_group_member(), rsbac_acl_change_group(), rsbac_acl_get_group_members(), rsbac_acl_group_exist(), rsbac_acl_remove_group_member(), rsbac_list_exist(), rsbac_pm_exists(), rsbac_rc_role_exists(), rsbac_rc_set_item(), rsbac_rc_type_exists(), rsbac_ta_list_add_ttl(), rsbac_ta_list_all_dev(), rsbac_ta_list_count(), rsbac_ta_list_exist(), rsbac_ta_list_get_all_data(), rsbac_ta_list_get_all_desc(), rsbac_ta_list_get_all_items_ttl(), rsbac_ta_list_get_data_ttl(), rsbac_ta_list_get_desc(), rsbac_ta_list_get_max_desc(), rsbac_ta_list_get_next_desc(), rsbac_ta_list_lol_add_ttl(), rsbac_ta_list_lol_all_subcount(), rsbac_ta_list_lol_count(), rsbac_ta_list_lol_exist(), rsbac_ta_list_lol_get_all_data(), rsbac_ta_list_lol_get_all_desc(), rsbac_ta_list_lol_get_all_items(), rsbac_ta_list_lol_get_all_subdata(), rsbac_ta_list_lol_get_all_subdesc_ttl(), rsbac_ta_list_lol_get_all_subitems_ttl(), rsbac_ta_list_lol_get_data_ttl(), rsbac_ta_list_lol_get_desc(), rsbac_ta_list_lol_get_next_desc(), rsbac_ta_list_lol_get_subdata_ttl(), rsbac_ta_list_lol_remove(), rsbac_ta_list_lol_remove_all(), rsbac_ta_list_lol_subadd_ttl(), rsbac_ta_list_lol_subcount(), rsbac_ta_list_lol_subexist(), rsbac_ta_list_lol_subexist_compare(), rsbac_ta_list_lol_subremove(), rsbac_ta_list_lol_subremove_all(), rsbac_ta_list_lol_subremove_from_all(), rsbac_ta_list_remove(), rsbac_ta_list_remove_all(), 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(), and rsbac_um_remove_group().

08999   {
09000     struct rsbac_list_reg_item_t * list;
09001     u_long lock_flags, rlock_flags;
09002     struct rsbac_list_item_t     * item_p;
09003     int result;
09004 
09005     if(!handle || !desc)
09006       return FALSE;
09007     if(!list_initialized)
09008       return FALSE;
09009 
09010     list = (struct rsbac_list_reg_item_t *) handle;
09011     if(list->self != list)
09012       return -RSBAC_EINVALIDVALUE;
09013 
09014 #ifdef CONFIG_RSBAC_LIST_TRANS
09015     if(ta_number)
09016       {
09017         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
09018           return -RSBAC_EINVALIDTRANSACTION;
09019       }
09020 #endif
09021 
09022     rsbac_read_lock(&reg_head.lock, &rlock_flags);
09023 /*
09024 #ifdef CONFIG_RSBAC_DEBUG
09025     if(rsbac_debug_lists)
09026       rsbac_printk(KERN_DEBUG "rsbac_list_exist: testing on list %s.\n",
09027              list->name);
09028 #endif
09029 */
09030     rsbac_read_lock(&list->lock, &lock_flags);
09031 
09032 #ifdef CONFIG_RSBAC_LIST_TRANS
09033     if(ta_number && (list->ta_copied == ta_number))
09034       item_p = ta_lookup_item(ta_number, list, desc);
09035     else
09036 #endif
09037     item_p = lookup_item(list, desc);
09038     if(   item_p
09039        && (   !item_p->max_age
09040            || (item_p->max_age > RSBAC_CURRENT_TIME)
09041           )
09042       )
09043       { /* exists -> TRUE */
09044         result = TRUE;
09045       }
09046     else
09047       {
09048         result = FALSE;
09049       }
09050     rsbac_read_unlock(&list->lock, &lock_flags);
09051     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
09052     return result;
09053   }

long rsbac_ta_list_get_all_data rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void **  array_p
 

Definition at line 9918 of file gen_lists.c.

References rsbac_list_reg_item_t::count, rsbac_list_info_t::data_size, rsbac_list_info_t::desc_size, rsbac_list_reg_item_t::head, rsbac_list_reg_item_t::info, list_initialized, rsbac_list_reg_item_t::lock, rsbac_list_reg_head_t::lock, rsbac_list_item_t::max_age, rsbac_list_item_t::next, NULL, RSBAC_EINVALIDREQUEST, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOMEM, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_vmalloc, and rsbac_list_reg_item_t::self.

Referenced by rsbac_acl_list_groups(), rsbac_acl_remove_user(), and rsbac_list_get_all_data().

09922   {
09923     struct rsbac_list_reg_item_t * list;
09924     struct rsbac_list_item_t     * item_p;
09925            char                  * buffer;
09926     u_long lock_flags, rlock_flags;
09927     u_long offset = 0;
09928     long result = 0;
09929     u_int item_size;
09930     u_int item_offset;
09931 
09932     if(!handle)
09933       return -RSBAC_EINVALIDVALUE;
09934     if(!array_p)
09935       return -RSBAC_EINVALIDVALUE;
09936     if(!list_initialized)
09937       return -RSBAC_ENOTINITIALIZED;
09938 
09939     list = (struct rsbac_list_reg_item_t *) handle;
09940     if(list->self != list)
09941       return -RSBAC_EINVALIDVALUE;
09942     *array_p = NULL;
09943 
09944 #ifdef CONFIG_RSBAC_LIST_TRANS
09945     if(ta_number)
09946       {
09947         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
09948           return -RSBAC_EINVALIDTRANSACTION;
09949       }
09950 #endif
09951 
09952     rsbac_read_lock(&reg_head.lock, &rlock_flags);
09953 /*
09954 #ifdef CONFIG_RSBAC_DEBUG
09955     if(rsbac_debug_lists)
09956       rsbac_printk(KERN_DEBUG "rsbac_list_get_all_data: list %s.\n",
09957              list->name);
09958 #endif
09959 */
09960     rsbac_read_lock(&list->lock, &lock_flags);
09961     if(!list->info.data_size)
09962       {
09963         rsbac_read_unlock(&list->lock, &lock_flags);
09964         rsbac_read_unlock(&reg_head.lock, &rlock_flags);
09965         return -RSBAC_EINVALIDREQUEST;
09966       }
09967 #ifdef CONFIG_RSBAC_LIST_TRANS
09968     if(ta_number && (list->ta_copied == ta_number))
09969       {
09970         if(list->ta_count)
09971           {
09972             item_size = list->info.data_size;
09973             item_offset = list->info.desc_size;
09974             buffer = rsbac_vmalloc(item_size * list->ta_count);
09975             if(buffer)
09976               {
09977                 item_p = list->ta_head;
09978                 while(item_p)
09979                   {
09980                     if(   !item_p->max_age
09981                        || (item_p->max_age > RSBAC_CURRENT_TIME)
09982                       )
09983                       {
09984                         memcpy(buffer + offset,
09985                                ((char *) item_p) + sizeof(*item_p) + item_offset,
09986                                item_size);
09987                         offset += item_size;
09988                         result++;
09989                       }
09990                     item_p = item_p->next;
09991                   }
09992                 *array_p = buffer;
09993               }
09994             else
09995               {
09996                 result = -RSBAC_ENOMEM;
09997               }
09998           }
09999       }
10000     else
10001 #endif
10002     if(list->count)
10003       {
10004         item_size = list->info.data_size;
10005         item_offset = list->info.desc_size;
10006         buffer = rsbac_vmalloc(item_size * list->count);
10007         if(buffer)
10008           {
10009             item_p = list->head;
10010             while(item_p)
10011               {
10012                 if(   !item_p->max_age
10013                    || (item_p->max_age > RSBAC_CURRENT_TIME)
10014                   )
10015                   {
10016                     memcpy(buffer + offset,
10017                            ((char *) item_p) + sizeof(*item_p) + item_offset,
10018                            item_size);
10019                     offset += item_size;
10020                     result++;
10021                   }
10022                 item_p = item_p->next;
10023               }
10024             *array_p = buffer;
10025           }
10026         else
10027           {
10028             result = -RSBAC_ENOMEM;
10029           }
10030       }
10031     rsbac_read_unlock(&list->lock, &lock_flags);
10032     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
10033     return result;
10034   }

long rsbac_ta_list_get_all_desc rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void **  array_p
 

Definition at line 9547 of file gen_lists.c.

References rsbac_list_reg_item_t::count, rsbac_list_info_t::desc_size, rsbac_list_reg_item_t::head, rsbac_list_reg_item_t::info, list_initialized, rsbac_list_reg_item_t::lock, rsbac_list_reg_head_t::lock, rsbac_list_item_t::max_age, rsbac_list_item_t::next, NULL, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOMEM, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_vmalloc, and rsbac_list_reg_item_t::self.

Referenced by copy_new_uids(), rsbac_list_get_all_desc(), rsbac_rc_copy_type(), rsbac_rc_get_list(), rsbac_ta_list_all_dev(), rsbac_ta_list_all_group(), rsbac_ta_list_all_user(), and rsbac_um_get_group_list().

09551   {
09552     struct rsbac_list_reg_item_t * list;
09553     struct rsbac_list_item_t     * item_p;
09554            char                  * buffer;
09555     u_long lock_flags, rlock_flags;
09556     u_long offset = 0;
09557     long result = 0;
09558     u_int item_size;
09559 
09560     if(!handle)
09561       return -RSBAC_EINVALIDVALUE;
09562     if(!array_p)
09563       return -RSBAC_EINVALIDVALUE;
09564     if(!list_initialized)
09565       return -RSBAC_ENOTINITIALIZED;
09566 
09567     list = (struct rsbac_list_reg_item_t *) handle;
09568     if(list->self != list)
09569       return -RSBAC_EINVALIDVALUE;
09570     *array_p = NULL;
09571 
09572 #ifdef CONFIG_RSBAC_LIST_TRANS
09573     if(ta_number)
09574       {
09575         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
09576           return -RSBAC_EINVALIDTRANSACTION;
09577       }
09578 #endif
09579 
09580     rsbac_read_lock(&reg_head.lock, &rlock_flags);
09581 /*
09582 #ifdef CONFIG_RSBAC_DEBUG
09583     if(rsbac_debug_lists)
09584       rsbac_printk(KERN_DEBUG "rsbac_list_get_all_desc: list %s.\n",
09585              list->name);
09586 #endif
09587 */
09588     rsbac_read_lock(&list->lock, &lock_flags);
09589 #ifdef CONFIG_RSBAC_LIST_TRANS
09590     if(ta_number && (list->ta_copied == ta_number))
09591       {
09592         if(list->ta_count)
09593           {
09594             item_size = list->info.desc_size;
09595             buffer = rsbac_vmalloc(item_size * list->ta_count);
09596             if(buffer)
09597               {
09598                 item_p = list->ta_head;
09599                 while(item_p)
09600                   {
09601                     if(   !item_p->max_age
09602                        || (item_p->max_age > RSBAC_CURRENT_TIME)
09603                       )
09604                       {
09605                         memcpy(buffer + offset,
09606                                ((char *) item_p) + sizeof(*item_p),
09607                                item_size);
09608                         offset += item_size;
09609                         result++;
09610                       }
09611                     item_p = item_p->next;
09612                   }
09613                 *array_p = buffer;
09614               }
09615             else
09616               {
09617                 result = -RSBAC_ENOMEM;
09618               }
09619           }
09620       }
09621     else
09622 #endif
09623     if(list->count)
09624       {
09625         item_size = list->info.desc_size;
09626         buffer = rsbac_vmalloc(item_size * list->count);
09627         if(buffer)
09628           {
09629             item_p = list->head;
09630             while(item_p)
09631               {
09632                 if(   !item_p->max_age
09633                    || (item_p->max_age > RSBAC_CURRENT_TIME)
09634                   )
09635                   {
09636                     memcpy(buffer + offset,
09637                            ((char *) item_p) + sizeof(*item_p),
09638                            item_size);
09639                     offset += item_size;
09640                     result++;
09641                   }
09642                 item_p = item_p->next;
09643               }
09644             *array_p = buffer;
09645           }
09646         else
09647           {
09648             result = -RSBAC_ENOMEM;
09649           }
09650       }
09651     rsbac_read_unlock(&list->lock, &lock_flags);
09652     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
09653     return result;
09654   }

long rsbac_ta_list_get_all_items_ttl rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void **  array_p,
rsbac_time_t **  ttl_array_p
 

Definition at line 10347 of file gen_lists.c.

References rsbac_list_reg_item_t::count, rsbac_list_info_t::data_size, rsbac_list_info_t::desc_size, rsbac_list_reg_item_t::head, rsbac_list_reg_item_t::info, list_initialized, rsbac_list_reg_item_t::lock, rsbac_list_reg_head_t::lock, rsbac_list_item_t::max_age, rsbac_list_item_t::next, NULL, RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOMEM, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_vmalloc, and rsbac_list_reg_item_t::self.

Referenced by rsbac_acl_get_tlist(), rsbac_list_get_all_items(), and rsbac_list_get_all_items_ttl().

10352   {
10353     struct rsbac_list_reg_item_t * list;
10354     struct rsbac_list_item_t     * item_p;
10355            char                  * buffer;
10356            rsbac_time_t              * ttl_p = NULL;
10357     u_long lock_flags, rlock_flags;
10358     u_long offset = 0;
10359     long result = 0;
10360     u_int item_size;
10361 
10362     if(!handle)
10363       return -RSBAC_EINVALIDVALUE;
10364     if(!array_p)
10365       return -RSBAC_EINVALIDPOINTER;
10366     if(!list_initialized)
10367       return -RSBAC_ENOTINITIALIZED;
10368 
10369     list = (struct rsbac_list_reg_item_t *) handle;
10370     if(list->self != list)
10371       return -RSBAC_EINVALIDVALUE;
10372     *array_p = NULL;
10373 
10374 #ifdef CONFIG_RSBAC_LIST_TRANS
10375     if(ta_number)
10376       {
10377         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
10378           return -RSBAC_EINVALIDTRANSACTION;
10379       }
10380 #endif
10381 
10382     rsbac_read_lock(&reg_head.lock, &rlock_flags);
10383 /*
10384 #ifdef CONFIG_RSBAC_DEBUG
10385     if(rsbac_debug_lists)
10386       rsbac_printk(KERN_DEBUG "rsbac_list_get_all_items: list %s.\n",
10387              list->name);
10388 #endif
10389 */
10390     rsbac_read_lock(&list->lock, &lock_flags);
10391 #ifdef CONFIG_RSBAC_LIST_TRANS
10392     if(ta_number && (list->ta_copied == ta_number))
10393       {
10394         if(list->ta_count)
10395           {
10396             item_size = list->info.desc_size + list->info.data_size;
10397             buffer = rsbac_vmalloc(item_size * list->ta_count);
10398             if(buffer)
10399               {
10400                 if(ttl_array_p)
10401                   ttl_p = rsbac_vmalloc(sizeof(**ttl_array_p) * list->ta_count);
10402                 item_p = list->ta_head;
10403                 while(item_p)
10404                   {
10405                     if(   !item_p->max_age
10406                        || (item_p->max_age > RSBAC_CURRENT_TIME)
10407                       )
10408                       {
10409                         memcpy(buffer + offset,
10410                                ((char *) item_p) + sizeof(*item_p),
10411                                item_size);
10412                         if(ttl_p)
10413                           {
10414                             if(item_p->max_age)
10415                               ttl_p[result] = item_p->max_age - RSBAC_CURRENT_TIME;
10416                             else
10417                               ttl_p[result] = 0;
10418                           }
10419                         offset += item_size;
10420                         result++;
10421                       }
10422                     item_p = item_p->next;
10423                   }
10424                 *array_p = buffer;
10425                 if(ttl_array_p)
10426                   *ttl_array_p = ttl_p;
10427               }
10428             else
10429               {
10430                 result = -RSBAC_ENOMEM;
10431               }
10432           }
10433       }
10434     else
10435 #endif
10436     if(list->count)
10437       {
10438         item_size = list->info.desc_size + list->info.data_size;
10439         buffer = rsbac_vmalloc(item_size * list->count);
10440         if(buffer)
10441           {
10442             if(ttl_array_p)
10443               ttl_p = rsbac_vmalloc(sizeof(**ttl_array_p) * list->count);
10444             item_p = list->head;
10445             while(item_p)
10446               {
10447                 if(   !item_p->max_age
10448                    || (item_p->max_age > RSBAC_CURRENT_TIME)
10449                   )
10450                   {
10451                     memcpy(buffer + offset,
10452                            ((char *) item_p) + sizeof(*item_p),
10453                            item_size);
10454                     if(ttl_p)
10455                       {
10456                         if(item_p->max_age)
10457                           ttl_p[result] = item_p->max_age - RSBAC_CURRENT_TIME;
10458                         else
10459                           ttl_p[result] = 0;
10460                       }
10461                     offset += item_size;
10462                     result++;
10463                   }
10464                 item_p = item_p->next;
10465               }
10466             *array_p = buffer;
10467             if(ttl_array_p)
10468               *ttl_array_p = ttl_p;
10469           }
10470         else
10471           {
10472             result = -RSBAC_ENOMEM;
10473           }
10474       }
10475     rsbac_read_unlock(&list->lock, &lock_flags);
10476     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
10477     return result;
10478   }

int rsbac_ta_list_get_data_ttl rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
rsbac_time_t ttl_p,
void *  desc,
void *  data
 

Definition at line 8217 of file gen_lists.c.

References rsbac_list_info_t::data_size, rsbac_list_reg_item_t::def_data, rsbac_list_info_t::desc_size, rsbac_list_reg_item_t::info, list_initialized, rsbac_list_reg_item_t::lock, rsbac_list_reg_head_t::lock, lookup_item(), rsbac_list_item_t::max_age, RSBAC_EINVALIDREQUEST, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), and rsbac_list_reg_item_t::self.

Referenced by get_attr_dev(), get_attr_fd(), get_attr_ipc(), get_attr_process(), get_attr_user(), rsbac_acl_add_to_acl_entry(), rsbac_acl_get_group_entry(), rsbac_acl_get_rights(), rsbac_acl_get_single_right(), rsbac_acl_remove_from_acl_entry(), rsbac_list_get_data(), rsbac_list_get_data_ttl(), rsbac_pm_exists(), rsbac_pm_get_all_data(), rsbac_pm_get_data(), rsbac_pm_set_data(), rsbac_rc_copy_role(), rsbac_rc_copy_type(), rsbac_rc_get_item(), rsbac_rc_set_item(), rsbac_um_get_group_item(), rsbac_um_mod_group(), rsbac_um_set_group_pass(), set_attr_dev(), set_attr_fd(), set_attr_ipc(), set_attr_process(), and set_attr_user().

08223   {
08224     struct rsbac_list_reg_item_t * list;
08225     struct rsbac_list_item_t     * item_p;
08226     u_long lock_flags, rlock_flags;
08227     int err = 0;
08228 
08229     if(!handle || !desc)
08230       return -RSBAC_EINVALIDVALUE;
08231     if(!list_initialized)
08232       return -RSBAC_ENOTINITIALIZED;
08233 
08234     list = (struct rsbac_list_reg_item_t *) handle;
08235     if(list->self != list)
08236       return -RSBAC_EINVALIDVALUE;
08237 
08238 #ifdef CONFIG_RSBAC_LIST_TRANS
08239     if(ta_number)
08240       {
08241         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
08242           return -RSBAC_EINVALIDTRANSACTION;
08243       }
08244 #endif
08245 
08246     rsbac_read_lock(&reg_head.lock, &rlock_flags);
08247 /*
08248 #ifdef CONFIG_RSBAC_DEBUG
08249     if(rsbac_debug_lists)
08250       rsbac_printk(KERN_DEBUG "rsbac_list_get_data: getting data from list %s.\n",
08251              list->name);
08252 #endif
08253 */
08254     if(data && !list->info.data_size)
08255       {
08256         rsbac_read_unlock(&reg_head.lock, &rlock_flags);
08257         return -RSBAC_EINVALIDREQUEST;
08258       }
08259 
08260     rsbac_read_lock(&list->lock, &lock_flags);
08261 #ifdef CONFIG_RSBAC_LIST_TRANS
08262     if(ta_number && (list->ta_copied == ta_number))
08263       item_p = ta_lookup_item(ta_number, list, desc);
08264     else
08265 #endif
08266       item_p = lookup_item(list, desc);
08267     if(   item_p
08268        && (   !item_p->max_age
08269            || (item_p->max_age > RSBAC_CURRENT_TIME)
08270           )
08271       )
08272       { /* exists -> copy data, if any */
08273         if(ttl_p)
08274           {
08275             if(item_p->max_age)
08276               *ttl_p = item_p->max_age - RSBAC_CURRENT_TIME;
08277             else
08278               *ttl_p = 0;
08279           }
08280         if(data)
08281           {
08282             memcpy(data,
08283                    ((char *) item_p) + sizeof(*item_p) + list->info.desc_size,
08284                    list->info.data_size);
08285           }
08286       }
08287     else
08288       {
08289         if(!list->def_data)
08290           err = -RSBAC_ENOTFOUND;
08291         else
08292           {
08293             if(ttl_p)
08294               *ttl_p = 0;
08295             if(data)
08296               memcpy(data,
08297                      list->def_data,
08298                      list->info.data_size);
08299           }
08300       }
08301     rsbac_read_unlock(&list->lock, &lock_flags);
08302     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
08303     return err;
08304   }

int rsbac_ta_list_get_desc rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc,
void *  data,
rsbac_list_data_compare_function_t  compare
 

Definition at line 8832 of file gen_lists.c.

References rsbac_list_info_t::data_size, rsbac_list_info_t::desc_size, rsbac_list_reg_item_t::info, list_initialized, rsbac_list_reg_item_t::lock, rsbac_list_reg_head_t::lock, lookup_item_data(), RSBAC_EINVALIDREQUEST, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), and rsbac_list_reg_item_t::self.

Referenced by rsbac_list_get_desc(), and rsbac_um_get_gid().

08838   {
08839     struct rsbac_list_reg_item_t * list;
08840     struct rsbac_list_item_t     * item_p;
08841     u_long lock_flags, rlock_flags;
08842     int err = 0;
08843 
08844     if(!handle || !desc || !data)
08845       return -RSBAC_EINVALIDVALUE;
08846     if(!list_initialized)
08847       return -RSBAC_ENOTINITIALIZED;
08848 
08849     list = (struct rsbac_list_reg_item_t *) handle;
08850     if(list->self != list)
08851       return -RSBAC_EINVALIDVALUE;
08852 
08853 #ifdef CONFIG_RSBAC_LIST_TRANS
08854     if(ta_number)
08855       {
08856         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
08857           return -RSBAC_EINVALIDTRANSACTION;
08858       }
08859 #endif
08860 
08861     rsbac_read_lock(&reg_head.lock, &rlock_flags);
08862 /*
08863 #ifdef CONFIG_RSBAC_DEBUG
08864     if(rsbac_debug_lists)
08865       rsbac_printk(KERN_DEBUG "rsbac_list_get_desc: getting desc from list %s.\n",
08866              list->name);
08867 #endif
08868 */
08869     if(!list->info.data_size)
08870       {
08871         rsbac_read_unlock(&reg_head.lock, &rlock_flags);
08872         return -RSBAC_EINVALIDREQUEST;
08873       }
08874 
08875     rsbac_read_lock(&list->lock, &lock_flags);
08876 
08877 #ifdef CONFIG_RSBAC_LIST_TRANS
08878     if(ta_number && (list->ta_copied == ta_number))
08879       item_p = ta_lookup_item_data(ta_number, list, data, compare);
08880     else
08881 #endif
08882     item_p = lookup_item_data(list, data, compare);
08883     if(item_p)
08884       { /* exists -> copy desc */
08885         memcpy(desc,
08886                ((char *) item_p) + sizeof(*item_p),
08887                list->info.desc_size);
08888       }
08889     else
08890       {
08891         err = -RSBAC_ENOTFOUND;
08892       }
08893     rsbac_read_unlock(&list->lock, &lock_flags);
08894     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
08895     return err;
08896   }

int rsbac_ta_list_get_max_desc rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 8581 of file gen_lists.c.

References rsbac_list_info_t::desc_size, rsbac_list_reg_item_t::info, list_initialized, rsbac_list_reg_item_t::lock, rsbac_list_reg_head_t::lock, rsbac_list_item_t::max_age, rsbac_list_item_t::prev, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_list_reg_item_t::self, and rsbac_list_reg_item_t::tail.

Referenced by rsbac_list_get_max_desc().

08585   {
08586     struct rsbac_list_reg_item_t * list;
08587     struct rsbac_list_item_t * item_p;
08588     u_long lock_flags, rlock_flags;
08589     int err = 0;
08590 
08591     if(!handle)
08592       return -RSBAC_EINVALIDVALUE;
08593     if(!list_initialized)
08594       return -RSBAC_ENOTINITIALIZED;
08595 
08596     list = (struct rsbac_list_reg_item_t *) handle;
08597     if(list->self != list)
08598       return -RSBAC_EINVALIDVALUE;
08599 
08600 #ifdef CONFIG_RSBAC_LIST_TRANS
08601     if(ta_number)
08602       {
08603         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
08604           return -RSBAC_EINVALIDTRANSACTION;
08605       }
08606 #endif
08607 
08608     rsbac_read_lock(&reg_head.lock, &rlock_flags);
08609 /*
08610 #ifdef CONFIG_RSBAC_DEBUG
08611     if(rsbac_debug_lists)
08612       rsbac_printk(KERN_DEBUG "rsbac_list_get_max_desc: list %s.\n",
08613              list->name);
08614 #endif
08615 */
08616     rsbac_read_lock(&list->lock, &lock_flags);
08617 #ifdef CONFIG_RSBAC_LIST_TRANS
08618     if(ta_number && (list->ta_copied == ta_number))
08619       item_p = list->ta_tail;
08620     else
08621 #endif
08622     item_p = list->tail;
08623     while(   item_p
08624           && item_p->max_age
08625           && (item_p->max_age > RSBAC_CURRENT_TIME)
08626          )
08627       item_p = item_p->prev;
08628     if(item_p)
08629       memcpy(desc, (char *)item_p + sizeof(*item_p), list->info.desc_size);
08630     else
08631       {
08632         memset(desc, 0, list->info.desc_size);
08633         err = -RSBAC_ENOTFOUND;
08634       }
08635     rsbac_read_unlock(&list->lock, &lock_flags);
08636     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
08637     return err;
08638   }

int rsbac_ta_list_get_next_desc rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  old_desc,
void *  next_desc
 

Definition at line 8651 of file gen_lists.c.

References rsbac_list_reg_item_t::curr, rsbac_list_info_t::desc_size, rsbac_list_reg_item_t::head, rsbac_list_reg_item_t::info, list_initialized, rsbac_list_reg_item_t::lock, rsbac_list_reg_head_t::lock, lookup_item(), rsbac_list_item_t::max_age, rsbac_list_item_t::next, RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), and rsbac_list_reg_item_t::self.

Referenced by rsbac_list_get_next_desc().

08656   {
08657     struct rsbac_list_reg_item_t * list;
08658     struct rsbac_list_item_t * item_p;
08659     u_long lock_flags, rlock_flags;
08660 
08661     if(!handle)
08662       return -RSBAC_EINVALIDVALUE;
08663     if(!list_initialized)
08664       return -RSBAC_ENOTINITIALIZED;
08665     if(!next_desc)
08666       return -RSBAC_EINVALIDPOINTER;
08667 
08668     list = (struct rsbac_list_reg_item_t *) handle;
08669     if(list->self != list)
08670       return -RSBAC_EINVALIDVALUE;
08671 
08672 #ifdef CONFIG_RSBAC_LIST_TRANS
08673     if(ta_number)
08674       {
08675         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
08676           return -RSBAC_EINVALIDTRANSACTION;
08677       }
08678 #endif
08679 
08680     rsbac_read_lock(&reg_head.lock, &rlock_flags);
08681 /*
08682 #ifdef CONFIG_RSBAC_DEBUG
08683     if(rsbac_debug_lists)
08684       rsbac_printk(KERN_DEBUG "rsbac_list_get_next_desc: list %s.\n",
08685              list->name);
08686 #endif
08687 */
08688     rsbac_read_lock(&list->lock, &lock_flags);
08689     if(old_desc)
08690       {
08691 #ifdef CONFIG_RSBAC_LIST_TRANS
08692         if(ta_number && (list->ta_copied == ta_number))
08693           item_p = ta_lookup_item(ta_number, list, old_desc);
08694         else
08695 #endif
08696         item_p = lookup_item(list, old_desc);
08697         if(item_p)
08698           item_p = item_p->next;
08699       }
08700     else
08701 #ifdef CONFIG_RSBAC_LIST_TRANS
08702       if(ta_number && (list->ta_copied == ta_number))
08703         item_p = list->ta_head;
08704       else
08705 #endif
08706       item_p = list->head;
08707     while(   item_p
08708           && item_p->max_age
08709           && (item_p->max_age > RSBAC_CURRENT_TIME)
08710          )
08711       item_p = item_p->next;
08712     if(item_p)
08713       {
08714         memcpy(next_desc, (char *)item_p + sizeof(*item_p), list->info.desc_size);
08715         list->curr = item_p;
08716       }
08717     rsbac_read_unlock(&list->lock, &lock_flags);
08718     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
08719     if(item_p)
08720       return 0;
08721     else
08722       return -RSBAC_ENOTFOUND;
08723   }

int rsbac_ta_list_lol_add_ttl rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
rsbac_time_t  ttl,
void *  desc,
void *  data
 

Definition at line 7334 of file gen_lists.c.

References add_lol_item(), rsbac_list_lol_item_t::count, rsbac_list_lol_info_t::data_size, rsbac_list_lol_reg_item_t::def_data, rsbac_list_lol_info_t::desc_size, rsbac_list_lol_reg_item_t::dirty, do_remove_lol_item(), rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lol_touch, lookup_lol_item(), rsbac_list_lol_item_t::max_age, RSBAC_EBUSY, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, RSBAC_LIST_MAX_AGE_LIMIT, RSBAC_LIST_TTL_KEEP, rsbac_ta_list_exist(), rsbac_list_lol_reg_item_t::self, and TRUE.

Referenced by rsbac_acl_add_group_member(), rsbac_acl_add_to_acl_entry(), rsbac_acl_set_acl_entry(), rsbac_acl_set_mask(), rsbac_list_lol_add(), rsbac_list_lol_add_ttl(), rsbac_pm_create_set(), rsbac_um_add_user(), rsbac_um_mod_user(), and rsbac_um_set_pass().

07340   {
07341     struct rsbac_list_lol_reg_item_t * list;
07342     struct rsbac_list_lol_item_t     * item_p;
07343     u_long lock_flags, rlock_flags;
07344 
07345     if(!handle || !desc)
07346       return -RSBAC_EINVALIDVALUE;
07347     if(!list_initialized)
07348       return -RSBAC_ENOTINITIALIZED;
07349 
07350     list = (struct rsbac_list_lol_reg_item_t *) handle;
07351     if(!list || (list->self != list))
07352       return -RSBAC_EINVALIDVALUE;
07353 
07354 #ifdef CONFIG_RSBAC_LIST_TRANS
07355     if(ta_number && !rsbac_ta_list_exist(0, ta_handle, &ta_number))
07356       return -RSBAC_EINVALIDTRANSACTION;
07357 #endif
07358 
07359     if(ttl && (ttl != RSBAC_LIST_TTL_KEEP))
07360       {
07361         if(ttl > RSBAC_LIST_MAX_AGE_LIMIT)
07362           ttl = RSBAC_LIST_MAX_AGE_LIMIT;
07363         ttl += RSBAC_CURRENT_TIME;
07364       }
07365 
07366     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
07367     if(list->info.data_size && !data)
07368       {
07369         rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
07370         return -RSBAC_EINVALIDVALUE;
07371       }
07372 
07373 /*
07374 #ifdef CONFIG_RSBAC_DEBUG
07375     if(rsbac_debug_lists)
07376       rsbac_printk(KERN_DEBUG "rsbac_list_lol_add: adding to list %s.\n",
07377              list->name);
07378 #endif
07379 */
07380     rsbac_write_lock(&list->lock, &lock_flags);
07381 
07382 #ifdef CONFIG_RSBAC_LIST_TRANS
07383     if(!ta_number)
07384 #endif
07385       {
07386         item_p = lookup_lol_item(list, desc);
07387         if(item_p)
07388           { /* exists -> update data, if any */
07389             if(ttl != RSBAC_LIST_TTL_KEEP)
07390               item_p->max_age = ttl;
07391             if(data && list->info.data_size)
07392               {
07393                 if(   list->def_data
07394                    && !item_p->max_age
07395                    && !memcmp(list->def_data, data, list->info.data_size)
07396                    && !item_p->count
07397                   )
07398                   do_remove_lol_item(list, item_p);
07399                 else
07400                   memcpy(((char *) item_p) + sizeof(*item_p) + list->info.desc_size,
07401                          data, list->info.data_size);
07402               }
07403           }
07404         else
07405           {
07406             if(ttl == RSBAC_LIST_TTL_KEEP)
07407               ttl = 0;
07408             if(   !list->def_data
07409                || memcmp(list->def_data, data, list->info.data_size)
07410               )
07411               add_lol_item(list, ttl, desc, data);
07412           }
07413         lol_touch(list);
07414         list->dirty = TRUE;
07415       }
07416 #ifdef CONFIG_RSBAC_LIST_TRANS
07417     if(list->ta_copied || ta_number)
07418       {
07419         if(!list->ta_copied)
07420           ta_lol_copy(ta_number, list);
07421         else
07422           if(ta_number)
07423             {
07424               if(list->ta_copied != ta_number)
07425                 {
07426                   rsbac_write_unlock(&list->lock, &lock_flags);
07427                   rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
07428                   return -RSBAC_EBUSY;
07429                 }
07430             }
07431           else
07432             ta_number = list->ta_copied;
07433         item_p = ta_lookup_lol_item(ta_number, list, desc);
07434         if(item_p)
07435           { /* exists -> update data, if any */
07436             if(ttl != RSBAC_LIST_TTL_KEEP)
07437               item_p->max_age = ttl;
07438             if(data && list->info.data_size)
07439               {
07440                 if(   list->def_data
07441                    && !item_p->max_age
07442                    && !memcmp(list->def_data, data, list->info.data_size)
07443                    && !item_p->count
07444                   )
07445                   ta_do_remove_lol_item(list, item_p);
07446                 else
07447                   memcpy(((char *) item_p) + sizeof(*item_p) + list->info.desc_size,
07448                          data, list->info.data_size);
07449               }
07450           }
07451         else
07452           {
07453             if(ttl == RSBAC_LIST_TTL_KEEP)
07454               ttl = 0;
07455             if(   !list->def_data
07456                || memcmp(list->def_data, data, list->info.data_size)
07457               )
07458               ta_add_lol_item(ta_number, list, ttl, desc, data);
07459           }
07460       }
07461 #endif
07462     rsbac_write_unlock(&list->lock, &lock_flags);
07463     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
07464     return 0;
07465   }

long rsbac_ta_list_lol_all_subcount rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle
 

Definition at line 9387 of file gen_lists.c.

References rsbac_list_lol_item_t::count, rsbac_list_lol_reg_item_t::head, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, rsbac_list_lol_item_t::next, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), and rsbac_list_lol_reg_item_t::self.

Referenced by rsbac_list_lol_all_subcount().

09390   {
09391     struct rsbac_list_lol_reg_item_t * list;
09392     struct rsbac_list_lol_item_t     * sublist;
09393     u_long lock_flags, rlock_flags;
09394     long result = 0;
09395 
09396     if(!handle)
09397       return -RSBAC_EINVALIDVALUE;
09398     if(!list_initialized)
09399       return -RSBAC_ENOTINITIALIZED;
09400 
09401     list = (struct rsbac_list_lol_reg_item_t *) handle;
09402     if(list->self != list)
09403       return -RSBAC_EINVALIDVALUE;
09404 
09405 #ifdef CONFIG_RSBAC_LIST_TRANS
09406     if(ta_number)
09407       {
09408         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
09409           return -RSBAC_EINVALIDTRANSACTION;
09410       }
09411 #endif
09412 
09413     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
09414 /*
09415 #ifdef CONFIG_RSBAC_DEBUG
09416     if(rsbac_debug_lists)
09417       rsbac_printk(KERN_DEBUG "rsbac_list_lol_subcount: list %s.\n",
09418              list->name);
09419 #endif
09420 */
09421     rsbac_read_lock(&list->lock, &lock_flags);
09422 
09423 #ifdef CONFIG_RSBAC_LIST_TRANS
09424     if(ta_number && (list->ta_copied == ta_number))
09425       sublist = list->ta_head;
09426     else
09427 #endif
09428     sublist = list->head;
09429     while(sublist)
09430       {
09431         result += sublist->count;
09432         sublist = sublist->next;
09433       }
09434     rsbac_read_unlock(&list->lock, &lock_flags);
09435     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
09436     return result;
09437   }

long rsbac_ta_list_lol_count rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle
 

Definition at line 9450 of file gen_lists.c.

References rsbac_list_lol_reg_item_t::count, list_initialized, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), and rsbac_list_lol_reg_item_t::self.

Referenced by rsbac_acl_list_all_dev(), rsbac_acl_list_all_major_dev(), rsbac_acl_list_all_user(), rsbac_list_lol_count(), rsbac_um_get_gm_user_list(), and rsbac_um_get_user_list().

09453   {
09454     struct rsbac_list_lol_reg_item_t * list;
09455 
09456     if(!handle)
09457       return -RSBAC_EINVALIDVALUE;
09458     if(!list_initialized)
09459       return -RSBAC_ENOTINITIALIZED;
09460 
09461     list = (struct rsbac_list_lol_reg_item_t *) handle;
09462     if(list->self != list)
09463       return -RSBAC_EINVALIDVALUE;
09464 
09465 #ifdef CONFIG_RSBAC_LIST_TRANS
09466     if(ta_number)
09467       {
09468         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
09469           return -RSBAC_EINVALIDTRANSACTION;
09470       }
09471 #endif
09472 
09473 /*
09474 #ifdef CONFIG_RSBAC_DEBUG
09475     if(rsbac_debug_lists)
09476       rsbac_printk(KERN_DEBUG "rsbac_list_lol_count: list %s.\n",
09477              list->name);
09478 #endif
09479 */
09480 #ifdef CONFIG_RSBAC_LIST_TRANS
09481     if(ta_number && (list->ta_copied == ta_number))
09482       return list->ta_count;
09483     else
09484 #endif
09485     return list->count;
09486   }

int rsbac_ta_list_lol_exist rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 9243 of file gen_lists.c.

References FALSE, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lookup_lol_item(), rsbac_list_lol_item_t::max_age, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, rsbac_ta_list_exist(), rsbac_list_lol_reg_item_t::self, and TRUE.

Referenced by rsbac_acl_add_group_member(), rsbac_acl_add_to_acl_entry(), rsbac_acl_set_acl_entry(), rsbac_list_lol_exist(), rsbac_pm_create_set(), rsbac_pm_exists(), rsbac_pm_remove_target(), rsbac_pm_set_exist(), rsbac_um_add_user(), rsbac_um_get_user_item(), rsbac_um_mod_user(), rsbac_um_remove_user(), and rsbac_um_user_exists().

09247   {
09248     struct rsbac_list_lol_reg_item_t * list;
09249     u_long lock_flags, rlock_flags;
09250     struct rsbac_list_lol_item_t     * item_p;
09251     int result;
09252 
09253     if(!handle || !desc)
09254       return FALSE;
09255     if(!list_initialized)
09256       return FALSE;
09257 
09258     list = (struct rsbac_list_lol_reg_item_t *) handle;
09259     if(list->self != list)
09260       return -RSBAC_EINVALIDVALUE;
09261 
09262 #ifdef CONFIG_RSBAC_LIST_TRANS
09263     if(ta_number)
09264       {
09265         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
09266           return -RSBAC_EINVALIDTRANSACTION;
09267       }
09268 #endif
09269 
09270     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
09271 /*
09272 #ifdef CONFIG_RSBAC_DEBUG
09273     if(rsbac_debug_lists)
09274       rsbac_printk(KERN_DEBUG "rsbac_list_lol_exist: testing on list %s.\n",
09275              list->name);
09276 #endif
09277 */
09278     rsbac_read_lock(&list->lock, &lock_flags);
09279 
09280 #ifdef CONFIG_RSBAC_LIST_TRANS
09281     if(ta_number && (list->ta_copied == ta_number))
09282       item_p = ta_lookup_lol_item(ta_number, list, desc);
09283     else
09284 #endif
09285     item_p = lookup_lol_item(list, desc);
09286     if(   item_p
09287        && (   !item_p->max_age
09288            || (item_p->max_age > RSBAC_CURRENT_TIME)
09289           )
09290       )
09291       { /* exists -> TRUE */
09292         result = TRUE;
09293       }
09294     else
09295       {
09296         result = FALSE;
09297       }
09298     rsbac_read_unlock(&list->lock, &lock_flags);
09299     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
09300     return result;
09301   }

long rsbac_ta_list_lol_get_all_data rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void **  array_p
 

Definition at line 10154 of file gen_lists.c.

References rsbac_list_lol_reg_item_t::count, rsbac_list_lol_info_t::data_size, rsbac_list_lol_info_t::desc_size, rsbac_list_lol_reg_item_t::head, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, rsbac_list_lol_item_t::max_age, rsbac_list_lol_item_t::next, NULL, RSBAC_EINVALIDREQUEST, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOMEM, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_vmalloc, and rsbac_list_lol_reg_item_t::self.

Referenced by rsbac_list_lol_get_all_data().

10158   {
10159     struct rsbac_list_lol_reg_item_t * list;
10160     struct rsbac_list_lol_item_t     * item_p;
10161            char                      * buffer;
10162     u_long lock_flags, rlock_flags;
10163     u_long offset = 0;
10164     long result = 0;
10165     u_int item_size;
10166     u_int item_offset;
10167 
10168     if(!handle)
10169       return -RSBAC_EINVALIDVALUE;
10170     if(!array_p)
10171       return -RSBAC_EINVALIDVALUE;
10172     if(!list_initialized)
10173       return -RSBAC_ENOTINITIALIZED;
10174 
10175     list = (struct rsbac_list_lol_reg_item_t *) handle;
10176     if(list->self != list)
10177       return -RSBAC_EINVALIDVALUE;
10178     *array_p = NULL;
10179 
10180 #ifdef CONFIG_RSBAC_LIST_TRANS
10181     if(ta_number)
10182       {
10183         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
10184           return -RSBAC_EINVALIDTRANSACTION;
10185       }
10186 #endif
10187 
10188     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
10189 /*
10190 #ifdef CONFIG_RSBAC_DEBUG
10191     if(rsbac_debug_lists)
10192       rsbac_printk(KERN_DEBUG "rsbac_list_lol_get_all_desc: list %s.\n",
10193              list->name);
10194 #endif
10195 */
10196     rsbac_read_lock(&list->lock, &lock_flags);
10197     if(!list->info.data_size)
10198       {
10199         rsbac_read_unlock(&list->lock, &lock_flags);
10200         rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
10201         return -RSBAC_EINVALIDREQUEST;
10202       }
10203 #ifdef CONFIG_RSBAC_LIST_TRANS
10204     if(ta_number && (list->ta_copied == ta_number))
10205       {
10206         if(list->ta_count)
10207           {
10208             item_size = list->info.data_size;
10209             item_offset = list->info.desc_size;
10210             buffer = rsbac_vmalloc(item_size * list->ta_count);
10211             if(buffer)
10212               {
10213                 item_p = list->ta_head;
10214                 while(item_p)
10215                   {
10216                     if(   !item_p->max_age
10217                        || (item_p->max_age > RSBAC_CURRENT_TIME)
10218                       )
10219                       {
10220                         memcpy(buffer + offset,
10221                                ((char *) item_p) + sizeof(*item_p) + item_offset,
10222                                item_size);
10223                         offset += item_size;
10224                         result++;
10225                       }
10226                     item_p = item_p->next;
10227                   }
10228                 *array_p = buffer;
10229               }
10230             else
10231               {
10232                 result = -RSBAC_ENOMEM;
10233               }
10234           }
10235       }
10236     else
10237 #endif
10238     if(list->count)
10239       {
10240         item_size = list->info.data_size;
10241         item_offset = list->info.desc_size;
10242         buffer = rsbac_vmalloc(item_size * list->count);
10243         if(buffer)
10244           {
10245             item_p = list->head;
10246             while(item_p)
10247               {
10248                 if(   !item_p->max_age
10249                    || (item_p->max_age > RSBAC_CURRENT_TIME)
10250                   )
10251                   {
10252                     memcpy(buffer + offset,
10253                            ((char *) item_p) + sizeof(*item_p) + item_offset,
10254                            item_size);
10255                     offset += item_size;
10256                     result++;
10257                   }
10258                 item_p = item_p->next;
10259               }
10260             *array_p = buffer;
10261           }
10262         else
10263           {
10264             result = -RSBAC_ENOMEM;
10265           }
10266       }
10267     rsbac_read_unlock(&list->lock, &lock_flags);
10268     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
10269     return result;
10270   }

long rsbac_ta_list_lol_get_all_desc rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void **  array_p
 

Definition at line 9793 of file gen_lists.c.

References rsbac_list_lol_reg_item_t::count, rsbac_list_lol_info_t::desc_size, rsbac_list_lol_reg_item_t::head, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, rsbac_list_lol_item_t::max_age, rsbac_list_lol_item_t::next, NULL, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOMEM, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_vmalloc, and rsbac_list_lol_reg_item_t::self.

Referenced by rsbac_acl_get_group_members(), rsbac_acl_list_all_dev(), rsbac_acl_list_all_major_dev(), rsbac_acl_list_all_user(), rsbac_list_lol_get_all_desc(), rsbac_um_get_gm_user_list(), and rsbac_um_get_user_list().

09797   {
09798     struct rsbac_list_lol_reg_item_t * list;
09799     struct rsbac_list_lol_item_t     * item_p;
09800            char                      * buffer;
09801     u_long lock_flags, rlock_flags;
09802     u_long offset = 0;
09803     long result = 0;
09804     u_int item_size;
09805 
09806     if(!handle)
09807       return -RSBAC_EINVALIDVALUE;
09808     if(!array_p)
09809       return -RSBAC_EINVALIDVALUE;
09810     if(!list_initialized)
09811       return -RSBAC_ENOTINITIALIZED;
09812 
09813     list = (struct rsbac_list_lol_reg_item_t *) handle;
09814     if(list->self != list)
09815       return -RSBAC_EINVALIDVALUE;
09816     *array_p = NULL;
09817 
09818 #ifdef CONFIG_RSBAC_LIST_TRANS
09819     if(ta_number)
09820       {
09821         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
09822           return -RSBAC_EINVALIDTRANSACTION;
09823       }
09824 #endif
09825 
09826     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
09827 /*
09828 #ifdef CONFIG_RSBAC_DEBUG
09829     if(rsbac_debug_lists)
09830       rsbac_printk(KERN_DEBUG "rsbac_list_lol_get_all_desc: list %s.\n",
09831              list->name);
09832 #endif
09833 */
09834     rsbac_read_lock(&list->lock, &lock_flags);
09835 #ifdef CONFIG_RSBAC_LIST_TRANS
09836     if(ta_number && (list->ta_copied == ta_number))
09837       {
09838         if(list->ta_count)
09839           {
09840             item_size = list->info.desc_size;
09841             buffer = rsbac_vmalloc(item_size * list->ta_count);
09842             if(buffer)
09843               {
09844                 item_p = list->ta_head;
09845                 while(item_p)
09846                   {
09847                     if(   !item_p->max_age
09848                        || (item_p->max_age > RSBAC_CURRENT_TIME)
09849                       )
09850                       {
09851                         memcpy(buffer + offset,
09852                                ((char *) item_p) + sizeof(*item_p),
09853                                item_size);
09854                         offset += item_size;
09855                         result++;
09856                       }
09857                     item_p = item_p->next;
09858                   }
09859                 *array_p = buffer;
09860               }
09861             else
09862               {
09863                 result = -RSBAC_ENOMEM;
09864               }
09865           }
09866       }
09867     else
09868 #endif
09869     if(list->count)
09870       {
09871         item_size = list->info.desc_size;
09872         buffer = rsbac_vmalloc(item_size * list->count);
09873         if(buffer)
09874           {
09875             item_p = list->head;
09876             while(item_p)
09877               {
09878                 if(   !item_p->max_age
09879                    || (item_p->max_age > RSBAC_CURRENT_TIME)
09880                   )
09881                   {
09882                     memcpy(buffer + offset,
09883                            ((char *) item_p) + sizeof(*item_p),
09884                            item_size);
09885                     offset += item_size;
09886                     result++;
09887                   }
09888                 item_p = item_p->next;
09889               }
09890             *array_p = buffer;
09891           }
09892         else
09893           {
09894             result = -RSBAC_ENOMEM;
09895           }
09896       }
09897     rsbac_read_unlock(&list->lock, &lock_flags);
09898     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
09899     return result;
09900   }

long rsbac_ta_list_lol_get_all_items rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void **  array_p
 

Definition at line 10623 of file gen_lists.c.

References rsbac_list_lol_reg_item_t::count, rsbac_list_lol_info_t::data_size, rsbac_list_lol_info_t::desc_size, rsbac_list_lol_reg_item_t::head, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_reg_head_t::lock, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, rsbac_list_lol_item_t::max_age, rsbac_list_lol_item_t::next, NULL, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOMEM, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_vmalloc, and rsbac_list_lol_reg_item_t::self.

Referenced by rsbac_list_lol_get_all_items().

10627   {
10628     struct rsbac_list_lol_reg_item_t * list;
10629     struct rsbac_list_lol_item_t     * item_p;
10630            char                      * buffer;
10631     u_long lock_flags, rlock_flags;
10632     u_long offset = 0;
10633     long result = 0;
10634     u_int item_size;
10635 
10636     if(!handle)
10637       return -RSBAC_EINVALIDVALUE;
10638     if(!array_p)
10639       return -RSBAC_EINVALIDVALUE;
10640     if(!list_initialized)
10641       return -RSBAC_ENOTINITIALIZED;
10642 
10643     list = (struct rsbac_list_lol_reg_item_t *) handle;
10644     if(list->self != list)
10645       return -RSBAC_EINVALIDVALUE;
10646     *array_p = NULL;
10647 
10648 #ifdef CONFIG_RSBAC_LIST_TRANS
10649     if(ta_number)
10650       {
10651         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
10652           return -RSBAC_EINVALIDTRANSACTION;
10653       }
10654 #endif
10655 
10656     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
10657 /*
10658 #ifdef CONFIG_RSBAC_DEBUG
10659     if(rsbac_debug_lists)
10660       rsbac_printk(KERN_DEBUG "rsbac_list_lol_get_all_items: list %s.\n",
10661              list->name);
10662 #endif
10663 */
10664     rsbac_read_lock(&list->lock, &lock_flags);
10665 #ifdef CONFIG_RSBAC_LIST_TRANS
10666     if(ta_number && (list->ta_copied == ta_number))
10667       {
10668         if(list->ta_count)
10669           {
10670             item_size = list->info.desc_size + list->info.data_size;
10671             buffer = rsbac_vmalloc(item_size * list->ta_count);
10672             if(buffer)
10673               {
10674                 item_p = list->ta_head;
10675                 while(item_p)
10676                   {
10677                     if(   !item_p->max_age
10678                        || (item_p->max_age > RSBAC_CURRENT_TIME)
10679                       )
10680                       {
10681                         memcpy(buffer + offset,
10682                                ((char *) item_p) + sizeof(*item_p),
10683                                item_size);
10684                         offset += item_size;
10685                         result++;
10686                       }
10687                     item_p = item_p->next;
10688                   }
10689                 *array_p = buffer;
10690               }
10691             else
10692               {
10693                 result = -RSBAC_ENOMEM;
10694               }
10695           }
10696       }
10697     else
10698 #endif
10699     if(list->count)
10700       {
10701         item_size = list->info.desc_size + list->info.data_size;
10702         buffer = rsbac_vmalloc(item_size * list->count);
10703         if(buffer)
10704           {
10705             item_p = list->head;
10706             while(item_p)
10707               {
10708                 if(   !item_p->max_age
10709                    || (item_p->max_age > RSBAC_CURRENT_TIME)
10710                   )
10711                   {
10712                     memcpy(buffer + offset,
10713                            ((char *) item_p) + sizeof(*item_p),
10714                            item_size);
10715                     offset += item_size;
10716                     result++;
10717                   }
10718                 item_p = item_p->next;
10719               }
10720             *array_p = buffer;
10721           }
10722         else
10723           {
10724             result = -RSBAC_ENOMEM;
10725           }
10726       }
10727     rsbac_read_unlock(&list->lock, &lock_flags);
10728     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
10729     return result;
10730   }

long rsbac_ta_list_lol_get_all_subdata rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc,
void **  array_p
 

Definition at line 10049 of file gen_lists.c.

References rsbac_list_lol_item_t::count, rsbac_list_lol_item_t::head, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lookup_lol_item(), rsbac_list_item_t::max_age, rsbac_list_item_t::next, NULL, RSBAC_EINVALIDREQUEST, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOMEM, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_vmalloc, rsbac_list_lol_reg_item_t::self, rsbac_list_lol_info_t::subdata_size, and rsbac_list_lol_info_t::subdesc_size.

Referenced by rsbac_list_lol_get_all_subdata().

10054   {
10055     struct rsbac_list_lol_reg_item_t * list;
10056     struct rsbac_list_lol_item_t     * sublist;
10057     struct rsbac_list_item_t         * item_p;
10058            char                      * buffer;
10059     u_long lock_flags, rlock_flags;
10060     u_long offset = 0;
10061     long result = 0;
10062     u_int item_size;
10063     u_int item_offset;
10064 
10065     if(!handle)
10066       return -RSBAC_EINVALIDVALUE;
10067     if(!array_p)
10068       return -RSBAC_EINVALIDVALUE;
10069     if(!list_initialized)
10070       return -RSBAC_ENOTINITIALIZED;
10071 
10072     list = (struct rsbac_list_lol_reg_item_t *) handle;
10073     if(list->self != list)
10074       return -RSBAC_EINVALIDVALUE;
10075     *array_p = NULL;
10076 
10077 #ifdef CONFIG_RSBAC_LIST_TRANS
10078     if(ta_number)
10079       {
10080         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
10081           return -RSBAC_EINVALIDTRANSACTION;
10082       }
10083 #endif
10084 
10085     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
10086 /*
10087 #ifdef CONFIG_RSBAC_DEBUG
10088     if(rsbac_debug_lists)
10089       rsbac_printk(KERN_DEBUG "rsbac_ta_list_lol_get_all_desc: list %s.\n",
10090              list->name);
10091 #endif
10092 */
10093     rsbac_read_lock(&list->lock, &lock_flags);
10094     if(!list->info.subdata_size)
10095       {
10096         rsbac_read_unlock(&list->lock, &lock_flags);
10097         rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
10098         return -RSBAC_EINVALIDREQUEST;
10099       }
10100 #ifdef CONFIG_RSBAC_LIST_TRANS
10101     if(ta_number && (list->ta_copied == ta_number))
10102       sublist = ta_lookup_lol_item(ta_number, list, desc);
10103     else
10104 #endif
10105     sublist = lookup_lol_item(list, desc);
10106     if(sublist && sublist->count)
10107       {
10108         item_size = list->info.subdata_size;
10109         item_offset = list->info.subdesc_size;
10110         buffer = rsbac_vmalloc(item_size * sublist->count);
10111         if(buffer)
10112           {
10113             item_p = sublist->head;
10114             while(item_p)
10115               {
10116                 if(   !item_p->max_age
10117                    || (item_p->max_age > RSBAC_CURRENT_TIME)
10118                   )
10119                   {
10120                     memcpy(buffer + offset,
10121                            ((char *) item_p) + sizeof(*item_p) + item_offset,
10122                            item_size);
10123                     offset += item_size;
10124                     result++;
10125                   }
10126                 item_p = item_p->next;
10127               }
10128             *array_p = buffer;
10129           }
10130         else
10131           {
10132             result = -RSBAC_ENOMEM;
10133           }
10134       }
10135     rsbac_read_unlock(&list->lock, &lock_flags);
10136     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
10137     return result;
10138   }

long rsbac_ta_list_lol_get_all_subdesc_ttl rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc,
void **  array_p,
rsbac_time_t **  ttl_array_p
 

Definition at line 9669 of file gen_lists.c.

References rsbac_list_lol_item_t::count, rsbac_list_lol_item_t::head, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lookup_lol_item(), rsbac_list_item_t::max_age, rsbac_list_item_t::next, NULL, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOMEM, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_vmalloc, rsbac_list_lol_reg_item_t::self, and rsbac_list_lol_info_t::subdesc_size.

Referenced by rsbac_acl_get_user_groups(), rsbac_auth_get_f_caplist(), rsbac_auth_get_p_caplist(), rsbac_list_lol_get_all_subdesc(), rsbac_list_lol_get_all_subdesc_ttl(), rsbac_mac_get_f_trulist(), rsbac_mac_get_p_trulist(), rsbac_rc_copy_role(), rsbac_rc_get_list(), and rsbac_um_get_gm_list().

09675   {
09676     struct rsbac_list_lol_reg_item_t * list;
09677     struct rsbac_list_lol_item_t     * sublist;
09678     struct rsbac_list_item_t         * item_p;
09679            char                      * buffer;
09680            rsbac_time_t              * ttl_p = NULL;
09681     u_long lock_flags, rlock_flags;
09682     u_long offset = 0;
09683     long result = 0;
09684     u_int item_size;
09685 
09686     if(!handle)
09687       return -RSBAC_EINVALIDVALUE;
09688     if(!array_p)
09689       return -RSBAC_EINVALIDVALUE;
09690     if(!list_initialized)
09691       return -RSBAC_ENOTINITIALIZED;
09692 
09693     list = (struct rsbac_list_lol_reg_item_t *) handle;
09694     if(list->self != list)
09695       return -RSBAC_EINVALIDVALUE;
09696     *array_p = NULL;
09697 
09698 #ifdef CONFIG_RSBAC_LIST_TRANS
09699     if(ta_number)
09700       {
09701         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
09702           return -RSBAC_EINVALIDTRANSACTION;
09703       }
09704 #endif
09705 
09706     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
09707 /*
09708 #ifdef CONFIG_RSBAC_DEBUG
09709     if(rsbac_debug_lists)
09710       rsbac_printk(KERN_DEBUG "rsbac_list_lol_get_all_desc: list %s.\n",
09711              list->name);
09712 #endif
09713 */
09714     rsbac_read_lock(&list->lock, &lock_flags);
09715 #ifdef CONFIG_RSBAC_LIST_TRANS
09716     if(ta_number && (list->ta_copied == ta_number))
09717       sublist = ta_lookup_lol_item(ta_number, list, desc);
09718     else
09719 #endif
09720     sublist = lookup_lol_item(list, desc);
09721     if(sublist && sublist->count)
09722       {
09723         item_size = list->info.subdesc_size;
09724         buffer = rsbac_vmalloc(item_size * sublist->count);
09725         if(buffer)
09726           {
09727             if(ttl_array_p)
09728               ttl_p = rsbac_vmalloc(sizeof(**ttl_array_p) * sublist->count);
09729             item_p = sublist->head;
09730             while(item_p)
09731               {
09732                 if(   !item_p->max_age
09733                    || (item_p->max_age > RSBAC_CURRENT_TIME)
09734                   )
09735                   {
09736                     memcpy(buffer + offset,
09737                            ((char *) item_p) + sizeof(*item_p),
09738                            item_size);
09739                     if(ttl_p)
09740                       {
09741                         if(item_p->max_age)
09742                           ttl_p[result] = item_p->max_age - RSBAC_CURRENT_TIME;
09743                         else
09744                           ttl_p[result] = 0;
09745                       }
09746                     offset += item_size;
09747                     result++;
09748                   }
09749                 item_p = item_p->next;
09750               }
09751             *array_p = buffer;
09752             if(ttl_array_p)
09753               *ttl_array_p = ttl_p;
09754           }
09755         else
09756           {
09757             result = -RSBAC_ENOMEM;
09758           }
09759       }
09760     rsbac_read_unlock(&list->lock, &lock_flags);
09761     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
09762     return result;
09763   }

long rsbac_ta_list_lol_get_all_subitems_ttl rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc,
void **  array_p,
rsbac_time_t **  ttl_array_p
 

Definition at line 10502 of file gen_lists.c.

References rsbac_list_lol_item_t::count, rsbac_list_lol_item_t::head, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lookup_lol_item(), rsbac_list_item_t::max_age, rsbac_list_item_t::next, NULL, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOMEM, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_vmalloc, rsbac_list_lol_reg_item_t::self, rsbac_list_lol_info_t::subdata_size, and rsbac_list_lol_info_t::subdesc_size.

Referenced by rsbac_acl_get_tlist(), rsbac_list_lol_get_all_subitems(), rsbac_list_lol_get_all_subitems_ttl(), and rsbac_rc_copy_role().

10508   {
10509     struct rsbac_list_lol_reg_item_t * list;
10510     struct rsbac_list_lol_item_t     * sublist;
10511     struct rsbac_list_item_t         * item_p;
10512            char                      * buffer;
10513            rsbac_time_t              * ttl_p = NULL;
10514     u_long lock_flags, rlock_flags;
10515     u_long offset = 0;
10516     long result = 0;
10517     u_int item_size;
10518 
10519     if(!handle)
10520       return -RSBAC_EINVALIDVALUE;
10521     if(!array_p)
10522       return -RSBAC_EINVALIDVALUE;
10523     if(!list_initialized)
10524       return -RSBAC_ENOTINITIALIZED;
10525 
10526     list = (struct rsbac_list_lol_reg_item_t *) handle;
10527     if(list->self != list)
10528       return -RSBAC_EINVALIDVALUE;
10529     *array_p = NULL;
10530 
10531 #ifdef CONFIG_RSBAC_LIST_TRANS
10532     if(ta_number)
10533       {
10534         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
10535           return -RSBAC_EINVALIDTRANSACTION;
10536       }
10537 #endif
10538 
10539     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
10540 /*
10541 #ifdef CONFIG_RSBAC_DEBUG
10542     if(rsbac_debug_lists)
10543       rsbac_printk(KERN_DEBUG "rsbac_list_lol_get_all_subitems: list %s.\n",
10544              list->name);
10545 #endif
10546 */
10547     rsbac_read_lock(&list->lock, &lock_flags);
10548 #ifdef CONFIG_RSBAC_LIST_TRANS
10549     if(ta_number && (list->ta_copied == ta_number))
10550       sublist = ta_lookup_lol_item(ta_number, list, desc);
10551     else
10552 #endif
10553     sublist = lookup_lol_item(list, desc);
10554     if(sublist && sublist->count)
10555       {
10556         item_size = list->info.subdesc_size + list->info.subdata_size;
10557         buffer = rsbac_vmalloc(item_size * sublist->count);
10558         if(buffer)
10559           {
10560             if(ttl_array_p)
10561               ttl_p = rsbac_vmalloc(sizeof(**ttl_array_p) * sublist->count);
10562             item_p = sublist->head;
10563             while(item_p)
10564               {
10565                 if(   !item_p->max_age
10566                    || (item_p->max_age > RSBAC_CURRENT_TIME)
10567                   )
10568                   {
10569                     memcpy(buffer + offset,
10570                            ((char *) item_p) + sizeof(*item_p),
10571                            item_size);
10572                     if(ttl_p)
10573                       {
10574                         if(item_p->max_age)
10575                           ttl_p[result] = item_p->max_age - RSBAC_CURRENT_TIME;
10576                         else
10577                           ttl_p[result] = 0;
10578                       }
10579                     offset += item_size;
10580                     result++;
10581                   }
10582                 item_p = item_p->next;
10583               }
10584             *array_p = buffer;
10585             if(ttl_array_p)
10586               *ttl_array_p = ttl_p;
10587           }
10588         else
10589           {
10590             result = -RSBAC_ENOMEM;
10591           }
10592       }
10593     rsbac_read_unlock(&list->lock, &lock_flags);
10594     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
10595     return result;
10596   }

int rsbac_ta_list_lol_get_data_ttl rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
rsbac_time_t ttl_p,
void *  desc,
void *  data
 

Definition at line 8467 of file gen_lists.c.

References rsbac_list_lol_info_t::data_size, rsbac_list_lol_reg_item_t::def_data, rsbac_list_lol_info_t::desc_size, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lookup_lol_item(), rsbac_list_lol_item_t::max_age, RSBAC_EINVALIDREQUEST, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), and rsbac_list_lol_reg_item_t::self.

Referenced by rsbac_acl_get_mask(), rsbac_acl_get_rights(), rsbac_acl_get_single_right(), rsbac_acl_remove_acl_entry(), rsbac_list_lol_get_data(), rsbac_list_lol_get_data_ttl(), rsbac_um_check_account(), rsbac_um_check_pass(), rsbac_um_get_user_entry(), rsbac_um_get_user_item(), rsbac_um_mod_user(), and rsbac_um_set_pass().

08473   {
08474     struct rsbac_list_lol_reg_item_t * list;
08475     struct rsbac_list_lol_item_t     * item_p;
08476     u_long lock_flags, rlock_flags;
08477     int err = 0;
08478 
08479     if(!handle || !desc)
08480       return -RSBAC_EINVALIDVALUE;
08481     if(!list_initialized)
08482       return -RSBAC_ENOTINITIALIZED;
08483 
08484     list = (struct rsbac_list_lol_reg_item_t *) handle;
08485     if(list->self != list)
08486       return -RSBAC_EINVALIDVALUE;
08487 
08488 #ifdef CONFIG_RSBAC_LIST_TRANS
08489     if(ta_number)
08490       {
08491         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
08492           return -RSBAC_EINVALIDTRANSACTION;
08493       }
08494 #endif
08495 
08496     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
08497 /*
08498 #ifdef CONFIG_RSBAC_DEBUG
08499     if(rsbac_debug_lists)
08500       rsbac_printk(KERN_DEBUG "rsbac_list_lol_get_data: getting data from list %s.\n",
08501              list->name);
08502 #endif
08503 */
08504     if(data && !list->info.data_size)
08505       {
08506         rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
08507         return -RSBAC_EINVALIDREQUEST;
08508       }
08509 
08510     rsbac_read_lock(&list->lock, &lock_flags);
08511 
08512 #ifdef CONFIG_RSBAC_LIST_TRANS
08513     if(ta_number && (list->ta_copied == ta_number))
08514       item_p = ta_lookup_lol_item(ta_number, list, desc);
08515     else
08516 #endif
08517     item_p = lookup_lol_item(list, desc);
08518     if(   item_p
08519        && (   !item_p->max_age
08520            || (item_p->max_age > RSBAC_CURRENT_TIME)
08521           )
08522       )
08523       { /* exists -> copy data, if any */
08524         if(ttl_p)
08525           {
08526             if(item_p->max_age)
08527               *ttl_p = item_p->max_age - RSBAC_CURRENT_TIME;
08528             else
08529               *ttl_p = 0;
08530           }
08531         if(data)
08532           {
08533             memcpy(data,
08534                    ((char *) item_p) + sizeof(*item_p) + list->info.desc_size,
08535                    list->info.data_size);
08536           }
08537       }
08538     else
08539       {
08540         if(!list->def_data)
08541           err = -RSBAC_ENOTFOUND;
08542         else
08543           {
08544             if(ttl_p)
08545               *ttl_p = 0;
08546             if(data)
08547               memcpy(data,
08548                      list->def_data,
08549                      list->info.data_size);
08550           }
08551       }
08552     rsbac_read_unlock(&list->lock, &lock_flags);
08553     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
08554     return err;
08555   }

int rsbac_ta_list_lol_get_desc rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc,
void *  data,
rsbac_list_data_compare_function_t  compare
 

Definition at line 8913 of file gen_lists.c.

References rsbac_list_lol_info_t::data_size, rsbac_list_lol_info_t::desc_size, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lookup_lol_item_data(), RSBAC_EINVALIDREQUEST, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), and rsbac_list_lol_reg_item_t::self.

Referenced by rsbac_list_lol_get_desc(), and rsbac_um_get_uid().

08919   {
08920     struct rsbac_list_lol_reg_item_t * list;
08921     struct rsbac_list_lol_item_t     * item_p;
08922     u_long lock_flags, rlock_flags;
08923     int err = 0;
08924 
08925     if(!handle || !desc || !data)
08926       return -RSBAC_EINVALIDVALUE;
08927     if(!list_initialized)
08928       return -RSBAC_ENOTINITIALIZED;
08929 
08930     list = (struct rsbac_list_lol_reg_item_t *) handle;
08931     if(list->self != list)
08932       return -RSBAC_EINVALIDVALUE;
08933 
08934 #ifdef CONFIG_RSBAC_LIST_TRANS
08935     if(ta_number)
08936       {
08937         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
08938           return -RSBAC_EINVALIDTRANSACTION;
08939       }
08940 #endif
08941 
08942     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
08943 /*
08944 #ifdef CONFIG_RSBAC_DEBUG
08945     if(rsbac_debug_lists)
08946       rsbac_printk(KERN_DEBUG "rsbac_list_lol_get_desc: getting desc from list %s.\n",
08947              list->name);
08948 #endif
08949 */
08950     if(!list->info.data_size)
08951       {
08952         rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
08953         return -RSBAC_EINVALIDREQUEST;
08954       }
08955 
08956     rsbac_read_lock(&list->lock, &lock_flags);
08957 
08958 #ifdef CONFIG_RSBAC_LIST_TRANS
08959     if(ta_number && (list->ta_copied == ta_number))
08960       item_p = ta_lookup_lol_item_data(ta_number, list, data, compare);
08961     else
08962 #endif
08963     item_p = lookup_lol_item_data(list, data, compare);
08964     if(item_p)
08965       { /* exists -> copy desc */
08966         memcpy(desc,
08967                ((char *) item_p) + sizeof(*item_p),
08968                list->info.desc_size);
08969       }
08970     else
08971       {
08972         err = -RSBAC_ENOTFOUND;
08973       }
08974     rsbac_read_unlock(&list->lock, &lock_flags);
08975     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
08976     return err;
08977   }

int rsbac_ta_list_lol_get_next_desc rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  old_desc,
void *  next_desc
 

Definition at line 8736 of file gen_lists.c.

References rsbac_list_lol_reg_item_t::curr, rsbac_list_lol_info_t::desc_size, rsbac_list_lol_reg_item_t::head, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lookup_lol_item(), rsbac_list_lol_item_t::max_age, rsbac_list_lol_item_t::next, RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), and rsbac_list_lol_reg_item_t::self.

Referenced by rsbac_list_lol_get_next_desc(), and rsbac_um_get_next_user().

08741   {
08742     struct rsbac_list_lol_reg_item_t * list;
08743     struct rsbac_list_lol_item_t * item_p;
08744     u_long lock_flags, rlock_flags;
08745 
08746     if(!handle)
08747       return -RSBAC_EINVALIDVALUE;
08748     if(!list_initialized)
08749       return -RSBAC_ENOTINITIALIZED;
08750     if(!next_desc)
08751       return -RSBAC_EINVALIDPOINTER;
08752 
08753     list = (struct rsbac_list_lol_reg_item_t *) handle;
08754     if(list->self != list)
08755       return -RSBAC_EINVALIDVALUE;
08756 
08757 #ifdef CONFIG_RSBAC_LIST_TRANS
08758     if(ta_number)
08759       {
08760         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
08761           return -RSBAC_EINVALIDTRANSACTION;
08762       }
08763 #endif
08764 
08765     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
08766 /*
08767 #ifdef CONFIG_RSBAC_DEBUG
08768     if(rsbac_debug_lists)
08769       rsbac_printk(KERN_DEBUG "rsbac_list_lol_get_next_desc: list %s.\n",
08770              list->name);
08771 #endif
08772 */
08773     rsbac_read_lock(&list->lock, &lock_flags);
08774     if(old_desc)
08775       {
08776 #ifdef CONFIG_RSBAC_LIST_TRANS
08777         if(ta_number && (list->ta_copied == ta_number))
08778           item_p = ta_lookup_lol_item(ta_number, list, old_desc);
08779         else
08780 #endif
08781         item_p = lookup_lol_item(list, old_desc);
08782         if(item_p)
08783           item_p = item_p->next;
08784       }
08785     else
08786 #ifdef CONFIG_RSBAC_LIST_TRANS
08787       if(ta_number && (list->ta_copied == ta_number))
08788         item_p = list->ta_head;
08789       else
08790 #endif
08791       item_p = list->head;
08792     while(   item_p
08793           && item_p->max_age
08794           && (item_p->max_age > RSBAC_CURRENT_TIME)
08795          )
08796       item_p = item_p->next;
08797     if(item_p)
08798       {
08799         memcpy(next_desc, (char *)item_p + sizeof(*item_p), list->info.desc_size);
08800         list->curr = item_p;
08801       }
08802     rsbac_read_unlock(&list->lock, &lock_flags);
08803     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
08804     if(item_p)
08805       return 0;
08806     else
08807       return -RSBAC_ENOTFOUND;
08808   }

int rsbac_ta_list_lol_get_subdata_ttl rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
rsbac_time_t ttl_p,
void *  desc,
void *  subdesc,
void *  subdata
 

Definition at line 8328 of file gen_lists.c.

References rsbac_list_lol_reg_item_t::def_subdata, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lookup_lol_item(), lookup_lol_subitem(), rsbac_list_item_t::max_age, RSBAC_EINVALIDREQUEST, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_list_lol_reg_item_t::self, rsbac_list_lol_info_t::subdata_size, and rsbac_list_lol_info_t::subdesc_size.

Referenced by rsbac_acl_add_to_acl_entry(), rsbac_acl_get_group_members(), rsbac_acl_get_rights(), rsbac_acl_get_single_right(), rsbac_acl_remove_from_acl_entry(), rsbac_list_lol_get_subdata(), rsbac_list_lol_get_subdata_ttl(), rsbac_rc_copy_type(), and rsbac_rc_get_item().

08335   {
08336     struct rsbac_list_lol_reg_item_t * list;
08337     struct rsbac_list_lol_item_t     * sublist;
08338     struct rsbac_list_item_t         * item_p;
08339     u_long lock_flags, rlock_flags;
08340     int err = 0;
08341 
08342     if(!handle || !desc || !subdesc)
08343       return -RSBAC_EINVALIDVALUE;
08344     if(!list_initialized)
08345       return -RSBAC_ENOTINITIALIZED;
08346 
08347     list = (struct rsbac_list_lol_reg_item_t *) handle;
08348     if(list->self != list)
08349       return -RSBAC_EINVALIDVALUE;
08350 
08351 #ifdef CONFIG_RSBAC_LIST_TRANS
08352     if(ta_number)
08353       {
08354         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
08355           return -RSBAC_EINVALIDTRANSACTION;
08356       }
08357 #endif
08358 
08359     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
08360 /*
08361 #ifdef CONFIG_RSBAC_DEBUG
08362     if(rsbac_debug_lists)
08363       rsbac_printk(KERN_DEBUG "rsbac_list_lol_get_subdata: getting data from list %s.\n",
08364              list->name);
08365 #endif
08366 */
08367     if(subdata && !list->info.subdata_size)
08368       {
08369         rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
08370         return -RSBAC_EINVALIDREQUEST;
08371       }
08372 
08373     rsbac_read_lock(&list->lock, &lock_flags);
08374 
08375 #ifdef CONFIG_RSBAC_LIST_TRANS
08376     if(ta_number && (list->ta_copied == ta_number))
08377       sublist = ta_lookup_lol_item(ta_number, list, desc);
08378     else
08379 #endif
08380     sublist = lookup_lol_item(list, desc);
08381     if(sublist)
08382       { /* exists -> lookup subitem */
08383         item_p = lookup_lol_subitem(list, sublist, subdesc);
08384         if(   item_p
08385            && (   !item_p->max_age
08386                || (item_p->max_age > RSBAC_CURRENT_TIME)
08387               )
08388           )
08389           { /* exists -> copy data, if any */
08390             if(ttl_p)
08391               {
08392                 if(item_p->max_age)
08393                   *ttl_p = item_p->max_age - RSBAC_CURRENT_TIME;
08394                 else
08395                   *ttl_p = 0;
08396               }
08397             if(subdata)
08398               {
08399                 memcpy(subdata,
08400                        ((char *) item_p) + sizeof(*item_p) + list->info.subdesc_size,
08401                        list->info.subdata_size);
08402               }
08403           }
08404         else
08405           {
08406             if(!list->def_subdata)
08407               err = -RSBAC_ENOTFOUND;
08408             else
08409               {
08410                 if(ttl_p)
08411                   *ttl_p = 0;
08412                 if(subdata)
08413                   memcpy(subdata,
08414                          list->def_subdata,
08415                          list->info.subdata_size);
08416               }
08417           }
08418       }
08419     else
08420       {
08421         if(!list->def_subdata)
08422           err = -RSBAC_ENOTFOUND;
08423         else
08424           {
08425             if(ttl_p)
08426               *ttl_p = 0;
08427             if(subdata)
08428               memcpy(subdata,
08429                      list->def_subdata,
08430                      list->info.subdata_size);
08431           }
08432       }
08433     rsbac_read_unlock(&list->lock, &lock_flags);
08434     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
08435     return err;
08436   }

int rsbac_ta_list_lol_remove rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 8030 of file gen_lists.c.

References rsbac_list_lol_reg_item_t::dirty, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lol_touch, lookup_lol_item(), remove_lol_item(), RSBAC_EBUSY, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_list_lol_reg_item_t::self, and TRUE.

Referenced by rsbac_acl_remove_acl(), rsbac_acl_remove_acl_entry(), rsbac_acl_remove_group_member(), rsbac_acl_remove_user(), rsbac_auth_clear_f_capset(), rsbac_auth_clear_p_capset(), rsbac_list_lol_remove(), rsbac_mac_clear_f_truset(), rsbac_mac_clear_p_truset(), rsbac_pm_exists(), rsbac_pm_remove_set(), rsbac_pm_remove_target(), rsbac_rc_copy_role(), rsbac_rc_set_item(), and rsbac_um_remove_user().

08034   {
08035     struct rsbac_list_lol_reg_item_t * list;
08036     u_long lock_flags, rlock_flags;
08037 
08038     if(!handle || !desc)
08039       return -RSBAC_EINVALIDVALUE;
08040     if(!list_initialized)
08041       return -RSBAC_ENOTINITIALIZED;
08042 
08043     list = (struct rsbac_list_lol_reg_item_t *) handle;
08044     if(list->self != list)
08045       return -RSBAC_EINVALIDVALUE;
08046 
08047 #ifdef CONFIG_RSBAC_LIST_TRANS
08048     if(ta_number)
08049       {
08050         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
08051           return -RSBAC_EINVALIDTRANSACTION;
08052       }
08053 #endif
08054 
08055     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
08056 /*
08057 #ifdef CONFIG_RSBAC_DEBUG
08058     if(rsbac_debug_lists)
08059       rsbac_printk(KERN_DEBUG "rsbac_list_lol_remove: removing from list of lists %s.\n",
08060              list->name);
08061 #endif
08062 */
08063     rsbac_write_lock(&list->lock, &lock_flags);
08064 #ifdef CONFIG_RSBAC_LIST_TRANS
08065     if(list->ta_copied)
08066       {
08067         if(ta_number)
08068           {
08069             if(ta_lookup_lol_item(list->ta_copied, list, desc))
08070               {
08071                 if(list->ta_copied != ta_number)
08072                   {
08073                     rsbac_write_unlock(&list->lock, &lock_flags);
08074                     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
08075                     return -RSBAC_EBUSY;
08076                   }
08077                 else
08078                   ta_remove_lol_item(ta_number, list, desc);
08079               }
08080           }
08081         else
08082           ta_remove_lol_item(list->ta_copied, list, desc);
08083       }
08084     else
08085       {
08086         if(ta_number && lookup_lol_item(list, desc))
08087           {
08088             ta_lol_copy(ta_number, list);
08089             ta_remove_lol_item(ta_number, list, desc);
08090           }
08091       }
08092     if(!ta_number)
08093 #endif
08094       {
08095         if(lookup_lol_item(list, desc))
08096           { /* exists -> remove */
08097             remove_lol_item(list, desc);
08098             lol_touch(list);
08099             list->dirty = TRUE;
08100           }
08101       }
08102     rsbac_write_unlock(&list->lock, &lock_flags);
08103     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
08104     return 0;
08105   }

int rsbac_ta_list_lol_remove_all rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle
 

Definition at line 8121 of file gen_lists.c.

References rsbac_list_lol_reg_item_t::dirty, rsbac_list_lol_reg_item_t::head, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lol_touch, NULL, remove_all_lol_items(), RSBAC_EBUSY, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_list_lol_reg_item_t::self, and TRUE.

Referenced by rsbac_list_lol_remove_all().

08122   {
08123     struct rsbac_list_lol_reg_item_t * list;
08124     u_long lock_flags, rlock_flags;
08125 
08126     if(!handle)
08127       return -RSBAC_EINVALIDVALUE;
08128     if(!list_initialized)
08129       return -RSBAC_ENOTINITIALIZED;
08130 
08131     list = (struct rsbac_list_lol_reg_item_t *) handle;
08132     if(list->self != list)
08133       return -RSBAC_EINVALIDVALUE;
08134 
08135 #ifdef CONFIG_RSBAC_LIST_TRANS
08136     if(ta_number)
08137       {
08138         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
08139           return -RSBAC_EINVALIDTRANSACTION;
08140       }
08141 #endif
08142 
08143     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
08144 /*
08145 #ifdef CONFIG_RSBAC_DEBUG
08146     if(rsbac_debug_lists)
08147       rsbac_printk(KERN_DEBUG "rsbac_list_lol_remove_all: removing all items from list of lists %s.\n",
08148              list->name);
08149 #endif
08150 */
08151     rsbac_write_lock(&list->lock, &lock_flags);
08152 #ifdef CONFIG_RSBAC_LIST_TRANS
08153     if(list->ta_copied)
08154       {
08155         if(ta_number)
08156           {
08157             if(list->ta_copied == ta_number)
08158               {
08159                 ta_remove_all_lol_items(list);
08160                 if(!list->head)
08161                   {
08162                     list->ta_copied = 0;
08163                   }
08164               }
08165             else
08166               {
08167                 rsbac_write_unlock(&list->lock, &lock_flags);
08168                 rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
08169                 return -RSBAC_EBUSY;
08170               }
08171           }
08172         else
08173           ta_remove_all_lol_items(list);
08174       }
08175     else
08176       {
08177         if(ta_number)
08178           {
08179             if(list->head)
08180               {
08181                 list->ta_head = NULL;
08182                 list->ta_tail = NULL;
08183                 list->ta_curr = NULL;
08184                 list->ta_count = 0;
08185                 list->ta_copied = ta_number;
08186               }
08187           }
08188       }
08189 
08190     if(!ta_number)
08191 #endif
08192       if(list->head)
08193         {
08194           remove_all_lol_items(list);
08195           lol_touch(list);
08196           list->dirty = TRUE;
08197         }
08198     rsbac_write_unlock(&list->lock, &lock_flags);
08199     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
08200     return 0;
08201   }

int rsbac_ta_list_lol_subadd_ttl rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
rsbac_time_t  ttl,
void *  desc,
void *  subdesc,
void *  subdata
 

Definition at line 7112 of file gen_lists.c.

References add_lol_item(), add_lol_subitem(), rsbac_list_lol_reg_item_t::def_data, rsbac_list_lol_reg_item_t::def_subdata, rsbac_list_lol_reg_item_t::dirty, do_remove_lol_subitem(), rsbac_list_lol_reg_item_t::flags, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lol_touch, lookup_lol_item(), lookup_lol_subitem(), rsbac_list_item_t::max_age, rsbac_list_lol_item_t::max_age, remove_lol_item(), RSBAC_EBUSY, RSBAC_EINVALIDTARGET, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, RSBAC_LIST_DEF_DATA, RSBAC_LIST_MAX_AGE_LIMIT, RSBAC_LIST_TTL_KEEP, rsbac_ta_list_exist(), rsbac_list_lol_reg_item_t::self, rsbac_list_lol_info_t::subdata_size, rsbac_list_lol_info_t::subdesc_size, and TRUE.

Referenced by rsbac_acl_add_group_member(), rsbac_acl_add_to_acl_entry(), rsbac_acl_remove_from_acl_entry(), rsbac_acl_set_acl_entry(), rsbac_auth_add_to_f_capset(), rsbac_auth_add_to_p_capset(), rsbac_list_lol_subadd(), rsbac_list_lol_subadd_ttl(), rsbac_mac_add_to_f_truset(), rsbac_mac_add_to_p_truset(), rsbac_pm_add_to_set(), rsbac_rc_copy_role(), rsbac_rc_copy_type(), rsbac_rc_set_item(), and rsbac_um_add_gm().

07119   {
07120     struct rsbac_list_lol_reg_item_t * list;
07121     struct rsbac_list_lol_item_t     * sublist;
07122     struct rsbac_list_item_t     * item_p;
07123     u_long lock_flags, rlock_flags;
07124     int err = 0;
07125 
07126     if(!handle || !desc || !subdesc)
07127       return -RSBAC_EINVALIDVALUE;
07128     if(!list_initialized)
07129       return -RSBAC_ENOTINITIALIZED;
07130 
07131     list = (struct rsbac_list_lol_reg_item_t *) handle;
07132     if(!list || (list->self != list))
07133       return -RSBAC_EINVALIDVALUE;
07134 
07135 #ifdef CONFIG_RSBAC_LIST_TRANS
07136     if(ta_number && !rsbac_ta_list_exist(0, ta_handle, &ta_number))
07137       return -RSBAC_EINVALIDTRANSACTION;
07138 #endif
07139 
07140     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
07141     if(list->info.subdata_size && !subdata)
07142       {
07143         rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
07144         return -RSBAC_EINVALIDVALUE;
07145       }
07146 
07147 /*
07148 #ifdef CONFIG_RSBAC_DEBUG
07149     if(rsbac_debug_lists)
07150       rsbac_printk(KERN_DEBUG "rsbac_list_lol_subadd: adding to list %s.\n",
07151              list->name);
07152 #endif
07153 */
07154     rsbac_write_lock(&list->lock, &lock_flags);
07155 
07156 #ifdef CONFIG_RSBAC_LIST_TRANS
07157     if(!ta_number)
07158 #endif
07159       {
07160         sublist = lookup_lol_item(list, desc);
07161         if(   !sublist
07162            && (list->flags & RSBAC_LIST_DEF_DATA)
07163           )
07164           sublist = add_lol_item(list, 0, desc, list->def_data);
07165         if(sublist)
07166           {
07167             if(   sublist->max_age
07168                && (sublist->max_age <= RSBAC_CURRENT_TIME)
07169               )
07170               {
07171                 remove_lol_item(list, desc);
07172                 err = -RSBAC_EINVALIDTARGET;
07173               }
07174             else
07175               {
07176                 /* exists -> lookup subitem */
07177                 if(ttl && (ttl != RSBAC_LIST_TTL_KEEP))
07178                   {
07179                     if(ttl > RSBAC_LIST_MAX_AGE_LIMIT)
07180                       ttl = RSBAC_LIST_MAX_AGE_LIMIT;
07181                     ttl += RSBAC_CURRENT_TIME;
07182                   }
07183                 item_p = lookup_lol_subitem(list, sublist, subdesc);
07184                 if(item_p)
07185                   { /* exists -> update data, if any */
07186                     if(ttl != RSBAC_LIST_TTL_KEEP)
07187                       item_p->max_age = ttl;
07188                     if(subdata && list->info.subdata_size)
07189                       {
07190                         if(   list->def_subdata
07191                            && !item_p->max_age
07192                            && !memcmp(list->def_subdata, subdata, list->info.subdata_size)
07193                           )
07194                           do_remove_lol_subitem(sublist, item_p);
07195                         else
07196                           memcpy(((char *) item_p) + sizeof(*item_p) + list->info.subdesc_size,
07197                                  subdata,
07198                                  list->info.subdata_size);
07199                       }
07200                   }
07201                 else
07202                   {
07203                     if(ttl == RSBAC_LIST_TTL_KEEP)
07204                       ttl = 0;
07205                     if(   !list->def_subdata
07206                        || memcmp(list->def_subdata, subdata, list->info.subdata_size)
07207                       )
07208                       add_lol_subitem(list, sublist, ttl, subdesc, subdata);
07209                   }
07210                 lol_touch(list);
07211                 list->dirty = TRUE;
07212               }
07213           }
07214         else
07215           {
07216             err = -RSBAC_EINVALIDTARGET;
07217             goto out_unlock;
07218           }
07219       }
07220 #ifdef CONFIG_RSBAC_LIST_TRANS
07221     if(list->ta_copied || ta_number)
07222       {
07223         if(!list->ta_copied)
07224           {
07225             if((err = ta_lol_copy(ta_number,list)))
07226               goto out_unlock;
07227           }
07228         else
07229           if(ta_number)
07230             {
07231               if(list->ta_copied != ta_number)
07232                 {
07233                   err = -RSBAC_EBUSY;
07234                   goto out_unlock;
07235                 }
07236             }
07237           else
07238             ta_number = list->ta_copied;
07239         sublist = ta_lookup_lol_item(ta_number, list, desc);
07240         if(   !sublist
07241            && (list->flags & RSBAC_LIST_DEF_DATA)
07242           )
07243           sublist = ta_add_lol_item(ta_number, list, 0, desc, list->def_data);
07244         if(sublist)
07245           {
07246             if(   sublist->max_age
07247                && (sublist->max_age <= RSBAC_CURRENT_TIME)
07248               )
07249               {
07250                 ta_remove_lol_item(ta_number, list, desc);
07251                 err = -RSBAC_EINVALIDTARGET;
07252               }
07253             else
07254               {
07255                 /* exists -> lookup subitem */
07256                 if(ttl && (ttl != RSBAC_LIST_TTL_KEEP))
07257                   {
07258                     if(ttl > RSBAC_LIST_MAX_AGE_LIMIT)
07259                       ttl = RSBAC_LIST_MAX_AGE_LIMIT;
07260                     ttl += RSBAC_CURRENT_TIME;
07261                   }
07262                 item_p = lookup_lol_subitem(list, sublist, subdesc);
07263                 if(item_p)
07264                   { /* exists -> update data, if any */
07265                     if(ttl != RSBAC_LIST_TTL_KEEP)
07266                       item_p->max_age = ttl;
07267                     if(subdata && list->info.subdata_size)
07268                       {
07269                         if(   list->def_subdata
07270                            && !item_p->max_age
07271                            && !memcmp(list->def_subdata, subdata, list->info.subdata_size)
07272                           )
07273                           do_remove_lol_subitem(sublist, item_p);
07274                         else
07275                           memcpy(((char *) item_p) + sizeof(*item_p) + list->info.subdesc_size,
07276                                  subdata,
07277                                  list->info.subdata_size);
07278                       }
07279                   }
07280                 else
07281                   {
07282                     if(ttl == RSBAC_LIST_TTL_KEEP)
07283                       ttl = 0;
07284                     if(   !list->def_subdata
07285                        || memcmp(list->def_subdata, subdata, list->info.subdata_size)
07286                       )
07287                       add_lol_subitem(list, sublist, ttl, subdesc, subdata);
07288                   }
07289               }
07290           }
07291         else
07292           {
07293             err = -RSBAC_EINVALIDTARGET;
07294           }
07295       }
07296 #endif
07297 
07298 out_unlock:
07299     rsbac_write_unlock(&list->lock, &lock_flags);
07300     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
07301     return err;
07302   }

long rsbac_ta_list_lol_subcount rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 9318 of file gen_lists.c.

References rsbac_list_lol_item_t::count, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lookup_lol_item(), RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTFOUND, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), and rsbac_list_lol_reg_item_t::self.

Referenced by rsbac_acl_remove_acl_entry(), rsbac_acl_remove_group_member(), rsbac_list_lol_subcount(), rsbac_rc_get_list(), and rsbac_um_get_gm_list().

09322   {
09323     struct rsbac_list_lol_reg_item_t * list;
09324     struct rsbac_list_lol_item_t     * sublist;
09325     u_long lock_flags, rlock_flags;
09326     long result;
09327 
09328     if(!handle)
09329       return -RSBAC_EINVALIDVALUE;
09330     if(!list_initialized)
09331       return -RSBAC_ENOTINITIALIZED;
09332 
09333     list = (struct rsbac_list_lol_reg_item_t *) handle;
09334     if(list->self != list)
09335       return -RSBAC_EINVALIDVALUE;
09336 
09337 #ifdef CONFIG_RSBAC_LIST_TRANS
09338     if(ta_number)
09339       {
09340         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
09341           return -RSBAC_EINVALIDTRANSACTION;
09342       }
09343 #endif
09344 
09345     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
09346 /*
09347 #ifdef CONFIG_RSBAC_DEBUG
09348     if(rsbac_debug_lists)
09349       rsbac_printk(KERN_DEBUG "rsbac_list_lol_subcount: list %s.\n",
09350              list->name);
09351 #endif
09352 */
09353     rsbac_read_lock(&list->lock, &lock_flags);
09354 
09355 #ifdef CONFIG_RSBAC_LIST_TRANS
09356     if(ta_number && (list->ta_copied == ta_number))
09357       sublist = ta_lookup_lol_item(ta_number, list, desc);
09358     else
09359 #endif
09360     sublist = lookup_lol_item(list, desc);
09361     if(sublist)
09362       {
09363         result = sublist->count;
09364       }
09365     else
09366       {
09367         result = -RSBAC_ENOTFOUND;
09368       }
09369     rsbac_read_unlock(&list->lock, &lock_flags);
09370     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
09371     return result;
09372   }

int rsbac_ta_list_lol_subexist rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc,
void *  subdesc
 

Definition at line 9069 of file gen_lists.c.

References FALSE, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lookup_lol_item(), lookup_lol_subitem(), rsbac_list_item_t::max_age, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, rsbac_ta_list_exist(), rsbac_list_lol_reg_item_t::self, and TRUE.

Referenced by rsbac_acl_group_member(), rsbac_list_lol_subexist(), rsbac_pm_set_member(), and rsbac_um_get_gm_user_list().

09074   {
09075     struct rsbac_list_lol_reg_item_t * list;
09076     struct rsbac_list_lol_item_t     * sublist;
09077     u_long lock_flags, rlock_flags;
09078     struct rsbac_list_item_t     * item_p;
09079     int result;
09080 
09081     if(!handle || !desc || !subdesc)
09082       return FALSE;
09083     if(!list_initialized)
09084       return FALSE;
09085 
09086     list = (struct rsbac_list_lol_reg_item_t *) handle;
09087     if(list->self != list)
09088       return -RSBAC_EINVALIDVALUE;
09089 
09090 #ifdef CONFIG_RSBAC_LIST_TRANS
09091     if(ta_number)
09092       {
09093         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
09094           return -RSBAC_EINVALIDTRANSACTION;
09095       }
09096 #endif
09097 
09098     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
09099 /*
09100 #ifdef CONFIG_RSBAC_DEBUG
09101     if(rsbac_debug_lists)
09102       rsbac_printk(KERN_DEBUG "rsbac_list_lol_subexist: testing on list %s.\n",
09103              list->name);
09104 #endif
09105 */
09106     rsbac_read_lock(&list->lock, &lock_flags);
09107 
09108 #ifdef CONFIG_RSBAC_LIST_TRANS
09109     if(ta_number && (list->ta_copied == ta_number))
09110       sublist = ta_lookup_lol_item(ta_number, list, desc);
09111     else
09112 #endif
09113     sublist = lookup_lol_item(list, desc);
09114     if(sublist)
09115       { /* exists -> lookup subitem */
09116         item_p = lookup_lol_subitem(list, sublist, subdesc);
09117         if(   item_p
09118            && (   !item_p->max_age
09119                || (item_p->max_age > RSBAC_CURRENT_TIME)
09120               )
09121           )
09122           { /* exists -> TRUE */
09123             result = TRUE;
09124           }
09125         else
09126           {
09127             result = FALSE;
09128           }
09129       }
09130     else
09131       {
09132         result = FALSE;
09133       }
09134     rsbac_read_unlock(&list->lock, &lock_flags);
09135     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
09136     return result;
09137   }

int rsbac_ta_list_lol_subexist_compare rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc,
void *  subdesc,
rsbac_list_compare_function_t  compare
 

Definition at line 9153 of file gen_lists.c.

References FALSE, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lookup_lol_item(), lookup_lol_subitem_user_compare(), rsbac_list_item_t::max_age, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, rsbac_list_lol_subexist(), rsbac_ta_list_exist(), rsbac_list_lol_reg_item_t::self, and TRUE.

Referenced by rsbac_list_lol_subexist_compare().

09159   {
09160     struct rsbac_list_lol_reg_item_t * list;
09161     struct rsbac_list_lol_item_t     * sublist;
09162     u_long lock_flags, rlock_flags;
09163     struct rsbac_list_item_t     * item_p;
09164     int result;
09165 
09166     if(!handle || !desc || !subdesc)
09167       return FALSE;
09168     if(!list_initialized)
09169       return FALSE;
09170     /* Use standard function, if compare is not provided. */
09171     if(!compare)
09172       return rsbac_list_lol_subexist(handle, desc, subdesc);
09173 
09174     list = (struct rsbac_list_lol_reg_item_t *) handle;
09175     if(list->self != list)
09176       return -RSBAC_EINVALIDVALUE;
09177 
09178 #ifdef CONFIG_RSBAC_LIST_TRANS
09179     if(ta_number)
09180       {
09181         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
09182           return -RSBAC_EINVALIDTRANSACTION;
09183       }
09184 #endif
09185 
09186     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
09187 /*
09188 #ifdef CONFIG_RSBAC_DEBUG
09189     if(rsbac_debug_lists)
09190       rsbac_printk(KERN_DEBUG "rsbac_list_lol_subexist_compare: testing on list %s.\n",
09191              list->name);
09192 #endif
09193 */
09194     rsbac_read_lock(&list->lock, &lock_flags);
09195 
09196 #ifdef CONFIG_RSBAC_LIST_TRANS
09197     if(ta_number && (list->ta_copied == ta_number))
09198       sublist = ta_lookup_lol_item(ta_number, list, desc);
09199     else
09200 #endif
09201     sublist = lookup_lol_item(list, desc);
09202     if(sublist)
09203       { /* exists -> lookup subitem */
09204         item_p = lookup_lol_subitem_user_compare(list, sublist, subdesc, compare);
09205         if(   item_p
09206            && (   !item_p->max_age
09207                || (item_p->max_age > RSBAC_CURRENT_TIME)
09208               )
09209           )
09210           { /* exists -> TRUE */
09211             result = TRUE;
09212           }
09213         else
09214           {
09215             result = FALSE;
09216           }
09217       }
09218     else
09219       {
09220         result = FALSE;
09221       }
09222     rsbac_read_unlock(&list->lock, &lock_flags);
09223     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
09224     return result;
09225   }

int rsbac_ta_list_lol_subremove rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc,
void *  subdesc
 

Definition at line 7678 of file gen_lists.c.

References rsbac_list_lol_item_t::count, rsbac_list_lol_info_t::data_size, rsbac_list_lol_reg_item_t::def_data, rsbac_list_lol_info_t::desc_size, rsbac_list_lol_reg_item_t::dirty, do_remove_lol_item(), rsbac_list_lol_reg_item_t::flags, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lol_touch, lookup_lol_item(), lookup_lol_subitem(), rsbac_list_lol_item_t::max_age, remove_lol_subitem(), RSBAC_EBUSY, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, RSBAC_LIST_DEF_DATA, rsbac_ta_list_exist(), rsbac_list_lol_reg_item_t::self, and TRUE.

Referenced by rsbac_acl_remove_acl_entry(), rsbac_acl_remove_group_member(), rsbac_auth_remove_from_f_capset(), rsbac_auth_remove_from_p_capset(), rsbac_list_lol_subremove(), rsbac_mac_remove_from_f_truset(), rsbac_mac_remove_from_p_truset(), rsbac_pm_remove_from_set(), rsbac_rc_set_item(), and rsbac_um_remove_gm().

07683   {
07684     struct rsbac_list_lol_reg_item_t * list;
07685     struct rsbac_list_lol_item_t     * sublist;
07686     u_long lock_flags, rlock_flags;
07687 
07688     if(!handle || !desc || !subdesc)
07689       return -RSBAC_EINVALIDVALUE;
07690     if(!list_initialized)
07691       return -RSBAC_ENOTINITIALIZED;
07692 
07693     list = (struct rsbac_list_lol_reg_item_t *) handle;
07694     if(list->self != list)
07695       return -RSBAC_EINVALIDVALUE;
07696 
07697 #ifdef CONFIG_RSBAC_LIST_TRANS
07698     if(ta_number)
07699       {
07700         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
07701           return -RSBAC_EINVALIDTRANSACTION;
07702       }
07703 #endif
07704 
07705     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
07706 /*
07707 #ifdef CONFIG_RSBAC_DEBUG
07708     if(rsbac_debug_lists)
07709       rsbac_printk(KERN_DEBUG "rsbac_ta_list_lol_subremove: removing from list of lists %s, device %02u:%02u.\n",
07710              list->name,
07711              RSBAC_MAJOR(list->device), RSBAC_MINOR(list->device));
07712 #endif
07713 */
07714     rsbac_write_lock(&list->lock, &lock_flags);
07715 #ifdef CONFIG_RSBAC_LIST_TRANS
07716     if(list->ta_copied)
07717       {
07718         sublist = ta_lookup_lol_item(list->ta_copied, list, desc);
07719         if(sublist)
07720           {
07721             if(   sublist->max_age
07722                && (sublist->max_age <= RSBAC_CURRENT_TIME)
07723               )
07724               {
07725                 ta_do_remove_lol_item(list, sublist);
07726               }
07727             else
07728               {
07729                 if(ta_number && (list->ta_copied != ta_number))
07730                   {
07731                     rsbac_write_unlock(&list->lock, &lock_flags);
07732                     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
07733                     return -RSBAC_EBUSY;
07734                   }
07735                 if(lookup_lol_subitem(list, sublist, subdesc))
07736                   remove_lol_subitem(list, sublist, subdesc);
07737                 if(   !sublist->count
07738                    && (   (   list->def_data
07739                            && !memcmp(((char *) sublist) + sizeof(*sublist) + list->info.desc_size,
07740                                       list->def_data,
07741                                       list->info.data_size)
07742                           )
07743                        || (   !list->info.data_size
07744                            && (list->flags & RSBAC_LIST_DEF_DATA)
07745                           )
07746                       )
07747                       )
07748                   {
07749                     ta_do_remove_lol_item(list, sublist);
07750                   }
07751               }
07752           }
07753       }
07754     else
07755       {
07756         if(ta_number && lookup_lol_item(list, desc))
07757           {
07758             ta_lol_copy(ta_number, list);
07759             ta_remove_lol_item(ta_number, list, desc);
07760           }
07761       }
07762     if(!ta_number)
07763 #endif
07764       {
07765         sublist = lookup_lol_item(list, desc);
07766         if(sublist)
07767           {
07768             if(   sublist->max_age
07769                && (sublist->max_age <= RSBAC_CURRENT_TIME)
07770               )
07771               {
07772                 do_remove_lol_item(list, sublist);
07773                 lol_touch(list);
07774                 list->dirty = TRUE;
07775               }
07776             else
07777               {
07778                 if(lookup_lol_subitem(list, sublist, subdesc))
07779                   { /* exists -> remove and set dirty */
07780                     remove_lol_subitem(list, sublist, subdesc);
07781                     lol_touch(list);
07782                     list->dirty = TRUE;
07783                   }
07784                 if(   !sublist->count
07785                    && (   (   list->def_data
07786                            && !memcmp(((char *) sublist) + sizeof(*sublist) + list->info.desc_size,
07787                                       list->def_data,
07788                                       list->info.data_size)
07789                           )
07790                        || (   !list->info.data_size
07791                            && (list->flags & RSBAC_LIST_DEF_DATA)
07792                           )
07793                       )
07794                   )
07795                   {
07796                     do_remove_lol_item(list, sublist);
07797                     lol_touch(list);
07798                     list->dirty = TRUE;
07799                   }
07800               }
07801           }
07802       }
07803     rsbac_write_unlock(&list->lock, &lock_flags);
07804     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
07805     return 0;
07806   }

int rsbac_ta_list_lol_subremove_all rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 7921 of file gen_lists.c.

References rsbac_list_lol_info_t::data_size, rsbac_list_lol_reg_item_t::def_data, rsbac_list_lol_info_t::desc_size, rsbac_list_lol_reg_item_t::dirty, rsbac_list_lol_reg_item_t::flags, rsbac_list_lol_item_t::head, rsbac_list_lol_reg_item_t::info, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lol_touch, lookup_lol_item(), rsbac_list_lol_item_t::max_age, remove_all_lol_subitems(), RSBAC_EBUSY, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, RSBAC_LIST_DEF_DATA, rsbac_ta_list_exist(), rsbac_list_lol_reg_item_t::self, and TRUE.

Referenced by rsbac_list_lol_subremove_all(), and rsbac_pm_clear_set().

07925   {
07926     struct rsbac_list_lol_reg_item_t * list;
07927     struct rsbac_list_lol_item_t     * sublist;
07928     u_long lock_flags, rlock_flags;
07929 
07930     if(!handle)
07931       return -RSBAC_EINVALIDVALUE;
07932     if(!list_initialized)
07933       return -RSBAC_ENOTINITIALIZED;
07934 
07935     list = (struct rsbac_list_lol_reg_item_t *) handle;
07936     if(list->self != list)
07937       return -RSBAC_EINVALIDVALUE;
07938 
07939 #ifdef CONFIG_RSBAC_LIST_TRANS
07940     if(ta_number)
07941       {
07942         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
07943           return -RSBAC_EINVALIDTRANSACTION;
07944       }
07945 #endif
07946 
07947     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
07948 /*
07949 #ifdef CONFIG_RSBAC_DEBUG
07950     if(rsbac_debug_lists)
07951       rsbac_printk(KERN_DEBUG "rsbac_list_lol_subremove_all: removing all subitems from list of lists %s.\n",
07952              list->name);
07953 #endif
07954 */
07955     rsbac_write_lock(&list->lock, &lock_flags);
07956 #ifdef CONFIG_RSBAC_LIST_TRANS
07957     if(list->ta_copied)
07958       {
07959         sublist = ta_lookup_lol_item(list->ta_copied, list, desc);
07960         if(sublist)
07961           {
07962             if(   sublist->max_age
07963                && (sublist->max_age <= RSBAC_CURRENT_TIME)
07964               )
07965               {
07966                 ta_do_remove_lol_item(list, sublist);
07967               }
07968             else
07969               {
07970                 if(ta_number && (list->ta_copied != ta_number))
07971                   {
07972                     rsbac_write_unlock(&list->lock, &lock_flags);
07973                     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
07974                     return -RSBAC_EBUSY;
07975                   }
07976                 remove_all_lol_subitems(sublist);
07977                 if(   (   list->def_data
07978                        && !memcmp(((char *) sublist) + sizeof(*sublist) + list->info.desc_size,
07979                                   list->def_data,
07980                                   list->info.data_size)
07981                       )
07982                    || (   !list->info.data_size
07983                        && (list->flags & RSBAC_LIST_DEF_DATA)
07984                       )
07985                    
07986                   )
07987                   {
07988                     ta_do_remove_lol_item(list, sublist);
07989                   }
07990               }
07991           }
07992       }
07993     else
07994       {
07995         if(ta_number && lookup_lol_item(list, desc))
07996           {
07997             ta_lol_copy(ta_number, list);
07998             sublist = ta_lookup_lol_item(ta_number, list, desc);
07999             if(sublist)
08000               remove_all_lol_subitems(sublist);
08001           }
08002       }
08003     if(!ta_number)
08004 #endif
08005       {
08006         sublist = lookup_lol_item(list, desc);
08007         if(sublist && sublist->head)
08008           {
08009             remove_all_lol_subitems(sublist);
08010             lol_touch(list);
08011             list->dirty = TRUE;
08012           }
08013       }
08014     rsbac_write_unlock(&list->lock, &lock_flags);
08015     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
08016     return 0;
08017   }

int rsbac_ta_list_lol_subremove_from_all rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  subdesc
 

Definition at line 7823 of file gen_lists.c.

References rsbac_list_lol_reg_item_t::dirty, rsbac_list_lol_reg_item_t::head, list_initialized, rsbac_list_lol_reg_item_t::lock, rsbac_list_lol_reg_head_t::lock, lol_touch, lookup_lol_subitem(), rsbac_list_lol_item_t::next, remove_lol_subitem(), RSBAC_EBUSY, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_list_lol_reg_item_t::self, and TRUE.

Referenced by rsbac_acl_remove_group(), rsbac_acl_remove_subject(), rsbac_acl_remove_user(), rsbac_list_lol_subremove_from_all(), rsbac_rc_copy_type(), rsbac_rc_set_item(), and rsbac_um_remove_group().

07827   {
07828     struct rsbac_list_lol_reg_item_t * list;
07829     struct rsbac_list_lol_item_t     * sublist;
07830     u_long lock_flags, rlock_flags;
07831 
07832     if(!handle || !subdesc)
07833       return -RSBAC_EINVALIDVALUE;
07834     if(!list_initialized)
07835       return -RSBAC_ENOTINITIALIZED;
07836 
07837     list = (struct rsbac_list_lol_reg_item_t *) handle;
07838     if(list->self != list)
07839       return -RSBAC_EINVALIDVALUE;
07840 
07841 #ifdef CONFIG_RSBAC_LIST_TRANS
07842     if(ta_number)
07843       {
07844         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
07845           return -RSBAC_EINVALIDTRANSACTION;
07846       }
07847 #endif
07848 
07849     rsbac_read_lock(&lol_reg_head.lock, &rlock_flags);
07850 /*
07851 #ifdef CONFIG_RSBAC_DEBUG
07852     if(rsbac_debug_lists)
07853       rsbac_printk(KERN_DEBUG "rsbac_list_lol_subremove_from_all: removing from list of lists %s.\n",
07854              list->name);
07855 #endif
07856 */
07857     rsbac_write_lock(&list->lock, &lock_flags);
07858 #ifdef CONFIG_RSBAC_LIST_TRANS
07859     if(list->ta_copied)
07860       {
07861         if(ta_number && (list->ta_copied != ta_number))
07862           {
07863             rsbac_write_unlock(&list->lock, &lock_flags);
07864             rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
07865             return -RSBAC_EBUSY;
07866           }
07867         sublist = list->head;
07868         while(sublist)
07869           {
07870             remove_lol_subitem(list, sublist, subdesc);
07871             sublist = sublist->next;
07872           }
07873       }
07874     else
07875       {
07876         if(ta_number)
07877           {
07878             ta_lol_copy(ta_number, list);
07879             sublist = list->head;
07880             while(sublist)
07881               {
07882                 remove_lol_subitem(list, sublist, subdesc);
07883                 sublist = sublist->next;
07884               }
07885           }
07886       }
07887     if(!ta_number)
07888 #endif
07889       {
07890         sublist = list->head;
07891         while(sublist)
07892           {
07893             if(lookup_lol_subitem(list, sublist, subdesc))
07894               { /* exists -> remove and set dirty */
07895                 remove_lol_subitem(list, sublist, subdesc);
07896                 lol_touch(list);
07897                 list->dirty = TRUE;
07898               }
07899             sublist = sublist->next;
07900           }
07901       }
07902     rsbac_write_unlock(&list->lock, &lock_flags);
07903     rsbac_read_unlock(&lol_reg_head.lock, &rlock_flags);
07904     return 0;
07905   }

int rsbac_ta_list_remove rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle,
void *  desc
 

Definition at line 7494 of file gen_lists.c.

References rsbac_list_reg_item_t::dirty, list_initialized, rsbac_list_reg_item_t::lock, rsbac_list_reg_head_t::lock, lookup_item(), remove_item(), RSBAC_EBUSY, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_list_reg_item_t::self, touch, and TRUE.

Referenced by rsbac_acl_remove_acl_entry(), rsbac_acl_remove_group(), rsbac_acl_remove_subject(), rsbac_acl_remove_user(), rsbac_list_remove(), rsbac_pm_exists(), rsbac_pm_remove_target(), rsbac_rc_set_item(), rsbac_ta_remove_target(), rsbac_um_remove_group(), set_attr_fd(), and set_attr_user().

07498   {
07499     struct rsbac_list_reg_item_t * list;
07500     u_long lock_flags, rlock_flags;
07501 
07502     if(!handle || !desc)
07503       return -RSBAC_EINVALIDVALUE;
07504     if(!list_initialized)
07505       return -RSBAC_ENOTINITIALIZED;
07506 
07507     list = (struct rsbac_list_reg_item_t *) handle;
07508     if(!list || (list->self != list))
07509       return -RSBAC_EINVALIDVALUE;
07510 
07511 #ifdef CONFIG_RSBAC_LIST_TRANS
07512     if(ta_number)
07513       {
07514         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
07515           return -RSBAC_EINVALIDTRANSACTION;
07516       }
07517 #endif
07518 
07519     rsbac_read_lock(&reg_head.lock, &rlock_flags);
07520 /*
07521 #ifdef CONFIG_RSBAC_DEBUG
07522     if(rsbac_debug_lists)
07523       rsbac_printk(KERN_DEBUG "rsbac_list_ta_remove: removing from list %s.\n",
07524              list->name);
07525 #endif
07526 */
07527     rsbac_write_lock(&list->lock, &lock_flags);
07528 #ifdef CONFIG_RSBAC_LIST_TRANS
07529     if(list->ta_copied)
07530       {
07531         if(ta_number)
07532           {
07533             if(ta_lookup_item(list->ta_copied, list, desc))
07534               {
07535                 if(list->ta_copied != ta_number)
07536                   {
07537                     rsbac_write_unlock(&list->lock, &lock_flags);
07538                     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
07539                     return -RSBAC_EBUSY;
07540                   }
07541                 else
07542                   ta_remove_item(ta_number, list, desc);
07543               }
07544           }
07545         else
07546           ta_remove_item(list->ta_copied, list, desc);
07547       }
07548     else
07549       {
07550         if(ta_number && lookup_item(list, desc))
07551           {
07552             ta_copy(ta_number, list);
07553             ta_remove_item(ta_number, list, desc);
07554           }
07555       }
07556     if(!ta_number)
07557 #endif
07558       {
07559         if(lookup_item(list, desc))
07560           { /* exists -> remove */
07561             remove_item(list, desc);
07562             touch(list);
07563             list->dirty = TRUE;
07564           }
07565       }
07566     rsbac_write_unlock(&list->lock, &lock_flags);
07567     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
07568     return 0;
07569   }

int rsbac_ta_list_remove_all rsbac_list_ta_number_t  ta_number,
rsbac_list_handle_t  handle
 

Definition at line 7585 of file gen_lists.c.

References rsbac_list_reg_item_t::dirty, rsbac_list_reg_item_t::head, list_initialized, rsbac_list_reg_item_t::lock, rsbac_list_reg_head_t::lock, NULL, remove_all_items(), RSBAC_EBUSY, RSBAC_EINVALIDTRANSACTION, RSBAC_EINVALIDVALUE, RSBAC_ENOTINITIALIZED, rsbac_ta_list_exist(), rsbac_list_reg_item_t::self, touch, and TRUE.

Referenced by rsbac_list_remove_all().

07586   {
07587     struct rsbac_list_reg_item_t * list;
07588     u_long lock_flags, rlock_flags;
07589 
07590     if(!handle)
07591       return -RSBAC_EINVALIDVALUE;
07592     if(!list_initialized)
07593       return -RSBAC_ENOTINITIALIZED;
07594 
07595     list = (struct rsbac_list_reg_item_t *) handle;
07596     if(list->self != list)
07597       return -RSBAC_EINVALIDVALUE;
07598 
07599 #ifdef CONFIG_RSBAC_LIST_TRANS
07600     if(ta_number)
07601       {
07602         if(!rsbac_ta_list_exist(0, ta_handle, &ta_number))
07603           return -RSBAC_EINVALIDTRANSACTION;
07604       }
07605 #endif
07606 
07607     rsbac_read_lock(&reg_head.lock, &rlock_flags);
07608 /*
07609 #ifdef CONFIG_RSBAC_DEBUG
07610     if(rsbac_debug_lists)
07611       rsbac_printk(KERN_DEBUG "rsbac_ta_list_remove_all: removing all items from list %s.\n",
07612              list->name);
07613 #endif
07614 */
07615     rsbac_write_lock(&list->lock, &lock_flags);
07616 #ifdef CONFIG_RSBAC_LIST_TRANS
07617     if(list->ta_copied)
07618       {
07619         if(ta_number)
07620           {
07621             if(list->ta_copied == ta_number)
07622               {
07623                 ta_remove_all_items(list);
07624                 if(!list->head)
07625                   {
07626                     list->ta_copied = 0;
07627                   }
07628               }
07629             else
07630               {
07631                 rsbac_write_unlock(&list->lock, &lock_flags);
07632                 rsbac_read_unlock(&reg_head.lock, &rlock_flags);
07633                 return -RSBAC_EBUSY;
07634               }
07635           }
07636         else
07637           ta_remove_all_items(list);
07638       }
07639     else
07640       {
07641         if(ta_number)
07642           {
07643             if(list->head)
07644               {
07645                 list->ta_head = NULL;
07646                 list->ta_tail = NULL;
07647                 list->ta_curr = NULL;
07648                 list->ta_count = 0;
07649                 list->ta_copied = ta_number;
07650               }
07651           }
07652       }
07653 
07654     if(!ta_number)
07655 #endif
07656       if(list->head)
07657         {
07658           remove_all_items(list);
07659           touch(list);
07660           list->dirty = TRUE;
07661         }
07662     rsbac_write_unlock(&list->lock, &lock_flags);
07663     rsbac_read_unlock(&reg_head.lock, &rlock_flags);
07664     return 0;
07665   }


Generated on Thu Sep 22 16:42:23 2005 for RSBAC by  doxygen 1.4.2