#include <linux/types.h>#include <linux/version.h>#include <linux/fs.h>#include <linux/sched.h>#include <linux/quotaops.h>#include <linux/proc_fs.h>#include <linux/msdos_fs.h>#include <linux/iso_fs.h>#include <linux/nfs_fs.h>#include <linux/ext2_fs.h>#include <linux/coda.h>#include <linux/initrd.h>#include <linux/security.h>#include <linux/syscalls.h>#include <linux/coda_psdev.h>#include <linux/ncp_fs.h>#include <linux/smb.h>#include <linux/dnotify.h>#include <linux/mm.h>#include <linux/blkdev.h>#include <linux/init.h>#include <linux/config.h>#include <linux/module.h>#include <linux/netdevice.h>#include <linux/inetdevice.h>#include <asm/uaccess.h>#include <asm/atomic.h>#include <rsbac/types.h>#include <rsbac/aci.h>#include <rsbac/aci_data_structures.h>#include <rsbac/error.h>#include <rsbac/helpers.h>#include <rsbac/fs.h>#include <rsbac/getname.h>#include <rsbac/net_getname.h>#include <rsbac/adf.h>#include <rsbac/adf_main.h>#include <rsbac/reg.h>#include <rsbac/rkmem.h>#include <rsbac/gen_lists.h>#include <linux/string.h>#include <linux/kdev_t.h>#include <linux/smp_lock.h>Go to the source code of this file.
Defines | |
| #define | check_parent(dir, dentry) ((dir) == (dentry)->d_parent && !list_empty(&dentry->d_bucket)) |
Functions | |
| DECLARE_MUTEX (rsbac_write_sem) | |
| static struct rsbac_device_list_item_t * | lookup_device (kdev_t) |
| static int | gen_fd_hash (u_long inode) |
| static int | gen_p_hash (rsbac_pid_t pid) |
| rsbac_boolean_t | writable (struct super_block *sb_p) |
| static int | lookup_aci_path_dentry (struct super_block *sb_p, struct dentry **dir_dentry_pp, rsbac_boolean_t create_dir, kdev_t kdev) |
| static int | dev_compare (void *desc1, void *desc2) |
| static int | dev_major_compare (void *desc1, void *desc2) |
| static int | ipc_compare (void *desc1, void *desc2) |
| static int | gen_fd_conv (void *old_desc, void *old_data, void *new_desc, void *new_data) |
| static int | gen_fd_old_conv (void *old_desc, void *old_data, void *new_desc, void *new_data) |
| static int | gen_fd_old_old_conv (void *old_desc, void *old_data, void *new_desc, void *new_data) |
| rsbac_list_conv_function_t * | gen_fd_get_conv (rsbac_version_t old_version) |
| static int | gen_dev_conv (void *old_desc, void *old_data, void *new_desc, void *new_data) |
| rsbac_list_conv_function_t * | gen_dev_get_conv (rsbac_version_t old_version) |
| static int | register_fd_lists (struct rsbac_device_list_item_t *device_p, kdev_t kdev) |
| static int | aci_detach_fd_lists (struct rsbac_device_list_item_t *device_p) |
| static struct rsbac_device_list_item_t * | create_device_item (struct super_block *sb_p, struct dentry *d_covers) |
| static struct rsbac_device_list_item_t * | add_device_item (struct rsbac_device_list_item_t *device_p) |
| static void | clear_device_item (struct rsbac_device_list_item_t *item_p) |
| static void | remove_device_item (kdev_t kdev) |
| static int | rsbac_clear_file (struct dentry *dentry) |
| static void | wakeup_auto (u_long dummy) |
| super_block * | rsbac_get_super_block (kdev_t kdev) |
| int | rsbac_read_open (char *name, struct file *file_p, kdev_t kdev) |
| int | rsbac_write_open (char *name, struct file *file_p, kdev_t kdev) |
| void | rsbac_read_close (struct file *file_p) |
| void | rsbac_write_close (struct file *file_p) |
| int | rsbac_get_full_path (struct dentry *dentry_p, char path[], int maxlen) |
| int | rsbac_get_full_path_length (struct dentry *dentry_p) |
| static void __init | registration_error (int err, char *listname) |
| static int __init | register_dev_lists (void) |
| static int __init | register_ipc_lists (void) |
| static int __init | register_user_lists (void) |
| static int __init | register_process_lists (void) |
| static int __init | rsbac_do_init (void) |
| int __init | rsbac_init (kdev_t root_dev) |
| rsbac_boolean_t | rsbac_is_initialized (void) |
| int | rsbac_kthread_notify (rsbac_pid_t pid) |
| int | rsbac_mount (struct super_block *sb_p, struct dentry *d_covers) |
| int | rsbac_umount (struct super_block *sb_p, struct dentry *d_covers) |
| int | rsbac_free_dat_dentries (void) |
| int | rsbac_stats (void) |
| int | rsbac_check_inode (struct super_block *sb_p, rsbac_inode_nr_t inode) |
| int | rsbac_get_parent (enum rsbac_target_t target, union rsbac_target_id_t tid, enum rsbac_target_t *parent_target_p, union rsbac_target_id_t *parent_tid_p) |
| static int | get_attr_fd (rsbac_list_ta_number_t ta_number, enum rsbac_switch_target_t module, enum rsbac_target_t target, union rsbac_target_id_t *tid_p, enum rsbac_attribute_t attr, union rsbac_attribute_value_t *value, rsbac_boolean_t inherit) |
| static int | get_attr_dev (rsbac_list_ta_number_t ta_number, enum rsbac_switch_target_t module, enum rsbac_target_t target, struct rsbac_dev_desc_t dev, enum rsbac_attribute_t attr, union rsbac_attribute_value_t *value, rsbac_boolean_t inherit) |
| static int | get_attr_ipc (rsbac_list_ta_number_t ta_number, enum rsbac_switch_target_t module, enum rsbac_target_t target, union rsbac_target_id_t *tid_p, enum rsbac_attribute_t attr, union rsbac_attribute_value_t *value, rsbac_boolean_t inherit) |
| static int | get_attr_user (rsbac_list_ta_number_t ta_number, enum rsbac_switch_target_t module, enum rsbac_target_t target, union rsbac_target_id_t *tid_p, enum rsbac_attribute_t attr, union rsbac_attribute_value_t *value, rsbac_boolean_t inherit) |
| static int | get_attr_process (rsbac_list_ta_number_t ta_number, enum rsbac_switch_target_t module, enum rsbac_target_t target, union rsbac_target_id_t *tid_p, enum rsbac_attribute_t attr, union rsbac_attribute_value_t *value, rsbac_boolean_t inherit) |
| int | rsbac_ta_get_attr (rsbac_list_ta_number_t ta_number, enum rsbac_switch_target_t module, enum rsbac_target_t target, union rsbac_target_id_t tid, enum rsbac_attribute_t attr, union rsbac_attribute_value_t *value, rsbac_boolean_t inherit) |
| static int | set_attr_fd (rsbac_list_ta_number_t ta_number, enum rsbac_switch_target_t module, enum rsbac_target_t target, union rsbac_target_id_t *tid_p, enum rsbac_attribute_t attr, union rsbac_attribute_value_t *value_p) |
| static int | set_attr_dev (rsbac_list_ta_number_t ta_number, enum rsbac_switch_target_t module, enum rsbac_target_t target, struct rsbac_dev_desc_t dev, enum rsbac_attribute_t attr, union rsbac_attribute_value_t *value_p) |
| static int | set_attr_ipc (rsbac_list_ta_number_t ta_number, enum rsbac_switch_target_t module, enum rsbac_target_t target, union rsbac_target_id_t *tid_p, enum rsbac_attribute_t attr, union rsbac_attribute_value_t *value_p) |
| static int | set_attr_user (rsbac_list_ta_number_t ta_number, enum rsbac_switch_target_t module, enum rsbac_target_t target, union rsbac_target_id_t *tid_p, enum rsbac_attribute_t attr, union rsbac_attribute_value_t *value_p) |
| static int | set_attr_process (rsbac_list_ta_number_t ta_number, enum rsbac_switch_target_t module, enum rsbac_target_t target, union rsbac_target_id_t *tid_p, enum rsbac_attribute_t attr, union rsbac_attribute_value_t *value_p) |
| int | rsbac_ta_set_attr (rsbac_list_ta_number_t ta_number, enum rsbac_switch_target_t module, enum rsbac_target_t target, union rsbac_target_id_t tid, enum rsbac_attribute_t attr, union rsbac_attribute_value_t value) |
| int | rsbac_ta_remove_target (rsbac_list_ta_number_t ta_number, enum rsbac_target_t target, union rsbac_target_id_t tid) |
| int | rsbac_ta_list_all_dev (rsbac_list_ta_number_t ta_number, struct rsbac_dev_desc_t **id_pp) |
| static int | copy_new_uids (rsbac_list_handle_t list, rsbac_list_ta_number_t ta_number, int *count_p, int *i_count_p, rsbac_uid_t *res_id_p) |
| int | rsbac_ta_list_all_user (rsbac_list_ta_number_t ta_number, rsbac_uid_t **id_pp) |
| int | rsbac_ta_list_all_group (rsbac_list_ta_number_t ta_number, rsbac_gid_t **id_pp) |
Variables | |
| static rsbac_boolean_t | rsbac_initialized = FALSE |
| static char | compiled_modules [80] |
| kdev_t | rsbac_root_dev |
| static struct rsbac_device_list_head_t | device_list_head |
| static struct rsbac_dev_handles_t | dev_handles |
| static struct rsbac_dev_handles_t | dev_major_handles |
| static struct rsbac_ipc_handles_t | ipc_handles |
| static struct rsbac_user_handles_t | user_handles |
| static struct rsbac_process_handles_t | process_handles |
| static struct rsbac_gen_fd_aci_t | def_gen_root_dir_aci = DEFAULT_GEN_ROOT_DIR_ACI |
| static struct rsbac_gen_fd_aci_t | def_gen_fd_aci = DEFAULT_GEN_FD_ACI |
| static struct dentry * | sysfs_covered_p = NULL |
| static struct super_block * | sysfs_sb_p = NULL |
|
|
Definition at line 2262 of file aci_data_structures.c. Referenced by rsbac_write_open(). |
|
|
Definition at line 1630 of file aci_data_structures.c. References get_error_name(), RSBAC_EINVALIDPOINTER, RSBAC_GEN_FD_ACI_KEY, rsbac_kfree(), rsbac_kmalloc(), rsbac_list_detach(), RSBAC_MAXNAMELEN, and rsbac_printk(). Referenced by remove_device_item(). 01631 {
01632 int err = 0;
01633 int tmperr;
01634 u_int file_no;
01635
01636 if(!device_p)
01637 return(-RSBAC_EINVALIDPOINTER);
01638
01639 /* detach all general lists */
01640 for (file_no = 0; file_no < RSBAC_GEN_NR_FD_LISTS; file_no++)
01641 {
01642 tmperr = rsbac_list_detach(&device_p->handles.gen[file_no],
01643 RSBAC_GEN_FD_ACI_KEY);
01644 if(tmperr)
01645 {
01646 char * tmp;
01647
01648 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01649 if(tmp)
01650 {
01651 rsbac_printk(KERN_WARNING
01652 "detach_fd_lists(): detaching from general list %u for device %02u:%02u failed with error %s!\n",
01653 file_no,
01654 RSBAC_MAJOR(device_p->id),
01655 RSBAC_MINOR(device_p->id),
01656 get_error_name(tmp, tmperr));
01657 rsbac_kfree(tmp);
01658 }
01659 err = tmperr;
01660 }
01661 }
01662
01663 #if defined(CONFIG_RSBAC_MAC)
01664 /* detach all MAC lists */
01665 for (file_no = 0; file_no < RSBAC_MAC_NR_FD_LISTS; file_no++)
01666 {
01667 tmperr = rsbac_list_detach(&device_p->handles.mac[file_no],
01668 RSBAC_MAC_FD_ACI_KEY);
01669 if(tmperr)
01670 {
01671 char * tmp;
01672
01673 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01674 if(tmp)
01675 {
01676 rsbac_printk(KERN_WARNING
01677 "detach_fd_lists(): detaching from MAC list %u for device %02u:%02u failed with error %s!\n",
01678 file_no,
01679 RSBAC_MAJOR(device_p->id),
01680 RSBAC_MINOR(device_p->id),
01681 get_error_name(tmp, tmperr));
01682 rsbac_kfree(tmp);
01683 }
01684 err = tmperr;
01685 }
01686 }
01687 #endif
01688
01689 #if defined(CONFIG_RSBAC_PM)
01690 /* detach all PM lists */
01691 for (file_no = 0; file_no < RSBAC_PM_NR_FD_LISTS; file_no++)
01692 {
01693 tmperr = rsbac_list_detach(&device_p->handles.pm[file_no],
01694 RSBAC_PM_FD_ACI_KEY);
01695 if(tmperr)
01696 {
01697 char * tmp;
01698
01699 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01700 if(tmp)
01701 {
01702 rsbac_printk(KERN_WARNING
01703 "detach_fd_lists(): detaching from PM list %u for device %02u:%02u failed with error %s!\n",
01704 file_no,
01705 RSBAC_MAJOR(device_p->id),
01706 RSBAC_MINOR(device_p->id),
01707 get_error_name(tmp, tmperr));
01708 rsbac_kfree(tmp);
01709 }
01710 err = tmperr;
01711 }
01712 }
01713 #endif
01714
01715 #if defined(CONFIG_RSBAC_DAZ)
01716 /* detach all DAZ lists */
01717 for (file_no = 0; file_no < RSBAC_DAZ_NR_FD_LISTS; file_no++)
01718 {
01719 tmperr = rsbac_list_detach(&device_p->handles.daz[file_no],
01720 RSBAC_DAZ_FD_ACI_KEY);
01721 if(tmperr)
01722 {
01723 char * tmp;
01724
01725 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01726 if(tmp)
01727 {
01728 rsbac_printk(KERN_WARNING
01729 "detach_fd_lists(): detaching from DAZ list %u for device %02u:%02u failed with error %s!\n",
01730 file_no,
01731 RSBAC_MAJOR(device_p->id),
01732 RSBAC_MINOR(device_p->id),
01733 get_error_name(tmp, tmperr));
01734 rsbac_kfree(tmp);
01735 }
01736 err = tmperr;
01737 }
01738 }
01739 #if defined(CONFIG_RSBAC_DAZ_CACHE)
01740 /* detach all DAZ scanned lists */
01741 for (file_no = 0; file_no < RSBAC_DAZ_SCANNED_NR_FD_LISTS; file_no++)
01742 {
01743 tmperr = rsbac_list_detach(&device_p->handles.dazs[file_no],
01744 RSBAC_DAZ_FD_ACI_KEY);
01745 if(tmperr)
01746 {
01747 char * tmp;
01748
01749 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01750 if(tmp)
01751 {
01752 rsbac_printk(KERN_WARNING
01753 "detach_fd_lists(): detaching from DAZ scanned list %u for device %02u:%02u failed with error %s!\n",
01754 file_no,
01755 RSBAC_MAJOR(device_p->id),
01756 RSBAC_MINOR(device_p->id),
01757 get_error_name(tmp, tmperr));
01758 rsbac_kfree(tmp);
01759 }
01760 err = tmperr;
01761 }
01762 }
01763 #endif
01764 #endif
01765
01766 #if defined(CONFIG_RSBAC_FF)
01767 /* detach all FF lists */
01768 for (file_no = 0; file_no < RSBAC_FF_NR_FD_LISTS; file_no++)
01769 {
01770 tmperr = rsbac_list_detach(&device_p->handles.ff[file_no],
01771 RSBAC_FF_FD_ACI_KEY);
01772 if(tmperr)
01773 {
01774 char * tmp;
01775
01776 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01777 if(tmp)
01778 {
01779 rsbac_printk(KERN_WARNING
01780 "detach_fd_lists(): detaching from FF list %u for device %02u:%02u failed with error %s!\n",
01781 file_no,
01782 RSBAC_MAJOR(device_p->id),
01783 RSBAC_MINOR(device_p->id),
01784 get_error_name(tmp, tmperr));
01785 rsbac_kfree(tmp);
01786 }
01787 err = tmperr;
01788 }
01789 }
01790 #endif
01791
01792 #if defined(CONFIG_RSBAC_RC)
01793 /* detach all RC lists */
01794 for (file_no = 0; file_no < RSBAC_RC_NR_FD_LISTS; file_no++)
01795 {
01796 tmperr = rsbac_list_detach(&device_p->handles.rc[file_no],
01797 RSBAC_RC_FD_ACI_KEY);
01798 if(tmperr)
01799 {
01800 char * tmp;
01801
01802 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01803 if(tmp)
01804 {
01805 rsbac_printk(KERN_WARNING
01806 "detach_fd_lists(): detaching from RC list %u for device %02u:%02u failed with error %s!\n",
01807 file_no,
01808 RSBAC_MAJOR(device_p->id),
01809 RSBAC_MINOR(device_p->id),
01810 get_error_name(tmp, tmperr));
01811 rsbac_kfree(tmp);
01812 }
01813 err = tmperr;
01814 }
01815 }
01816 #endif
01817
01818 #if defined(CONFIG_RSBAC_AUTH)
01819 /* detach all AUTH lists */
01820 for (file_no = 0; file_no < RSBAC_AUTH_NR_FD_LISTS; file_no++)
01821 {
01822 tmperr = rsbac_list_detach(&device_p->handles.auth[file_no],
01823 RSBAC_AUTH_FD_ACI_KEY);
01824 if(tmperr)
01825 {
01826 char * tmp;
01827
01828 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01829 if(tmp)
01830 {
01831 rsbac_printk(KERN_WARNING
01832 "detach_fd_lists(): detaching from AUTH list %u for device %02u:%02u failed with error %s!\n",
01833 file_no,
01834 RSBAC_MAJOR(device_p->id),
01835 RSBAC_MINOR(device_p->id),
01836 get_error_name(tmp, tmperr));
01837 rsbac_kfree(tmp);
01838 }
01839 err = tmperr;
01840 }
01841 }
01842 #endif
01843
01844 #if defined(CONFIG_RSBAC_CAP)
01845 /* detach all CAP lists */
01846 for (file_no = 0; file_no < RSBAC_CAP_NR_FD_LISTS; file_no++)
01847 {
01848 tmperr = rsbac_list_detach(&device_p->handles.cap[file_no],
01849 RSBAC_CAP_FD_ACI_KEY);
01850 if(tmperr)
01851 {
01852 char * tmp;
01853
01854 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01855 if(tmp)
01856 {
01857 rsbac_printk(KERN_WARNING
01858 "detach_fd_lists(): detaching from CAP list %u for device %02u:%02u failed with error %s!\n",
01859 file_no,
01860 RSBAC_MAJOR(device_p->id),
01861 RSBAC_MINOR(device_p->id),
01862 get_error_name(tmp, tmperr));
01863 rsbac_kfree(tmp);
01864 }
01865 err = tmperr;
01866 }
01867 }
01868 #endif
01869
01870 #if defined(CONFIG_RSBAC_PAX)
01871 /* detach all PAX lists */
01872 for (file_no = 0; file_no < RSBAC_PAX_NR_FD_LISTS; file_no++)
01873 {
01874 tmperr = rsbac_list_detach(&device_p->handles.pax[file_no],
01875 RSBAC_PAX_FD_ACI_KEY);
01876 if(tmperr)
01877 {
01878 char * tmp;
01879
01880 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01881 if(tmp)
01882 {
01883 rsbac_printk(KERN_WARNING
01884 "detach_fd_lists(): detaching from PAX list %u for device %02u:%02u failed with error %s!\n",
01885 file_no,
01886 RSBAC_MAJOR(device_p->id),
01887 RSBAC_MINOR(device_p->id),
01888 get_error_name(tmp, tmperr));
01889 rsbac_kfree(tmp);
01890 }
01891 err = tmperr;
01892 }
01893 }
01894 #endif
01895
01896 #if defined(CONFIG_RSBAC_RES)
01897 /* detach all RES lists */
01898 for (file_no = 0; file_no < RSBAC_RES_NR_FD_LISTS; file_no++)
01899 {
01900 tmperr = rsbac_list_detach(&device_p->handles.res[file_no],
01901 RSBAC_RES_FD_ACI_KEY);
01902 if(tmperr)
01903 {
01904 char * tmp;
01905
01906 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01907 if(tmp)
01908 {
01909 rsbac_printk(KERN_WARNING
01910 "detach_fd_lists(): detaching from RES list %u for device %02u:%02u failed with error %s!\n",
01911 file_no,
01912 RSBAC_MAJOR(device_p->id),
01913 RSBAC_MINOR(device_p->id),
01914 get_error_name(tmp, tmperr));
01915 rsbac_kfree(tmp);
01916 }
01917 err = tmperr;
01918 }
01919 }
01920 #endif
01921
01922 return err;
01923 }
|
|
|
Definition at line 1950 of file aci_data_structures.c. References device_list_head, and NULL. Referenced by rsbac_do_init(), rsbac_init_acl(), rsbac_init_auth(), rsbac_init_mac(), rsbac_mount(), rsbac_mount_acl(), rsbac_mount_auth(), and rsbac_mount_mac(). 01951 {
01952 if (!device_p)
01953 return(NULL);
01954
01955 /* add new device to device list */
01956 if (!device_list_head.head)
01957 { /* first device */
01958 device_list_head.head=device_p;
01959 device_list_head.tail=device_p;
01960 device_list_head.curr=device_p;
01961 device_list_head.count=1;
01962 device_p->prev=NULL;
01963 device_p->next=NULL;
01964 }
01965 else
01966 { /* there is another device -> hang to tail */
01967 device_p->prev=device_list_head.tail;
01968 device_p->next=NULL;
01969 device_list_head.tail->next=device_p;
01970 device_list_head.tail=device_p;
01971 device_list_head.curr=device_p;
01972 device_list_head.count++;
01973 }
01974 return(device_p);
01975 }
|
|
|
Definition at line 1984 of file aci_data_structures.c. References rsbac_kfree(). Referenced by remove_device_item(), rsbac_do_init(), rsbac_mount(), rsbac_mount_acl(), rsbac_mount_auth(), and rsbac_mount_mac(). 01985 {
01986 if(!item_p)
01987 return;
01988
01989 /* dput() rsbac_dir_dentry_p, if set */
01990 if(item_p->rsbac_dir_dentry_p)
01991 dput(item_p->rsbac_dir_dentry_p);
01992 /* OK, lets remove the device item itself */
01993 rsbac_kfree(item_p);
01994 } /* end of clear_device_item() */
|
|
||||||||||||||||||||||||
|
Definition at line 14917 of file aci_data_structures.c. References FALSE, NULL, RSBAC_EINVALIDPOINTER, rsbac_ta_list_get_all_desc(), rsbac_vfree, and TRUE. Referenced by rsbac_ta_list_all_user(). 14922 {
14923 rsbac_uid_t * i_id_p = NULL;
14924 rsbac_boolean_t found;
14925 int tmp_count;
14926 int i;
14927 int j;
14928
14929 if(!list || !count_p || !i_count_p || !res_id_p)
14930 return -RSBAC_EINVALIDPOINTER;
14931 if(!*i_count_p)
14932 return 0;
14933 // rsbac_printk(KERN_DEBUG "copy_new_uids: list %p, ta_number %u, count %u, i_count %u, res_id_p %p, res_id_p[0] %u\n",
14934 // list, ta_number, *count_p, *i_count_p, res_id_p, res_id_p[0]);
14935 tmp_count = rsbac_ta_list_get_all_desc(ta_number, list, (void **) &i_id_p);
14936 if(tmp_count > 0)
14937 {
14938 if(tmp_count > *i_count_p)
14939 tmp_count = *i_count_p;
14940 for(i=0; i < tmp_count; i++)
14941 {
14942 found = FALSE;
14943 for(j=0; j < *count_p; j++)
14944 {
14945 if(res_id_p[j] == i_id_p[i])
14946 {
14947 found = TRUE;
14948 break;
14949 }
14950 }
14951 if(found == FALSE)
14952 {
14953 res_id_p[*count_p] = i_id_p[i];
14954 (*count_p)++;
14955 (*i_count_p)--;
14956 }
14957 }
14958 rsbac_vfree(i_id_p);
14959 }
14960 return 0;
14961 }
|
|
||||||||||||
|
Definition at line 1928 of file aci_data_structures.c. References NULL, and rsbac_kmalloc(). Referenced by rsbac_do_init(), rsbac_init_acl(), rsbac_init_auth(), rsbac_init_mac(), rsbac_mount(), rsbac_mount_acl(), rsbac_mount_auth(), and rsbac_mount_mac(). 01929 {
01930 struct rsbac_device_list_item_t * new_item_p;
01931
01932 if(!sb_p)
01933 return NULL;
01934 /* allocate memory for new device, return NULL, if failed */
01935 if ( !(new_item_p = (struct rsbac_device_list_item_t *)
01936 rsbac_kmalloc(sizeof(*new_item_p)) ) )
01937 return(NULL);
01938
01939 memset(new_item_p, 0, sizeof(*new_item_p));
01940 new_item_p->id = sb_p->s_dev;
01941 new_item_p->sb_p = sb_p;
01942 new_item_p->d_covers = d_covers;
01943 new_item_p->mount_count = 1;
01944 /* everything else is 0 by memset -> return */
01945 return(new_item_p);
01946 }
|
|
|
|
|
||||||||||||
|
Definition at line 620 of file aci_data_structures.c. References rsbac_dev_desc_t::major, rsbac_dev_desc_t::minor, and rsbac_dev_desc_t::type. Referenced by register_dev_lists(), and rsbac_init_acl(). 00621 {
00622 int result;
00623 struct rsbac_dev_desc_t * i_desc1 = desc1;
00624 struct rsbac_dev_desc_t * i_desc2 = desc2;
00625
00626 result = memcmp(&i_desc1->type,
00627 &i_desc2->type,
00628 sizeof(i_desc1->type));
00629 if(result)
00630 return result;
00631 result = memcmp(&i_desc1->major,
00632 &i_desc2->major,
00633 sizeof(i_desc1->major));
00634 if(result)
00635 return result;
00636 return memcmp(&i_desc1->minor,
00637 &i_desc2->minor,
00638 sizeof(i_desc1->minor));
00639 }
|
|
||||||||||||
|
Definition at line 641 of file aci_data_structures.c. References rsbac_dev_desc_t::major, and rsbac_dev_desc_t::type. Referenced by register_dev_lists(), and rsbac_init_acl(). 00642 {
00643 int result;
00644 struct rsbac_dev_desc_t * i_desc1 = desc1;
00645 struct rsbac_dev_desc_t * i_desc2 = desc2;
00646
00647 result = memcmp(&i_desc1->type,
00648 &i_desc2->type,
00649 sizeof(i_desc1->type));
00650 if(result)
00651 return result;
00652 return memcmp(&i_desc1->major,
00653 &i_desc2->major,
00654 sizeof(i_desc1->major));
00655 }
|
|
||||||||||||||||||||
|
Definition at line 772 of file aci_data_structures.c. Referenced by gen_dev_get_conv(). 00777 {
00778 struct rsbac_dev_desc_t * new = new_desc;
00779 struct rsbac_dev_t * old = old_desc;
00780
00781 memcpy(new_data, old_data, sizeof(struct rsbac_gen_dev_aci_t));
00782 new->type = old->type;
00783 new->major = RSBAC_MAJOR(old->id);
00784 new->minor = RSBAC_MINOR(old->id);
00785 return 0;
00786 }
|
|
|
Definition at line 788 of file aci_data_structures.c. References gen_dev_conv(), NULL, and RSBAC_GEN_DEV_OLD_ACI_VERSION. Referenced by register_dev_lists(). 00789 {
00790 switch(old_version)
00791 {
00792 case RSBAC_GEN_DEV_OLD_ACI_VERSION:
00793 return gen_dev_conv;
00794 default:
00795 return NULL;
00796 }
00797 }
|
|
||||||||||||||||||||
|
|
Definition at line 757 of file aci_data_structures.c. References gen_fd_conv(), gen_fd_old_conv(), gen_fd_old_old_conv(), NULL, RSBAC_GEN_FD_OLD_ACI_VERSION, RSBAC_GEN_FD_OLD_OLD_ACI_VERSION, and RSBAC_GEN_FD_OLD_OLD_OLD_ACI_VERSION. Referenced by register_fd_lists(). 00758 {
00759 switch(old_version)
00760 {
00761 case RSBAC_GEN_FD_OLD_ACI_VERSION:
00762 return gen_fd_conv;
00763 case RSBAC_GEN_FD_OLD_OLD_ACI_VERSION:
00764 return gen_fd_old_conv;
00765 case RSBAC_GEN_FD_OLD_OLD_OLD_ACI_VERSION:
00766 return gen_fd_old_old_conv;
00767 default:
00768 return NULL;
00769 }
00770 }
|
|
|
Definition at line 224 of file aci_data_structures.c. Referenced by get_attr_fd(), rsbac_ta_remove_target(), and set_attr_fd(). 00225 {
00226 return(inode % RSBAC_GEN_NR_FD_LISTS);
00227 }
|
|
||||||||||||||||||||
|
||||||||||||||||||||
|
|
Definition at line 228 of file aci_data_structures.c. Referenced by get_attr_process(), rsbac_ta_remove_target(), and set_attr_process(). 00229 {
00230 return(pid % CONFIG_RSBAC_GEN_NR_P_LISTS);
00231 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 10487 of file aci_data_structures.c. References A_log_array_high, A_log_array_low, A_mac_categories, A_mac_check, A_pm_object_class, A_pm_object_type, A_rc_type, A_security_level, D_block, D_block_major, D_char, D_char_major, DEFAULT_GEN_DEV_ACI, dev_handles, dev_major_handles, GEN, rsbac_gen_dev_aci_t::log_array_high, rsbac_attribute_value_t::log_array_high, rsbac_gen_dev_aci_t::log_array_low, rsbac_attribute_value_t::log_array_low, MAC, rsbac_attribute_value_t::mac_categories, rsbac_attribute_value_t::mac_check, NULL, PM, rsbac_attribute_value_t::pm_object_class, rsbac_attribute_value_t::pm_object_type, RC, rsbac_attribute_value_t::rc_type, RC_type_inherit_parent, RSBAC_EINVALIDATTR, RSBAC_EINVALIDMODULE, RSBAC_EINVALIDTARGET, RSBAC_RC_GENERAL_TYPE, rsbac_ta_list_get_data_ttl(), rsbac_attribute_value_t::security_level, and rsbac_dev_desc_t::type. Referenced by rsbac_ta_get_attr(). 10495 {
10496 int err = 0;
10497 /*
10498 #ifdef CONFIG_RSBAC_DEBUG
10499 if (rsbac_debug_ds)
10500 rsbac_printk(KERN_DEBUG
10501 "rsbac_get_attr(): Getting dev attribute\n");
10502 #endif
10503 */
10504 switch(module)
10505 {
10506 case GEN:
10507 {
10508 struct rsbac_gen_dev_aci_t aci = DEFAULT_GEN_DEV_ACI;
10509
10510 rsbac_ta_list_get_data_ttl(ta_number,
10511 dev_handles.gen,
10512 NULL,
10513 &dev,
10514 &aci);
10515 switch (attr)
10516 {
10517 case A_log_array_low:
10518 value->log_array_low = aci.log_array_low;
10519 break;
10520 case A_log_array_high:
10521 value->log_array_high = aci.log_array_high;
10522 break;
10523 default:
10524 err = -RSBAC_EINVALIDATTR;
10525 }
10526 }
10527 break;
10528
10529 #if defined(CONFIG_RSBAC_MAC)
10530 case MAC:
10531 {
10532 struct rsbac_mac_dev_aci_t aci = DEFAULT_MAC_DEV_ACI;
10533
10534 rsbac_ta_list_get_data_ttl(ta_number,
10535 dev_handles.mac,
10536 NULL,
10537 &dev,
10538 &aci);
10539 switch (attr)
10540 {
10541 case A_security_level:
10542 value->security_level = aci.sec_level;
10543 break;
10544 case A_mac_categories:
10545 value->mac_categories = aci.mac_categories;
10546 break;
10547 case A_mac_check:
10548 value->mac_check = aci.mac_check;
10549 break;
10550
10551 default:
10552 err = -RSBAC_EINVALIDATTR;
10553 }
10554 }
10555 break;
10556 #endif /* MAC */
10557
10558 #if defined(CONFIG_RSBAC_PM)
10559 case PM:
10560 {
10561 struct rsbac_pm_dev_aci_t aci = DEFAULT_PM_DEV_ACI;
10562
10563 rsbac_ta_list_get_data_ttl(ta_number,
10564 dev_handles.pm,
10565 NULL,
10566 &dev,
10567 &aci);
10568 switch (attr)
10569 {
10570 case A_pm_object_class:
10571 value->pm_object_class = aci.pm_object_class;
10572 break;
10573 case A_pm_object_type:
10574 value->pm_object_type = aci.pm_object_type;
10575 break;
10576 default:
10577 err = -RSBAC_EINVALIDATTR;
10578 }
10579 }
10580 break;
10581 #endif /* PM */
10582
10583 #if defined(CONFIG_RSBAC_RC)
10584 case RC:
10585 {
10586 rsbac_rc_type_id_t type = RSBAC_RC_GENERAL_TYPE;
10587
10588 switch(dev.type)
10589 {
10590 case D_char:
10591 case D_block:
10592 if(rsbac_ta_list_get_data_ttl(ta_number,
10593 dev_handles.rc,
10594 NULL,
10595 &dev,
10596 &type)
10597 || ( (type == RC_type_inherit_parent)
10598 && inherit
10599 )
10600 )
10601 rsbac_ta_list_get_data_ttl(ta_number,
10602 dev_major_handles.rc,
10603 NULL,
10604 &dev,
10605 &type);
10606 break;
10607 case D_char_major:
10608 case D_block_major:
10609 dev.type -= (D_block_major - D_block);
10610 rsbac_ta_list_get_data_ttl(ta_number,
10611 dev_major_handles.rc,
10612 NULL,
10613 &dev,
10614 &type);
10615 break;
10616 default:
10617 return -RSBAC_EINVALIDTARGET;
10618 }
10619 switch (attr)
10620 {
10621 case A_rc_type:
10622 value->rc_type = type;
10623 break;
10624
10625 default:
10626 err = -RSBAC_EINVALIDATTR;
10627 }
10628 }
10629 break;
10630 #endif /* RC */
10631
10632 default:
10633 err = -RSBAC_EINVALIDMODULE;
10634 }
10635 /* and return */
10636 return err;
10637 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 9892 of file aci_data_structures.c. References A_auid_exempt, A_auth_learn, A_auth_may_set_cap, A_auth_may_setuid, A_daz_scanned, A_daz_scanner, A_fake_root_uid, A_ff_flags, A_linux_dac_disable, A_log_array_high, A_log_array_low, A_log_program_based, A_mac_auto, A_mac_categories, A_mac_file_flags, A_mac_prop_trusted, A_max_caps, A_min_caps, A_pax_flags, A_pm_object_class, A_pm_object_type, A_pm_tp, A_rc_force_role, A_rc_initial_role, A_rc_type_fd, A_res_max, A_res_min, A_security_level, A_symlink_add_mac_level, A_symlink_add_rc_role, A_symlink_add_remote_ip, A_symlink_add_uid, rsbac_gen_fd_aci_t::auid_exempt, rsbac_attribute_value_t::auid_exempt, AUTH, rsbac_attribute_value_t::auth_learn, rsbac_attribute_value_t::auth_may_set_cap, rsbac_attribute_value_t::auth_may_setuid, CAP, DAZ, rsbac_attribute_value_t::daz_scanned, rsbac_attribute_value_t::daz_scanner, DEFAULT_GEN_FD_ACI, device_list_head, rsbac_gen_fd_aci_t::fake_root_uid, rsbac_attribute_value_t::fake_root_uid, FALSE, FF, FF_add_inherited, rsbac_attribute_value_t::ff_flags, FF_no_delete_or_rename, GEN, gen_fd_hash(), LDD_inherit, rsbac_gen_fd_aci_t::linux_dac_disable, rsbac_attribute_value_t::linux_dac_disable, rsbac_gen_fd_aci_t::log_array_high, rsbac_attribute_value_t::log_array_high, rsbac_gen_fd_aci_t::log_array_low, rsbac_attribute_value_t::log_array_low, rsbac_gen_fd_aci_t::log_program_based, rsbac_attribute_value_t::log_program_based, lookup_device(), MA_inherit, MAC, rsbac_attribute_value_t::mac_auto, rsbac_attribute_value_t::mac_categories, rsbac_attribute_value_t::mac_file_flags, rsbac_attribute_value_t::mac_prop_trusted, rsbac_attribute_value_t::max_caps, rsbac_attribute_value_t::min_caps, NULL, PAX, rsbac_attribute_value_t::pax_flags, PM, rsbac_attribute_value_t::pm_object_class, rsbac_attribute_value_t::pm_object_type, rsbac_attribute_value_t::pm_tp, RC, rsbac_attribute_value_t::rc_force_role, rsbac_attribute_value_t::rc_initial_role, RC_role_inherit_parent, rsbac_attribute_value_t::rc_type_fd, RC_type_inherit_parent, RES, rsbac_attribute_value_t::res_array, RSBAC_EINVALIDATTR, RSBAC_EINVALIDDEV, RSBAC_EINVALIDMODULE, RSBAC_FF_DEF, rsbac_get_parent(), RSBAC_MAC_INHERIT_CAT_VECTOR, rsbac_mount(), RSBAC_PAX_DEF_FLAGS, rsbac_printk(), rsbac_ta_list_get_data_ttl(), rsbac_attribute_value_t::security_level, SL_inherit, rsbac_gen_fd_aci_t::symlink_add_mac_level, rsbac_attribute_value_t::symlink_add_mac_level, rsbac_gen_fd_aci_t::symlink_add_rc_role, rsbac_attribute_value_t::symlink_add_rc_role, rsbac_gen_fd_aci_t::symlink_add_remote_ip, rsbac_attribute_value_t::symlink_add_remote_ip, rsbac_gen_fd_aci_t::symlink_add_uid, rsbac_attribute_value_t::symlink_add_uid, and TRUE. Referenced by rsbac_ta_get_attr(). 09900 {
09901 int err = 0;
09902 struct rsbac_device_list_item_t * device_p;
09903 u_long dflags;
09904 #if defined(CONFIG_RSBAC_FF)
09905 rsbac_ff_flags_t ff_flags = 0;
09906 rsbac_ff_flags_t ff_tmp_flags;
09907 rsbac_ff_flags_t ff_mask = -1;
09908 #endif
09909
09910 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
09911 if( !RSBAC_MAJOR(tid_p->file.device)
09912 && !RSBAC_MINOR(tid_p->file.device)
09913 )
09914 return -RSBAC_EINVALIDDEV;
09915 #endif
09916 /* use loop for inheritance - used to be recursive calls */
09917 for(;;)
09918 {
09919 /*
09920 #ifdef CONFIG_RSBAC_DEBUG
09921 if (rsbac_debug_ds)
09922 rsbac_printk(KERN_DEBUG "rsbac_get_attr(): Getting file/dir/fifo/symlink attribute %u for device %02u:%02u, inode %lu, dentry_p %p\n",
09923 attr, RSBAC_MAJOR(tid_p->file.device),RSBAC_MINOR(tid_p->file.device), (u_long) tid_p->file.inode, tid_p->file.dentry_p);
09924 #endif
09925 */
09926 /* wait for read access to device_list_head */
09927 rsbac_read_lock(&device_list_head.lock, &dflags);
09928 /* OK, go on */
09929 /*
09930 #ifdef CONFIG_RSBAC_DEBUG
09931 if (rsbac_debug_ds)
09932 rsbac_printk(KERN_DEBUG
09933 "rsbac_get_attr(): passed device read lock\n");
09934 #endif
09935 */
09936
09937 /* lookup device */
09938 device_p = lookup_device(tid_p->file.device);
09939 if (!device_p)
09940 {
09941 struct super_block * sb_p;
09942
09943 rsbac_read_unlock(&device_list_head.lock, &dflags);
09944 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
09945 sb_p = user_get_super(tid_p->file.device);
09946 #else
09947 sb_p = get_super(tid_p->file.device);
09948 #endif
09949 if(sb_p)
09950 {
09951 rsbac_printk(KERN_INFO
09952 "rsbac_get_attr(): auto-mounting device %02u:%02u\n",
09953 RSBAC_MAJOR(tid_p->file.device), RSBAC_MINOR(tid_p->file.device));
09954 rsbac_mount(sb_p, NULL);
09955 /* free super_block pointer */
09956 drop_super(sb_p);
09957 rsbac_read_lock(&device_list_head.lock, &dflags);
09958 device_p = lookup_device(tid_p->file.device);
09959 if (!device_p)
09960 {
09961 rsbac_printk(KERN_WARNING
09962 "rsbac_get_attr(): unknown device %02u:%02u\n",
09963 RSBAC_MAJOR(tid_p->file.device), RSBAC_MINOR(tid_p->file.device));
09964 rsbac_read_unlock(&device_list_head.lock, &dflags);
09965 return -RSBAC_EINVALIDDEV;
09966 }
09967 }
09968 else
09969 return -RSBAC_EINVALIDDEV;
09970 }
09971 switch(module)
09972 {
09973 case GEN:
09974 {
09975 struct rsbac_gen_fd_aci_t aci = DEFAULT_GEN_FD_ACI;
09976
09977 if(attr == A_internal)
09978 {
09979 if(!device_p->rsbac_dir_inode || !tid_p->file.inode)
09980 value->internal = FALSE;
09981 else
09982 if(device_p->rsbac_dir_inode == tid_p->file.inode)
09983 value->internal = TRUE;
09984 else
09985 if(inherit)
09986 {
09987 enum rsbac_target_t parent_target;
09988 union rsbac_target_id_t parent_tid;
09989
09990 /* inheritance possible? */
09991 if(!rsbac_get_parent(target, *tid_p, &parent_target, &parent_tid))
09992 { /* yes: inherit this single level */
09993 if(device_p->rsbac_dir_inode == parent_tid.file.inode)
09994 value->internal = TRUE;
09995 else
09996 value->internal = FALSE;
09997 }
09998 else
09999 {
10000 value->internal = FALSE;
10001 }
10002 }
10003 else
10004 {
10005 value->internal = FALSE;
10006 }
10007
10008 /* free access to device_list_head */
10009 rsbac_read_unlock(&device_list_head.lock, &dflags);
10010 return 0;
10011 }
10012 rsbac_ta_list_get_data_ttl(ta_number,
10013 device_p->handles.gen[gen_fd_hash(tid_p->file.inode)],
10014 NULL,
10015 &tid_p->file.inode,
10016 &aci);
10017 switch (attr)
10018 {
10019 case A_log_array_low:
10020 value->log_array_low = aci.log_array_low;
10021 break;
10022 case A_log_array_high:
10023 value->log_array_high = aci.log_array_high;
10024 break;
10025 case A_log_program_based:
10026 value->log_program_based = aci.log_program_based;
10027 break;
10028 case A_symlink_add_remote_ip:
10029 value->symlink_add_remote_ip = aci.symlink_add_remote_ip;
10030 break;
10031 case A_symlink_add_uid:
10032 value->symlink_add_uid = aci.symlink_add_uid;
10033 break;
10034 case A_symlink_add_mac_level:
10035 value->symlink_add_mac_level = aci.symlink_add_mac_level;
10036 break;
10037 case A_symlink_add_rc_role:
10038 value->symlink_add_rc_role = aci.symlink_add_rc_role;
10039 break;
10040 case A_linux_dac_disable:
10041 value->linux_dac_disable = aci.linux_dac_disable;
10042 if((value->linux_dac_disable == LDD_inherit) && inherit)
10043 {
10044 enum rsbac_target_t parent_target;
10045 union rsbac_target_id_t parent_tid;
10046
10047 /* free access to device_list_head - see above */
10048 rsbac_read_unlock(&device_list_head.lock, &dflags);
10049
10050 /* inheritance possible? */
10051 if(!rsbac_get_parent(target, *tid_p, &parent_target, &parent_tid))
10052 {
10053 target = parent_target;
10054 *tid_p = parent_tid;
10055 continue;
10056 }
10057 else
10058 {
10059 value->linux_dac_disable
10060 = def_gen_root_dir_aci.linux_dac_disable;
10061 return 0;
10062 }
10063 }
10064 break;
10065 case A_fake_root_uid:
10066 value->fake_root_uid = aci.fake_root_uid;
10067 break;
10068 case A_auid_exempt:
10069 value->auid_exempt = aci.auid_exempt;
10070 break;
10071 default:
10072 err = -RSBAC_EINVALIDATTR;
10073 }
10074 }
10075 break;
10076
10077 #if defined(CONFIG_RSBAC_MAC)
10078 case MAC:
10079 {
10080 struct rsbac_mac_fd_aci_t aci = DEFAULT_MAC_FD_ACI;
10081
10082 rsbac_ta_list_get_data_ttl(ta_number,
10083 device_p->handles.mac[mac_fd_hash(tid_p->file.inode)],
10084 NULL,
10085 &tid_p->file.inode,
10086 &aci);
10087 switch (attr)
10088 {
10089 case A_security_level:
10090 value->security_level = aci.sec_level;
10091 if((value->security_level == SL_inherit) && inherit)
10092 {
10093 enum rsbac_target_t parent_target;
10094 union rsbac_target_id_t parent_tid;
10095
10096 /* free access to device_list_head - see above */
10097 rsbac_read_unlock(&device_list_head.lock, &dflags);
10098
10099 /* inheritance possible? */
10100 if(!rsbac_get_parent(target, *tid_p, &parent_target, &parent_tid))
10101 {
10102 target = parent_target;
10103 *tid_p = parent_tid;
10104 continue;
10105 }
10106 else
10107 {
10108 value->security_level
10109 = def_mac_root_dir_aci.sec_level;
10110 return 0;
10111 }
10112 }
10113 break;
10114 case A_mac_categories:
10115 value->mac_categories = aci.mac_categories;
10116 if( (value->mac_categories == RSBAC_MAC_INHERIT_CAT_VECTOR)
10117 && inherit
10118 )
10119 {
10120 enum rsbac_target_t parent_target;
10121 union rsbac_target_id_t parent_tid;
10122
10123 /* free access to device_list_head - see above */
10124 rsbac_read_unlock(&device_list_head.lock, &dflags);
10125
10126 /* inheritance possible? */
10127 if(!rsbac_get_parent(target, *tid_p, &parent_target, &parent_tid))
10128 {
10129 target = parent_target;
10130 *tid_p = parent_tid;
10131 continue;
10132 }
10133 else
10134 {
10135 value->mac_categories
10136 = def_mac_root_dir_aci.mac_categories;
10137 return 0;
10138 }
10139 }
10140 break;
10141 case A_mac_auto:
10142 value->mac_auto = aci.mac_auto;
10143 if( (value->mac_auto == MA_inherit)
10144 && inherit
10145 )
10146 {
10147 enum rsbac_target_t parent_target;
10148 union rsbac_target_id_t parent_tid;
10149
10150 /* free access to device_list_head - see above */
10151 rsbac_read_unlock(&device_list_head.lock, &dflags);
10152
10153 /* inheritance possible? */
10154 if(!rsbac_get_parent(target, *tid_p, &parent_target, &parent_tid))
10155 {
10156 target = parent_target;
10157 *tid_p = parent_tid;
10158 continue;
10159 }
10160 else
10161 {
10162 value->mac_auto
10163 = def_mac_root_dir_aci.mac_auto;
10164 return 0;
10165 }
10166 }
10167 break;
10168 case A_mac_prop_trusted:
10169 value->mac_prop_trusted = aci.mac_prop_trusted;
10170 break;
10171 case A_mac_file_flags:
10172 value->mac_file_flags = aci.mac_file_flags;
10173 break;
10174
10175 default:
10176 err = -RSBAC_EINVALIDATTR;
10177 }
10178 }
10179 break;
10180 #endif /* MAC */
10181
10182 #if defined(CONFIG_RSBAC_PM)
10183 case PM:
10184 {
10185 struct rsbac_pm_fd_aci_t aci = DEFAULT_PM_FD_ACI;
10186
10187 rsbac_ta_list_get_data_ttl(ta_number,
10188 device_p->handles.pm[pm_fd_hash(tid_p->file.inode)],
10189 NULL,
10190 &tid_p->file.inode,
10191 &aci);
10192 switch (attr)
10193 {
10194 case A_pm_object_class:
10195 value->pm_object_class = aci.pm_object_class;
10196 break;
10197 case A_pm_tp:
10198 value->pm_tp = aci.pm_tp;
10199 break;
10200 case A_pm_object_type:
10201 value->pm_object_type = aci.pm_object_type;
10202 break;
10203 default:
10204 err = -RSBAC_EINVALIDATTR;
10205 }
10206 }
10207 break;
10208 #endif /* PM */
10209
10210 #if defined(CONFIG_RSBAC_DAZ)
10211 case DAZ:
10212 {
10213 #if defined(CONFIG_RSBAC_DAZ_CACHE)
10214 if(attr == A_daz_scanned)
10215 {
10216 err = rsbac_ta_list_get_data_ttl(ta_number,
10217 device_p->handles.dazs[daz_scanned_fd_hash(tid_p->file.inode)],
10218 NULL,
10219 &tid_p->file.inode,
10220 &value->daz_scanned);
10221 }
10222 else
10223 #endif
10224 {
10225 struct rsbac_daz_fd_aci_t aci = DEFAULT_DAZ_FD_ACI;
10226
10227 rsbac_ta_list_get_data_ttl(ta_number,
10228 device_p->handles.daz[daz_fd_hash(tid_p->file.inode)],
10229 NULL,
10230 &tid_p->file.inode,
10231 &aci);
10232 switch (attr)
10233 {
10234 case A_daz_scanner:
10235 value->daz_scanner = aci.daz_scanner;
10236 break;
10237 default:
10238 err = -RSBAC_EINVALIDATTR;
10239 }
10240 }
10241 }
10242 break;
10243 #endif /* DAZ */
10244
10245 #if defined(CONFIG_RSBAC_FF)
10246 case FF:
10247 {
10248 switch (attr)
10249 {
10250 case A_ff_flags:
10251 ff_tmp_flags = RSBAC_FF_DEF;
10252 rsbac_ta_list_get_data_ttl(ta_number,
10253 device_p->handles.ff[ff_fd_hash(tid_p->file.inode)],
10254 NULL,
10255 &tid_p->file.inode,
10256 &ff_tmp_flags);
10257 ff_flags |= ff_tmp_flags & ff_mask;
10258 value->ff_flags = ff_flags;
10259 if((ff_tmp_flags & FF_add_inherited) && inherit)
10260 {
10261 /* inheritance possible? */
10262 if(!rsbac_get_parent(target, *tid_p, &target, tid_p))
10263 {
10264 /* free access to device_list_head - see above */
10265 rsbac_read_unlock(&device_list_head.lock, &dflags);
10266
10267 ff_mask &= ~(FF_no_delete_or_rename | FF_add_inherited);
10268 ff_flags &= ~(FF_add_inherited);
10269 continue;
10270 }
10271 else
10272 value->ff_flags &= ~(FF_add_inherited);
10273 }
10274 break;
10275
10276 default:
10277 err = -RSBAC_EINVALIDATTR;
10278 }
10279 }
10280 break;
10281 #endif /* FF */
10282
10283 #if defined(CONFIG_RSBAC_RC)
10284 case RC:
10285 {
10286 struct rsbac_rc_fd_aci_t aci = DEFAULT_RC_FD_ACI;
10287
10288 rsbac_ta_list_get_data_ttl(ta_number,
10289 device_p->handles.rc[rc_fd_hash(tid_p->file.inode)],
10290 NULL,
10291 &tid_p->file.inode,
10292 &aci);
10293 switch (attr)
10294 {
10295 case A_rc_type_fd:
10296 value->rc_type_fd = aci.rc_type_fd;
10297 if(value->rc_type_fd == RC_type_inherit_parent && inherit)
10298 {
10299 enum rsbac_target_t parent_target;
10300 union rsbac_target_id_t parent_tid;
10301
10302 /* free access to device_list_head - see above */
10303 rsbac_read_unlock(&device_list_head.lock, &dflags);
10304
10305 /* inheritance possible? */
10306 if(!rsbac_get_parent(target, *tid_p, &parent_target, &parent_tid))
10307 {
10308 target = parent_target;
10309 *tid_p = parent_tid;
10310 continue;
10311 }
10312 else
10313 {
10314 value->rc_type_fd
10315 = def_rc_root_dir_aci.rc_type_fd;
10316 return 0;
10317 }
10318 }
10319 break;
10320 case A_rc_force_role:
10321 value->rc_force_role = aci.rc_force_role;
10322 if(value->rc_force_role == RC_role_inherit_parent && inherit)
10323 {
10324 enum rsbac_target_t parent_target;
10325 union rsbac_target_id_t parent_tid;
10326
10327 /* free access to device_list_head - see above */
10328 rsbac_read_unlock(&device_list_head.lock, &dflags);
10329
10330 /* inheritance possible? */
10331 if(!rsbac_get_parent(target, *tid_p, &parent_target, &parent_tid))
10332 {
10333 target = parent_target;
10334 *tid_p = parent_tid;
10335 continue;
10336 }
10337 else
10338 {
10339 value->rc_force_role
10340 = def_rc_root_dir_aci.rc_force_role;
10341 return 0;
10342 }
10343 }
10344 break;
10345 case A_rc_initial_role:
10346 value->rc_initial_role = aci.rc_initial_role;
10347 if(value->rc_initial_role == RC_role_inherit_parent && inherit)
10348 {
10349 enum rsbac_target_t parent_target;
10350 union rsbac_target_id_t parent_tid;
10351
10352 /* free access to device_list_head - see above */
10353 rsbac_read_unlock(&device_list_head.lock, &dflags);
10354
10355 /* inheritance possible? */
10356 if(!rsbac_get_parent(target, *tid_p, &parent_target, &parent_tid))
10357 {
10358 target = parent_target;
10359 *tid_p = parent_tid;
10360 continue;
10361 }
10362 else
10363 {
10364 value->rc_initial_role
10365 = def_rc_root_dir_aci.rc_initial_role;
10366 return 0;
10367 }
10368 }
10369 break;
10370
10371 default:
10372 err = -RSBAC_EINVALIDATTR;
10373 }
10374 }
10375 break;
10376 #endif /* RC */
10377
10378 #if defined(CONFIG_RSBAC_AUTH)
10379 case AUTH:
10380 {
10381 struct rsbac_auth_fd_aci_t aci = DEFAULT_AUTH_FD_ACI;
10382
10383 rsbac_ta_list_get_data_ttl(ta_number,
10384 device_p->handles.auth[auth_fd_hash(tid_p->file.inode)],
10385 NULL,
10386 &tid_p->file.inode,
10387 &aci);
10388 switch (attr)
10389 {
10390 case A_auth_may_setuid:
10391 value->auth_may_setuid = aci.auth_may_setuid;
10392 break;
10393 case A_auth_may_set_cap:
10394 value->auth_may_set_cap = aci.auth_may_set_cap;
10395 break;
10396 case A_auth_learn:
10397 value->auth_learn = aci.auth_learn;
10398 break;
10399 default:
10400 err = -RSBAC_EINVALIDATTR;
10401 }
10402 }
10403 break;
10404 #endif /* AUTH */
10405
10406 #if defined(CONFIG_RSBAC_CAP)
10407 case CAP:
10408 {
10409 struct rsbac_cap_fd_aci_t aci = DEFAULT_CAP_FD_ACI;
10410
10411 rsbac_ta_list_get_data_ttl(ta_number,
10412 device_p->handles.cap[cap_fd_hash(tid_p->file.inode)],
10413 NULL,
10414 &tid_p->file.inode,
10415 &aci);
10416 switch (attr)
10417 {
10418 case A_min_caps:
10419 value->min_caps = aci.min_caps;
10420 break;
10421 case A_max_caps:
10422 value->max_caps = aci.max_caps;
10423 break;
10424 default:
10425 err = -RSBAC_EINVALIDATTR;
10426 }
10427 }
10428 break;
10429 #endif /* CAP */
10430
10431 #if defined(CONFIG_RSBAC_RES)
10432 case RES:
10433 {
10434 struct rsbac_res_fd_aci_t aci = DEFAULT_RES_FD_ACI;
10435
10436 rsbac_ta_list_get_data_ttl(ta_number,
10437 device_p->handles.res[res_fd_hash(tid_p->file.inode)],
10438 NULL,
10439 &tid_p->file.inode,
10440 &aci);
10441 switch (attr)
10442 {
10443 case A_res_min:
10444 memcpy(&value->res_array, &aci.res_min, sizeof(aci.res_min));
10445 break;
10446 case A_res_max:
10447 memcpy(&value->res_array, &aci.res_max, sizeof(aci.res_max));
10448 break;
10449 default:
10450 err = -RSBAC_EINVALIDATTR;
10451 }
10452 }
10453 break;
10454 #endif /* RES */
10455
10456 #if defined(CONFIG_RSBAC_PAX)
10457 case PAX:
10458 {
10459 switch (attr)
10460 {
10461 case A_pax_flags:
10462 value->pax_flags = RSBAC_PAX_DEF_FLAGS;
10463 rsbac_ta_list_get_data_ttl(ta_number,
10464 device_p->handles.pax[pax_fd_hash(tid_p->file.inode)],
10465 NULL,
10466 &tid_p->file.inode,
10467 &value->pax_flags);
10468 break;
10469
10470 default:
10471 err = -RSBAC_EINVALIDATTR;
10472 }
10473 }
10474 break;
10475 #endif /* PAX */
10476
10477 default:
10478 err = -RSBAC_EINVALIDMODULE;
10479 }
10480 /* free access to device_list_head */
10481 rsbac_read_unlock(&device_list_head.lock, &dflags);
10482 /* and return */
10483 return err;
10484 } /* end of for(;;) loop for inheritance */
10485 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 10639 of file aci_data_structures.c. References A_jail_id, A_mac_categories, A_pm_ipc_purpose, A_pm_object_class, A_pm_object_type, A_rc_type, A_security_level, rsbac_target_id_t::ipc, ipc_handles, JAIL, rsbac_attribute_value_t::jail_id, MAC, rsbac_attribute_value_t::mac_categories, NULL, PM, rsbac_attribute_value_t::pm_ipc_purpose, rsbac_attribute_value_t::pm_object_class, rsbac_attribute_value_t::pm_object_type, RC, rsbac_attribute_value_t::rc_type, RSBAC_EINVALIDATTR, RSBAC_EINVALIDMODULE, RSBAC_JAIL_DEF_ID, RSBAC_RC_GENERAL_TYPE, rsbac_ta_list_get_data_ttl(), and rsbac_attribute_value_t::security_level. Referenced by rsbac_ta_get_attr(). 10647 {
10648 int err = 0;
10649
10650 /*
10651 #ifdef CONFIG_RSBAC_DEBUG
10652 if (rsbac_debug_ds) rsbac_printk(KERN_DEBUG
10653 "rsbac_get_attr(): Getting ipc attribute\n");
10654 #endif
10655 */
10656 /* lookup only, if not sock or (sock-id != NULL), OK with NULL fifo */
10657 switch(module)
10658 {
10659 #if defined(CONFIG_RSBAC_MAC)
10660 case MAC:
10661 {
10662 struct rsbac_mac_ipc_aci_t aci = DEFAULT_MAC_IPC_ACI;
10663
10664 rsbac_ta_list_get_data_ttl(ta_number,
10665 ipc_handles.mac,
10666 NULL,
10667 &tid_p->ipc,
10668 &aci);
10669 switch (attr)
10670 {
10671 case A_security_level:
10672 value->security_level = aci.sec_level;
10673 break;
10674 case A_mac_categories:
10675 value->mac_categories = aci.mac_categories;
10676 break;
10677
10678 default:
10679 err = -RSBAC_EINVALIDATTR;
10680 }
10681 }
10682 break;
10683 #endif /* MAC */
10684
10685 #if defined(CONFIG_RSBAC_PM)
10686 case PM:
10687 {
10688 struct rsbac_pm_ipc_aci_t aci = DEFAULT_PM_IPC_ACI;
10689
10690 rsbac_ta_list_get_data_ttl(ta_number,
10691 ipc_handles.pm,
10692 NULL,
10693 &tid_p->ipc,
10694 &aci);
10695 switch (attr)
10696 {
10697 case A_pm_object_class:
10698 value->pm_object_class = aci.pm_object_class;
10699 break;
10700 case A_pm_ipc_purpose:
10701 value->pm_ipc_purpose = aci.pm_ipc_purpose;
10702 break;
10703 case A_pm_object_type:
10704 value->pm_object_type = aci.pm_object_type;
10705 break;
10706 default:
10707 err = -RSBAC_EINVALIDATTR;
10708 }
10709 }
10710 break;
10711 #endif /* PM */
10712
10713 #if defined(CONFIG_RSBAC_RC)
10714 case RC:
10715 {
10716 rsbac_rc_type_id_t type = RSBAC_RC_GENERAL_TYPE;
10717
10718 rsbac_ta_list_get_data_ttl(ta_number,
10719 ipc_handles.rc,
10720 NULL,
10721 &tid_p->ipc,
10722 &type);
10723 switch (attr)
10724 {
10725 case A_rc_type:
10726 value->rc_type = type;
10727 break;
10728
10729 default:
10730 err = -RSBAC_EINVALIDATTR;
10731 }
10732 }
10733 break;
10734 #endif /* RC */
10735
10736 #if defined(CONFIG_RSBAC_JAIL)
10737 case JAIL:
10738 {
10739 rsbac_jail_id_t id = RSBAC_JAIL_DEF_ID;
10740
10741 rsbac_ta_list_get_data_ttl(ta_number,
10742 ipc_handles.jail,
10743 NULL,
10744 &tid_p->ipc,
10745 &id);
10746 switch (attr)
10747 {
10748 case A_jail_id:
10749 value->jail_id = id;
10750 break;
10751
10752 default:
10753 err = -RSBAC_EINVALIDATTR;
10754 }
10755 }
10756 break;
10757 #endif /* JAIL */
10758
10759 default:
10760 err = -RSBAC_EINVALIDMODULE;
10761 }
10762 /* and return */
10763 return err;
10764 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 11098 of file aci_data_structures.c. References A_audit_uid, A_auid_exempt, A_auth_last_auth, A_auth_learn, A_auth_may_set_cap, A_auth_may_setuid, A_cap_process_hiding, A_current_sec_level, A_daz_scanner, A_fake_root_uid, A_initial_security_level, A_jail_flags, A_jail_id, A_jail_ip, A_jail_max_caps, A_jail_scd_get, A_jail_scd_modify, A_log_program_based, A_mac_auto, A_mac_categories, A_mac_curr_categories, A_mac_initial_categories, A_mac_min_categories, A_mac_process_flags, A_max_caps_program, A_max_caps_user, A_max_read_categories, A_max_read_open, A_min_security_level, A_min_write_categories, A_min_write_open, A_pax_flags, A_pm_current_task, A_pm_process_type, A_pm_tp, A_rc_force_role, A_rc_role, A_rc_type, A_remote_ip, A_security_level, rsbac_gen_process_aci_t::audit_uid, rsbac_attribute_value_t::audit_uid, rsbac_gen_process_aci_t::auid_exempt, rsbac_attribute_value_t::auid_exempt, AUTH, rsbac_attribute_value_t::auth_last_auth, rsbac_attribute_value_t::auth_learn, rsbac_attribute_value_t::auth_may_set_cap, rsbac_attribute_value_t::auth_may_setuid, CAP, rsbac_attribute_value_t::cap_process_hiding, rsbac_attribute_value_t::current_sec_level, DAZ, rsbac_attribute_value_t::daz_scanner, DEFAULT_GEN_P_ACI, rsbac_gen_process_aci_t::fake_root_uid, rsbac_attribute_value_t::fake_root_uid, FALSE, GEN, gen_p_hash(), JAIL, rsbac_attribute_value_t::jail_flags, rsbac_attribute_value_t::jail_id, rsbac_attribute_value_t::jail_ip, rsbac_attribute_value_t::jail_max_caps, rsbac_attribute_value_t::jail_scd_get, rsbac_attribute_value_t::jail_scd_modify, rsbac_gen_process_aci_t::log_program_based, rsbac_attribute_value_t::log_program_based, MAC, rsbac_attribute_value_t::mac_auto, MAC_auto, rsbac_attribute_value_t::mac_categories, rsbac_attribute_value_t::mac_process_flags, rsbac_attribute_value_t::max_caps_program, rsbac_attribute_value_t::max_caps_user, rsbac_attribute_value_t::max_read_open, rsbac_attribute_value_t::min_write_open, NULL, PAX, rsbac_attribute_value_t::pax_flags, PM, rsbac_attribute_value_t::pm_current_task, rsbac_attribute_value_t::pm_process_type, rsbac_attribute_value_t::pm_tp, rsbac_target_id_t::process, process_handles, RC, rsbac_attribute_value_t::rc_force_role, rsbac_attribute_value_t::rc_role, rsbac_attribute_value_t::rc_type, rsbac_gen_process_aci_t::remote_ip, rsbac_attribute_value_t::remote_ip, RSBAC_EINVALIDATTR, RSBAC_EINVALIDMODULE, RSBAC_EINVALIDTARGET, RSBAC_PAX_ALL_FLAGS, rsbac_ta_list_get_data_ttl(), rsbac_attribute_value_t::security_level, and TRUE. Referenced by rsbac_ta_get_attr(). 11106 {
11107 int err = 0;
11108
11109 /*
11110 #ifdef CONFIG_RSBAC_DEBUG
11111 if (rsbac_debug_ds) rsbac_printk(KERN_DEBUG "%s\n",
11112 "rsbac_get_attr(): Getting process attribute");
11113 #endif
11114 */
11115 switch(module)
11116 {
11117 case GEN:
11118 {
11119 struct rsbac_gen_process_aci_t aci = DEFAULT_GEN_P_ACI;
11120
11121 rsbac_ta_list_get_data_ttl(ta_number,
11122 process_handles.gen[gen_p_hash(tid_p->process)],
11123 NULL,
11124 &tid_p->process,
11125 &aci);
11126 switch (attr)
11127 {
11128 case A_log_program_based:
11129 value->log_program_based = aci.log_program_based;
11130 break;
11131 case A_fake_root_uid:
11132 value->fake_root_uid = aci.fake_root_uid;
11133 break;
11134 case A_audit_uid:
11135 value->audit_uid = aci.audit_uid;
11136 break;
11137 case A_auid_exempt:
11138 value->auid_exempt = aci.auid_exempt;
11139 break;
11140 case A_remote_ip:
11141 value->remote_ip = aci.remote_ip;
11142 break;
11143 default:
11144 err = -RSBAC_EINVALIDATTR;
11145 }
11146 }
11147 break;
11148
11149 #if defined(CONFIG_RSBAC_MAC)
11150 case MAC:
11151 {
11152 struct rsbac_mac_process_aci_t aci = DEFAULT_MAC_P_ACI;
11153
11154 rsbac_ta_list_get_data_ttl(ta_number,
11155 process_handles.mac[mac_p_hash(tid_p->process)],
11156 NULL,
11157 &tid_p->process,
11158 &aci);
11159 switch (attr)
11160 {
11161 case A_security_level:
11162 value->security_level = aci.owner_sec_level;
11163 break;
11164 case A_initial_security_level:
11165 value->security_level = aci.owner_initial_sec_level;
11166 break;
11167 case A_min_security_level:
11168 value->security_level = aci.owner_min_sec_level;
11169 break;
11170 case A_mac_categories:
11171 value->mac_categories = aci.mac_owner_categories;
11172 break;
11173 case A_mac_initial_categories:
11174 value->mac_categories = aci.mac_owner_initial_categories;
11175 break;
11176 case A_mac_min_categories:
11177 value->mac_categories = aci.mac_owner_min_categories;
11178 break;
11179 case A_current_sec_level:
11180 value->current_sec_level = aci.current_sec_level;
11181 break;
11182 case A_mac_curr_categories:
11183 value->mac_categories = aci.mac_curr_categories;
11184 break;
11185 case A_min_write_open:
11186 value->min_write_open = aci.min_write_open;
11187 break;
11188 case A_min_write_categories:
11189 value->mac_categories = aci.min_write_categories;
11190 break;
11191 case A_max_read_open:
11192 value->max_read_open = aci.max_read_open;
11193 break;
11194 case A_max_read_categories:
11195 value->mac_categories = aci.max_read_categories;
11196 break;
11197 case A_mac_process_flags:
11198 value->mac_process_flags = aci.mac_process_flags;
11199 break;
11200 case A_mac_auto:
11201 if(aci.mac_process_flags & MAC_auto)
11202 value->mac_auto = TRUE;
11203 else
11204 value->mac_auto = FALSE;
11205 break;
11206
11207 default:
11208 err = -RSBAC_EINVALIDATTR;
11209 }
11210 }
11211 break;
11212 #endif /* MAC */
11213
11214 #if defined(CONFIG_RSBAC_PM)
11215 case PM:
11216 {
11217 struct rsbac_pm_process_aci_t aci = DEFAULT_PM_P_ACI;
11218
11219 rsbac_ta_list_get_data_ttl(ta_number,
11220 process_handles.pm,
11221 NULL,
11222 &tid_p->process,
11223 &aci);
11224 switch (attr)
11225 {
11226 case A_pm_tp:
11227 value->pm_tp = aci.pm_tp;
11228 break;
11229 case A_pm_current_task:
11230 value->pm_current_task = aci.pm_current_task;
11231 break;
11232 case A_pm_process_type:
11233 value->pm_process_type = aci.pm_process_type;
11234 break;
11235 default:
11236 err = -RSBAC_EINVALIDATTR;
11237 }
11238 }
11239 break;
11240 #endif /* PM */
11241
11242 #if defined(CONFIG_RSBAC_DAZ)
11243 case DAZ:
11244 {
11245 struct rsbac_daz_process_aci_t aci = DEFAULT_DAZ_P_ACI;
11246
11247 rsbac_ta_list_get_data_ttl(ta_number,
11248 process_handles.daz,
11249 NULL,
11250 &tid_p->process,
11251 &aci);
11252 switch (attr)
11253 {
11254 case A_daz_scanner:
11255 value->daz_scanner = aci.daz_scanner;
11256 break;
11257 default:
11258 err = -RSBAC_EINVALIDATTR;
11259 }
11260 }
11261 break;
11262 #endif /* DAZ */
11263
11264 #if defined(CONFIG_RSBAC_RC)
11265 case RC:
11266 {
11267 struct rsbac_rc_process_aci_t aci = DEFAULT_RC_P_ACI;
11268
11269 rsbac_ta_list_get_data_ttl(ta_number,
11270 process_handles.rc[rc_p_hash(tid_p->process)],
11271 NULL,
11272 &tid_p->process,
11273 &aci);
11274 switch (attr)
11275 {
11276 case A_rc_role:
11277 value->rc_role = aci.rc_role;
11278 break;
11279 case A_rc_type:
11280 value->rc_type = aci.rc_type;
11281 break;
11282 case A_rc_force_role:
11283 value->rc_force_role = aci.rc_force_role;
11284 break;
11285 default:
11286 err = -RSBAC_EINVALIDATTR;
11287 }
11288 }
11289 break;
11290 #endif /* RC */
11291
11292 #if defined(CONFIG_RSBAC_AUTH)
11293 case AUTH:
11294 {
11295 struct rsbac_auth_process_aci_t aci = DEFAULT_AUTH_P_ACI;
11296
11297 rsbac_ta_list_get_data_ttl(ta_number,
11298 process_handles.auth,
11299 NULL,
11300 &tid_p->process,
11301 &aci);
11302 switch (attr)
11303 {
11304 case A_auth_may_setuid:
11305 value->auth_may_setuid = aci.auth_may_setuid;
11306 break;
11307 case A_auth_may_set_cap:
11308 value->auth_may_set_cap = aci.auth_may_set_cap;
11309 break;
11310 #if defined(CONFIG_RSBAC_AUTH_LEARN)
11311 case A_auth_program_file:
11312 value->auth_program_file = aci.auth_program_file;
11313 break;
11314 case A_auth_start_uid:
11315 value->auth_start_uid = aci.auth_start_uid;
11316 break;
11317 #ifdef CONFIG_RSBAC_AUTH_DAC_OWNER
11318 case A_auth_start_euid:
11319 value->auth_start_euid = aci.auth_start_euid;
11320 break;
11321 #endif
11322 #ifdef CONFIG_RSBAC_AUTH_GROUP
11323 case A_auth_start_gid:
11324 value->auth_start_gid = aci.auth_start_gid;
11325 break;
11326 #ifdef CONFIG_RSBAC_AUTH_DAC_GROUP
11327 case A_auth_start_egid:
11328 value->auth_start_egid = aci.auth_start_egid;
11329 break;
11330 #endif
11331 #endif
11332 case A_auth_learn:
11333 value->auth_learn = aci.auth_learn;
11334 break;
11335 #else
11336 case A_auth_learn:
11337 value->auth_learn = FALSE;
11338 break;
11339 #endif
11340 case A_auth_last_auth:
11341 value->auth_last_auth = aci.auth_last_auth;
11342 break;
11343 default:
11344 err = -RSBAC_EINVALIDATTR;
11345 }
11346 }
11347 break;
11348 #endif /* AUTH */
11349
11350 #if defined(CONFIG_RSBAC_CAP)
11351 case CAP:
11352 {
11353 struct rsbac_cap_process_aci_t aci = DEFAULT_CAP_P_ACI;
11354
11355 rsbac_ta_list_get_data_ttl(ta_number,
11356 process_handles.cap,
11357 NULL,
11358 &tid_p->process,
11359 &aci);
11360 switch (attr)
11361 {
11362 case A_cap_process_hiding:
11363 value->cap_process_hiding = aci.cap_process_hiding;
11364 break;
11365 #ifdef CONFIG_RSBAC_CAP_LOG_MISSING
11366 case A_max_caps_user:
11367 value->max_caps_user = aci.max_caps_user;
11368 break;
11369 case A_max_caps_program:
11370 value->max_caps_program = aci.max_caps_program;
11371 break;
11372 #endif
11373 default:
11374 err = -RSBAC_EINVALIDATTR;
11375 }
11376 }
11377 break;
11378 #endif /* CAP */
11379
11380 #if defined(CONFIG_RSBAC_JAIL)
11381 case JAIL:
11382 {
11383 struct rsbac_jail_process_aci_t aci = DEFAULT_JAIL_P_ACI;
11384
11385 rsbac_ta_list_get_data_ttl(ta_number,
11386 process_handles.jail[jail_p_hash(tid_p->process)],
11387 NULL,
11388 &tid_p->process,
11389 &aci);
11390 switch (attr)
11391 {
11392 case A_jail_id:
11393 value->jail_id = aci.id;
11394 break;
11395 case A_jail_ip:
11396 value->jail_ip = aci.ip;
11397 break;
11398 case A_jail_flags:
11399 value->jail_flags = aci.flags;
11400 break;
11401 case A_jail_max_caps:
11402 value->jail_max_caps = aci.max_caps;
11403 break;
11404 case A_jail_scd_get:
11405 value->jail_scd_get = aci.scd_get;
11406 break;
11407 case A_jail_scd_modify:
11408 value->jail_scd_modify = aci.scd_modify;
11409 break;
11410 default:
11411 err = -RSBAC_EINVALIDATTR;
11412 }
11413 }
11414 break;
11415 #endif /* JAIL */
11416
11417 #if defined(CONFIG_RSBAC_PAX)
11418 case PAX:
11419 {
11420 struct task_struct * task_p;
11421
11422 switch (attr)
11423 {
11424 case A_pax_flags:
11425 read_lock(&tasklist_lock);
11426 task_p = find_task_by_pid(tid_p->process);
11427 if(task_p)
11428 {
11429 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
11430 #if defined(CONFIG_PAX_NOEXEC) || defined(CONFIG_PAX_ASLR)
11431 if(task_p->mm)
11432 value->pax_flags = task_p->mm->flags & RSBAC_PAX_ALL_FLAGS;
11433 else
11434 #endif
11435 value->pax_flags = 0;
11436 #else
11437 value->pax_flags = task_p->flags & RSBAC_PAX_ALL_FLAGS;
11438 #endif
11439 }
11440 else
11441 err = -RSBAC_EINVALIDTARGET;
11442 read_unlock(&tasklist_lock);
11443 break;
11444 default:
11445 err = -RSBAC_EINVALIDATTR;
11446 }
11447 }
11448 break;
11449 #endif /* PAX */
11450
11451 default:
11452 err = -RSBAC_EINVALIDMODULE;
11453 }
11454 return err;
11455 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 10766 of file aci_data_structures.c. References A_auth_role, A_cap_role, A_daz_role, A_ff_role, A_initial_security_level, A_jail_role, A_log_user_based, A_mac_categories, A_mac_initial_categories, A_mac_min_categories, A_mac_role, A_mac_user_flags, A_max_caps, A_min_caps, A_min_security_level, A_pax_role, A_pm_role, A_pm_task_set, A_pseudo, A_rc_def_role, A_rc_type, A_res_max, A_res_min, A_res_role, A_security_level, A_system_role, AUTH, CAP, DAZ, DEFAULT_GEN_U_ACI, FF, GEN, JAIL, rsbac_gen_user_aci_t::log_user_based, rsbac_attribute_value_t::log_user_based, MAC, rsbac_attribute_value_t::mac_categories, rsbac_attribute_value_t::mac_user_flags, rsbac_attribute_value_t::max_caps, rsbac_attribute_value_t::min_caps, NULL, PAX, PM, rsbac_attribute_value_t::pm_role, rsbac_attribute_value_t::pm_task_set, rsbac_gen_user_aci_t::pseudo, rsbac_attribute_value_t::pseudo, RC, rsbac_attribute_value_t::rc_def_role, rsbac_attribute_value_t::rc_type, RES, rsbac_attribute_value_t::res_array, RSBAC_ALL_USERS, RSBAC_EINVALIDATTR, RSBAC_EINVALIDMODULE, rsbac_ta_list_get_data_ttl(), rsbac_attribute_value_t::security_level, SR_user, rsbac_attribute_value_t::system_role, rsbac_target_id_t::user, and user_handles. Referenced by rsbac_ta_get_attr(). 10774 {
10775 int err = 0;
10776
10777 /*
10778 #ifdef CONFIG_RSBAC_DEBUG
10779 if (rsbac_debug_ds) rsbac_printk(KERN_DEBUG
10780 "rsbac_get_attr(): Getting user attribute\n");
10781 #endif
10782 */
10783 switch(module)
10784 {
10785 case GEN:
10786 {
10787 struct rsbac_gen_user_aci_t aci = DEFAULT_GEN_U_ACI;
10788
10789 rsbac_ta_list_get_data_ttl(ta_number,
10790 user_handles.gen,
10791 NULL,
10792 &tid_p->user,
10793 &aci);
10794 switch (attr)
10795 {
10796 case A_pseudo:
10797 value->pseudo = aci.pseudo;
10798 break;
10799 case A_log_user_based:
10800 value->log_user_based = aci.log_user_based;
10801 break;
10802 default:
10803 err = -RSBAC_EINVALIDATTR;
10804 }
10805 }
10806 break;
10807
10808 #if defined(CONFIG_RSBAC_MAC)
10809 case MAC:
10810 {
10811 struct rsbac_mac_user_aci_t aci = DEFAULT_MAC_U_ACI;
10812
10813 rsbac_ta_list_get_data_ttl(ta_number,
10814 user_handles.mac,
10815 NULL,
10816 &tid_p->user,
10817 &aci);
10818 switch (attr)
10819 {
10820 case A_security_level:
10821 value->security_level = aci.security_level;
10822 break;
10823 case A_initial_security_level:
10824 value->security_level = aci.initial_security_level;
10825 break;
10826 case A_min_security_level:
10827 value->security_level = aci.min_security_level;
10828 break;
10829 case A_mac_categories:
10830 value->mac_categories = aci.mac_categories;
10831 break;
10832 case A_mac_initial_categories:
10833 value->mac_categories = aci.mac_initial_categories;
10834 break;
10835 case A_mac_min_categories:
10836 value->mac_categories = aci.mac_min_categories;
10837 break;
10838 case A_system_role:
10839 case A_mac_role:
10840 value->system_role = aci.system_role;
10841 break;
10842 case A_mac_user_flags:
10843 value->mac_user_flags = aci.mac_user_flags;
10844 break;
10845
10846 default:
10847 err = -RSBAC_EINVALIDATTR;
10848 }
10849 }
10850 break;
10851 #endif /* MAC */
10852
10853 #if defined(CONFIG_RSBAC_PM)
10854 case PM:
10855 {
10856 struct rsbac_pm_user_aci_t aci = DEFAULT_PM_U_ACI;
10857
10858 rsbac_ta_list_get_data_ttl(ta_number,
10859 user_handles.pm,
10860 NULL,
10861 &tid_p->user,
10862 &aci);
10863 switch (attr)
10864 {
10865 case A_pm_task_set:
10866 value->pm_task_set = aci.pm_task_set;
10867 break;
10868 case A_pm_role:
10869 value->pm_role = aci.pm_role;
10870 break;
10871 default:
10872 err = -RSBAC_EINVALIDATTR;
10873 }
10874 }
10875 break;
10876 #endif /* PM */
10877
10878 #if defined(CONFIG_RSBAC_DAZ)
10879 case DAZ:
10880 {
10881 rsbac_system_role_int_t role = SR_user;
10882
10883 rsbac_ta_list_get_data_ttl(ta_number,
10884 user_handles.daz,
10885 NULL,
10886 &tid_p->user,
10887 &role);
10888 switch (attr)
10889 {
10890 case A_system_role:
10891 case A_daz_role:
10892 value->system_role = role;
10893 break;
10894
10895 default:
10896 err = -RSBAC_EINVALIDATTR;
10897 }
10898 }
10899 break;
10900 #endif /* DAZ */
10901
10902 #if defined(CONFIG_RSBAC_FF)
10903 case FF:
10904 {
10905 rsbac_system_role_int_t role = SR_user;
10906
10907 rsbac_ta_list_get_data_ttl(ta_number,
10908 user_handles.ff,
10909 NULL,
10910 &tid_p->user,
10911 &role);
10912 switch (attr)
10913 {
10914 case A_system_role:
10915 case A_ff_role:
10916 value->system_role = role;
10917 break;
10918
10919 default:
10920 err = -RSBAC_EINVALIDATTR;
10921 }
10922 }
10923 break;
10924 #endif /* FF */
10925
10926 #if defined(CONFIG_RSBAC_RC)
10927 case RC:
10928 {
10929 struct rsbac_rc_user_aci_t aci = DEFAULT_RC_U_ACI;
10930
10931 rsbac_ta_list_get_data_ttl(ta_number,
10932 user_handles.rc,
10933 NULL,
10934 &tid_p->user,
10935 &aci);
10936 switch (attr)
10937 {
10938 case A_rc_def_role:
10939 value->rc_def_role = aci.rc_role;
10940 break;
10941 case A_rc_type:
10942 value->rc_type = aci.rc_type;
10943 break;
10944 default:
10945 err = -RSBAC_EINVALIDATTR;
10946 }
10947 }
10948 break;
10949 #endif /* RC */
10950
10951 #if defined(CONFIG_RSBAC_AUTH)
10952 case AUTH:
10953 {
10954 rsbac_system_role_int_t role = SR_user;
10955
10956 rsbac_ta_list_get_data_ttl(ta_number,
10957 user_handles.auth,
10958 NULL,
10959 &tid_p->user,
10960 &role);
10961 switch (attr)
10962 {
10963 case A_system_role:
10964 case A_auth_role:
10965 value->system_role = role;
10966 break;
10967
10968 default:
10969 err = -RSBAC_EINVALIDATTR;
10970 }
10971 }
10972 break;
10973 #endif /* AUTH */
10974
10975 #if defined(CONFIG_RSBAC_CAP)
10976 case CAP:
10977 {
10978 struct rsbac_cap_user_aci_t aci = DEFAULT_CAP_U_ACI;
10979
10980 rsbac_ta_list_get_data_ttl(ta_number,
10981 user_handles.cap,
10982 NULL,
10983 &tid_p->user,
10984 &aci);
10985 switch (attr)
10986 {
10987 case A_system_role:
10988 case A_cap_role:
10989 value->system_role = aci.cap_role;
10990 break;
10991 case A_min_caps:
10992 value->min_caps = aci.min_caps;
10993 break;
10994 case A_max_caps:
10995 value->max_caps = aci.max_caps;
10996 break;
10997 default:
10998 err = -RSBAC_EINVALIDATTR;
10999 }
11000 }
11001 break;
11002 #endif /* CAP */
11003
11004 #if defined(CONFIG_RSBAC_JAIL)
11005 case JAIL:
11006 {
11007 rsbac_system_role_int_t role = SR_user;
11008
11009 rsbac_ta_list_get_data_ttl(ta_number,
11010 user_handles.jail,
11011 NULL,
11012 &tid_p->user,
11013 &role);
11014 switch (attr)
11015 {
11016 case A_system_role:
11017 case A_jail_role:
11018 value->system_role = role;
11019 break;
11020
11021 default:
11022 err = -RSBAC_EINVALIDATTR;
11023 }
11024 }
11025 break;
11026 #endif /* JAIL */
11027
11028 #if defined(CONFIG_RSBAC_RES)
11029 case RES:
11030 {
11031 struct rsbac_res_user_aci_t aci = DEFAULT_RES_U_ACI;
11032
11033 if( rsbac_ta_list_get_data_ttl(ta_number,
11034 user_handles.res,
11035 NULL,
11036 &tid_p->user,
11037 &aci)
11038 && (tid_p->user != RSBAC_ALL_USERS)
11039 )
11040 {
11041 tid_p->user = RSBAC_ALL_USERS;
11042 rsbac_ta_list_get_data_ttl(ta_number,
11043 user_handles.res,
11044 NULL,
11045 &tid_p->user,
11046 &aci);
11047 }
11048 switch (attr)
11049 {
11050 case A_system_role:
11051 case A_res_role:
11052 value->system_role = aci.res_role;
11053 break;
11054 case A_res_min:
11055 memcpy(&value->res_array, &aci.res_min, sizeof(aci.res_min));
11056 break;
11057 case A_res_max:
11058 memcpy(&value->res_array, &aci.res_max, sizeof(aci.res_max));
11059 break;
11060 default:
11061 err = -RSBAC_EINVALIDATTR;
11062 }
11063 }
11064 break;
11065 #endif /* RES */
11066
11067 #if defined(CONFIG_RSBAC_PAX)
11068 case PAX:
11069 {
11070 rsbac_system_role_int_t role = SR_user;
11071
11072 rsbac_ta_list_get_data_ttl(ta_number,
11073 user_handles.pax,
11074 NULL,
11075 &tid_p->user,
11076 &role);
11077 switch (attr)
11078 {
11079 case A_system_role:
11080 case A_pax_role:
11081 value->system_role = role;
11082 break;
11083
11084 default:
11085 err = -RSBAC_EINVALIDATTR;
11086 }
11087 }
11088 break;
11089 #endif /* PAX */
11090
11091 default:
11092 err = -RSBAC_EINVALIDMODULE;
11093 }
11094 /* and return */
11095 return err;
11096 }
|
|
||||||||||||
|
Definition at line 657 of file aci_data_structures.c. References rsbac_ipc_t::id, rsbac_ipc_id_t::id_nr, and rsbac_ipc_t::type. Referenced by register_ipc_lists(). 00658 {
00659 int result;
00660 struct rsbac_ipc_t * i_desc1 = desc1;
00661 struct rsbac_ipc_t * i_desc2 = desc2;
00662
00663 result = memcmp(&i_desc1->type,
00664 &i_desc2->type,
00665 sizeof(i_desc1->type));
00666 if(result)
00667 return result;
00668 else
00669 return memcmp(&i_desc1->id.id_nr,
00670 &i_desc2->id.id_nr,
00671 sizeof(i_desc1->id.id_nr));
00672 }
|
|
||||||||||||||||||||
|
Definition at line 353 of file aci_data_structures.c. References device_list_head, lookup_device(), NULL, RSBAC_EACCESS, RSBAC_ECOULDNOTCREATEPATH, RSBAC_EINVALIDDEV, RSBAC_EINVALIDPOINTER, RSBAC_ENOROOTDIR, RSBAC_ENOTFOUND, RSBAC_ENOTWRITABLE, RSBAC_EPATHTOOLONG, rsbac_get_super_block(), rsbac_lookup_one_len(), rsbac_printk(), SOCKFS_MAGIC, and writable(). Referenced by rsbac_read_open(), and rsbac_write_open(). 00357 {
00358 struct dentry * dir_dentry_p = NULL;
00359 struct dentry * root_dentry_p = NULL;
00360 int err=0;
00361 struct rsbac_device_list_item_t * device_p;
00362 u_long dflags;
00363
00364 if(!dir_dentry_pp)
00365 return(-RSBAC_EINVALIDPOINTER);
00366
00367 if(!sb_p)
00368 {
00369 sb_p = rsbac_get_super_block(kdev);
00370 if (!sb_p)
00371 {
00372 rsbac_printk(KERN_WARNING
00373 "lookup_aci_path_dentry(): invalid device %02u:%02u\n",
00374 RSBAC_MAJOR(kdev), RSBAC_MINOR(kdev));
00375 return (-RSBAC_EINVALIDDEV);
00376 }
00377 }
00378
00379 /* pipefs must not be read from */
00380 if( (sb_p->s_magic == PIPEFS_MAGIC)
00381 || (sb_p->s_magic == SOCKFS_MAGIC)
00382 )
00383 {
00384 return -RSBAC_ENOTFOUND;
00385 }
00386
00387 rsbac_read_lock(&device_list_head.lock, &dflags);
00388 device_p = lookup_device(kdev);
00389 if(!device_p)
00390 {
00391 rsbac_printk(KERN_WARNING
00392 "lookup_aci_path_dentry(): No entry for device %02u:%02u\n",
00393 MAJOR(kdev), MINOR(kdev));
00394 rsbac_read_unlock(&device_list_head.lock, &dflags);
00395 return(-RSBAC_EINVALIDDEV);
00396 }
00397 /* already looked up earlier? */
00398 if(device_p->rsbac_dir_dentry_p)
00399 {
00400 *dir_dentry_pp = device_p->rsbac_dir_dentry_p;
00401 #ifdef CONFIG_RSBAC_DEBUG
00402 if(rsbac_debug_ds)
00403 {
00404 rsbac_printk(KERN_DEBUG
00405 "lookup_aci_path_dentry(): device_p->rsbac_dir_dentry_p->d_count for device %02u:%02u is %i!\n",
00406 MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev),
00407 atomic_read(&device_p->rsbac_dir_dentry_p->d_count));
00408 }
00409 #endif
00410 rsbac_read_unlock(&device_list_head.lock, &dflags);
00411 return(0);
00412 }
00413 /* Must unlock here for the lookup */
00414 rsbac_read_unlock(&device_list_head.lock, &dflags);
00415
00416 #ifdef CONFIG_RSBAC_DEBUG
00417 if(rsbac_debug_ds)
00418 {
00419 rsbac_printk(KERN_DEBUG
00420 "lookup_aci_path_dentry(): first time lookup for or non-existing %s on device %02u:%02u!\n",
00421 RSBAC_ACI_PATH,
00422 MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev));
00423 }
00424 #endif
00425 if (!sb_p->s_root)
00426 {
00427 rsbac_printk(KERN_WARNING
00428 "lookup_aci_path_dentry(): Super_block for device %02u:%02u has no root dentry!\n",
00429 MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev));
00430 err = -RSBAC_EINVALIDDEV;
00431 goto out;
00432 }
00433
00434 if (!sb_p->s_root->d_inode)
00435 {
00436 rsbac_printk(KERN_WARNING
00437 "lookup_aci_path_dentry(): Super_block for device %02u:%02u has no root dentry->d_inode!\n",
00438 MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev));
00439 err = -RSBAC_EINVALIDDEV;
00440 goto out;
00441 }
00442
00443 /* lookup dentry of ACI_PATH on this device */
00444 #ifdef CONFIG_RSBAC_DEBUG
00445 if(rsbac_debug_ds)
00446 {
00447 rsbac_printk(KERN_DEBUG
00448 "lookup_aci_path_dentry(): lookup rsbac path %s for device %02u:%02u, sb_p->s_root->d_count is %i!\n",
00449 RSBAC_ACI_PATH, MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev),
00450 atomic_read(&sb_p->s_root->d_count));
00451 }
00452 #endif
00453 dir_dentry_p = rsbac_lookup_one_len(RSBAC_ACI_PATH, sb_p->s_root, strlen(RSBAC_ACI_PATH));
00454 if(IS_ERR(dir_dentry_p))
00455 switch(PTR_ERR(dir_dentry_p))
00456 {
00457 case -ENOENT:
00458 case -ENOTDIR:
00459 err = -RSBAC_ENOTFOUND;
00460 goto out;
00461 case -ENOMEM:
00462 rsbac_printk(KERN_WARNING
00463 "lookup_aci_path_dentry(): memory allocation error!\n");
00464 err = -RSBAC_ENOROOTDIR;
00465 goto out;
00466 case -ENAMETOOLONG:
00467 rsbac_printk(KERN_WARNING
00468 "lookup_aci_path_dentry(): ACI_PATH too long on fs!\n");
00469 err = -RSBAC_EPATHTOOLONG;
00470 goto out;
00471 case -EACCES:
00472 rsbac_printk(KERN_WARNING
00473 "lookup_aci_path_dentry(): No access to ACI_PATH!\n");
00474 err = -RSBAC_EACCESS;
00475 goto out;
00476 default:
00477 rsbac_printk(KERN_WARNING
00478 "lookup_aci_path_dentry(): Error on root dir: %li!\n",
00479 PTR_ERR(dir_dentry_p));
00480 err = -RSBAC_ENOROOTDIR;
00481 goto out;
00482 }
00483
00484 if (!dir_dentry_p)
00485 {
00486 rsbac_printk(KERN_WARNING
00487 "lookup_aci_path_dentry(): rsbac_lookup_(dentry|one) returned null pointer!\n");
00488 err = -RSBAC_EINVALIDPOINTER;
00489 goto out;
00490 }
00491 if (!dir_dentry_p->d_inode)
00492 { /* dir could not be found -> try to create it */
00493 /* but only, if allowed... */
00494 if (!create_dir)
00495 {
00496 err = -RSBAC_ENOTFOUND;
00497 goto out_dir_dput;
00498 }
00499 #ifdef CONFIG_RSBAC_DEBUG
00500 if(rsbac_debug_ds)
00501 {
00502 rsbac_printk(KERN_DEBUG
00503 "lookup_aci_path_dentry(): try to create dir, first test writable!\n");
00504 }
00505 #endif
00506 /* ... and writable. */
00507 if (!writable(sb_p))
00508 { /* mounted read only or special case */
00509 err = -RSBAC_ENOTWRITABLE;
00510 goto out_dir_dput;
00511 }
00512 root_dentry_p = lock_parent(dir_dentry_p);
00513 err = PTR_ERR(root_dentry_p);
00514 if ( IS_ERR(root_dentry_p))
00515 {
00516 err = -RSBAC_ECOULDNOTCREATEPATH;
00517 goto out_dir_dput;
00518 }
00519 if ( !root_dentry_p->d_inode
00520 || !root_dentry_p->d_inode->i_op
00521 || !root_dentry_p->d_inode->i_op->mkdir)
00522 {
00523 unlock_dir(root_dentry_p);
00524 err = -RSBAC_ECOULDNOTCREATEPATH;
00525 goto out_dir_dput;
00526 }
00527 DQUOT_INIT(root_dentry_p->d_inode);
00528 err = root_dentry_p->d_inode->i_op->mkdir(root_dentry_p->d_inode,
00529 dir_dentry_p,
00530 RSBAC_ACI_DIR_MODE);
00531 unlock_dir(root_dentry_p);
00532 if (err)
00533 {
00534 err = -RSBAC_ECOULDNOTCREATEPATH;
00535 goto out_dir_dput;
00536 }
00537 }
00538 else /* was found */
00539 { /* check, whether this is a dir */
00540 if(!S_ISDIR(dir_dentry_p->d_inode->i_mode))
00541 { /* no dir! We have a real prob here! */
00542 rsbac_printk(KERN_WARNING
00543 "lookup_aci_path_dentry(): supposed /%s dir on dev %02u:%02u is no dir!\n",
00544 RSBAC_ACI_PATH,
00545 MAJOR(sb_p->s_dev),
00546 MINOR(sb_p->s_dev));
00547 err = -RSBAC_EACCESS;
00548 goto out_dir_dput;
00549 }
00550 }
00551 #ifdef CONFIG_RSBAC_DEBUG
00552 if(rsbac_debug_ds)
00553 {
00554 rsbac_printk(KERN_DEBUG
00555 "lookup_aci_path_dentry(): dir_dentry_p->d_count is %i!\n",
00556 atomic_read(&dir_dentry_p->d_count));
00557 rsbac_printk(KERN_DEBUG
00558 "lookup_aci_path_dentry(): sb_p->s_root->d_count is now %i!\n",
00559 atomic_read(&sb_p->s_root->d_count));
00560 }
00561 #endif
00562 /* we want to keep dir_dentry_p in device_item */
00563 /* dput must be done in remove_device_item! */
00564 *dir_dentry_pp = dir_dentry_p;
00565
00566 /* Must lock and relookup device_p to cache result */
00567 rsbac_read_lock(&device_list_head.lock, &dflags);
00568 device_p = lookup_device(kdev);
00569 if(device_p && !device_p->rsbac_dir_dentry_p)
00570 {
00571 device_p->rsbac_dir_dentry_p = dir_dentry_p;
00572 device_p->rsbac_dir_inode = dir_dentry_p->d_inode->i_ino;
00573 }
00574 rsbac_read_unlock(&device_list_head.lock, &dflags);
00575
00576 out:
00577 return (err);
00578
00579 out_dir_dput:
00580 dput(dir_dentry_p);
00581 goto out;
00582 }
|
|
|
Definition at line 593 of file aci_data_structures.c. References device_list_head. Referenced by get_attr_fd(), lookup_aci_path_dentry(), remove_device_item(), rsbac_auth_add_to_f_capset(), rsbac_auth_clear_f_capset(), rsbac_auth_copy_fp_capset(), rsbac_auth_get_f_caplist(), rsbac_auth_p_capset_member(), rsbac_auth_remove_from_f_capset(), rsbac_get_full_path(), rsbac_get_full_path_length(), rsbac_get_parent(), rsbac_get_super_block(), rsbac_mac_add_to_f_truset(), rsbac_mac_clear_f_truset(), rsbac_mac_copy_fp_truset(), rsbac_mac_get_f_trulist(), rsbac_mac_remove_from_f_truset(), rsbac_mount(), rsbac_mount_auth(), rsbac_mount_mac(), rsbac_ta_remove_target(), rsbac_umount(), rsbac_umount_auth(), rsbac_umount_mac(), and set_attr_fd(). 00594 {
00595 struct rsbac_device_list_item_t * curr = device_list_head.curr;
00596
00597 /* if there is no current item or it is not the right one, search... */
00598 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
00599 if(! (curr && (MAJOR(curr->id) == MAJOR(kdev)) && (MINOR(curr->id) == MINOR(kdev)) ) )
00600 #else
00601 if(! (curr && (curr->id == kdev) ) )
00602 #endif
00603 {
00604 curr = device_list_head.head;
00605 while ( curr
00606 && ( (RSBAC_MAJOR(curr->id) != RSBAC_MAJOR(kdev))
00607 || (RSBAC_MINOR(curr->id) != RSBAC_MINOR(kdev))
00608 )
00609 )
00610 {
00611 curr = curr->next;
00612 }
00613 if (curr)
00614 device_list_head.curr=curr;
00615 }
00616 /* it is the current item -> return it */
00617 return (curr);
00618 }
|
|
|
Definition at line 5503 of file aci_data_structures.c. References DEFAULT_GEN_DEV_ACI, dev_compare(), dev_handles, dev_major_compare(), dev_major_handles, gen_dev_get_conv(), RC_type_inherit_parent, registration_error(), RSBAC_GEN_ACI_DEV_NAME, RSBAC_GEN_DEV_ACI_KEY, RSBAC_GEN_DEV_ACI_VERSION, RSBAC_LIST_BACKUP, RSBAC_LIST_DEF_DATA, RSBAC_LIST_PERSIST, rsbac_list_register(), RSBAC_LIST_VERSION, RSBAC_MAC_ACI_DEV_NAME, RSBAC_PM_ACI_DEV_NAME, rsbac_printk(), RSBAC_RC_ACI_DEV_MAJOR_NAME, RSBAC_RC_ACI_DEV_NAME, and RSBAC_RC_GENERAL_TYPE. Referenced by rsbac_do_init(). 05505 {
05506 int err = 0;
05507 struct rsbac_list_info_t * list_info_p;
05508
05509 list_info_p = kmalloc(sizeof(*list_info_p), GFP_KERNEL);
05510 if(!list_info_p)
05511 {
05512 return -ENOMEM;
05513 }
05514
05515 #ifdef CONFIG_RSBAC_DEBUG
05516 if (rsbac_debug_ds)
05517 {
05518 rsbac_printk(KERN_DEBUG "rsbac_do_init(): registering DEV lists\n");
05519 }
05520 #endif
05521 {
05522 struct rsbac_gen_dev_aci_t def_aci = DEFAULT_GEN_DEV_ACI;
05523
05524 list_info_p->version = RSBAC_GEN_DEV_ACI_VERSION;
05525 list_info_p->key = RSBAC_GEN_DEV_ACI_KEY;
05526 list_info_p->desc_size = sizeof(struct rsbac_dev_desc_t);
05527 list_info_p->data_size = sizeof(struct rsbac_gen_dev_aci_t);
05528 list_info_p->max_age = 0;
05529 err = rsbac_list_register(RSBAC_LIST_VERSION,
05530 &dev_handles.gen,
05531 list_info_p,
05532 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
05533 RSBAC_LIST_BACKUP |
05534 #endif
05535 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
05536 dev_compare,
05537 gen_dev_get_conv,
05538 &def_aci,
05539 RSBAC_GEN_ACI_DEV_NAME,
05540 RSBAC_AUTO_DEV);
05541 if(err)
05542 {
05543 registration_error(err, "DEV General");
05544 }
05545 }
05546 #if defined(CONFIG_RSBAC_MAC)
05547 {
05548 struct rsbac_mac_dev_aci_t def_aci = DEFAULT_MAC_DEV_ACI;
05549
05550 list_info_p->version = RSBAC_MAC_DEV_ACI_VERSION;
05551 list_info_p->key = RSBAC_MAC_DEV_ACI_KEY;
05552 list_info_p->desc_size = sizeof(struct rsbac_dev_desc_t);
05553 list_info_p->data_size = sizeof(struct rsbac_mac_dev_aci_t);
05554 list_info_p->max_age = 0;
05555 err = rsbac_list_register(RSBAC_LIST_VERSION,
05556 &dev_handles.mac,
05557 list_info_p,
05558 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
05559 RSBAC_LIST_BACKUP |
05560 #endif
05561 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
05562 dev_compare,
05563 mac_dev_get_conv,
05564 &def_aci,
05565 RSBAC_MAC_ACI_DEV_NAME,
05566 RSBAC_AUTO_DEV);
05567 if(err)
05568 {
05569 registration_error(err, "DEV MAC");
05570 }
05571 }
05572 #endif
05573 #if defined(CONFIG_RSBAC_PM)
05574 {
05575 struct rsbac_pm_dev_aci_t def_aci = DEFAULT_PM_DEV_ACI;
05576
05577 list_info_p->version = RSBAC_PM_DEV_ACI_VERSION;
05578 list_info_p->key = RSBAC_PM_DEV_ACI_KEY;
05579 list_info_p->desc_size = sizeof(struct rsbac_dev_desc_t);
05580 list_info_p->data_size = sizeof(struct rsbac_pm_dev_aci_t);
05581 list_info_p->max_age = 0;
05582 err = rsbac_list_register(RSBAC_LIST_VERSION,
05583 &dev_handles.pm,
05584 list_info_p,
05585 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
05586 RSBAC_LIST_BACKUP |
05587 #endif
05588 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
05589 dev_compare,
05590 pm_dev_get_conv,
05591 &def_aci,
05592 RSBAC_PM_ACI_DEV_NAME,
05593 RSBAC_AUTO_DEV);
05594 if(err)
05595 {
05596 registration_error(err, "DEV PM");
05597 }
05598 }
05599 #endif
05600 #if defined(CONFIG_RSBAC_RC)
05601 {
05602 rsbac_rc_type_id_t def_major_aci = RSBAC_RC_GENERAL_TYPE;
05603 rsbac_rc_type_id_t def_aci = RC_type_inherit_parent;
05604
05605 list_info_p->version = RSBAC_RC_DEV_ACI_VERSION;
05606 list_info_p->key = RSBAC_RC_DEV_ACI_KEY;
05607 list_info_p->desc_size = sizeof(struct rsbac_dev_desc_t);
05608 list_info_p->data_size = sizeof(rsbac_rc_type_id_t);
05609 list_info_p->max_age = 0;
05610 err = rsbac_list_register(RSBAC_LIST_VERSION,
05611 &dev_major_handles.rc,
05612 list_info_p,
05613 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
05614 RSBAC_LIST_BACKUP |
05615 #endif
05616 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
05617 dev_major_compare,
05618 rc_dev_get_conv,
05619 &def_major_aci,
05620 RSBAC_RC_ACI_DEV_MAJOR_NAME,
05621 RSBAC_AUTO_DEV);
05622 if(err)
05623 {
05624 registration_error(err, "DEV major RC");
05625 }
05626 list_info_p->version = RSBAC_RC_DEV_ACI_VERSION;
05627 list_info_p->key = RSBAC_RC_DEV_ACI_KEY;
05628 list_info_p->desc_size = sizeof(struct rsbac_dev_desc_t);
05629 list_info_p->data_size = sizeof(rsbac_rc_type_id_t);
05630 list_info_p->max_age = 0;
05631 err = rsbac_list_register(RSBAC_LIST_VERSION,
05632 &dev_handles.rc,
05633 list_info_p,
05634 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
05635 RSBAC_LIST_BACKUP |
05636 #endif
05637 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
05638 dev_compare,
05639 rc_dev_get_conv,
05640 &def_aci,
05641 RSBAC_RC_ACI_DEV_NAME,
05642 RSBAC_AUTO_DEV);
05643 if(err)
05644 {
05645 registration_error(err, "DEV RC");
05646 }
05647 }
05648 #endif
05649
05650 return err;
05651 }
|
|
||||||||||||
|
Definition at line 1105 of file aci_data_structures.c. References DEFAULT_DAZ_FD_SCANNED, gen_fd_get_conv(), get_error_name(), name, NULL, PF_PAX_EMUTRAMP, PF_PAX_MPROTECT, PF_PAX_PAGEEXEC, PF_PAX_RANDEXEC, PF_PAX_RANDMMAP, PF_PAX_SEGMEXEC, RSBAC_EINVALIDPOINTER, RSBAC_ENOMEM, RSBAC_FF_DEF, RSBAC_GEN_FD_ACI_KEY, RSBAC_GEN_FD_ACI_VERSION, rsbac_kfree(), rsbac_kmalloc(), rsbac_list_compare_u32(), RSBAC_LIST_DEF_DATA, RSBAC_LIST_PERSIST, rsbac_list_register(), RSBAC_LIST_VERSION, RSBAC_MAXNAMELEN, RSBAC_PAX_DEF_FLAGS, and rsbac_printk(). Referenced by rsbac_do_init(), and rsbac_mount(). 01107 {
01108 char * name;
01109 int err = 0;
01110 int tmperr;
01111 u_int file_no;
01112 struct rsbac_list_info_t * info_p;
01113 if(!device_p)
01114 return(-RSBAC_EINVALIDPOINTER);
01115 name = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01116 if(!name)
01117 return -RSBAC_ENOMEM;
01118 info_p = rsbac_kmalloc(sizeof(*info_p));
01119 if(!info_p)
01120 {
01121 rsbac_kfree(name);
01122 return -RSBAC_ENOMEM;
01123 }
01124
01125 /* register general lists */
01126 {
01127 for (file_no = 0; file_no < RSBAC_GEN_NR_FD_LISTS; file_no++)
01128 {
01129 /* construct name from base name + number */
01130 sprintf(name, "%s%u", RSBAC_GEN_FD_NAME, file_no);
01131 info_p->version = RSBAC_GEN_FD_ACI_VERSION;
01132 info_p->key = RSBAC_GEN_FD_ACI_KEY;
01133 info_p->desc_size = sizeof(rsbac_inode_nr_t);
01134 info_p->data_size = sizeof(struct rsbac_gen_fd_aci_t);
01135 info_p->max_age = 0;
01136 tmperr = rsbac_list_register(RSBAC_LIST_VERSION,
01137 &(device_p->handles.gen[file_no]),
01138 info_p,
01139 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
01140 rsbac_list_compare_u32,
01141 gen_fd_get_conv,
01142 &def_gen_fd_aci,
01143 name,
01144 kdev);
01145 if(tmperr)
01146 {
01147 char * tmp;
01148
01149 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01150 if(tmp)
01151 {
01152 rsbac_printk(KERN_WARNING
01153 "register_fd_lists(): registering general list %u for device %02u:%02u failed with error %s!\n",
01154 file_no,
01155 RSBAC_MAJOR(kdev),
01156 RSBAC_MINOR(kdev),
01157 get_error_name(tmp, tmperr));
01158 rsbac_kfree(tmp);
01159 }
01160 err = tmperr;
01161 }
01162 }
01163 }
01164
01165 #if defined(CONFIG_RSBAC_MAC)
01166 {
01167 /* register MAC lists */
01168 for (file_no = 0; file_no < RSBAC_MAC_NR_FD_LISTS; file_no++)
01169 {
01170 /* construct name from base name + number */
01171 sprintf(name, "%s%u", RSBAC_MAC_FD_NAME, file_no);
01172 info_p->version = RSBAC_MAC_FD_ACI_VERSION;
01173 info_p->key = RSBAC_MAC_FD_ACI_KEY;
01174 info_p->desc_size = sizeof(rsbac_inode_nr_t);
01175 info_p->data_size = sizeof(struct rsbac_mac_fd_aci_t);
01176 info_p->max_age = 0;
01177 tmperr = rsbac_list_register(RSBAC_LIST_VERSION,
01178 &(device_p->handles.mac[file_no]),
01179 info_p,
01180 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
01181 rsbac_list_compare_u32,
01182 mac_fd_get_conv,
01183 &def_mac_fd_aci,
01184 name,
01185 kdev);
01186 if(tmperr)
01187 {
01188 char * tmp;
01189
01190 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01191 if(tmp)
01192 {
01193 rsbac_printk(KERN_WARNING
01194 "register_fd_lists(): registering MAC list %u for device %02u:%02u failed with error %s!\n",
01195 file_no,
01196 RSBAC_MAJOR(kdev),
01197 RSBAC_MINOR(kdev),
01198 get_error_name(tmp, tmperr));
01199 rsbac_kfree(tmp);
01200 }
01201 err = tmperr;
01202 }
01203 }
01204 }
01205 #endif
01206
01207 #if defined(CONFIG_RSBAC_PM)
01208 {
01209 /* register PM lists */
01210 for (file_no = 0; file_no < RSBAC_PM_NR_FD_LISTS; file_no++)
01211 {
01212 /* construct name from base name + number */
01213 sprintf(name, "%s%u", RSBAC_PM_FD_NAME, file_no);
01214 info_p->version = RSBAC_PM_FD_ACI_VERSION;
01215 info_p->key = RSBAC_PM_FD_ACI_KEY;
01216 info_p->desc_size = sizeof(rsbac_inode_nr_t);
01217 info_p->data_size = sizeof(struct rsbac_pm_fd_aci_t);
01218 info_p->max_age = 0;
01219 tmperr = rsbac_list_register(RSBAC_LIST_VERSION,
01220 &(device_p->handles.pm[file_no]),
01221 info_p,
01222 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
01223 rsbac_list_compare_u32,
01224 NULL,
01225 &def_pm_fd_aci,
01226 name,
01227 kdev);
01228 if(tmperr)
01229 {
01230 char * tmp;
01231
01232 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01233 if(tmp)
01234 {
01235 rsbac_printk(KERN_WARNING
01236 "register_fd_lists(): registering PM list %u for device %02u:%02u failed with error %s!\n",
01237 file_no,
01238 RSBAC_MAJOR(kdev),
01239 RSBAC_MINOR(kdev),
01240 get_error_name(tmp, tmperr));
01241 rsbac_kfree(tmp);
01242 }
01243 err = tmperr;
01244 }
01245 }
01246 }
01247 #endif
01248
01249 #if defined(CONFIG_RSBAC_DAZ)
01250 {
01251 struct rsbac_daz_fd_aci_t def_daz_fd_aci = DEFAULT_DAZ_FD_ACI;
01252 /* register DAZ lists */
01253 for (file_no = 0; file_no < RSBAC_DAZ_NR_FD_LISTS; file_no++)
01254 {
01255 /* construct name from base name + number */
01256 sprintf(name, "%s%u", RSBAC_DAZ_FD_NAME, file_no);
01257 info_p->version = RSBAC_DAZ_FD_ACI_VERSION;
01258 info_p->key = RSBAC_DAZ_FD_ACI_KEY;
01259 info_p->desc_size = sizeof(rsbac_inode_nr_t);
01260 info_p->data_size = sizeof(struct rsbac_daz_fd_aci_t);
01261 info_p->max_age = 0;
01262 tmperr = rsbac_list_register(RSBAC_LIST_VERSION,
01263 &(device_p->handles.daz[file_no]),
01264 info_p,
01265 RSBAC_LIST_PERSIST |
01266 RSBAC_LIST_DEF_DATA,
01267 rsbac_list_compare_u32,
01268 NULL,
01269 &def_daz_fd_aci,
01270 name,
01271 kdev);
01272 if(tmperr)
01273 {
01274 char * tmp;
01275
01276 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01277 if(tmp)
01278 {
01279 rsbac_printk(KERN_WARNING
01280 "register_fd_lists(): registering DAZ list %u for device %02u:%02u failed with error %s!\n",
01281 file_no,
01282 RSBAC_MAJOR(kdev),
01283 RSBAC_MINOR(kdev),
01284 get_error_name(tmp, tmperr));
01285 rsbac_kfree(tmp);
01286 }
01287 err = tmperr;
01288 }
01289 }
01290 }
01291 #if defined(CONFIG_RSBAC_DAZ_CACHE)
01292 {
01293 rsbac_daz_scanned_t def_daz_scanned_fd_aci = DEFAULT_DAZ_FD_SCANNED;
01294
01295 /* register DAZ scanned lists */
01296 for (file_no = 0; file_no < RSBAC_DAZ_SCANNED_NR_FD_LISTS; file_no++)
01297 {
01298 /* construct name from base name + number */
01299 sprintf(name, "%s%u", RSBAC_DAZ_SCANNED_FD_NAME, file_no);
01300 info_p->version = RSBAC_DAZ_SCANNED_FD_ACI_VERSION;
01301 info_p->key = RSBAC_DAZ_FD_ACI_KEY;
01302 info_p->desc_size = sizeof(rsbac_inode_nr_t);
01303 info_p->data_size = sizeof(rsbac_daz_scanned_t);
01304 info_p->max_age = 0;
01305 tmperr = rsbac_list_register(RSBAC_LIST_VERSION,
01306 &(device_p->handles.dazs[file_no]),
01307 info_p,
01308 #ifdef CONFIG_RSBAC_DAZ_PERSIST
01309 RSBAC_LIST_PERSIST |
01310 #endif
01311 RSBAC_LIST_DEF_DATA,
01312 rsbac_list_compare_u32,
01313 NULL,
01314 &def_daz_scanned_fd_aci,
01315 name,
01316 kdev);
01317 if(tmperr)
01318 {
01319 char * tmp;
01320
01321 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01322 if(tmp)
01323 {
01324 rsbac_printk(KERN_WARNING
01325 "register_fd_lists(): registering DAZ scanned list %u for device %02u:%02u failed with error %s!\n",
01326 file_no,
01327 RSBAC_MAJOR(kdev),
01328 RSBAC_MINOR(kdev),
01329 get_error_name(tmp, tmperr));
01330 rsbac_kfree(tmp);
01331 }
01332 err = tmperr;
01333 }
01334 }
01335 }
01336 #endif
01337 #endif
01338
01339 #if defined(CONFIG_RSBAC_FF)
01340 {
01341 rsbac_ff_flags_t def_ff_fd_aci = RSBAC_FF_DEF;
01342
01343 /* register FF lists */
01344 for (file_no = 0; file_no < RSBAC_FF_NR_FD_LISTS; file_no++)
01345 {
01346 /* construct name from base name + number */
01347 sprintf(name, "%s%u", RSBAC_FF_FD_NAME, file_no);
01348 info_p->version = RSBAC_FF_FD_ACI_VERSION;
01349 info_p->key = RSBAC_FF_FD_ACI_KEY;
01350 info_p->desc_size = sizeof(rsbac_inode_nr_t);
01351 info_p->data_size = sizeof(rsbac_ff_flags_t);
01352 info_p->max_age = 0;
01353 tmperr = rsbac_list_register(RSBAC_LIST_VERSION,
01354 &(device_p->handles.ff[file_no]),
01355 info_p,
01356 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
01357 rsbac_list_compare_u32,
01358 NULL,
01359 &def_ff_fd_aci,
01360 name,
01361 kdev);
01362 if(tmperr)
01363 {
01364 char * tmp;
01365
01366 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01367 if(tmp)
01368 {
01369 rsbac_printk(KERN_WARNING
01370 "register_fd_lists(): registering FF list %u for device %02u:%02u failed with error %s!\n",
01371 file_no,
01372 RSBAC_MAJOR(kdev),
01373 RSBAC_MINOR(kdev),
01374 get_error_name(tmp, tmperr));
01375 rsbac_kfree(tmp);
01376 }
01377 err = tmperr;
01378 }
01379 }
01380 }
01381 #endif
01382
01383 #if defined(CONFIG_RSBAC_RC)
01384 {
01385 /* register RC lists */
01386 for (file_no = 0; file_no < RSBAC_RC_NR_FD_LISTS; file_no++)
01387 {
01388 /* construct name from base name + number */
01389 sprintf(name, "%s%u", RSBAC_RC_FD_NAME, file_no);
01390 info_p->version = RSBAC_RC_FD_ACI_VERSION;
01391 info_p->key = RSBAC_RC_FD_ACI_KEY;
01392 info_p->desc_size = sizeof(rsbac_inode_nr_t);
01393 info_p->data_size = sizeof(struct rsbac_rc_fd_aci_t);
01394 info_p->max_age = 0;
01395 tmperr = rsbac_list_register(RSBAC_LIST_VERSION,
01396 &(device_p->handles.rc[file_no]),
01397 info_p,
01398 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
01399 rsbac_list_compare_u32,
01400 NULL,
01401 &def_rc_fd_aci,
01402 name,
01403 kdev);
01404 if(tmperr)
01405 {
01406 char * tmp;
01407
01408 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01409 if(tmp)
01410 {
01411 rsbac_printk(KERN_WARNING
01412 "register_fd_lists(): registering RC list %u for device %02u:%02u failed with error %s!\n",
01413 file_no,
01414 RSBAC_MAJOR(kdev),
01415 RSBAC_MINOR(kdev),
01416 get_error_name(tmp, tmperr));
01417 rsbac_kfree(tmp);
01418 }
01419 err = tmperr;
01420 }
01421 }
01422 }
01423 #endif
01424
01425 #if defined(CONFIG_RSBAC_AUTH)
01426 {
01427 struct rsbac_auth_fd_aci_t def_auth_fd_aci = DEFAULT_AUTH_FD_ACI;
01428
01429 /* register AUTH lists */
01430 for (file_no = 0; file_no < RSBAC_AUTH_NR_FD_LISTS; file_no++)
01431 {
01432 /* construct name from base name + number */
01433 sprintf(name, "%s%u", RSBAC_AUTH_FD_NAME, file_no);
01434 info_p->version = RSBAC_AUTH_FD_ACI_VERSION;
01435 info_p->key = RSBAC_AUTH_FD_ACI_KEY;
01436 info_p->desc_size = sizeof(rsbac_inode_nr_t);
01437 info_p->data_size = sizeof(struct rsbac_auth_fd_aci_t);
01438 info_p->max_age = 0;
01439 tmperr = rsbac_list_register(RSBAC_LIST_VERSION,
01440 &(device_p->handles.auth[file_no]),
01441 info_p,
01442 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
01443 rsbac_list_compare_u32,
01444 auth_fd_get_conv,
01445 &def_auth_fd_aci,
01446 name,
01447 kdev);
01448 if(tmperr)
01449 {
01450 char * tmp;
01451
01452 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01453 if(tmp)
01454 {
01455 rsbac_printk(KERN_WARNING
01456 "register_fd_lists(): registering AUTH list %u for device %02u:%02u failed with error %s!\n",
01457 file_no,
01458 RSBAC_MAJOR(kdev),
01459 RSBAC_MINOR(kdev),
01460 get_error_name(tmp, tmperr));
01461 rsbac_kfree(tmp);
01462 }
01463 err = tmperr;
01464 }
01465 }
01466 }
01467 #endif
01468
01469 #if defined(CONFIG_RSBAC_CAP)
01470 {
01471 struct rsbac_cap_fd_aci_t def_cap_fd_aci = DEFAULT_CAP_FD_ACI;
01472
01473 /* register CAP lists */
01474 for (file_no = 0; file_no < RSBAC_CAP_NR_FD_LISTS; file_no++)
01475 {
01476 /* construct name from base name + number */
01477 sprintf(name, "%s%u", RSBAC_CAP_FD_NAME, file_no);
01478 info_p->version = RSBAC_CAP_FD_ACI_VERSION;
01479 info_p->key = RSBAC_CAP_FD_ACI_KEY;
01480 info_p->desc_size = sizeof(rsbac_inode_nr_t);
01481 info_p->data_size = sizeof(struct rsbac_cap_fd_aci_t);
01482 info_p->max_age = 0;
01483 tmperr = rsbac_list_register(RSBAC_LIST_VERSION,
01484 &(device_p->handles.cap[file_no]),
01485 info_p,
01486 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
01487 rsbac_list_compare_u32,
01488 NULL,
01489 &def_cap_fd_aci,
01490 name,
01491 kdev);
01492 if(tmperr)
01493 {
01494 char * tmp;
01495
01496 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01497 if(tmp)
01498 {
01499 rsbac_printk(KERN_WARNING
01500 "register_fd_lists(): registering CAP list %u for device %02u:%02u failed with error %s!\n",
01501 file_no,
01502 RSBAC_MAJOR(kdev),
01503 RSBAC_MINOR(kdev),
01504 get_error_name(tmp, tmperr));
01505 rsbac_kfree(tmp);
01506 }
01507 err = tmperr;
01508 }
01509 }
01510 }
01511 #endif
01512
01513 #if defined(CONFIG_RSBAC_PAX)
01514 {
01515 rsbac_pax_flags_t def_pax_fd_aci;
01516
01517 #ifdef CONFIG_RSBAC_PAX_DEFAULT
01518 def_pax_fd_aci = 0;
01519 #ifdef CONFIG_RSBAC_PAX_PAGEEXEC
01520 def_pax_fd_aci |= PF_PAX_PAGEEXEC;
01521 #endif
01522 #ifdef CONFIG_RSBAC_PAX_EMUTRAMP
01523 def_pax_fd_aci |= PF_PAX_EMUTRAMP;
01524 #endif
01525 #ifdef CONFIG_RSBAC_PAX_MPROTECT
01526 def_pax_fd_aci |= PF_PAX_MPROTECT;
01527 #endif
01528 #ifdef CONFIG_RSBAC_PAX_RANDMMAP
01529 def_pax_fd_aci |= PF_PAX_RANDMMAP;
01530 #endif
01531 #ifdef CONFIG_RSBAC_PAX_RANDEXEC
01532 def_pax_fd_aci |= PF_PAX_RANDEXEC;
01533 #endif
01534 #ifdef CONFIG_RSBAC_PAX_SEGMEXEC
01535 def_pax_fd_aci |= PF_PAX_SEGMEXEC;
01536 #endif
01537
01538 #else
01539 def_pax_fd_aci = RSBAC_PAX_DEF_FLAGS;
01540 #endif
01541
01542 info_p->version = RSBAC_PAX_FD_ACI_VERSION;
01543 info_p->key = RSBAC_PAX_FD_ACI_KEY;
01544 info_p->desc_size = sizeof(rsbac_inode_nr_t);
01545 info_p->data_size = sizeof(rsbac_pax_flags_t);
01546 info_p->max_age = 0;
01547 /* register PAX lists */
01548 for (file_no = 0; file_no < RSBAC_PAX_NR_FD_LISTS; file_no++)
01549 {
01550 /* construct name from base name + number */
01551 sprintf(name, "%s%u", RSBAC_PAX_FD_NAME, file_no);
01552 tmperr = rsbac_list_register(RSBAC_LIST_VERSION,
01553 &(device_p->handles.pax[file_no]),
01554 info_p,
01555 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
01556 rsbac_list_compare_u32,
01557 NULL,
01558 &def_pax_fd_aci,
01559 name,
01560 kdev);
01561 if(tmperr)
01562 {
01563 char * tmp;
01564
01565 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01566 if(tmp)
01567 {
01568 rsbac_printk(KERN_WARNING
01569 "register_fd_lists(): registering PAX list %u for device %02u:%02u failed with error %s!\n",
01570 file_no,
01571 RSBAC_MAJOR(kdev),
01572 RSBAC_MINOR(kdev),
01573 get_error_name(tmp, tmperr));
01574 rsbac_kfree(tmp);
01575 }
01576 err = tmperr;
01577 }
01578 }
01579 }
01580 #endif
01581
01582 #if defined(CONFIG_RSBAC_RES)
01583 {
01584 /* register RES lists */
01585 for (file_no = 0; file_no < RSBAC_RES_NR_FD_LISTS; file_no++)
01586 {
01587 /* construct name from base name + number */
01588 sprintf(name, "%s%u", RSBAC_RES_FD_NAME, file_no);
01589 info_p->version = RSBAC_RES_FD_ACI_VERSION;
01590 info_p->key = RSBAC_RES_FD_ACI_KEY;
01591 info_p->desc_size = sizeof(rsbac_inode_nr_t);
01592 info_p->data_size = sizeof(struct rsbac_res_fd_aci_t);
01593 info_p->max_age = 0;
01594 tmperr = rsbac_list_register(RSBAC_LIST_VERSION,
01595 &(device_p->handles.res[file_no]),
01596 info_p,
01597 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
01598 rsbac_list_compare_u32,
01599 NULL,
01600 &def_res_fd_aci,
01601 name,
01602 kdev);
01603 if(tmperr)
01604 {
01605 char * tmp;
01606
01607 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01608 if(tmp)
01609 {
01610 rsbac_printk(KERN_WARNING
01611 "register_fd_lists(): registering RES list %u for device %02u:%02u failed with error %s!\n",
01612 file_no,
01613 RSBAC_MAJOR(kdev),
01614 RSBAC_MINOR(kdev),
01615 get_error_name(tmp, tmperr));
01616 rsbac_kfree(tmp);
01617 }
01618 err = tmperr;
01619 }
01620 }
01621 }
01622 #endif
01623
01624 return err;
01625 }
|
|
|
Definition at line 5656 of file aci_data_structures.c. References ipc_compare(), ipc_handles, NULL, registration_error(), RSBAC_JAIL_ACI_IPC_NAME, RSBAC_JAIL_DEF_ID, RSBAC_LIST_DEF_DATA, rsbac_list_register(), RSBAC_LIST_VERSION, RSBAC_MAC_ACI_IPC_NAME, RSBAC_PM_ACI_IPC_NAME, rsbac_printk(), RSBAC_RC_ACI_IPC_NAME, and RSBAC_RC_GENERAL_TYPE. Referenced by rsbac_do_init(). 05658 {
05659 int err = 0;
05660 struct rsbac_list_info_t * list_info_p;
05661
05662 list_info_p = kmalloc(sizeof(*list_info_p), GFP_KERNEL);
05663 if(!list_info_p)
05664 {
05665 return -ENOMEM;
05666 }
05667
05668 #ifdef CONFIG_RSBAC_DEBUG
05669 if (rsbac_debug_ds)
05670 {
05671 rsbac_printk(KERN_DEBUG "rsbac_do_init(): registering IPC lists\n");
05672 }
05673 #endif
05674 #if defined(CONFIG_RSBAC_MAC)
05675 {
05676 struct rsbac_mac_ipc_aci_t def_aci = DEFAULT_MAC_IPC_ACI;
05677
05678 list_info_p->version = RSBAC_MAC_IPC_ACI_VERSION;
05679 list_info_p->key = RSBAC_MAC_IPC_ACI_KEY;
05680 list_info_p->desc_size = sizeof(struct rsbac_ipc_t);
05681 list_info_p->data_size = sizeof(struct rsbac_mac_ipc_aci_t);
05682 list_info_p->max_age = 0;
05683 err = rsbac_list_register(RSBAC_LIST_VERSION,
05684 &ipc_handles.mac,
05685 list_info_p,
05686 RSBAC_LIST_DEF_DATA,
05687 ipc_compare,
05688 NULL,
05689 &def_aci,
05690 RSBAC_MAC_ACI_IPC_NAME,
05691 RSBAC_AUTO_DEV);
05692 if(err)
05693 {
05694 registration_error(err, "IPC MAC");
05695 }
05696 }
05697 #endif
05698 #if defined(CONFIG_RSBAC_PM)
05699 {
05700 struct rsbac_pm_ipc_aci_t def_aci = DEFAULT_PM_IPC_ACI;
05701
05702 list_info_p->version = RSBAC_PM_IPC_ACI_VERSION;
05703 list_info_p->key = RSBAC_PM_IPC_ACI_KEY;
05704 list_info_p->desc_size = sizeof(struct rsbac_ipc_t);
05705 list_info_p->data_size = sizeof(struct rsbac_pm_ipc_aci_t);
05706 list_info_p->max_age = 0;
05707 err = rsbac_list_register(RSBAC_LIST_VERSION,
05708 &ipc_handles.pm,
05709 list_info_p,
05710 RSBAC_LIST_DEF_DATA,
05711 ipc_compare,
05712 NULL,
05713 &def_aci,
05714 RSBAC_PM_ACI_IPC_NAME,
05715 RSBAC_AUTO_DEV);
05716 if(err)
05717 {
05718 registration_error(err, "IPC PM");
05719 }
05720 }
05721 #endif
05722 #if defined(CONFIG_RSBAC_RC)
05723 {
05724 rsbac_rc_type_id_t def_aci = RSBAC_RC_GENERAL_TYPE;
05725
05726 list_info_p->version = RSBAC_RC_IPC_ACI_VERSION;
05727 list_info_p->key = RSBAC_RC_IPC_ACI_KEY;
05728 list_info_p->desc_size = sizeof(struct rsbac_ipc_t);
05729 list_info_p->data_size = sizeof(rsbac_rc_type_id_t);
05730 list_info_p->max_age = 0;
05731 err = rsbac_list_register(RSBAC_LIST_VERSION,
05732 &ipc_handles.rc,
05733 list_info_p,
05734 RSBAC_LIST_DEF_DATA,
05735 ipc_compare,
05736 NULL,
05737 &def_aci,
05738 RSBAC_RC_ACI_IPC_NAME,
05739 RSBAC_AUTO_DEV);
05740 if(err)
05741 {
05742 registration_error(err, "IPC RC");
05743 }
05744 }
05745 #endif
05746 #if defined(CONFIG_RSBAC_JAIL)
05747 {
05748 rsbac_jail_id_t def_aci = RSBAC_JAIL_DEF_ID;
05749
05750 list_info_p->version = RSBAC_JAIL_IPC_ACI_VERSION;
05751 list_info_p->key = RSBAC_JAIL_IPC_ACI_KEY;
05752 list_info_p->desc_size = sizeof(struct rsbac_ipc_t);
05753 list_info_p->data_size = sizeof(rsbac_jail_id_t);
05754 list_info_p->max_age = 0;
05755 err = rsbac_list_register(RSBAC_LIST_VERSION,
05756 &ipc_handles.jail,
05757 list_info_p,
05758 RSBAC_LIST_DEF_DATA,
05759 ipc_compare,
05760 NULL,
05761 &def_aci,
05762 RSBAC_JAIL_ACI_IPC_NAME,
05763 RSBAC_AUTO_DEV);
05764 if(err)
05765 {
05766 registration_error(err, "IPC JAIL");
05767 }
05768 }
05769 #endif
05770
05771 return err;
05772 }
|
|
|
Definition at line 6320 of file aci_data_structures.c. References DEFAULT_GEN_P_ACI, NULL, PH_from_other_users, process_handles, registration_error(), RSBAC_AUTH_ACI_PROCESS_NAME, RSBAC_CAP_ACI_PROCESS_NAME, RSBAC_DAZ_ACI_PROCESS_NAME, RSBAC_GEN_ACI_PROCESS_NAME, RSBAC_GEN_PROCESS_ACI_KEY, RSBAC_GEN_PROCESS_ACI_VERSION, RSBAC_JAIL_ACI_PROCESS_NAME, rsbac_list_compare_u32(), RSBAC_LIST_DEF_DATA, rsbac_list_register(), RSBAC_LIST_VERSION, RSBAC_MAC_ACI_PROCESS_NAME, RSBAC_MAXNAMELEN, RSBAC_PM_ACI_PROCESS_NAME, rsbac_printk(), and RSBAC_RC_ACI_PROCESS_NAME. Referenced by rsbac_do_init(). 06322 {
06323 int err = 0;
06324 struct rsbac_list_info_t * list_info_p;
06325
06326 list_info_p = kmalloc(sizeof(*list_info_p), GFP_KERNEL);
06327 if(!list_info_p)
06328 {
06329 return -ENOMEM;
06330 }
06331
06332 #ifdef CONFIG_RSBAC_DEBUG
06333 if (rsbac_debug_ds)
06334 {
06335 rsbac_printk(KERN_DEBUG "rsbac_do_init(): registering PROCESS lists\n");
06336 }
06337 #endif
06338 {
06339 struct rsbac_gen_process_aci_t def_aci = DEFAULT_GEN_P_ACI;
06340 char name[RSBAC_MAXNAMELEN];
06341 int i;
06342
06343 list_info_p->version = RSBAC_GEN_PROCESS_ACI_VERSION;
06344 list_info_p->key = RSBAC_GEN_PROCESS_ACI_KEY;
06345 list_info_p->desc_size = sizeof(rsbac_pid_t);
06346 list_info_p->data_size = sizeof(struct rsbac_gen_process_aci_t);
06347 list_info_p->max_age = 0;
06348 for(i=0; i<CONFIG_RSBAC_GEN_NR_P_LISTS; i++)
06349 {
06350 sprintf(name, "%s%u", RSBAC_GEN_ACI_PROCESS_NAME, i);
06351 err = rsbac_list_register(RSBAC_LIST_VERSION,
06352 &process_handles.gen[i],
06353 list_info_p,
06354 RSBAC_LIST_DEF_DATA,
06355 rsbac_list_compare_u32,
06356 NULL,
06357 &def_aci,
06358 name,
06359 RSBAC_AUTO_DEV);
06360 if(err)
06361 {
06362 registration_error(err, "PROCESS GEN");
06363 }
06364 }
06365 }
06366 #if defined(CONFIG_RSBAC_MAC)
06367 {
06368 struct rsbac_mac_process_aci_t def_aci = DEFAULT_MAC_P_ACI;
06369 char name[RSBAC_MAXNAMELEN];
06370 int i;
06371
06372 list_info_p->version = RSBAC_MAC_PROCESS_ACI_VERSION;
06373 list_info_p->key = RSBAC_MAC_PROCESS_ACI_KEY;
06374 list_info_p->desc_size = sizeof(rsbac_pid_t);
06375 list_info_p->data_size = sizeof(struct rsbac_mac_process_aci_t);
06376 list_info_p->max_age = 0;
06377 for(i=0; i<CONFIG_RSBAC_MAC_NR_P_LISTS; i++)
06378 {
06379 sprintf(name, "%s%u", RSBAC_MAC_ACI_PROCESS_NAME, i);
06380
06381 err = rsbac_list_register(RSBAC_LIST_VERSION,
06382 &process_handles.mac[i],
06383 list_info_p,
06384 RSBAC_LIST_DEF_DATA,
06385 rsbac_list_compare_u32,
06386 NULL,
06387 &def_aci,
06388 name,
06389 RSBAC_AUTO_DEV);
06390 if(err)
06391 {
06392 registration_error(err, "PROCESS MAC");
06393 }
06394 }
06395 }
06396 #endif
06397 #if defined(CONFIG_RSBAC_PM)
06398 {
06399 struct rsbac_pm_process_aci_t def_aci = DEFAULT_PM_P_ACI;
06400
06401 list_info_p->version = RSBAC_PM_PROCESS_ACI_VERSION;
06402 list_info_p->key = RSBAC_PM_PROCESS_ACI_KEY;
06403 list_info_p->desc_size = sizeof(rsbac_pid_t);
06404 list_info_p->data_size = sizeof(struct rsbac_pm_process_aci_t);
06405 list_info_p->max_age = 0;
06406 err = rsbac_list_register(RSBAC_LIST_VERSION,
06407 &process_handles.pm,
06408 list_info_p,
06409 RSBAC_LIST_DEF_DATA,
06410 rsbac_list_compare_u32,
06411 NULL,
06412 &def_aci,
06413 RSBAC_PM_ACI_PROCESS_NAME,
06414 RSBAC_AUTO_DEV);
06415 if(err)
06416 {
06417 registration_error(err, "PROCESS PM");
06418 }
06419 }
06420 #endif
06421 #if defined(CONFIG_RSBAC_DAZ)
06422 {
06423 struct rsbac_daz_process_aci_t def_aci = DEFAULT_DAZ_P_ACI;
06424
06425 list_info_p->version = RSBAC_DAZ_PROCESS_ACI_VERSION;
06426 list_info_p->key = RSBAC_DAZ_PROCESS_ACI_KEY;
06427 list_info_p->desc_size = sizeof(rsbac_pid_t);
06428 list_info_p->data_size = sizeof(struct rsbac_daz_process_aci_t);
06429 list_info_p->max_age = 0;
06430 err = rsbac_list_register(RSBAC_LIST_VERSION,
06431 &process_handles.daz,
06432 list_info_p,
06433 RSBAC_LIST_DEF_DATA,
06434 rsbac_list_compare_u32,
06435 NULL,
06436 &def_aci,
06437 RSBAC_DAZ_ACI_PROCESS_NAME,
06438 RSBAC_AUTO_DEV);
06439 if(err)
06440 {
06441 registration_error(err, "PROCESS DAZ");
06442 }
06443 }
06444 #endif
06445 #if defined(CONFIG_RSBAC_RC)
06446 {
06447 struct rsbac_rc_process_aci_t def_aci = DEFAULT_RC_P_ACI;
06448 char name[RSBAC_MAXNAMELEN];
06449 int i;
06450
06451 list_info_p->version = RSBAC_RC_PROCESS_ACI_VERSION;
06452 list_info_p->key = RSBAC_RC_PROCESS_ACI_KEY;
06453 list_info_p->desc_size = sizeof(rsbac_pid_t);
06454 list_info_p->data_size = sizeof(struct rsbac_rc_process_aci_t);
06455 list_info_p->max_age = 0;
06456 for(i=0; i<CONFIG_RSBAC_RC_NR_P_LISTS; i++)
06457 {
06458 sprintf(name, "%s%u", RSBAC_RC_ACI_PROCESS_NAME, i);
06459 err = rsbac_list_register(RSBAC_LIST_VERSION,
06460 &process_handles.rc[i],
06461 list_info_p,
06462 RSBAC_LIST_DEF_DATA,
06463 rsbac_list_compare_u32,
06464 NULL,
06465 &def_aci,
06466 name,
06467 RSBAC_AUTO_DEV);
06468 if(err)
06469 {
06470 registration_error(err, "PROCESS RC");
06471 }
06472 }
06473 }
06474 #endif
06475 #if defined(CONFIG_RSBAC_AUTH)
06476 {
06477 struct rsbac_auth_process_aci_t def_aci = DEFAULT_AUTH_P_ACI;
06478
06479 list_info_p->version = RSBAC_AUTH_PROCESS_ACI_VERSION;
06480 list_info_p->key = RSBAC_AUTH_PROCESS_ACI_KEY;
06481 list_info_p->desc_size = sizeof(rsbac_pid_t);
06482 list_info_p->data_size = sizeof(struct rsbac_auth_process_aci_t);
06483 list_info_p->max_age = 0;
06484 err = rsbac_list_register(RSBAC_LIST_VERSION,
06485 &process_handles.auth,
06486 list_info_p,
06487 RSBAC_LIST_DEF_DATA,
06488 rsbac_list_compare_u32,
06489 NULL,
06490 &def_aci,
06491 RSBAC_AUTH_ACI_PROCESS_NAME,
06492 RSBAC_AUTO_DEV);
06493 if(err)
06494 {
06495 registration_error(err, "PROCESS AUTH");
06496 }
06497 }
06498 #endif
06499 #if defined(CONFIG_RSBAC_CAP)
06500 {
06501 struct rsbac_cap_process_aci_t def_aci = DEFAULT_CAP_P_ACI;
06502
06503 #if defined(CONFIG_RSBAC_CAP_PROC_HIDE)
06504 if(rsbac_cap_process_hiding)
06505 def_aci.cap_process_hiding = PH_from_other_users;
06506 #endif
06507 list_info_p->version = RSBAC_CAP_PROCESS_ACI_VERSION;
06508 list_info_p->key = RSBAC_CAP_PROCESS_ACI_KEY;
06509 list_info_p->desc_size = sizeof(rsbac_pid_t);
06510 list_info_p->data_size = sizeof(struct rsbac_cap_process_aci_t);
06511 list_info_p->max_age = 0;
06512 err = rsbac_list_register(RSBAC_LIST_VERSION,
06513 &process_handles.cap,
06514 list_info_p,
06515 RSBAC_LIST_DEF_DATA,
06516 rsbac_list_compare_u32,
06517 NULL,
06518 &def_aci,
06519 RSBAC_CAP_ACI_PROCESS_NAME,
06520 RSBAC_AUTO_DEV);
06521 if(err)
06522 {
06523 registration_error(err, "PROCESS CAP");
06524 }
06525 }
06526 #endif
06527 #if defined(CONFIG_RSBAC_JAIL)
06528 {
06529 struct rsbac_jail_process_aci_t def_aci = DEFAULT_JAIL_P_ACI;
06530 char name[RSBAC_MAXNAMELEN];
06531 int i;
06532
06533 list_info_p->version = RSBAC_JAIL_PROCESS_ACI_VERSION;
06534 list_info_p->key = RSBAC_JAIL_PROCESS_ACI_KEY;
06535 list_info_p->desc_size = sizeof(rsbac_pid_t);
06536 list_info_p->data_size = sizeof(struct rsbac_jail_process_aci_t);
06537 list_info_p->max_age = 0;
06538 for(i=0; i<CONFIG_RSBAC_JAIL_NR_P_LISTS; i++)
06539 {
06540 sprintf(name, "%s%u", RSBAC_JAIL_ACI_PROCESS_NAME, i);
06541 err = rsbac_list_register(RSBAC_LIST_VERSION,
06542 &process_handles.jail[i],
06543 list_info_p,
06544 RSBAC_LIST_DEF_DATA,
06545 rsbac_list_compare_u32,
06546 NULL,
06547 &def_aci,
06548 name,
06549 RSBAC_AUTO_DEV);
06550 if(err)
06551 {
06552 registration_error(err, "PROCESS JAIL");
06553 }
06554 }
06555 }
06556 #endif
06557
06558 return err;
06559 }
|
|
|
Definition at line 5777 of file aci_data_structures.c. References DEFAULT_GEN_U_ACI, NULL, registration_error(), RSBAC_AUDITOR_UID, RSBAC_AUTH_ACI_USER_NAME, RSBAC_CAP_ACI_USER_NAME, RSBAC_DATAPROT_UID, RSBAC_DAZ_ACI_USER_NAME, RSBAC_FF_ACI_USER_NAME, RSBAC_GEN_ACI_USER_NAME, RSBAC_GEN_USER_ACI_KEY, RSBAC_GEN_USER_ACI_VERSION, RSBAC_JAIL_ACI_USER_NAME, rsbac_list_add(), RSBAC_LIST_BACKUP, rsbac_list_compare_u32(), rsbac_list_count(), RSBAC_LIST_DEF_DATA, RSBAC_LIST_PERSIST, rsbac_list_register(), RSBAC_LIST_VERSION, RSBAC_MAC_ACI_USER_NAME, rsbac_no_defaults, RSBAC_PAX_ACI_USER_NAME, RSBAC_PM_ACI_USER_NAME, rsbac_printk(), RSBAC_RC_ACI_USER_NAME, RSBAC_RES_ACI_USER_NAME, RSBAC_SECOFF_UID, RSBAC_SYSADM_UID, RSBAC_TPMAN_UID, SR_administrator, SR_auditor, SR_security_officer, SR_user, and user_handles. Referenced by rsbac_do_init(). 05779 {
05780 int err = 0;
05781 struct rsbac_list_info_t * list_info_p;
05782
05783 list_info_p = kmalloc(sizeof(*list_info_p), GFP_KERNEL);
05784 if(!list_info_p)
05785 {
05786 return -ENOMEM;
05787 }
05788
05789 #ifdef CONFIG_RSBAC_DEBUG
05790 if (rsbac_debug_ds)
05791 {
05792 rsbac_printk(KERN_DEBUG "rsbac_do_init(): registering USER lists\n");
05793 }
05794 #endif
05795
05796 {
05797 struct rsbac_gen_user_aci_t def_aci = DEFAULT_GEN_U_ACI;
05798
05799 list_info_p->version = RSBAC_GEN_USER_ACI_VERSION;
05800 list_info_p->key = RSBAC_GEN_USER_ACI_KEY;
05801 list_info_p->desc_size = sizeof(rsbac_uid_t);
05802 list_info_p->data_size = sizeof(struct rsbac_gen_user_aci_t);
05803 list_info_p->max_age = 0;
05804 err = rsbac_list_register(RSBAC_LIST_VERSION,
05805 &user_handles.gen,
05806 list_info_p,
05807 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
05808 RSBAC_LIST_BACKUP |
05809 #endif
05810 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
05811 rsbac_list_compare_u32,
05812 NULL,
05813 &def_aci,
05814 RSBAC_GEN_ACI_USER_NAME,
05815 RSBAC_AUTO_DEV);
05816 if(err)
05817 {
05818 registration_error(err, "USER General");
05819 }
05820 }
05821 #if defined(CONFIG_RSBAC_MAC)
05822 {
05823 struct rsbac_mac_user_aci_t def_aci = DEFAULT_MAC_U_ACI;
05824
05825 list_info_p->version = RSBAC_MAC_USER_ACI_VERSION;
05826 list_info_p->key = RSBAC_MAC_USER_ACI_KEY;
05827 list_info_p->desc_size = sizeof(rsbac_uid_t);
05828 list_info_p->data_size = sizeof(struct rsbac_mac_user_aci_t);
05829 list_info_p->max_age = 0;
05830 err = rsbac_list_register(RSBAC_LIST_VERSION,
05831 &user_handles.mac,
05832 list_info_p,
05833 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
05834 RSBAC_LIST_BACKUP |
05835 #endif
05836 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
05837 rsbac_list_compare_u32,
05838 mac_user_get_conv,
05839 &def_aci,
05840 RSBAC_MAC_ACI_USER_NAME,
05841 RSBAC_AUTO_DEV);
05842 if(err)
05843 {
05844 registration_error(err, "USER MAC");
05845 }
05846 else
05847 if(!rsbac_no_defaults && !rsbac_list_count(user_handles.mac))
05848 {
05849 struct rsbac_mac_user_aci_t sysadm_aci = DEFAULT_MAC_U_SYSADM_ACI;
05850 struct rsbac_mac_user_aci_t secoff_aci = DEFAULT_MAC_U_SECOFF_ACI;
05851 struct rsbac_mac_user_aci_t auditor_aci = DEFAULT_MAC_U_AUDITOR_ACI;
05852 rsbac_uid_t user;
05853
05854 rsbac_printk(KERN_WARNING
05855 "rsbac_do_init(): USER MAC ACI could not be read - generating standard entries!\n");
05856 user = RSBAC_SYSADM_UID;
05857 if(rsbac_list_add(user_handles.mac, &user, &sysadm_aci))
05858 rsbac_printk(KERN_WARNING
05859 "rsbac_do_init(): SYSADM USER MAC entry could not be added!\n");
05860 user = RSBAC_SECOFF_UID;
05861 if(rsbac_list_add(user_handles.mac, &user, &secoff_aci))
05862 rsbac_printk(KERN_WARNING
05863 "rsbac_do_init(): SECOFF USER MAC entry could not be added!\n");
05864 user = RSBAC_AUDITOR_UID;
05865 if(rsbac_list_add(user_handles.mac, &user, &auditor_aci))
05866 rsbac_printk(KERN_WARNING
05867 "rsbac_do_init(): AUDITOR USER MAC entry could not be added!\n");
05868 }
05869 }
05870 #endif
05871 #if defined(CONFIG_RSBAC_PM)
05872 {
05873 struct rsbac_pm_user_aci_t def_aci = DEFAULT_PM_U_ACI;
05874
05875 list_info_p->version = RSBAC_PM_USER_ACI_VERSION;
05876 list_info_p->key = RSBAC_PM_USER_ACI_KEY;
05877 list_info_p->desc_size = sizeof(rsbac_uid_t);
05878 list_info_p->data_size = sizeof(struct rsbac_pm_user_aci_t);
05879 list_info_p->max_age = 0;
05880 err = rsbac_list_register(RSBAC_LIST_VERSION,
05881 &user_handles.pm,
05882 list_info_p,
05883 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
05884 RSBAC_LIST_BACKUP |
05885 #endif
05886 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
05887 rsbac_list_compare_u32,
05888 NULL,
05889 &def_aci,
05890 RSBAC_PM_ACI_USER_NAME,
05891 RSBAC_AUTO_DEV);
05892 if(err)
05893 {
05894 registration_error(err, "USER PM");
05895 }
05896 else
05897 if(!rsbac_no_defaults && !rsbac_list_count(user_handles.pm))
05898 {
05899 struct rsbac_pm_user_aci_t sysadm_aci = DEFAULT_PM_U_SYSADM_ACI;
05900 struct rsbac_pm_user_aci_t secoff_aci = DEFAULT_PM_U_SECOFF_ACI;
05901 struct rsbac_pm_user_aci_t dataprot_aci = DEFAULT_PM_U_DATAPROT_ACI;
05902 struct rsbac_pm_user_aci_t tpman_aci = DEFAULT_PM_U_TPMAN_ACI;
05903 rsbac_uid_t user;
05904
05905 rsbac_printk(KERN_WARNING
05906 "rsbac_do_init(): USER PM ACI could not be read - generating standard entries!\n");
05907 user = RSBAC_SYSADM_UID;
05908 if(rsbac_list_add(user_handles.pm, &user, &sysadm_aci))
05909 rsbac_printk(KERN_WARNING
05910 "rsbac_do_init(): SYSADM USER PM entry could not be added!\n");
05911 user = RSBAC_SECOFF_UID;
05912 if(rsbac_list_add(user_handles.pm, &user, &secoff_aci))
05913 rsbac_printk(KERN_WARNING
05914 "rsbac_do_init(): SECOFF USER PM entry could not be added!\n");
05915 user = RSBAC_DATAPROT_UID;
05916 if(rsbac_list_add(user_handles.pm, &user, &dataprot_aci))
05917 rsbac_printk(KERN_WARNING
05918 "rsbac_do_init(): DATAPROT USER PM entry could not be added!\n");
05919 user = RSBAC_TPMAN_UID;
05920 if(rsbac_list_add(user_handles.pm, &user, &tpman_aci))
05921 rsbac_printk(KERN_WARNING
05922 "rsbac_do_init(): TPMAN USER PM entry could not be added!\n");
05923 }
05924 }
05925 #endif
05926 #if defined(CONFIG_RSBAC_DAZ)
05927 {
05928 rsbac_system_role_int_t def_aci = SR_user;
05929
05930 list_info_p->version = RSBAC_DAZ_USER_ACI_VERSION;
05931 list_info_p->key = RSBAC_DAZ_USER_ACI_KEY;
05932 list_info_p->desc_size = sizeof(rsbac_uid_t);
05933 list_info_p->data_size = sizeof(rsbac_system_role_int_t);
05934 list_info_p->max_age = 0;
05935 err = rsbac_list_register(RSBAC_LIST_VERSION,
05936 &user_handles.daz,
05937 list_info_p,
05938 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
05939 RSBAC_LIST_BACKUP |
05940 #endif
05941 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
05942 rsbac_list_compare_u32,
05943 NULL,
05944 &def_aci,
05945 RSBAC_DAZ_ACI_USER_NAME,
05946 RSBAC_AUTO_DEV);
05947 if(err)
05948 {
05949 registration_error(err, "USER DAZ");
05950 }
05951 else
05952 if(!rsbac_no_defaults && !rsbac_list_count(user_handles.daz))
05953 {
05954 rsbac_uid_t user;
05955 rsbac_system_role_int_t role;
05956
05957 rsbac_printk(KERN_WARNING
05958 "rsbac_do_init(): USER DAZ ACI could not be read - generating standard entries!\n");
05959 user = RSBAC_SYSADM_UID;
05960 role = SR_administrator;
05961 if(rsbac_list_add(user_handles.daz, &user, &role))
05962 rsbac_printk(KERN_WARNING
05963 "rsbac_do_init(): SYSADM USER DAZ entry could not be added!\n");
05964 user = RSBAC_SECOFF_UID;
05965 role = SR_security_officer;
05966 if(rsbac_list_add(user_handles.daz, &user, &role))
05967 rsbac_printk(KERN_WARNING
05968 "rsbac_do_init(): SECOFF USER DAZ entry could not be added!\n");
05969 }
05970 }
05971 #endif
05972 #if defined(CONFIG_RSBAC_FF)
05973 {
05974 rsbac_system_role_int_t def_aci = SR_user;
05975
05976 list_info_p->version = RSBAC_FF_USER_ACI_VERSION;
05977 list_info_p->key = RSBAC_FF_USER_ACI_KEY;
05978 list_info_p->desc_size = sizeof(rsbac_uid_t);
05979 list_info_p->data_size = sizeof(rsbac_system_role_int_t);
05980 list_info_p->max_age = 0;
05981 err = rsbac_list_register(RSBAC_LIST_VERSION,
05982 &user_handles.ff,
05983 list_info_p,
05984 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
05985 RSBAC_LIST_BACKUP |
05986 #endif
05987 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
05988 rsbac_list_compare_u32,
05989 NULL,
05990 &def_aci,
05991 RSBAC_FF_ACI_USER_NAME,
05992 RSBAC_AUTO_DEV);
05993 if(err)
05994 {
05995 registration_error(err, "USER FF");
05996 }
05997 else
05998 if(!rsbac_no_defaults && !rsbac_list_count(user_handles.ff))
05999 {
06000 rsbac_uid_t user;
06001 rsbac_system_role_int_t role;
06002
06003 rsbac_printk(KERN_WARNING
06004 "rsbac_do_init(): USER FF ACI could not be read - generating standard entries!\n");
06005 user = RSBAC_SYSADM_UID;
06006 role = SR_administrator;
06007 if(rsbac_list_add(user_handles.ff, &user, &role))
06008 rsbac_printk(KERN_WARNING
06009 "rsbac_do_init(): SYSADM USER FF entry could not be added!\n");
06010 user = RSBAC_SECOFF_UID;
06011 role = SR_security_officer;
06012 if(rsbac_list_add(user_handles.ff, &user, &role))
06013 rsbac_printk(KERN_WARNING
06014 "rsbac_do_init(): SECOFF USER FF entry could not be added!\n");
06015 user = RSBAC_AUDITOR_UID;
06016 role = SR_auditor;
06017 if(rsbac_list_add(user_handles.ff, &user, &role))
06018 rsbac_printk(KERN_WARNING
06019 "rsbac_do_init(): AUDITOR USER FF entry could not be added!\n");
06020 }
06021 }
06022 #endif
06023 #if defined(CONFIG_RSBAC_RC)
06024 {
06025 struct rsbac_rc_user_aci_t def_aci = DEFAULT_RC_U_ACI;
06026
06027 list_info_p->version = RSBAC_RC_USER_ACI_VERSION;
06028 list_info_p->key = RSBAC_RC_USER_ACI_KEY;
06029 list_info_p->desc_size = sizeof(rsbac_uid_t);
06030 list_info_p->data_size = sizeof(struct rsbac_rc_user_aci_t);
06031 list_info_p->max_age = 0;
06032 err = rsbac_list_register(RSBAC_LIST_VERSION,
06033 &user_handles.rc,
06034 list_info_p,
06035 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
06036 RSBAC_LIST_BACKUP |
06037 #endif
06038 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
06039 rsbac_list_compare_u32,
06040 rc_user_get_conv,
06041 &def_aci,
06042 RSBAC_RC_ACI_USER_NAME,
06043 RSBAC_AUTO_DEV);
06044 if(err)
06045 {
06046 registration_error(err, "USER RC");
06047 }
06048 else
06049 if(!rsbac_no_defaults && !rsbac_list_count(user_handles.rc))
06050 {
06051 rsbac_uid_t user;
06052 struct rsbac_rc_user_aci_t sysadm_aci = DEFAULT_RC_U_SYSADM_ACI;
06053 struct rsbac_rc_user_aci_t secoff_aci = DEFAULT_RC_U_SECOFF_ACI;
06054 struct rsbac_rc_user_aci_t auditor_aci = DEFAULT_RC_U_AUDITOR_ACI;
06055
06056 rsbac_printk(KERN_WARNING
06057 "rsbac_do_init(): USER RC ACI could not be read - generating standard entries!\n");
06058 user = RSBAC_SYSADM_UID;
06059 if(rsbac_list_add(user_handles.rc, &user, &sysadm_aci))
06060 rsbac_printk(KERN_WARNING
06061 "rsbac_do_init(): SYSADM USER RC entry could not be added!\n");
06062 user = RSBAC_SECOFF_UID;
06063 if(rsbac_list_add(user_handles.rc, &user, &secoff_aci))
06064 rsbac_printk(KERN_WARNING
06065 "rsbac_do_init(): SECOFF USER RC entry could not be added!\n");
06066 user = RSBAC_AUDITOR_UID;
06067 if(rsbac_list_add(user_handles.rc, &user, &auditor_aci))
06068 rsbac_printk(KERN_WARNING
06069 "rsbac_do_init(): AUDITOR USER RC entry could not be added!\n");
06070 }
06071 }
06072 #endif
06073 #if defined(CONFIG_RSBAC_AUTH)
06074 {
06075 rsbac_system_role_int_t def_aci = SR_user;
06076
06077 list_info_p->version = RSBAC_AUTH_USER_ACI_VERSION;
06078 list_info_p->key = RSBAC_AUTH_USER_ACI_KEY;
06079 list_info_p->desc_size = sizeof(rsbac_uid_t);
06080 list_info_p->data_size = sizeof(rsbac_system_role_int_t);
06081 list_info_p->max_age = 0;
06082 err = rsbac_list_register(RSBAC_LIST_VERSION,
06083 &user_handles.auth,
06084 list_info_p,
06085 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
06086 RSBAC_LIST_BACKUP |
06087 #endif
06088 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
06089 rsbac_list_compare_u32,
06090 NULL,
06091 &def_aci,
06092 RSBAC_AUTH_ACI_USER_NAME,
06093 RSBAC_AUTO_DEV);
06094 if(err)
06095 {
06096 registration_error(err, "USER AUTH");
06097 }
06098 else
06099 if(!rsbac_no_defaults && !rsbac_list_count(user_handles.auth))
06100 {
06101 rsbac_uid_t user;
06102 rsbac_system_role_int_t role;
06103
06104 rsbac_printk(KERN_WARNING
06105 "rsbac_do_init(): USER AUTH ACI could not be read - generating standard entries!\n");
06106 user = RSBAC_SYSADM_UID;
06107 role = SR_administrator;
06108 if(rsbac_list_add(user_handles.auth, &user, &role))
06109 rsbac_printk(KERN_WARNING
06110 "rsbac_do_init(): SYSADM USER AUTH entry could not be added!\n");
06111 user = RSBAC_SECOFF_UID;
06112 role = SR_security_officer;
06113 if(rsbac_list_add(user_handles.auth, &user, &role))
06114 rsbac_printk(KERN_WARNING
06115 "rsbac_do_init(): SECOFF USER AUTH entry could not be added!\n");
06116 user = RSBAC_AUDITOR_UID;
06117 role = SR_auditor;
06118 if(rsbac_list_add(user_handles.auth, &user, &role))
06119 rsbac_printk(KERN_WARNING
06120 "rsbac_do_init(): AUDITOR USER AUTH entry could not be added!\n");
06121 }
06122 }
06123 #endif /* AUTH */
06124 #if defined(CONFIG_RSBAC_CAP)
06125 {
06126 struct rsbac_cap_user_aci_t def_aci = DEFAULT_CAP_U_ACI;
06127
06128 list_info_p->version = RSBAC_CAP_USER_ACI_VERSION;
06129 list_info_p->key = RSBAC_CAP_USER_ACI_KEY;
06130 list_info_p->desc_size = sizeof(rsbac_uid_t);
06131 list_info_p->data_size = sizeof(struct rsbac_cap_user_aci_t);
06132 list_info_p->max_age = 0;
06133 err = rsbac_list_register(RSBAC_LIST_VERSION,
06134 &user_handles.cap,
06135 list_info_p,
06136 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
06137 RSBAC_LIST_BACKUP |
06138 #endif
06139 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
06140 rsbac_list_compare_u32,
06141 NULL,
06142 &def_aci,
06143 RSBAC_CAP_ACI_USER_NAME,
06144 RSBAC_AUTO_DEV);
06145 if(err)
06146 {
06147 registration_error(err, "USER CAP");
06148 }
06149 else
06150 if(!rsbac_no_defaults && !rsbac_list_count(user_handles.cap))
06151 {
06152 struct rsbac_cap_user_aci_t sysadm_aci = DEFAULT_CAP_U_SYSADM_ACI;
06153 struct rsbac_cap_user_aci_t secoff_aci = DEFAULT_CAP_U_SECOFF_ACI;
06154 struct rsbac_cap_user_aci_t auditor_aci = DEFAULT_CAP_U_AUDITOR_ACI;
06155 rsbac_uid_t user;
06156
06157 rsbac_printk(KERN_WARNING
06158 "rsbac_do_init(): USER CAP ACI could not be read - generating standard entries!\n");
06159 rsbac_printk(KERN_WARNING
06160 "rsbac_do_init(): USER CAP ACI could not be read - generating standard entries!\n");
06161 user = RSBAC_SYSADM_UID;
06162 if(rsbac_list_add(user_handles.cap, &user, &sysadm_aci))
06163 rsbac_printk(KERN_WARNING
06164 "rsbac_do_init(): SYSADM USER CAP entry could not be added!\n");
06165 user = RSBAC_SECOFF_UID;
06166 if(rsbac_list_add(user_handles.cap, &user, &secoff_aci))
06167 rsbac_printk(KERN_WARNING
06168 "rsbac_do_init(): SECOFF USER CAP entry could not be added!\n");
06169 user = RSBAC_AUDITOR_UID;
06170 if(rsbac_list_add(user_handles.cap, &user, &auditor_aci))
06171 rsbac_printk(KERN_WARNING
06172 "rsbac_do_init(): AUDITOR USER CAP entry could not be added!\n");
06173 }
06174 }
06175 #endif
06176 #if defined(CONFIG_RSBAC_JAIL)
06177 {
06178 rsbac_system_role_int_t def_aci = SR_user;
06179
06180 list_info_p->version = RSBAC_JAIL_USER_ACI_VERSION;
06181 list_info_p->key = RSBAC_JAIL_USER_ACI_KEY;
06182 list_info_p->desc_size = sizeof(rsbac_uid_t);
06183 list_info_p->data_size = sizeof(rsbac_system_role_int_t);
06184 list_info_p->max_age = 0;
06185 err = rsbac_list_register(RSBAC_LIST_VERSION,
06186 &user_handles.jail,
06187 list_info_p,
06188 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
06189 RSBAC_LIST_BACKUP |
06190 #endif
06191 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
06192 rsbac_list_compare_u32,
06193 NULL,
06194 &def_aci,
06195 RSBAC_JAIL_ACI_USER_NAME,
06196 RSBAC_AUTO_DEV);
06197 if(err)
06198 {
06199 registration_error(err, "USER JAIL");
06200 }
06201 else
06202 if(!rsbac_no_defaults && !rsbac_list_count(user_handles.jail))
06203 {
06204 rsbac_uid_t user;
06205 rsbac_system_role_int_t role;
06206
06207 rsbac_printk(KERN_WARNING
06208 "rsbac_do_init(): USER JAIL ACI could not be read - generating standard entries!\n");
06209 user = RSBAC_SYSADM_UID;
06210 role = SR_administrator;
06211 if(rsbac_list_add(user_handles.jail, &user, &role))
06212 rsbac_printk(KERN_WARNING
06213 "rsbac_do_init(): SYSADM USER JAIL entry could not be added!\n");
06214 user = RSBAC_SECOFF_UID;
06215 role = SR_security_officer;
06216 if(rsbac_list_add(user_handles.jail, &user, &role))
06217 rsbac_printk(KERN_WARNING
06218 "rsbac_do_init(): SECOFF USER JAIL entry could not be added!\n");
06219 }
06220 }
06221 #endif
06222 #if defined(CONFIG_RSBAC_RES)
06223 {
06224 list_info_p->version = RSBAC_RES_USER_ACI_VERSION;
06225 list_info_p->key = RSBAC_RES_USER_ACI_KEY;
06226 list_info_p->desc_size = sizeof(rsbac_uid_t);
06227 list_info_p->data_size = sizeof(struct rsbac_res_user_aci_t);
06228 list_info_p->max_age = 0;
06229 err = rsbac_list_register(RSBAC_LIST_VERSION,
06230 &user_handles.res,
06231 list_info_p,
06232 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
06233 RSBAC_LIST_BACKUP |
06234 #endif
06235 RSBAC_LIST_PERSIST,
06236 rsbac_list_compare_u32,
06237 NULL,
06238 NULL,
06239 RSBAC_RES_ACI_USER_NAME,
06240 RSBAC_AUTO_DEV);
06241 if(err)
06242 {
06243 registration_error(err, "USER RES");
06244 }
06245 else
06246 if(!rsbac_no_defaults && !rsbac_list_count(user_handles.res))
06247 {
06248 struct rsbac_res_user_aci_t sysadm_aci = DEFAULT_RES_U_SYSADM_ACI;
06249 struct rsbac_res_user_aci_t secoff_aci = DEFAULT_RES_U_SECOFF_ACI;
06250 rsbac_uid_t user;
06251
06252 rsbac_printk(KERN_WARNING
06253 "rsbac_do_init(): USER RES ACI could not be read - generating standard entries!\n");
06254 rsbac_printk(KERN_WARNING
06255 "rsbac_do_init(): USER RES ACI could not be read - generating standard entries!\n");
06256 user = RSBAC_SYSADM_UID;
06257 if(rsbac_list_add(user_handles.res, &user, &sysadm_aci))
06258 rsbac_printk(KERN_WARNING
06259 "rsbac_do_init(): SYSADM USER RES entry could not be added!\n");
06260 user = RSBAC_SECOFF_UID;
06261 if(rsbac_list_add(user_handles.res, &user, &secoff_aci))
06262 rsbac_printk(KERN_WARNING
06263 "rsbac_do_init(): SECOFF USER RES entry could not be added!\n");
06264 }
06265 }
06266 #endif
06267 #if defined(CONFIG_RSBAC_PAX)
06268 {
06269 rsbac_system_role_int_t def_aci = SR_user;
06270
06271 list_info_p->version = RSBAC_PAX_USER_ACI_VERSION;
06272 list_info_p->key = RSBAC_PAX_USER_ACI_KEY;
06273 list_info_p->desc_size = sizeof(rsbac_uid_t);
06274 list_info_p->data_size = sizeof(rsbac_system_role_int_t);
06275 list_info_p->max_age = 0;
06276 err = rsbac_list_register(RSBAC_LIST_VERSION,
06277 &user_handles.pax,
06278 list_info_p,
06279 #ifdef CONFIG_RSBAC_DEV_USER_BACKUP
06280 RSBAC_LIST_BACKUP |
06281 #endif
06282 RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
06283 rsbac_list_compare_u32,
06284 NULL,
06285 &def_aci,
06286 RSBAC_PAX_ACI_USER_NAME,
06287 RSBAC_AUTO_DEV);
06288 if(err)
06289 {
06290 registration_error(err, "USER PAX");
06291 }
06292 else
06293 if(!rsbac_no_defaults && !rsbac_list_count(user_handles.pax))
06294 {
06295 rsbac_uid_t user;
06296 rsbac_system_role_int_t role;
06297
06298 rsbac_printk(KERN_WARNING
06299 "rsbac_do_init(): USER PAX ACI could not be read - generating standard entries!\n");
06300 user = RSBAC_SYSADM_UID;
06301 role = SR_administrator;
06302 if(rsbac_list_add(user_handles.pax, &user, &role))
06303 rsbac_printk(KERN_WARNING
06304 "rsbac_do_init(): SYSADM USER PAX entry could not be added!\n");
06305 user = RSBAC_SECOFF_UID;
06306 role = SR_security_officer;
06307 if(rsbac_list_add(user_handles.pax, &user, &role))
06308 rsbac_printk(KERN_WARNING
06309 "rsbac_do_init(): SECOFF USER PAX entry could not be added!\n");
06310 }
06311 }
06312 #endif
06313
06314 return err;
06315 }
|
|
||||||||||||
|
Definition at line 5482 of file aci_data_structures.c. References get_error_name(), rsbac_kfree(), rsbac_kmalloc(), RSBAC_MAXNAMELEN, and rsbac_printk(). Referenced by register_dev_lists(), register_ipc_lists(), register_process_lists(), register_user_lists(), rsbac_init_acl(), rsbac_init_pm(), and rsbac_init_rc(). 05484 {
05485 if(err < 0)
05486 {
05487 char * tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
05488
05489 if(tmp)
05490 {
05491 rsbac_printk(KERN_WARNING
05492 "rsbac_do_init(): Registering %s list failed with error %s\n",
05493 listname,
05494 get_error_name(tmp, err));
05495 rsbac_kfree(tmp);
05496 }
05497 }
05498 }
|
|
|
Definition at line 1996 of file aci_data_structures.c. References aci_detach_fd_lists(), clear_device_item(), device_list_head, lookup_device(), and NULL. Referenced by rsbac_umount(), rsbac_umount_acl(), rsbac_umount_auth(), and rsbac_umount_mac(). 01997 {
01998 struct rsbac_device_list_item_t * item_p;
01999
02000 /* first we must locate the item. */
02001 if ( (item_p = lookup_device(kdev)) )
02002 { /* ok, item was found */
02003 if (device_list_head.head == item_p)
02004 { /* item is head */
02005 if (device_list_head.tail == item_p)
02006 { /* item is head and tail = only item -> list will be empty*/
02007 device_list_head.head = NULL;
02008 device_list_head.tail = NULL;
02009 }
02010 else
02011 { /* item is head, but not tail -> next item becomes head */
02012 item_p->next->prev = NULL;
02013 device_list_head.head = item_p->next;
02014 }
02015 }
02016 else
02017 { /* item is not head */
02018 if (device_list_head.tail == item_p)
02019 { /*item is not head, but tail -> previous item becomes tail*/
02020 item_p->prev->next = NULL;
02021 device_list_head.tail = item_p->prev;
02022 }
02023 else
02024 { /* item is neither head nor tail -> item is cut out */
02025 item_p->prev->next = item_p->next;
02026 item_p->next->prev = item_p->prev;
02027 }
02028 }
02029
02030 /* curr is no longer valid -> reset. */
02031 device_list_head.curr=NULL;
02032 /* adjust counter */
02033 device_list_head.count--;
02034
02035 /* clean up */
02036 aci_detach_fd_lists(item_p);
02037
02038 /* clear item */
02039 clear_device_item(item_p);
02040 } /* end of if: item was found */
02041
02042 } /* end of remove_device_item() */
|
|
||||||||||||
|
Definition at line 9128 of file aci_data_structures.c. References RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDVALUE, RSBAC_ENOTFOUND, and rsbac_printk(). 09129 {
09130 struct inode * inode_p;
09131 int err = 0;
09132
09133 if(!sb_p)
09134 return -RSBAC_EINVALIDPOINTER;
09135 if(!inode)
09136 return -RSBAC_EINVALIDVALUE;
09137 if(!MAJOR(sb_p->s_dev))
09138 return 0;
09139
09140 if(sb_p->s_magic != EXT2_SUPER_MAGIC)
09141 return 0;
09142
09143 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
09144 if(sb_p->s_op && sb_p->s_op->read_inode2)
09145 return 0;
09146 #endif
09147 inode_p = iget(sb_p, inode);
09148 if(is_bad_inode(inode_p))
09149 {
09150 return -RSBAC_ENOTFOUND;
09151 }
09152 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
09153 /* currently only deletion checking of ext2 inodes is possible */
09154 if(sb_p->s_magic == EXT2_SUPER_MAGIC)
09155 {
09156 if(inode_p->u.ext2_i.i_dtime)
09157 { /* inode has been deleted */
09158 err = -RSBAC_ENOTFOUND;
09159 }
09160 else
09161 {
09162 if(inode_p->i_nlink <= 0)
09163 { /* inode has been unlinked, but no dtime is set -> warn */
09164 rsbac_printk(KERN_WARNING
09165 "rsbac_check_inode(): inode %u with nlink <= 0 on device %02u:%02u detected!\n",
09166 inode, RSBAC_MAJOR(sb_p->s_dev), RSBAC_MINOR(sb_p->s_dev));
09167 err = -RSBAC_ENOTFOUND;
09168 }
09169 }
09170 }
09171 #endif
09172 iput(inode_p);
09173 return err;
09174 }
|
|
|
Definition at line 2049 of file aci_data_structures.c. Referenced by rsbac_write_open(). 02050 {
02051 struct inode *inode = dentry->d_inode;
02052 int error;
02053 struct iattr newattrs;
02054
02055 down(&inode->i_sem);
02056 newattrs.ia_size = 0;
02057 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
02058 error = notify_change(dentry, &newattrs);
02059 up(&inode->i_sem);
02060 return error;
02061 }
|
|
|
Definition at line 7084 of file aci_data_structures.c. References add_device_item(), clear_device_item(), compiled_modules, create_device_item(), device_list_head, get_error_name(), NULL, register_dev_lists(), register_fd_lists(), register_ipc_lists(), register_process_lists(), register_user_lists(), RSBAC_AUTH_LOGIN_PATH, RSBAC_AUTH_LOGIN_PATH_DIR, RSBAC_AUTH_LOGIN_PATH_FILE, rsbac_check(), rsbac_check_acl(), rsbac_check_auth(), rsbac_check_lists(), RSBAC_ECOULDNOTADDDEVICE, RSBAC_ECOULDNOTADDITEM, RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDTARGET, RSBAC_ENOROOTDEV, RSBAC_ENOTFOUND, rsbac_init_acl(), rsbac_init_adf(), rsbac_init_auth(), rsbac_init_daz(), rsbac_init_debug(), rsbac_init_mac(), rsbac_init_pm(), rsbac_init_rc(), rsbac_init_um(), rsbac_initialized, rsbac_kfree(), rsbac_kmalloc(), rsbac_kmem_cache_sizes_init(), rsbac_list_add(), rsbac_list_get_data(), rsbac_list_init(), rsbac_lookup_one_len(), RSBAC_MAXNAMELEN, rsbac_mount(), rsbac_pax_set_flags_func(), rsbac_printk(), rsbac_root_dev, RSBAC_VERSION, sysfs_covered_p, sysfs_sb_p, and TRUE. Referenced by rsbac_init(). 07086 {
07087 int err = 0;
07088 struct rsbac_device_list_item_t * device_p;
07089 struct rsbac_device_list_item_t * new_device_p;
07090 u_long flags;
07091 struct rsbac_list_info_t * list_info_p;
07092 struct super_block * sb_p;
07093
07094 #ifdef CONFIG_RSBAC_DEBUG
07095 if(rsbac_debug_stack)
07096 {
07097 unsigned long * n;
07098
07099 n = (unsigned long *) (current+1);
07100 while (!*n)
07101 n++;
07102 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack: %lu\n",
07103 (unsigned long) n - (unsigned long)(current+1));
07104 }
07105 #endif
07106 list_info_p = kmalloc(sizeof(*list_info_p), GFP_KERNEL);
07107 if(!list_info_p)
07108 {
07109 return -ENOMEM;
07110 }
07111 compiled_modules[0] = (char) 0;
07112 #ifdef CONFIG_RSBAC_REG
07113 strcat(compiled_modules, " REG");
07114 #endif
07115 #ifdef CONFIG_RSBAC_MAC
07116 #ifdef CONFIG_RSBAC_MAC_LIGHT
07117 strcat(compiled_modules, " MAC-L");
07118 #else
07119 strcat(compiled_modules, " MAC");
07120 #endif
07121 #endif
07122 #ifdef CONFIG_RSBAC_PM
07123 strcat(compiled_modules, " PM");
07124 #endif
07125 #ifdef CONFIG_RSBAC_DAZ
07126 strcat(compiled_modules, " DAZ");
07127 #endif
07128 #ifdef CONFIG_RSBAC_FF
07129 strcat(compiled_modules, " FF");
07130 #endif
07131 #ifdef CONFIG_RSBAC_RC
07132 strcat(compiled_modules, " RC");
07133 #endif
07134 #ifdef CONFIG_RSBAC_AUTH
07135 strcat(compiled_modules, " AUTH");
07136 #endif
07137 #ifdef CONFIG_RSBAC_ACL
07138 strcat(compiled_modules, " ACL");
07139 #endif
07140 #ifdef CONFIG_RSBAC_CAP
07141 strcat(compiled_modules, " CAP");
07142 #endif
07143 #ifdef CONFIG_RSBAC_JAIL
07144 strcat(compiled_modules, " JAIL");
07145 #endif
07146 #ifdef CONFIG_RSBAC_RES
07147 strcat(compiled_modules, " RES");
07148 #endif
07149 #ifdef CONFIG_RSBAC_PAX
07150 strcat(compiled_modules, " PAX");
07151 #endif
07152 #ifdef CONFIG_RSBAC_MAINT
07153 rsbac_printk(KERN_INFO
07154 "rsbac_do_init(): Initializing RSBAC %s (Maintenance Mode)\n",
07155 RSBAC_VERSION);
07156 /* Print banner we are initializing */
07157 printk(KERN_INFO "rsbac_do_init(): Initializing RSBAC %s (Maintenance Mode)\n", RSBAC_VERSION);
07158
07159 rsbac_printk(KERN_INFO
07160 "rsbac_do_init(): Supported module data structures:%s\n",
07161 compiled_modules);
07162 #else
07163 rsbac_printk(KERN_INFO
07164 "rsbac_do_init(): Initializing RSBAC %s\n",
07165 RSBAC_VERSION);
07166 /* Print banner we are initializing */
07167 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
07168 if (rsbac_nosyslog)
07169 #endif
07170 printk(KERN_INFO "rsbac_do_init(): Initializing RSBAC %s\n", RSBAC_VERSION);
07171
07172 rsbac_printk(KERN_INFO
07173 "rsbac_do_init(): compiled modules:%s\n",
07174 compiled_modules);
07175 #endif
07176
07177 /* init memory */
07178 rsbac_printk(KERN_INFO
07179 "rsbac_do_init(): Initializing memory slabs\n");
07180 rsbac_kmem_cache_sizes_init();
07181
07182 /* set rw-spinlocks to unlocked status and init data structures */
07183 device_list_head.lock = RW_LOCK_UNLOCKED;
07184 device_list_head.head = NULL;
07185 device_list_head.tail = NULL;
07186 device_list_head.curr = NULL;
07187 device_list_head.count = 0;
07188
07189 #if defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS)
07190 #ifdef CONFIG_RSBAC_DEBUG
07191 if(rsbac_debug_stack)
07192 {
07193 unsigned long * n = (unsigned long *) (current+1);
07194
07195 while (!*n)
07196 n++;
07197 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before registering proc dir: %lu\n",
07198 (unsigned long) n - (unsigned long)(current+1));
07199 }
07200 #endif
07201 rsbac_printk(KERN_INFO "rsbac_do_init(): Registering RSBAC proc dir\n");
07202 register_all_rsbac_proc();
07203 #endif
07204
07205 #ifdef CONFIG_RSBAC_DEBUG
07206 if(rsbac_debug_stack)
07207 {
07208 unsigned long * n = (unsigned long *) (current+1);
07209
07210 while (!*n)
07211 n++;
07212 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before get_super: %lu\n",
07213 (unsigned long) n - (unsigned long)(current+1));
07214 }
07215 #endif
07216 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
07217 sb_p = user_get_super(rsbac_root_dev);
07218 #else
07219 sb_p = get_super(rsbac_root_dev);
07220 #endif
07221 if(!sb_p)
07222 {
07223 kfree(list_info_p);
07224 return -RSBAC_ENOROOTDEV;
07225 }
07226 /* read fd aci from root device */
07227 #ifdef CONFIG_RSBAC_DEBUG
07228 if (rsbac_debug_ds)
07229 {
07230 rsbac_printk(KERN_DEBUG
07231 "rsbac_do_init(): reading aci from device number %02u:%02u\n",
07232 RSBAC_MAJOR(rsbac_root_dev),
07233 RSBAC_MINOR(rsbac_root_dev));
07234 }
07235 #endif
07236 /* create a private device item */
07237 new_device_p = create_device_item(sb_p, NULL);
07238 if (!new_device_p)
07239 {
07240 rsbac_printk(KERN_CRIT "rsbac_do_init(): Could not alloc device item!\n");
07241 err = -RSBAC_ECOULDNOTADDDEVICE;
07242 goto out_free;
07243 }
07244 /* Add new_device_p to device list */
07245 /* wait for write access to device_list_head */
07246 rsbac_write_lock(&device_list_head.lock, &flags);
07247 /* OK, go on */
07248 device_p = add_device_item(new_device_p);
07249 /* device was added, allow access */
07250 rsbac_write_unlock(&device_list_head.lock, &flags);
07251 if (!device_p)
07252 {
07253 rsbac_printk(KERN_CRIT "rsbac_do_init(): Could not add device!\n");
07254 clear_device_item(new_device_p);
07255 err = -RSBAC_ECOULDNOTADDDEVICE;
07256 goto out_free;
07257 }
07258
07259 /* init lists - we need the root device_p to be initialized, but no generic list registered */
07260 rsbac_printk(KERN_INFO
07261 "rsbac_do_init(): Initializing generic lists\n");
07262 rsbac_list_init();
07263
07264 #ifdef CONFIG_RSBAC_DEBUG
07265 if(rsbac_debug_stack)
07266 {
07267 unsigned long * n = (unsigned long *) (current+1);
07268
07269 while (!*n)
07270 n++;
07271 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before init_debug: %lu\n",
07272 (unsigned long) n - (unsigned long)(current+1));
07273 }
07274 #endif
07275 rsbac_init_debug();
07276
07277 rsbac_printk(KERN_INFO
07278 "rsbac_do_init(): reading FD attributes from root dev\n");
07279
07280 #ifdef CONFIG_RSBAC_DEBUG
07281 if(rsbac_debug_stack)
07282 {
07283 unsigned long * n = (unsigned long *) (current+1);
07284
07285 while (!*n)
07286 n++;
07287 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before reading FD lists: %lu\n",
07288 (unsigned long) n - (unsigned long)(current+1));
07289 }
07290 #endif
07291 /* no locking needed, device_p is known and there can be no parallel init! */
07292 if((err = register_fd_lists(device_p,rsbac_root_dev)))
07293 {
07294 char * tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
07295
07296 if(tmp)
07297 {
07298 rsbac_printk(KERN_WARNING
07299 "rsbac_do_init(): File/Dir lists registration failed for dev %02u:%02u, err %s!\n",
07300 RSBAC_MAJOR(rsbac_root_dev), RSBAC_MINOR(rsbac_root_dev), get_error_name(tmp,err));
07301 rsbac_kfree(tmp);
07302 }
07303 }
07304
07305 #ifdef CONFIG_RSBAC_DEBUG
07306 if(rsbac_debug_stack)
07307 {
07308 unsigned long * n = (unsigned long *) (current+1);
07309
07310 while (!*n)
07311 n++;
07312 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before DEV lists registration: %lu\n",
07313 (unsigned long) n - (unsigned long)(current+1));
07314 }
07315 #endif
07316 register_dev_lists();
07317
07318 #ifdef CONFIG_RSBAC_DEBUG
07319 if(rsbac_debug_stack)
07320 {
07321 unsigned long * n = (unsigned long *) (current+1);
07322
07323 while (!*n)
07324 n++;
07325 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before registering IPC lists: %lu\n",
07326 (unsigned long) n - (unsigned long)(current+1));
07327 }
07328 #endif
07329
07330 register_ipc_lists();
07331
07332 #ifdef CONFIG_RSBAC_DEBUG
07333 if(rsbac_debug_stack)
07334 {
07335 unsigned long * n = (unsigned long *) (current+1);
07336
07337 while (!*n)
07338 n++;
07339 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before registering USER lists: %lu\n",
07340 (unsigned long) n - (unsigned long)(current+1));
07341 }
07342 #endif
07343 register_user_lists();
07344
07345 #ifdef CONFIG_RSBAC_DEBUG
07346 if(rsbac_debug_stack)
07347 {
07348 unsigned long * n = (unsigned long *) (current+1);
07349
07350 while (!*n)
07351 n++;
07352 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before registering PROCESS aci: %lu\n",
07353 (unsigned long) n - (unsigned long)(current+1));
07354 }
07355 #endif
07356 register_process_lists();
07357
07358
07359 #ifdef CONFIG_RSBAC_UM
07360 #ifdef CONFIG_RSBAC_DEBUG
07361 if(rsbac_debug_stack)
07362 {
07363 unsigned long * n = (unsigned long *) (current+1);
07364
07365 while (!*n)
07366 n++;
07367 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before GROUP lists registration: %lu\n",
07368 (unsigned long) n - (unsigned long)(current+1));
07369 }
07370 #endif
07371 register_group_lists();
07372 #endif /* CONFIG_RSBAC_UM */
07373
07374 #ifdef CONFIG_RSBAC_NET_DEV
07375 register_netdev_lists();
07376 #endif
07377
07378 #ifdef CONFIG_RSBAC_NET_OBJ
07379 register_nettemp_list();
07380 register_nettemp_aci_lists();
07381 register_netobj_lists();
07382 #endif /* NET_OBJ */
07383
07384 /* Call other init functions */
07385 #if defined(CONFIG_RSBAC_MAC)
07386 #ifdef CONFIG_RSBAC_DEBUG
07387 if(rsbac_debug_stack)
07388 {
07389 unsigned long * n = (unsigned long *) (current+1);
07390
07391 while (!*n)
07392 n++;
07393 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before init_mac: %lu\n",
07394 (unsigned long) n - (unsigned long)(current+1));
07395 }
07396 #endif
07397 rsbac_init_mac();
07398 #endif
07399
07400 #ifdef CONFIG_RSBAC_PM
07401 #ifdef CONFIG_RSBAC_DEBUG
07402 if(rsbac_debug_stack)
07403 {
07404 unsigned long * n = (unsigned long *) (current+1);
07405
07406 while (!*n)
07407 n++;
07408 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before init_pm: %lu\n",
07409 (unsigned long) n - (unsigned long)(current+1));
07410 }
07411 #endif
07412 rsbac_init_pm();
07413 #endif
07414
07415 #if defined(CONFIG_RSBAC_DAZ) && !defined(CONFIG_RSBAC_MAINT)
07416 #ifdef CONFIG_RSBAC_DEBUG
07417 if(rsbac_debug_stack)
07418 {
07419 unsigned long * n = (unsigned long *) (current+1);
07420
07421 while (!*n)
07422 n++;
07423 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before init_daz: %lu\n",
07424 (unsigned long) n - (unsigned long)(current+1));
07425 }
07426 #endif
07427 rsbac_init_daz();
07428 #endif
07429
07430 #if defined(CONFIG_RSBAC_RC)
07431 #ifdef CONFIG_RSBAC_DEBUG
07432 if(rsbac_debug_stack)
07433 {
07434 unsigned long * n = (unsigned long *) (current+1);
07435
07436 while (!*n)
07437 n++;
07438 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before init_rc: %lu\n",
07439 (unsigned long) n - (unsigned long)(current+1));
07440 }
07441 #endif
07442 rsbac_init_rc();
07443 #endif
07444
07445 #if defined(CONFIG_RSBAC_AUTH)
07446 #ifdef CONFIG_RSBAC_DEBUG
07447 if(rsbac_debug_stack)
07448 {
07449 unsigned long * n = (unsigned long *) (current+1);
07450
07451 while (!*n)
07452 n++;
07453 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before init_auth: %lu\n",
07454 (unsigned long) n - (unsigned long)(current+1));
07455 }
07456 #endif
07457 rsbac_init_auth();
07458 if (rsbac_auth_enable_login)
07459 {
07460 struct dentry * t_dentry;
07461 struct dentry * dir_dentry = NULL;
07462 struct rsbac_auth_fd_aci_t auth_fd_aci = DEFAULT_AUTH_FD_ACI;
07463 int list_no;
07464
07465 rsbac_printk(KERN_WARNING
07466 "rsbac_do_init(): auth_enable_login is set: setting auth_may_setuid for %s\n",
07467 RSBAC_AUTH_LOGIN_PATH);
07468
07469 /* lookup filename */
07470 if(sb_p)
07471 {
07472 dir_dentry = rsbac_lookup_one_len(RSBAC_AUTH_LOGIN_PATH_DIR,
07473 sb_p->s_root,
07474 strlen(RSBAC_AUTH_LOGIN_PATH_DIR));
07475 }
07476 if (!dir_dentry)
07477 {
07478 err = -RSBAC_ENOTFOUND;
07479 rsbac_printk(KERN_WARNING "rsbac_do_init(): call to rsbac_lookup_one_len for /%s failed\n",
07480 RSBAC_AUTH_LOGIN_PATH_DIR);
07481 goto auth_out;
07482 }
07483 if (IS_ERR(dir_dentry))
07484 {
07485 err = PTR_ERR(dir_dentry);
07486 rsbac_printk(KERN_WARNING "rsbac_do_init(): call to rsbac_lookup_one_len for /%s returned %i\n",
07487 RSBAC_AUTH_LOGIN_PATH_DIR,
07488 err);
07489 goto auth_out;
07490 }
07491 if (!dir_dentry->d_inode)
07492 {
07493 err = -RSBAC_ENOTFOUND;
07494 rsbac_printk(KERN_WARNING "rsbac_do_init(): call to rsbac_lookup_one_len for /%s failed\n",
07495 RSBAC_AUTH_LOGIN_PATH_DIR);
07496 dput(dir_dentry);
07497 goto auth_out;
07498 }
07499 t_dentry = rsbac_lookup_one_len(RSBAC_AUTH_LOGIN_PATH_FILE,
07500 dir_dentry,
07501 strlen(RSBAC_AUTH_LOGIN_PATH_FILE));
07502 if (!t_dentry)
07503 {
07504 err = -RSBAC_ENOTFOUND;
07505 rsbac_printk(KERN_WARNING "rsbac_do_init(): call to rsbac_lookup_one_len for /%s/%s failed\n",
07506 RSBAC_AUTH_LOGIN_PATH_DIR,
07507 RSBAC_AUTH_LOGIN_PATH_FILE);
07508 goto auth_out;
07509 }
07510 if (IS_ERR(t_dentry))
07511 {
07512 err = PTR_ERR(t_dentry);
07513 rsbac_printk(KERN_WARNING "rsbac_do_init(): call to rsbac_lookup_one_len for /%s/%s returned %i\n",
07514 RSBAC_AUTH_LOGIN_PATH_DIR,
07515 RSBAC_AUTH_LOGIN_PATH_FILE,
07516 err);
07517 goto auth_out;
07518 }
07519 if (!t_dentry->d_inode)
07520 {
07521 err = -RSBAC_ENOTFOUND;
07522 rsbac_printk(KERN_WARNING "rsbac_do_init(): call to rsbac_lookup_one_len for /%s/%s failed\n",
07523 RSBAC_AUTH_LOGIN_PATH_DIR,
07524 RSBAC_AUTH_LOGIN_PATH_FILE);
07525 dput(t_dentry);
07526 goto auth_out;
07527 }
07528
07529 if (!t_dentry->d_inode)
07530 {
07531 rsbac_printk(KERN_WARNING "rsbac_do_init(): file %s not found\n",
07532 RSBAC_AUTH_LOGIN_PATH);
07533 err = -RSBAC_EINVALIDTARGET;
07534 goto auth_out_dput;
07535 }
07536 /* is inode of type file? */
07537 if (!S_ISREG(t_dentry->d_inode->i_mode))
07538 {
07539 rsbac_printk(KERN_WARNING "rsbac_do_init(): %s is no file\n", RSBAC_AUTH_LOGIN_PATH);
07540 err = -RSBAC_EINVALIDTARGET;
07541 goto auth_out_dput;
07542 }
07543 list_no = auth_fd_hash(t_dentry->d_inode->i_ino);
07544 rsbac_list_get_data(device_p->handles.auth[list_no],
07545 &t_dentry->d_inode->i_ino,
07546 &auth_fd_aci);
07547 auth_fd_aci.auth_may_setuid = TRUE;
07548 if(rsbac_list_add(device_p->handles.auth[list_no],
07549 &t_dentry->d_inode->i_ino,
07550 &auth_fd_aci))
07551 { /* Adding failed! */
07552 rsbac_printk(KERN_WARNING
07553 "rsbac_do_init(): Could not add AUTH file/dir item!\n");
07554 err = -RSBAC_ECOULDNOTADDITEM;
07555 }
07556
07557 auth_out_dput:
07558 auth_out:
07559 { }
07560 }
07561 #endif
07562
07563 #if defined(CONFIG_RSBAC_ACL)
07564 #ifdef CONFIG_RSBAC_DEBUG
07565 if(rsbac_debug_stack)
07566 {
07567 unsigned long * n = (unsigned long *) (current+1);
07568
07569 while (!*n)
07570 n++;
07571 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before init_acl: %lu\n",
07572 (unsigned long) n - (unsigned long)(current+1));
07573 }
07574 #endif
07575 rsbac_init_acl();
07576 #endif
07577
07578 #if defined(CONFIG_RSBAC_UM)
07579 #ifdef CONFIG_RSBAC_DEBUG
07580 if(rsbac_debug_stack)
07581 {
07582 unsigned long * n = (unsigned long *) (current+1);
07583
07584 while (!*n)
07585 n++;
07586 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before init_um: %lu\n",
07587 (unsigned long) n - (unsigned long)(current+1));
07588 }
07589 #endif
07590 rsbac_init_um();
07591 #endif
07592
07593
07594 #ifdef CONFIG_RSBAC_DEBUG
07595 if(rsbac_debug_stack)
07596 {
07597 unsigned long * n = (unsigned long *) (current+1);
07598
07599 while (!*n)
07600 n++;
07601 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before init_adf: %lu\n",
07602 (unsigned long) n - (unsigned long)(current+1));
07603 }
07604 #endif
07605 rsbac_init_adf();
07606
07607 /* free super_block pointer */
07608 drop_super(sb_p);
07609
07610 #if defined(CONFIG_RSBAC_PAX) && defined(CONFIG_PAX_HOOK_ACL_FLAGS)
07611 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
07612 pax_set_initial_flags_func = rsbac_pax_set_flags_func;
07613 #else
07614 pax_set_flags_func = rsbac_pax_set_flags_func;
07615 #endif
07616 #endif
07617
07618 /* Tell that rsbac is initialized */
07619 rsbac_initialized = TRUE;
07620
07621 /* Add initrd mount */
07622 #ifdef CONFIG_BLK_DEV_INITRD
07623 if(initrd_start)
07624 {
07625 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
07626 sb_p = user_get_super(MKDEV(RAMDISK_MAJOR,0));
07627 #else
07628 sb_p = get_super(MKDEV(RAMDISK_MAJOR,0));
07629 #endif
07630 if(sb_p)
07631 {
07632 rsbac_mount(sb_p, NULL);
07633 drop_super(sb_p);
07634 }
07635 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
07636 sb_p = user_get_super(MKDEV(RAMDISK_MAJOR,INITRD_MINOR));
07637 #else
07638 sb_p = get_super(MKDEV(RAMDISK_MAJOR,INITRD_MINOR));
07639 #endif
07640 if(sb_p)
07641 {
07642 rsbac_mount(sb_p, NULL);
07643 drop_super(sb_p);
07644 }
07645 }
07646 #endif
07647
07648 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
07649 /* Add sysfs mount */
07650 if( sysfs_covered_p
07651 && sysfs_sb_p
07652 )
07653 {
07654 rsbac_printk(KERN_WARNING "rsbac_do_init(): automounting sysfs device %02u:%02u\n",
07655 MAJOR(sysfs_sb_p->s_dev), MINOR(sysfs_sb_p->s_dev));
07656 rsbac_mount(sysfs_sb_p, sysfs_covered_p);
07657 }
07658 #endif
07659
07660 /* Add devfs mount */
07661 #ifdef CONFIG_DEVFS_MOUNT
07662 if( devfs_covered_p
07663 && devfs_sb_p
07664 )
07665 {
07666 rsbac_printk(KERN_WARNING "rsbac_do_init(): automounting devfs device %02u:%02u\n",
07667 MAJOR(devfs_sb_p->s_dev), MINOR(devfs_sb_p->s_dev));
07668 rsbac_mount(devfs_sb_p, devfs_covered_p);
07669 }
07670 #endif
07671
07672 /* Force a check, if configured */
07673 #ifdef CONFIG_RSBAC_INIT_CHECK
07674 #ifdef CONFIG_RSBAC_DEBUG
07675 if(rsbac_debug_stack)
07676 {
07677 unsigned long * n = (unsigned long *) (current+1);
07678
07679 while (!*n)
07680 n++;
07681 rsbac_printk(KERN_DEBUG "rsbac_do_init: free stack before rsbac_check: %lu\n",
07682 (unsigned long) n - (unsigned long)(current+1));
07683 }
07684 #endif
07685 rsbac_printk(KERN_INFO "rsbac_do_init(): Forcing consistency check.\n");
07686 rsbac_check_lists(1);
07687 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
07688 rsbac_check(1,0);
07689 /* call other checks */
07690 #if defined(CONFIG_RSBAC_AUTH)
07691 rsbac_check_auth(1,0);
07692 #endif
07693 #endif
07694 #if defined(CONFIG_RSBAC_ACL)
07695 rsbac_check_acl(1,0);
07696 #endif
07697 #endif
07698
07699 if (!current->fs)
07700 {
07701 rsbac_printk(KERN_WARNING "rsbac_do_init(): current->fs is invalid!\n");
07702 err = -RSBAC_EINVALIDPOINTER;
07703 }
07704 out:
07705 /* Ready. */
07706 rsbac_printk(KERN_INFO "rsbac_do_init(): Ready.\n");
07707 /* We are up and running */
07708 rsbac_printk(KERN_INFO "rsbac_do_init(): Ready.\n");
07709
07710 kfree(list_info_p);
07711 return err;
07712
07713 out_free:
07714 /* free super_block pointer */
07715 drop_super(sb_p);
07716 goto out;
07717 }
|
|
|
Definition at line 8583 of file aci_data_structures.c. References device_list_head, NULL, RSBAC_ENOTINITIALIZED, rsbac_initialized, and rsbac_printk(). 08584 {
08585 u_long flags;
08586 struct rsbac_device_list_item_t * device_p;
08587
08588 if (!rsbac_initialized)
08589 {
08590 rsbac_printk(KERN_WARNING "rsbac_free_dat_dentry(): RSBAC not initialized\n");
08591 return(-RSBAC_ENOTINITIALIZED);
08592 }
08593
08594 rsbac_printk(KERN_INFO "rsbac_free_dat_dentry(): freeing dat dir dentries\n");
08595
08596 /* wait for write access to device_list_head */
08597 rsbac_write_lock_irq(&device_list_head.lock, &flags);
08598 /* OK, nobody else is working on it... */
08599 device_p = device_list_head.head;
08600 while(device_p)
08601 {
08602 if(device_p->rsbac_dir_dentry_p)
08603 {
08604 dput(device_p->rsbac_dir_dentry_p);
08605 device_p->rsbac_dir_dentry_p = NULL;
08606 }
08607 device_p = device_p->next;
08608 }
08609 /* allow access */
08610 rsbac_write_unlock_irq(&device_list_head.lock, &flags);
08611
08612 return(0);
08613 }
|
|
||||||||||||||||
|
Definition at line 2667 of file aci_data_structures.c. References A_pseudo, FALSE, GEN, lookup_device(), rsbac_attribute_value_t::pseudo, RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDVALUE, RSBAC_ENOMEM, rsbac_get_attr, rsbac_kfree(), rsbac_kmalloc(), RSBAC_MAXNAMELEN, T_USER, and rsbac_target_id_t::user. Referenced by get_target_name(), rsbac_adf_request_int(), rsbac_jail_sys_jail(), and xp_fill_file_struct(). 02668 {
02669 int len=0;
02670 char * i_path;
02671 int tmplen=0;
02672 #ifdef CONFIG_RSBAC_LOG_PSEUDO_FS
02673 union rsbac_target_id_t i_tid;
02674 union rsbac_attribute_value_t i_attr_val;
02675 #endif
02676
02677 if(!dentry_p || !path)
02678 return -RSBAC_EINVALIDPOINTER;
02679 if(maxlen <= 0)
02680 return -RSBAC_EINVALIDVALUE;
02681 i_path = rsbac_kmalloc(maxlen + RSBAC_MAXNAMELEN);
02682 if(!i_path)
02683 return -RSBAC_ENOMEM;
02684
02685 path[0] = 0;
02686
02687 while(dentry_p && (len<maxlen) && dentry_p->d_name.len && dentry_p->d_name.name)
02688 {
02689 #ifdef CONFIG_RSBAC_LOG_PSEUDO_FS
02690 if( dentry_p->d_inode
02691 && dentry_p->d_parent
02692 && dentry_p->d_parent->d_inode
02693 && (i_tid.user = dentry_p->d_inode->i_uid)
02694 && (dentry_p->d_inode->i_uid != dentry_p->d_parent->d_inode->i_uid)
02695 && !rsbac_get_attr(GEN,T_USER,i_tid,A_pseudo,&i_attr_val,FALSE)
02696 && i_attr_val.pseudo
02697 )
02698 { /* Max len of 32 Bit value in decimal print is 11 */
02699 if((maxlen-len) < 12)
02700 {
02701 rsbac_kfree(i_path);
02702 return(len);
02703 }
02704 tmplen = snprintf(i_path, 11, "%u", i_attr_val.pseudo);
02705 }
02706 else
02707 #endif
02708 {
02709 tmplen = dentry_p->d_name.len;
02710 if((tmplen+1) > (maxlen-len))
02711 {
02712 rsbac_kfree(i_path);
02713 return(len);
02714 }
02715 strncpy(i_path, dentry_p->d_name.name, tmplen);
02716 }
02717 if(len && (i_path[tmplen-1] != '/'))
02718 {
02719 i_path[tmplen] = '/';
02720 tmplen++;
02721 }
02722 i_path[tmplen]=0;
02723 strcat(i_path, path);
02724 strcpy(path, i_path);
02725 len += tmplen;
02726 if( dentry_p->d_parent
02727 && (dentry_p->d_parent != dentry_p)
02728 && (dentry_p->d_sb->s_root != dentry_p)
02729 )
02730 dentry_p = dentry_p->d_parent;
02731 else
02732 {
02733 struct rsbac_device_list_item_t * device_p;
02734
02735 device_p = lookup_device(dentry_p->d_sb->s_dev);
02736 if( device_p
02737 && device_p->d_covers
02738 )
02739 dentry_p = device_p->d_covers;
02740 else
02741 break;
02742 }
02743 }
02744 rsbac_kfree(i_path);
02745 return(len);
02746 }
|
|
|
Definition at line 2751 of file aci_data_structures.c. References lookup_device(), and RSBAC_EINVALIDPOINTER. Referenced by xp_fill_file_struct(). 02752 {
02753 int len=0;
02754 int tmplen=0;
02755
02756 if(!dentry_p)
02757 return -RSBAC_EINVALIDPOINTER;
02758
02759 while(dentry_p && dentry_p->d_name.len && dentry_p->d_name.name)
02760 {
02761 tmplen = dentry_p->d_name.len;
02762 if(len && (dentry_p->d_name.name[tmplen-1] != '/'))
02763 {
02764 tmplen++;
02765 }
02766 len += tmplen;
02767 if( dentry_p->d_parent
02768 && (dentry_p->d_parent != dentry_p)
02769 && (dentry_p->d_sb->s_root != dentry_p)
02770 )
02771 dentry_p = dentry_p->d_parent;
02772 else
02773 {
02774 struct rsbac_device_list_item_t * device_p;
02775
02776 device_p = lookup_device(dentry_p->d_sb->s_dev);
02777 if( device_p
02778 && device_p->d_covers
02779 )
02780 dentry_p = device_p->d_covers;
02781 else
02782 break;
02783 }
02784 }
02785 return(len);
02786 }
|
|
||||||||||||||||||||
|
Definition at line 9805 of file aci_data_structures.c. References device_list_head, lookup_device(), RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDTARGET, RSBAC_ENOTFOUND, rsbac_printk(), T_DIR, T_FIFO, T_FILE, and T_SYMLINK. Referenced by copy_fp_cap_set_item(), copy_fp_tru_set_item(), get_attr_fd(), rsbac_acl_get_rights(), and rsbac_acl_get_single_right(). 09809 {
09810 if(!parent_target_p || !parent_tid_p)
09811 return -RSBAC_EINVALIDPOINTER;
09812 /*
09813 #ifdef CONFIG_RSBAC_DEBUG
09814 if (rsbac_debug_ds)
09815 {
09816 rsbac_printk(KERN_DEBUG
09817 "rsbac_get_parent(): Getting file/dir/fifo/symlink parent for device %02u:%02u, inode %lu, dentry_p %p\n",
09818 RSBAC_MAJOR(tid.file.device),RSBAC_MINOR(tid.file.device), (u_long) tid.file.inode, tid.file.dentry_p);
09819 }
09820 #endif
09821 */
09822 switch(target)
09823 {
09824 case T_FILE:
09825 case T_DIR:
09826 case T_FIFO:
09827 case T_SYMLINK:
09828 break;
09829 default:
09830 return -RSBAC_EINVALIDTARGET;
09831 }
09832
09833 if(!tid.file.dentry_p)
09834 return -RSBAC_ENOTFOUND;
09835
09836 *parent_target_p = T_DIR;
09837 /* Is this dentry root of a mounted device? */
09838 if( tid.file.dentry_p->d_sb
09839 && (tid.file.dentry_p->d_sb->s_root == tid.file.dentry_p)
09840 )
09841 {
09842 struct rsbac_device_list_item_t * device_p;
09843 u_long dflags;
09844
09845 /* wait for read access to device_list_head */
09846 rsbac_read_lock(&device_list_head.lock, &dflags);
09847
09848 device_p = lookup_device(tid.file.device);
09849 if( !device_p
09850 || !device_p->d_covers
09851 || !device_p->d_covers->d_parent
09852 || !device_p->d_covers->d_parent->d_inode
09853 )
09854 {
09855 /* free access to device_list_head */
09856 rsbac_read_unlock(&device_list_head.lock, &dflags);
09857 return -RSBAC_ENOTFOUND;
09858 }
09859 parent_tid_p->dir.device = device_p->d_covers->d_parent->d_sb->s_dev;
09860 parent_tid_p->dir.inode = device_p->d_covers->d_parent->d_inode->i_ino;
09861 parent_tid_p->dir.dentry_p = device_p->d_covers->d_parent;
09862 /* free access to device_list_head */
09863 rsbac_read_unlock(&device_list_head.lock, &dflags);
09864 }
09865 else
09866 { /* no root of filesystem -> use d_parent, dev keeps unchanged */
09867 if(!tid.file.dentry_p->d_parent)
09868 {
09869 rsbac_printk(KERN_WARNING
09870 "rsbac_get_parent(): oops - d_parent is NULL!\n");
09871 return -RSBAC_ENOTFOUND;
09872 }
09873 if(tid.file.dentry_p == tid.file.dentry_p->d_parent)
09874 {
09875 rsbac_printk(KERN_WARNING
09876 "rsbac_get_parent(): oops - d_parent == dentry_p!\n");
09877 return -RSBAC_ENOTFOUND;
09878 }
09879 if(!tid.file.dentry_p->d_parent->d_inode)
09880 {
09881 rsbac_printk(KERN_WARNING
09882 "rsbac_get_parent(): oops - d_parent has no d_inode!\n");
09883 return -RSBAC_ENOTFOUND;
09884 }
09885 parent_tid_p->dir.device = tid.file.device;
09886 parent_tid_p->dir.inode = tid.file.dentry_p->d_parent->d_inode->i_ino;
09887 parent_tid_p->dir.dentry_p = tid.file.dentry_p->d_parent;
09888 }
09889 return 0;
09890 }
|
|
|
Definition at line 2071 of file aci_data_structures.c. References device_list_head, lookup_device(), NULL, rsbac_mount(), rsbac_printk(), rsbac_write_sem, and wakeup_auto(). Referenced by lookup_aci_path_dentry(), rsbac_acl_add_to_acl_entry(), rsbac_acl_get_mask(), rsbac_acl_get_rights(), rsbac_acl_get_single_right(), rsbac_acl_get_tlist(), rsbac_acl_remove_acl(), rsbac_acl_remove_acl_entry(), rsbac_acl_remove_from_acl_entry(), rsbac_acl_set_acl_entry(), rsbac_acl_set_mask(), rsbac_adf_request_int(), rsbac_adf_set_attr(), rsbac_auth_add_to_f_capset(), rsbac_auth_clear_f_capset(), rsbac_auth_copy_fp_capset(), rsbac_auth_get_f_caplist(), rsbac_auth_remove_from_f_capset(), rsbac_check_acl(), rsbac_mac_add_to_f_truset(), rsbac_mac_clear_f_truset(), rsbac_mac_copy_fp_truset(), rsbac_mac_get_f_trulist(), rsbac_mac_remove_from_f_truset(), and rsbac_write_open(). 02072 {
02073 struct rsbac_device_list_item_t * device_p;
02074 u_long dflags;
02075 struct super_block * sb_p;
02076
02077 if(RSBAC_IS_AUTO_DEV(kdev))
02078 return NULL;
02079
02080 /* get super_block-pointer */
02081 rsbac_read_lock(&device_list_head.lock, &dflags);
02082 device_p = lookup_device(kdev);
02083 if (!device_p)
02084 {
02085 rsbac_read_unlock(&device_list_head.lock, &dflags);
02086 down(&rsbac_write_sem);
02087 up(&rsbac_write_sem);
02088 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
02089 sb_p = user_get_super(kdev);
02090 #else
02091 sb_p = get_super(kdev);
02092 #endif
02093 if(!sb_p)
02094 { /* Wait a second and retry */
02095 DECLARE_WAIT_QUEUE_HEAD(auto_wait);
02096 struct timer_list auto_timer;
02097
02098 rsbac_printk(KERN_INFO
02099 "rsbac_get_super_block(): device %02u:%02u not yet available, sleeping\n",
02100 RSBAC_MAJOR(kdev), RSBAC_MINOR(kdev));
02101 init_timer(&auto_timer);
02102 auto_timer.function = wakeup_auto;
02103 auto_timer.data = (u_long) &auto_wait;
02104 auto_timer.expires = jiffies + HZ;
02105 add_timer(&auto_timer);
02106 interruptible_sleep_on(&auto_wait);
02107
02108 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
02109 sb_p = user_get_super(kdev);
02110 #else
02111 sb_p = get_super(kdev);
02112 #endif
02113 }
02114 if(sb_p)
02115 {
02116 device_p = lookup_device(kdev);
02117 if (!device_p)
02118 {
02119 rsbac_printk(KERN_INFO
02120 "rsbac_get_super_block(): auto-mounting device %02u:%02u\n",
02121 RSBAC_MAJOR(kdev), RSBAC_MINOR(kdev));
02122 rsbac_mount(sb_p, NULL);
02123 }
02124 /* free super_block pointer */
02125 drop_super(sb_p);
02126 rsbac_read_lock(&device_list_head.lock, &dflags);
02127 device_p = lookup_device(kdev);
02128 if (!device_p)
02129 {
02130 rsbac_printk(KERN_WARNING
02131 "rsbac_get_super_block(): unknown device %02u:%02u\n",
02132 RSBAC_MAJOR(kdev), RSBAC_MINOR(kdev));
02133 rsbac_read_unlock(&device_list_head.lock, &dflags);
02134 return NULL;
02135 }
02136 }
02137 else
02138 {
02139 return NULL;
02140 }
02141 }
02142 sb_p = device_p->sb_p;
02143 rsbac_read_unlock(&device_list_head.lock, &dflags);
02144 return sb_p;
02145 }
|
|
|
Definition at line 7945 of file aci_data_structures.c. Referenced by rsbac_mount(). 07947 {
07948 int err = 0;
07949 #if (defined(CONFIG_RSBAC_AUTO_WRITE) && (CONFIG_RSBAC_AUTO_WRITE > 0)) \
07950 || defined(CONFIG_RSBAC_INIT_THREAD)
07951 rsbac_pid_t rsbacd_pid;
07952 #endif
07953
07954 if (rsbac_initialized)
07955 {
07956 rsbac_printk(KERN_WARNING "rsbac_init(): RSBAC already initialized\n");
07957 return(-RSBAC_EREINIT);
07958 }
07959 if (!current->fs)
07960 {
07961 rsbac_printk(KERN_WARNING "rsbac_init(): current->fs is invalid!\n");
07962 return(-RSBAC_EINVALIDPOINTER);
07963 }
07964
07965 rsbac_root_dev = root_dev;
07966
07967 #if (defined(CONFIG_RSBAC_AUTO_WRITE) && (CONFIG_RSBAC_AUTO_WRITE > 0)) \
07968 || defined(CONFIG_RSBAC_INIT_THREAD)
07969 /* init the rsbacd wait queue head */
07970 init_waitqueue_head(&rsbacd_wait);
07971 #endif
07972
07973 #ifdef CONFIG_RSBAC_INIT_THREAD
07974 /* trigger dependency */
07975 #ifdef CONFIG_RSBAC_MAX_INIT_TIME
07976 #endif
07977 rsbac_printk(KERN_INFO "rsbac_init(): Setting init timeout to %u seconds (%u jiffies).\n",
07978 RSBAC_MAX_INIT_TIME, RSBAC_MAX_INIT_TIME * HZ);
07979 init_timer(&rsbac_timer);
07980 rsbac_timer.function = wakeup_rsbacd;
07981 rsbac_timer.data = 0;
07982 rsbac_timer.expires = jiffies + (RSBAC_MAX_INIT_TIME * HZ);
07983 add_timer(&rsbac_timer);
07984
07985 /* Start rsbac thread for init */
07986 rsbacd_pid = kernel_thread(rsbac_initd, NULL, 0);
07987 rsbac_printk(KERN_INFO "rsbac_init(): Started rsbac_initd thread with pid %u\n",
07988 rsbacd_pid);
07989
07990 if(!rsbac_initialized)
07991 interruptible_sleep_on(&rsbacd_wait);
07992 if(!rsbac_initialized)
07993 {
07994 rsbac_printk(KERN_ERR
07995 "rsbac_init(): *** RSBAC init timed out - RSBAC not correctly initialized! ***\n");
07996 rsbac_printk(KERN_ERR
07997 "rsbac_init(): *** Killing rsbac_initd! ***\n");
07998 sys_kill(rsbacd_pid, SIGKILL);
07999 rsbac_initialized = FALSE;
08000 }
08001 #else
08002 rsbac_do_init();
08003 #endif
08004
08005 #if defined(CONFIG_RSBAC_AUTO_WRITE) && (CONFIG_RSBAC_AUTO_WRITE > 0)
08006 if(rsbac_initialized)
08007 {
08008 /* Start rsbacd thread for auto write */
08009 rsbacd_pid = kernel_thread(rsbacd, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
08010 if(rsbacd_pid < 0)
08011 {
08012 rsbac_printk(KERN_ERR
08013 "rsbac_init(): *** Starting rsbacd thread failed with error %i! ***\n",
08014 rsbacd_pid);
08015 }
08016 else
08017 {
08018 rsbac_printk(KERN_INFO "rsbac_init(): Started rsbacd thread with pid %u\n",
08019 rsbacd_pid);
08020 }
08021 }
08022 #endif
08023
08024 /* Ready. */
08025 /* schedule(); */
08026 #ifdef CONFIG_RSBAC_INIT_THREAD
08027 sys_wait4(-1, NULL, WNOHANG, NULL);
08028 #endif
08029
08030 /* Add all processes to list of processes as init processes */
08031 #if defined(CONFIG_RSBAC_MAC) || defined(CONFIG_RSBAC_RC)
08032 {
08033 #ifdef CONFIG_RSBAC_MAC
08034 struct rsbac_mac_user_aci_t mac_u_aci;
08035 #endif
08036 #ifdef CONFIG_RSBAC_RC
08037 struct rsbac_rc_user_aci_t rc_u_aci;
08038 struct rsbac_rc_process_aci_t rc_init_p_aci = DEFAULT_RC_P_INIT_ACI;
08039 #endif
08040 rsbac_uid_t user = RSBAC_SYSADM_UID;
08041 rsbac_pid_t pid = 1;
08042 struct task_struct * p;
08043
08044 rsbac_printk(KERN_INFO "rsbac_init(): Adjusting attributes of existing processes\n");
08045 /* Prepare entries: change standard values to root's values */
08046 #ifdef CONFIG_RSBAC_MAC
08047 if(!rsbac_list_get_data(user_handles.mac, &user, &mac_u_aci))
08048 {
08049 mac_init_p_aci.owner_sec_level = mac_u_aci.security_level;
08050 mac_init_p_aci.owner_initial_sec_level = mac_u_aci.initial_security_level;
08051 mac_init_p_aci.current_sec_level = mac_u_aci.initial_security_level;
08052 mac_init_p_aci.owner_min_sec_level = mac_u_aci.min_security_level;
08053 mac_init_p_aci.mac_owner_categories = mac_u_aci.mac_categories;
08054 mac_init_p_aci.mac_owner_initial_categories = mac_u_aci.mac_initial_categories;
08055 mac_init_p_aci.mac_curr_categories = mac_u_aci.mac_initial_categories;
08056 mac_init_p_aci.mac_owner_min_categories = mac_u_aci.mac_min_categories;
08057 mac_init_p_aci.min_write_open = mac_u_aci.security_level;
08058 mac_init_p_aci.max_read_open = mac_u_aci.min_security_level;
08059 mac_init_p_aci.min_write_categories = mac_u_aci.mac_categories;
08060 mac_init_p_aci.max_read_categories = mac_u_aci.mac_min_categories;
08061 mac_init_p_aci.mac_process_flags
08062 = (mac_u_aci.mac_user_flags & RSBAC_MAC_P_FLAGS) | RSBAC_MAC_DEF_INIT_P_FLAGS;
08063 }
08064 #endif
08065
08066 /* Set process aci - first init */
08067 #ifdef CONFIG_RSBAC_MAC
08068 if(rsbac_list_add(process_handles.mac[mac_p_hash(pid)], &pid, &mac_init_p_aci))
08069 rsbac_printk(KERN_WARNING
08070 "rsbac_do_init(): MAC ACI for Init process 1 could not be added!");
08071 #endif
08072 #ifdef CONFIG_RSBAC_RC
08073 /* Get boot role */
08074 if(rsbac_rc_get_boot_role(&rc_init_p_aci.rc_role))
08075 { /* none: use root's role */
08076 if(!rsbac_list_get_data(user_handles.rc, &user, &rc_u_aci))
08077 {
08078 rc_init_p_aci.rc_role = rc_u_aci.rc_role;
08079 }
08080 else
08081 { /* last resort: general role */
08082 rsbac_ds_get_error("rsbac_do_init", A_rc_def_role);
08083 rc_init_p_aci.rc_role = RSBAC_RC_GENERAL_ROLE;
08084 }
08085 }
08086 rc_kernel_p_aci.rc_role = rc_init_p_aci.rc_role;
08087 if(rsbac_list_add(process_handles.rc[rc_p_hash(pid)], &pid, &rc_init_p_aci))
08088 rsbac_printk(KERN_WARNING
08089 "rsbac_do_init(): RC ACI for Init process 1 could not be added!");
08090 #endif
08091 read_lock(&tasklist_lock);
08092 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
08093 for_each_task(p)
08094 #else
08095 for_each_process(p)
08096 #endif
08097 {
08098 /* not for kernel and init though... */
08099 if(!p->pid || (p->pid == 1))
08100 continue;
08101 pid = p->pid;
08102 #ifdef CONFIG_RSBAC_DEBUG
08103 if (rsbac_debug_ds)
08104 {
08105 rsbac_printk(KERN_DEBUG "rsbac_do_init(): setting aci for process %u\n",
08106 pid);
08107 }
08108 #endif
08109 #ifdef CONFIG_RSBAC_MAC
08110 if(rsbac_list_add(process_handles.mac[mac_p_hash(pid)], &pid, &mac_init_p_aci))
08111 rsbac_printk(KERN_WARNING
08112 "rsbac_do_init(): MAC ACI for Init process %u could not be added!",
08113 pid);
08114 #endif
08115 #ifdef CONFIG_RSBAC_RC
08116 if(!p->mm)
08117 {
08118 if(rsbac_list_add(process_handles.rc[rc_p_hash(pid)], &pid, &rc_kernel_p_aci))
08119 rsbac_printk(KERN_WARNING
08120 "rsbac_do_init(): RC ACI for Kernel process %u could not be added!",
08121 pid);
08122 }
08123 #endif
08124 }
08125 read_unlock(&tasklist_lock);
08126 }
08127 #endif /* MAC or RC */
08128
08129 rsbac_printk(KERN_INFO "rsbac_init(): Ready.\n");
08130 return(err);
08131 }
|
|
|
|
Definition at line 8143 of file aci_data_structures.c. References process_handles, rsbac_initialized, rsbac_list_add(), and rsbac_printk(). 08144 {
08145 if (!rsbac_initialized)
08146 return 0;
08147 /* Set process aci */
08148 #ifdef CONFIG_RSBAC_MAC
08149 if(rsbac_list_add(process_handles.mac[mac_p_hash(pid)], &pid, &mac_init_p_aci))
08150 rsbac_printk(KERN_WARNING
08151 "rsbac_do_init(): MAC ACI for kernel process %u could not be added!",
08152 pid);
08153 #endif
08154 #ifdef CONFIG_RSBAC_RC
08155 if(rsbac_list_add(process_handles.rc[rc_p_hash(pid)], &pid, &rc_kernel_p_aci))
08156 rsbac_printk(KERN_WARNING
08157 "rsbac_do_init(): RC ACI for kernel process %u could not be added!",
08158 pid);
08159 #endif
08160 return 0;
08161 }
|
|
||||||||||||
|
Definition at line 8165 of file aci_data_structures.c. References add_device_item(), clear_device_item(), create_device_item(), device_list_head, get_error_name(), lookup_device(), NULL, register_fd_lists(), rsbac_debug_no_write, RSBAC_ECOULDNOTADDDEVICE, RSBAC_EINVALIDPOINTER, RSBAC_ENOTINITIALIZED, rsbac_init(), rsbac_initialized, rsbac_kfree(), rsbac_kmalloc(), rsbac_list_mount(), RSBAC_MAXNAMELEN, rsbac_mount_acl(), rsbac_mount_auth(), rsbac_mount_mac(), rsbac_mount_reg(), rsbac_printk(), rsbac_root_dev, rsbac_write_sem, sysfs_covered_p, SYSFS_MAGIC, sysfs_sb_p, and TRUE. Referenced by get_attr_fd(), rsbac_aef_sb_post_addmount(), rsbac_aef_sb_umount_busy(), rsbac_do_init(), rsbac_get_super_block(), rsbac_ta_remove_target(), and set_attr_fd(). 08166 {
08167 int err = 0;
08168 struct rsbac_device_list_item_t * device_p;
08169 struct rsbac_device_list_item_t * new_device_p;
08170 u_long flags;
08171 rsbac_boolean_t old_no_write;
08172
08173 if(!sb_p)
08174 {
08175 rsbac_printk(KERN_WARNING
08176 "rsbac_mount(): called with NULL pointer\n");
08177 return -RSBAC_EINVALIDPOINTER;
08178 }
08179 if (!rsbac_initialized)
08180 {
08181 #ifdef CONFIG_RSBAC_INIT_DELAY
08182 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
08183 if( !RSBAC_MAJOR(rsbac_delayed_root)
08184 && !RSBAC_MINOR(rsbac_delayed_root)
08185 && rsbac_delayed_root_str[0]
08186 )
08187 { /* translate string to kdev_t */
08188 char * p = rsbac_delayed_root_str;
08189 u_int major = 0;
08190 u_int minor = 0;
08191
08192 major = simple_strtoul(p, NULL, 0);
08193 while((*p != ':') && (*p != '\0'))
08194 p++;
08195 if(*p)
08196 {
08197 p++;
08198 minor = simple_strtoul(p, NULL, 0);
08199 }
08200 rsbac_delayed_root = RSBAC_MKDEV(major,minor);
08201 }
08202 #endif
08203 if( !rsbac_no_delay_init
08204 && ( ( !RSBAC_MAJOR(rsbac_delayed_root)
08205 && !RSBAC_MINOR(rsbac_delayed_root)
08206 && (MAJOR(sb_p->s_dev) > 1)
08207 )
08208 || ( ( RSBAC_MAJOR(rsbac_delayed_root)
08209 || RSBAC_MINOR(rsbac_delayed_root)
08210 )
08211 && ( (MAJOR(sb_p->s_dev) == RSBAC_MAJOR(rsbac_delayed_root))
08212 && ( !RSBAC_MINOR(rsbac_delayed_root)
08213 || (MINOR(sb_p->s_dev) == RSBAC_MINOR(rsbac_delayed_root))
08214 )
08215 )
08216 )
08217 )
08218 )
08219 {
08220 if(RSBAC_MAJOR(rsbac_delayed_root) || RSBAC_MINOR(rsbac_delayed_root))
08221 {
08222 rsbac_printk(KERN_INFO
08223 "rsbac_mount(): forcing delayed RSBAC init on DEV %02u:%02u, matching %02u:%02u!\n",
08224 MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev),
08225 RSBAC_MAJOR(rsbac_delayed_root), RSBAC_MINOR(rsbac_delayed_root));
08226 }
08227 else
08228 {
08229 rsbac_printk(KERN_INFO
08230 "rsbac_mount(): forcing delayed RSBAC init on DEV %02u:%02u!\n",
08231 MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev));
08232 }
08233 rsbac_init(sb_p->s_dev);
08234 return 0;
08235 }
08236 #endif
08237
08238 rsbac_printk(KERN_WARNING
08239 "rsbac_mount(): RSBAC not initialized while mounting DEV %02u:%02u, delaying\n",
08240 MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev));
08241
08242 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
08243 if( (sb_p->s_magic == SYSFS_MAGIC)
08244 && !RSBAC_MAJOR(sb_p->s_dev)
08245 )
08246 {
08247 rsbac_printk(KERN_WARNING
08248 "rsbac_mount(): sysfs mount detected, keeping values for later use\n");
08249 sysfs_sb_p = sb_p;
08250 sysfs_covered_p = d_covers;
08251 }
08252 #endif
08253 #ifdef CONFIG_DEVFS_MOUNT
08254 if( (sb_p->s_magic == DEVFS_SUPER_MAGIC)
08255 && !RSBAC_MAJOR(sb_p->s_dev)
08256 )
08257 {
08258 rsbac_printk(KERN_WARNING
08259 "rsbac_mount(): devfs mount detected, keeping values for later use\n");
08260 devfs_sb_p = sb_p;
08261 devfs_covered_p = d_covers;
08262 }
08263 #endif
08264 return(-RSBAC_ENOTINITIALIZED);
08265 }
08266 #ifdef CONFIG_RSBAC_DEBUG
08267 if (rsbac_debug_ds)
08268 {
08269 rsbac_printk(KERN_DEBUG "rsbac_mount(): mounting device %02u:%02u\n",
08270 MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev));
08271 }
08272 if(rsbac_debug_stack)
08273 {
08274 unsigned long * n = (unsigned long *) (current+1);
08275
08276 while (!*n)
08277 n++;
08278 rsbac_printk(KERN_DEBUG "rsbac_mount: free stack: %lu\n",
08279 (unsigned long) n - (unsigned long)(current+1));
08280 }
08281 #endif
08282 down(&rsbac_write_sem);
08283 old_no_write = rsbac_debug_no_write;
08284 rsbac_debug_no_write = TRUE;
08285 up(&rsbac_write_sem);
08286 /* wait for read access to device_list_head */
08287 rsbac_read_lock(&device_list_head.lock, &flags);
08288 device_p = lookup_device(sb_p->s_dev);
08289 /* repeated mount? */
08290 if(device_p)
08291 {
08292 rsbac_printk(KERN_INFO "rsbac_mount: repeated mount %u of device %02u:%02u\n",
08293 device_p->mount_count, MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev));
08294 device_p->mount_count++;
08295 if( d_covers
08296 && !device_p->d_covers
08297 && (MAJOR(sb_p->s_dev) != MAJOR(rsbac_root_dev))
08298 && (MINOR(sb_p->s_dev) != MINOR(rsbac_root_dev))
08299 )
08300 {
08301 rsbac_printk(KERN_WARNING "rsbac_mount: replacing NULL d_covers with new value %p as inheritance parent\n",
08302 d_covers);
08303 device_p->d_covers = d_covers;
08304 }
08305 rsbac_read_unlock(&device_list_head.lock, &flags);
08306 }
08307 else
08308 {
08309 rsbac_read_unlock(&device_list_head.lock, &flags);
08310 /* OK, go on */
08311 new_device_p = create_device_item(sb_p, d_covers);
08312 #ifdef CONFIG_RSBAC_DEBUG
08313 if(rsbac_debug_stack)
08314 {
08315 unsigned long * n = (unsigned long *) (current+1);
08316
08317 while (!*n)
08318 n++;
08319 rsbac_printk(KERN_DEBUG "rsbac_mount: after creating device item: free stack: %lu\n",
08320 (unsigned long) n - (unsigned long)(current+1));
08321 }
08322 #endif
08323 if(!new_device_p)
08324 {
08325 rsbac_debug_no_write = old_no_write;
08326 return -RSBAC_ECOULDNOTADDDEVICE;
08327 }
08328
08329 rsbac_read_lock(&device_list_head.lock, &flags);
08330 /* make sure to only add, if this device item has not been added in the meantime */
08331 device_p = lookup_device(sb_p->s_dev);
08332 if(device_p)
08333 {
08334 rsbac_printk(KERN_WARNING
08335 "rsbac_mount(): mount race for device %02u:%02u detected!\n",
08336 MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev));
08337 device_p->mount_count++;
08338 rsbac_read_unlock(&device_list_head.lock, &flags);
08339 clear_device_item(new_device_p);
08340 }
08341 else
08342 {
08343 rsbac_read_unlock(&device_list_head.lock, &flags);
08344 rsbac_write_lock(&device_list_head.lock, &flags);
08345 device_p = add_device_item(new_device_p);
08346 rsbac_write_unlock(&device_list_head.lock, &flags);
08347 if(!device_p)
08348 {
08349 rsbac_printk(KERN_WARNING "rsbac_mount: adding device %02u:%02u failed!\n",
08350 MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev));
08351 clear_device_item(new_device_p);
08352 rsbac_debug_no_write = old_no_write;
08353 return -RSBAC_ECOULDNOTADDDEVICE;
08354 }
08355 }
08356
08357 /* Generic lists */
08358 rsbac_list_mount(sb_p->s_dev);
08359 /* we do not lock device head - we know the device_p and hope for the best... */
08360 /* also, we are within kernel mount sem */
08361 if((err = register_fd_lists(new_device_p, sb_p->s_dev)))
08362 {
08363 char * tmp;
08364
08365 tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
08366 if(tmp)
08367 {
08368 rsbac_printk(KERN_WARNING
08369 "rsbac_mount(): File/Dir ACI registration failed for dev %02u:%02u, err %s!\n",
08370 MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev), get_error_name(tmp,err));
08371 rsbac_kfree(tmp);
08372 }
08373 }
08374 #ifdef CONFIG_RSBAC_DEBUG
08375 if(rsbac_debug_stack)
08376 {
08377 unsigned long * n = (unsigned long *) (current+1);
08378
08379 while (!*n)
08380 n++;
08381 rsbac_printk(KERN_DEBUG "rsbac_mount: after registering fd lists: free stack: %lu\n",
08382 (unsigned long) n - (unsigned long)(current+1));
08383 }
08384 #endif
08385 }
08386
08387 /* call other mount functions */
08388 /****** MAC *******/
08389 #if defined(CONFIG_RSBAC_MAC)
08390 rsbac_mount_mac(sb_p->s_dev);
08391 #ifdef CONFIG_RSBAC_DEBUG
08392 if(rsbac_debug_stack)
08393 {
08394 unsigned long * n = (unsigned long *) (current+1);
08395
08396 while (!*n)
08397 n++;
08398 rsbac_printk(KERN_DEBUG "rsbac_mount: after mount_mac: free stack: %lu\n",
08399 (unsigned long) n - (unsigned long)(current+1));
08400 }
08401 #endif
08402 #endif
08403 /****** AUTH *******/
08404 #if defined(CONFIG_RSBAC_AUTH)
08405 rsbac_mount_auth(sb_p->s_dev);
08406 #ifdef CONFIG_RSBAC_DEBUG
08407 if(rsbac_debug_stack)
08408 {
08409 unsigned long * n = (unsigned long *) (current+1);
08410
08411 while (!*n)
08412 n++;
08413 rsbac_printk(KERN_DEBUG "rsbac_mount: after mount_auth: free stack: %lu\n",
08414 (unsigned long) n - (unsigned long)(current+1));
08415 }
08416 #endif
08417 #endif
08418 /****** ACL *******/
08419 #if defined(CONFIG_RSBAC_ACL)
08420 rsbac_mount_acl(sb_p->s_dev);
08421 #ifdef CONFIG_RSBAC_DEBUG
08422 if(rsbac_debug_stack)
08423 {
08424 unsigned long * n = (unsigned long *) (current+1);
08425
08426 while (!*n)
08427 n++;
08428 rsbac_printk(KERN_DEBUG "rsbac_mount: after mount_acl: free stack: %lu\n",
08429 (unsigned long) n - (unsigned long)(current+1));
08430 }
08431 #endif
08432 #endif
08433 /****** REG *******/
08434 #if defined(CONFIG_RSBAC_REG)
08435 rsbac_mount_reg(sb_p->s_dev);
08436 #ifdef CONFIG_RSBAC_DEBUG
08437 if(rsbac_debug_stack)
08438 {
08439 unsigned long * n = (unsigned long *) (current+1);
08440
08441 while (!*n)
08442 n++;
08443 rsbac_printk(KERN_DEBUG "rsbac_mount: after mount_reg: free stack: %lu\n",
08444 (unsigned long) n - (unsigned long)(current+1));
08445 }
08446 #endif
08447 #endif /* REG */
08448
08449 rsbac_debug_no_write = old_no_write;
08450 return(err);
08451 }
|
|
|
Definition at line 2642 of file aci_data_structures.c. References NULL. Referenced by read_info(), read_list(), read_lol_list(), and rsbac_write_close(). 02643 {
02644 /* cleanup copied from __fput */
02645 struct dentry * dentry = file_p->f_dentry;
02646 struct inode * inode = dentry->d_inode;
02647
02648 if (file_p->f_op && file_p->f_op->release)
02649 file_p->f_op->release(inode, file_p);
02650 file_p->f_dentry = NULL;
02651 if (file_p->f_mode & FMODE_WRITE)
02652 put_write_access(inode);
02653 dput(dentry);
02654 }
|
|
||||||||||||||||
|
Definition at line 2150 of file aci_data_structures.c. References FALSE, init_private_file(), lookup_aci_path_dentry(), NULL, RSBAC_EINVALIDPOINTER, RSBAC_ENOMEM, RSBAC_ENOTFOUND, RSBAC_EREADFAILED, rsbac_kfree(), rsbac_kmalloc(), rsbac_lookup_one_len(), RSBAC_MAXNAMELEN, and rsbac_printk(). Referenced by read_info(), read_list(), and read_lol_list(). 02153 {
02154 struct dentry * dir_dentry_p;
02155 struct dentry * file_dentry_p;
02156 int tmperr, err;
02157
02158 if(!name || !file_p)
02159 {
02160 #ifdef CONFIG_RSBAC_DEBUG
02161 if (rsbac_debug_ds)
02162 {
02163 rsbac_printk(KERN_DEBUG "rsbac_read_open(): called with NULL pointer!");
02164 }
02165 #endif
02166 return(-RSBAC_EINVALIDPOINTER);
02167 }
02168
02169 /* lookup dentry of ACI_PATH on root device, lock is released there */
02170 if ((err=lookup_aci_path_dentry(NULL, &dir_dentry_p, FALSE, kdev)))
02171 {
02172 return(err);
02173 }
02174
02175 /* open file for reading - this must be done 'by hand', because */
02176 /* standard system calls are now extended by rsbac decision calls. */
02177 file_dentry_p = rsbac_lookup_one_len(name, dir_dentry_p, strlen(name));
02178 if (!file_dentry_p || IS_ERR (file_dentry_p))
02179 { /* error in lookup */
02180 return(-RSBAC_EREADFAILED);
02181 }
02182 if (!file_dentry_p->d_inode)
02183 { /* file not found: trying backup */
02184 char * bname;
02185 int name_len = strlen(name);
02186
02187 dput(file_dentry_p);
02188 bname = rsbac_kmalloc(RSBAC_MAXNAMELEN);
02189 if(!bname)
02190 {
02191 return -RSBAC_ENOMEM;
02192 }
02193
02194 strcpy(bname,name);
02195 bname[name_len] = 'b';
02196 name_len++;
02197 bname[name_len] = (char) 0;
02198 #ifdef CONFIG_RSBAC_DEBUG
02199 if (rsbac_debug_ds)
02200 {
02201 rsbac_printk(KERN_DEBUG "rsbac_read_open(): could not lookup file %s, trying backup %s\n",
02202 name,bname);
02203 }
02204 #endif
02205 file_dentry_p = rsbac_lookup_one_len(bname, dir_dentry_p, strlen(bname));
02206 rsbac_kfree(bname);
02207 if (!file_dentry_p || IS_ERR (file_dentry_p))
02208 { /* error in lookup */
02209 return(-RSBAC_EREADFAILED);
02210 }
02211 if (!file_dentry_p->d_inode)
02212 { /* backup file also not found: return error */
02213 #ifdef CONFIG_RSBAC_DEBUG
02214 if (rsbac_debug_ds)
02215 {
02216 rsbac_printk(KERN_DEBUG "rsbac_read_open(): could not lookup backup file %sb\n",
02217 name);
02218 }
02219 #endif
02220 dput(file_dentry_p);
02221 return(-RSBAC_ENOTFOUND);
02222 }
02223 }
02224 if ( !(S_ISREG(file_dentry_p->d_inode->i_mode)) )
02225 { /* this is not a file! -> error! */
02226 rsbac_printk(KERN_WARNING "rsbac_read_open(): expected file is not a file!\n");
02227 dput(file_dentry_p);
02228 return(-RSBAC_EREADFAILED);
02229 }
02230
02231 /* Now we fill the file structure and */
02232 /* if there is an open func for this file, use it, otherwise ignore */
02233 if ((tmperr = init_private_file(file_p, file_dentry_p,O_RDONLY)))
02234 {
02235 dput(file_dentry_p);
02236 rsbac_printk(KERN_WARNING "rsbac_read_open(): could not open file '%s'!\n", name);
02237 return -RSBAC_EREADFAILED;
02238 }
02239
02240 /* if there is no read func, we get a problem -> error */
02241 if ((!file_p->f_op) || (!file_p->f_op->read))
02242 {
02243 if (!file_p->f_op)
02244 {
02245 rsbac_printk(KERN_WARNING "rsbac_read_open(): no f_op for file '%s'!\n", name);
02246 }
02247 else
02248 {
02249 rsbac_printk(KERN_WARNING "rsbac_read_open(): no file read func for file '%s'!\n", name);
02250 if (file_p->f_op->release)
02251 file_p->f_op->release(file_dentry_p->d_inode, file_p);
02252 }
02253 dput(file_dentry_p);
02254 return -RSBAC_EREADFAILED;
02255 }
02256 return 0;
02257 } /* end of rsbac_read_open_device_p */
|
|
|
Definition at line 8618 of file aci_data_structures.c. References dev_handles, dev_major_handles, device_list_head, ipc_handles, process_handles, rsbac_adf_request_count, rsbac_adf_set_attr_count, RSBAC_ENOTINITIALIZED, rsbac_initialized, rsbac_list_count(), rsbac_printk(), rsbac_stats_acl(), rsbac_stats_auth(), rsbac_stats_pm(), rsbac_stats_rc(), T_DEV, T_DIR, T_FIFO, T_FILE, T_IPC, T_NETDEV, T_NETOBJ, T_NETTEMP, T_PROCESS, T_SCD, T_SYMLINK, T_USER, and user_handles. Referenced by sys_rsbac_stats(). 08619 {
08620 struct rsbac_device_list_item_t * device_p;
08621 int i;
08622 u_long fd_count = 0, fd_sum = 0;
08623 u_long dev_sum = 0;
08624 u_long ipc_sum = 0;
08625 u_long user_sum = 0;
08626 u_long process_sum = 0;
08627 #if defined(CONFIG_RSBAC_UM)
08628 u_long group_sum = 0;
08629 #endif
08630 #if defined(CONFIG_RSBAC_NET_OBJ)
08631 u_long nettemp_sum = 0;
08632 u_long lnetobj_sum = 0;
08633 u_long rnetobj_sum = 0;
08634 #endif
08635 u_long total_sum = 0;
08636 long tmp_count;
08637 u_long dflags;
08638
08639 if (!rsbac_initialized)
08640 {
08641 rsbac_printk(KERN_WARNING "rsbac_stats(): RSBAC not initialized\n");
08642 return(-RSBAC_ENOTINITIALIZED);
08643 }
08644 /* wait for read access to device_list_head */
08645 rsbac_read_lock(&device_list_head.lock, &dflags);
08646 /* OK, go on */
08647 /* rsbac_printk(KERN_INFO "rsbac_stats(): currently %u processes working on file/dir aci\n",
08648 device_list_head.lock.lock); */
08649 device_p = device_list_head.head;
08650 while (device_p)
08651 { /* for all sublists */
08652 fd_count = 0;
08653 for (i=0; i < RSBAC_GEN_NR_FD_LISTS; i++)
08654 {
08655 tmp_count = rsbac_list_count(device_p->handles.gen[i]);
08656 if(tmp_count > 0)
08657 fd_count+=tmp_count;
08658 }
08659 rsbac_printk(KERN_INFO "Device %02u:%02u fd_items: %lu GEN",
08660 RSBAC_MAJOR(device_p->id), RSBAC_MINOR(device_p->id), fd_count);
08661 fd_sum += fd_count;
08662
08663 #if defined(CONFIG_RSBAC_MAC)
08664 fd_count = 0;
08665 for (i=0; i < RSBAC_MAC_NR_FD_LISTS; i++)
08666 {
08667 tmp_count = rsbac_list_count(device_p->handles.mac[i]);
08668 if(tmp_count > 0)
08669 fd_count+=tmp_count;
08670 }
08671 rsbac_printk(", %lu MAC",
08672 fd_count);
08673 fd_sum += fd_count;
08674 #endif
08675
08676 #if defined(CONFIG_RSBAC_PM)
08677 fd_count = 0;
08678 for (i=0; i < RSBAC_PM_NR_FD_LISTS; i++)
08679 {
08680 tmp_count = rsbac_list_count(device_p->handles.pm[i]);
08681 if(tmp_count > 0)
08682 fd_count+=tmp_count;
08683 }
08684 rsbac_printk(", %lu PM",
08685 fd_count);
08686 fd_sum += fd_count;
08687 #endif
08688
08689 #if defined(CONFIG_RSBAC_DAZ)
08690 fd_count = 0;
08691 for (i=0; i < RSBAC_DAZ_NR_FD_LISTS; i++)
08692 {
08693 tmp_count = rsbac_list_count(device_p->handles.daz[i]);
08694 if(tmp_count > 0)
08695 fd_count+=tmp_count;
08696 }
08697 rsbac_printk(", %lu DAZ",
08698 fd_count);
08699 fd_sum += fd_count;
08700 #if defined(CONFIG_RSBAC_DAZ_CACHE)
08701 fd_count = 0;
08702 for (i=0; i < RSBAC_DAZ_SCANNED_NR_FD_LISTS; i++)
08703 {
08704 tmp_count = rsbac_list_count(device_p->handles.dazs[i]);
08705 if(tmp_count > 0)
08706 fd_count+=tmp_count;
08707 }
08708 rsbac_printk(", %lu DAZ_SCANNED",
08709 fd_count);
08710 fd_sum += fd_count;
08711 #endif
08712 #endif
08713
08714 #if defined(CONFIG_RSBAC_FF)
08715 fd_count = 0;
08716 for (i=0; i < RSBAC_FF_NR_FD_LISTS; i++)
08717 {
08718 tmp_count = rsbac_list_count(device_p->handles.ff[i]);
08719 if(tmp_count > 0)
08720 fd_count+=tmp_count;
08721 }
08722 rsbac_printk(", %lu FF",
08723 fd_count);
08724 fd_sum += fd_count;
08725 #endif
08726
08727 #if defined(CONFIG_RSBAC_RC)
08728 fd_count = 0;
08729 for (i=0; i < RSBAC_RC_NR_FD_LISTS; i++)
08730 {
08731 tmp_count = rsbac_list_count(device_p->handles.rc[i]);
08732 if(tmp_count > 0)
08733 fd_count+=tmp_count;
08734 }
08735 rsbac_printk(", %lu RC",
08736 fd_count);
08737 fd_sum += fd_count;
08738 #endif
08739
08740 #if defined(CONFIG_RSBAC_AUTH)
08741 fd_count = 0;
08742 for (i=0; i < RSBAC_AUTH_NR_FD_LISTS; i++)
08743 {
08744 tmp_count = rsbac_list_count(device_p->handles.auth[i]);
08745 if(tmp_count > 0)
08746 fd_count+=tmp_count;
08747 }
08748 rsbac_printk(", %lu AUTH",
08749 fd_count);
08750 fd_sum += fd_count;
08751 #endif
08752
08753 #if defined(CONFIG_RSBAC_CAP)
08754 fd_count = 0;
08755 for (i=0; i < RSBAC_CAP_NR_FD_LISTS; i++)
08756 {
08757 tmp_count = rsbac_list_count(device_p->handles.cap[i]);
08758 if(tmp_count > 0)
08759 fd_count+=tmp_count;
08760 }
08761 rsbac_printk(", %lu CAP",
08762 fd_count);
08763 fd_sum += fd_count;
08764 #endif
08765 #if defined(CONFIG_RSBAC_RES)
08766 fd_count = 0;
08767 for (i=0; i < RSBAC_RES_NR_FD_LISTS; i++)
08768 {
08769 tmp_count = rsbac_list_count(device_p->handles.res[i]);
08770 if(tmp_count > 0)
08771 fd_count+=tmp_count;
08772 }
08773 rsbac_printk(", %lu RES",
08774 fd_count);
08775 fd_sum += fd_count;
08776 #endif
08777 #if defined(CONFIG_RSBAC_PAX)
08778 fd_count = 0;
08779 for (i=0; i < RSBAC_PAX_NR_FD_LISTS; i++)
08780 {
08781 tmp_count = rsbac_list_count(device_p->handles.pax[i]);
08782 if(tmp_count > 0)
08783 fd_count+=tmp_count;
08784 }
08785 rsbac_printk(", %lu PAX",
08786 fd_count);
08787 fd_sum += fd_count;
08788 #endif
08789
08790 rsbac_printk("\n");
08791 device_p = device_p->next;
08792 }
08793 rsbac_printk(KERN_INFO "rsbac_stats(): Sum of %u Devices with %lu fd-items\n",
08794 device_list_head.count, fd_sum);
08795 /* free access to device_list_head */
08796 rsbac_read_unlock(&device_list_head.lock, &dflags);
08797 total_sum += fd_sum;
08798
08799 /* dev lists */
08800 tmp_count = rsbac_list_count(dev_handles.gen);
08801 rsbac_printk(KERN_INFO "DEV items: %lu GEN",
08802 tmp_count);
08803 dev_sum += tmp_count;
08804 #if defined(CONFIG_RSBAC_MAC)
08805 tmp_count = rsbac_list_count(dev_handles.mac);
08806 rsbac_printk(", %lu MAC",
08807 tmp_count);
08808 dev_sum += tmp_count;
08809 #endif
08810 #if defined(CONFIG_RSBAC_PM)
08811 tmp_count = rsbac_list_count(dev_handles.pm);
08812 rsbac_printk(", %lu PM",
08813 tmp_count);
08814 dev_sum += tmp_count;
08815 #endif
08816 #if defined(CONFIG_RSBAC_RC)
08817 tmp_count = rsbac_list_count(dev_major_handles.rc);
08818 rsbac_printk(", %lu major RC",
08819 tmp_count);
08820 dev_sum += tmp_count;
08821 tmp_count = rsbac_list_count(dev_handles.rc);
08822 rsbac_printk(", %lu RC",
08823 tmp_count);
08824 dev_sum += tmp_count;
08825 #endif
08826 rsbac_printk("\n");
08827 rsbac_printk(KERN_INFO "Sum of %lu DEV items\n",
08828 dev_sum);
08829 total_sum += dev_sum;
08830
08831 /* ipc lists */
08832 rsbac_printk(KERN_INFO "IPC items: no GEN");
08833 #if defined(CONFIG_RSBAC_MAC)
08834 tmp_count = rsbac_list_count(ipc_handles.mac);
08835 rsbac_printk(", %lu MAC",
08836 tmp_count);
08837 ipc_sum += tmp_count;
08838 #endif
08839 #if defined(CONFIG_RSBAC_PM)
08840 tmp_count = rsbac_list_count(ipc_handles.pm);
08841 rsbac_printk(", %lu PM",
08842 tmp_count);
08843 ipc_sum += tmp_count;
08844 #endif
08845 #if defined(CONFIG_RSBAC_RC)
08846 tmp_count = rsbac_list_count(ipc_handles.rc);
08847 rsbac_printk(", %lu RC",
08848 tmp_count);
08849 ipc_sum += tmp_count;
08850 #endif
08851 #if defined(CONFIG_RSBAC_JAIL)
08852 tmp_count = rsbac_list_count(ipc_handles.jail);
08853 rsbac_printk(", %lu JAIL",
08854 tmp_count);
08855 ipc_sum += tmp_count;
08856 #endif
08857 rsbac_printk("\n");
08858 rsbac_printk(KERN_INFO "Sum of %lu IPC items\n",
08859 ipc_sum);
08860 total_sum += ipc_sum;
08861
08862 /* user lists */
08863 tmp_count = rsbac_list_count(user_handles.gen);
08864 rsbac_printk(KERN_INFO "USER items: %lu GEN",
08865 tmp_count);
08866 user_sum += tmp_count;
08867 #if defined(CONFIG_RSBAC_MAC)
08868 tmp_count = rsbac_list_count(user_handles.mac);
08869 rsbac_printk(", %lu MAC",
08870 tmp_count);
08871 user_sum += tmp_count;
08872 #endif
08873 #if defined(CONFIG_RSBAC_PM)
08874 tmp_count = rsbac_list_count(user_handles.pm);
08875 rsbac_printk(", %lu PM",
08876 tmp_count);
08877 user_sum += tmp_count;
08878 #endif
08879 #if defined(CONFIG_RSBAC_DAZ)
08880 tmp_count = rsbac_list_count(user_handles.daz);
08881 rsbac_printk(", %lu DAZ",
08882 tmp_count);
08883 user_sum += tmp_count;
08884 #endif
08885 #if defined(CONFIG_RSBAC_RC)
08886 tmp_count = rsbac_list_count(user_handles.rc);
08887 rsbac_printk(", %lu RC",
08888 tmp_count);
08889 user_sum += tmp_count;
08890 #endif
08891 #if defined(CONFIG_RSBAC_AUTH)
08892 tmp_count = rsbac_list_count(user_handles.auth);
08893 rsbac_printk(", %lu AUTH",
08894 tmp_count);
08895 user_sum += tmp_count;
08896 #endif
08897 #if defined(CONFIG_RSBAC_CAP)
08898 tmp_count = rsbac_list_count(user_handles.cap);
08899 rsbac_printk(", %lu CAP",
08900 tmp_count);
08901 user_sum += tmp_count;
08902 #endif
08903 #if defined(CONFIG_RSBAC_JAIL)
08904 tmp_count = rsbac_list_count(user_handles.jail);
08905 rsbac_printk(", %lu JAIL",
08906 tmp_count);
08907 user_sum += tmp_count;
08908 #endif
08909 #if defined(CONFIG_RSBAC_RES)
08910 tmp_count = rsbac_list_count(user_handles.res);
08911 rsbac_printk(", %lu RES",
08912 tmp_count);
08913 user_sum += tmp_count;
08914 #endif
08915 #if defined(CONFIG_RSBAC_PAX)
08916 tmp_count = rsbac_list_count(user_handles.pax);
08917 rsbac_printk(", %lu PAX",
08918 tmp_count);
08919 user_sum += tmp_count;
08920 #endif
08921 rsbac_printk("\n");
08922 rsbac_printk(KERN_INFO "Sum of %lu USER items\n",
08923 user_sum);
08924 total_sum += user_sum;
08925
08926 /* process lists */
08927 tmp_count = 0;
08928 for(i=0; i<CONFIG_RSBAC_GEN_NR_P_LISTS; i++)
08929 tmp_count += rsbac_list_count(process_handles.gen[i]);
08930 rsbac_printk(KERN_INFO "PROCESS items: %lu GEN",
08931 tmp_count);
08932 process_sum += tmp_count;
08933 #if defined(CONFIG_RSBAC_MAC)
08934 tmp_count = 0;
08935 for(i=0; i<CONFIG_RSBAC_MAC_NR_P_LISTS; i++)
08936 tmp_count += rsbac_list_count(process_handles.mac[i]);
08937 rsbac_printk(", %lu MAC",
08938 tmp_count);
08939 process_sum += tmp_count;
08940 #endif
08941 #if defined(CONFIG_RSBAC_PM)
08942 tmp_count = rsbac_list_count(process_handles.pm);
08943 rsbac_printk(", %lu PM",
08944 tmp_count);
08945 process_sum += tmp_count;
08946 #endif
08947 #if defined(CONFIG_RSBAC_DAZ)
08948 tmp_count = rsbac_list_count(process_handles.daz);
08949 rsbac_printk(", %lu DAZ",
08950 tmp_count);
08951 process_sum += tmp_count;
08952 #endif
08953 #if defined(CONFIG_RSBAC_RC)
08954 tmp_count = 0;
08955 for(i=0; i<CONFIG_RSBAC_RC_NR_P_LISTS; i++)
08956 tmp_count += rsbac_list_count(process_handles.rc[i]);
08957 rsbac_printk(", %lu RC",
08958 tmp_count);
08959 process_sum += tmp_count;
08960 #endif
08961 #if defined(CONFIG_RSBAC_AUTH)
08962 tmp_count = rsbac_list_count(process_handles.auth);
08963 rsbac_printk(", %lu AUTH",
08964 tmp_count);
08965 process_sum += tmp_count;
08966 #endif
08967 #if defined(CONFIG_RSBAC_CAP)
08968 tmp_count = rsbac_list_count(process_handles.cap);
08969 rsbac_printk(", %lu CAP",
08970 tmp_count);
08971 process_sum += tmp_count;
08972 #endif
08973 #if defined(CONFIG_RSBAC_JAIL)
08974 tmp_count = 0;
08975 for(i=0; i<CONFIG_RSBAC_JAIL_NR_P_LISTS; i++)
08976 tmp_count += rsbac_list_count(process_handles.jail[i]);
08977 rsbac_printk(", %lu JAIL",
08978 tmp_count);
08979 process_sum += tmp_count;
08980 #endif
08981 rsbac_printk("\n");
08982 rsbac_printk(KERN_INFO "Sum of %lu PROCESS items\n",
08983 process_sum);
08984 total_sum += process_sum;
08985
08986 #if defined(CONFIG_RSBAC_UM)
08987 /* group lists */
08988 rsbac_printk(KERN_INFO "GROUP items: ");
08989 #if defined(CONFIG_RSBAC_RC_UM_PROT)
08990 tmp_count = rsbac_list_count(group_handles.rc);
08991 rsbac_printk("%lu RC",
08992 tmp_count);
08993 user_sum += tmp_count;
08994 #endif
08995 rsbac_printk("\n");
08996 rsbac_printk(KERN_INFO "Sum of %lu GROUP items\n",
08997 group_sum);
08998 total_sum += group_sum;
08999 #endif
09000
09001 #if defined(CONFIG_RSBAC_NET_OBJ)
09002 /* nettemp lists */
09003 rsbac_printk(KERN_INFO "NETTEMP items: ");
09004 #if defined(CONFIG_RSBAC_MAC)
09005 tmp_count = rsbac_list_count(nettemp_handles.mac);
09006 rsbac_printk("%lu MAC, ",
09007 tmp_count);
09008 nettemp_sum += tmp_count;
09009 #endif
09010 #if defined(CONFIG_RSBAC_PM)
09011 tmp_count = rsbac_list_count(nettemp_handles.pm);
09012 rsbac_printk("%lu PM, ",
09013 tmp_count);
09014 nettemp_sum += tmp_count;
09015 #endif
09016 #if defined(CONFIG_RSBAC_RC)
09017 tmp_count = rsbac_list_count(nettemp_handles.rc);
09018 rsbac_printk("%lu RC, ",
09019 tmp_count);
09020 nettemp_sum += tmp_count;
09021 #endif
09022 rsbac_printk("\n");
09023 rsbac_printk(KERN_INFO "Sum of %lu NETTEMP items\n",
09024 nettemp_sum);
09025 total_sum += nettemp_sum;
09026
09027 /* local netobj lists */
09028 rsbac_printk(KERN_INFO "Local NETOBJ items:");
09029 #if defined(CONFIG_RSBAC_MAC)
09030 tmp_count = rsbac_list_count(lnetobj_handles.mac);
09031 rsbac_printk(" %lu MAC,",
09032 tmp_count);
09033 lnetobj_sum += tmp_count;
09034 #endif
09035 #if defined(CONFIG_RSBAC_PM)
09036 tmp_count = rsbac_list_count(lnetobj_handles.pm);
09037 rsbac_printk(" %lu PM,",
09038 tmp_count);
09039 lnetobj_sum += tmp_count;
09040 #endif
09041 #if defined(CONFIG_RSBAC_RC)
09042 tmp_count = rsbac_list_count(lnetobj_handles.rc);
09043 rsbac_printk(" %lu RC",
09044 tmp_count);
09045 lnetobj_sum += tmp_count;
09046 #endif
09047 rsbac_printk("\n");
09048 rsbac_printk(KERN_INFO "Sum of %lu Local NETOBJ items\n",
09049 lnetobj_sum);
09050 total_sum += lnetobj_sum;
09051
09052 /* remote netobj lists */
09053 rsbac_printk(KERN_INFO "Remote NETOBJ items:");
09054 #if defined(CONFIG_RSBAC_MAC)
09055 tmp_count = rsbac_list_count(rnetobj_handles.mac);
09056 rsbac_printk(" %lu MAC,",
09057 tmp_count);
09058 rnetobj_sum += tmp_count;
09059 #endif
09060 #if defined(CONFIG_RSBAC_PM)
09061 tmp_count = rsbac_list_count(rnetobj_handles.pm);
09062 rsbac_printk(" %lu PM,",
09063 tmp_count);
09064 rnetobj_sum += tmp_count;
09065 #endif
09066 #if defined(CONFIG_RSBAC_RC)
09067 tmp_count = rsbac_list_count(rnetobj_handles.rc);
09068 rsbac_printk(" %lu RC",
09069 tmp_count);
09070 rnetobj_sum += tmp_count;
09071 #endif
09072 rsbac_printk("\n");
09073 rsbac_printk(KERN_INFO "Sum of %lu Remote NETOBJ items\n",
09074 rnetobj_sum);
09075 total_sum += rnetobj_sum;
09076 #endif /* NET_OBJ */
09077
09078 rsbac_printk(KERN_INFO
09079 "Total of %lu registered rsbac-items\n",
09080 total_sum);
09081
09082 rsbac_printk(KERN_INFO
09083 "adf_request calls: file: %lu, dir: %lu, fifo: %lu, symlink: %lu, dev: %lu, ipc: %lu, scd: %lu, user: %lu, process: %lu, netdev: %lu, nettemp: %lu, netobj: %lu\n",
09084 rsbac_adf_request_count[T_FILE],
09085 rsbac_adf_request_count[T_DIR],
09086 rsbac_adf_request_count[T_FIFO],
09087 rsbac_adf_request_count[T_SYMLINK],
09088 rsbac_adf_request_count[T_DEV],
09089 rsbac_adf_request_count[T_IPC],
09090 rsbac_adf_request_count[T_SCD],
09091 rsbac_adf_request_count[T_USER],
09092 rsbac_adf_request_count[T_PROCESS],
09093 rsbac_adf_request_count[T_NETDEV],
09094 rsbac_adf_request_count[T_NETTEMP],
09095 rsbac_adf_request_count[T_NETOBJ]);
09096 rsbac_printk(KERN_INFO
09097 "adf_set_attr calls: file: %lu, dir: %lu, fifo: %lu, symlink: %lu, dev: %lu, ipc: %lu, scd: %lu, user: %lu, process: %lu, netdev: %lu, nettemp: %lu, netobj: %lu\n",
09098 rsbac_adf_set_attr_count[T_FILE],
09099 rsbac_adf_set_attr_count[T_DIR],
09100 rsbac_adf_set_attr_count[T_FIFO],
09101 rsbac_adf_set_attr_count[T_SYMLINK],
09102 rsbac_adf_set_attr_count[T_DEV],
09103 rsbac_adf_set_attr_count[T_IPC],
09104 rsbac_adf_set_attr_count[T_SCD],
09105 rsbac_adf_set_attr_count[T_USER],
09106 rsbac_adf_set_attr_count[T_PROCESS],
09107 rsbac_adf_set_attr_count[T_NETDEV],
09108 rsbac_adf_set_attr_count[T_NETTEMP],
09109 rsbac_adf_set_attr_count[T_NETOBJ]);
09110
09111 #if defined(CONFIG_RSBAC_PM)
09112 rsbac_stats_pm();
09113 #endif
09114 #if defined(CONFIG_RSBAC_RC)
09115 rsbac_stats_rc();
09116 #endif
09117 #if defined(CONFIG_RSBAC_AUTH)
09118 rsbac_stats_auth();
09119 #endif
09120 #if defined(CONFIG_RSBAC_ACL)
09121 rsbac_stats_acl();
09122 #endif
09123 return(0);
09124 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 12027 of file aci_data_structures.c. References rsbac_target_id_t::dev, get_attr_dev(), get_attr_fd(), get_attr_ipc(), get_attr_process(), get_attr_user(), RSBAC_EINVALIDPOINTER, RSBAC_EINVALIDTARGET, RSBAC_ENOTINITIALIZED, rsbac_initialized, rsbac_printk(), T_DEV, T_DIR, T_FIFO, T_FILE, T_GROUP, T_IPC, T_NETDEV, T_NETOBJ, T_NETTEMP, T_PROCESS, T_SYMLINK, and T_USER. Referenced by rsbac_pm(), sys_rsbac_get_attr(), and sys_rsbac_get_attr_n(). 12035 {
12036 int err = 0;
12037
12038 if (!rsbac_initialized)
12039 {
12040 rsbac_printk(KERN_WARNING "rsbac_get_attr(): RSBAC not initialized\n");
12041 return(-RSBAC_ENOTINITIALIZED);
12042 }
12043 if (!value)
12044 return(-RSBAC_EINVALIDPOINTER);
12045 if (in_interrupt())
12046 {
12047 rsbac_printk(KERN_WARNING "rsbac_get_attr(): called from interrupt!\n");
12048 }
12049 #ifdef CONFIG_RSBAC_XSTATS
12050 get_attr_count[target]++;
12051 #endif
12052 switch (target)
12053 {
12054 case T_FILE:
12055 case T_DIR:
12056 case T_FIFO:
12057 case T_SYMLINK:
12058 return get_attr_fd(ta_number, module, target, &tid,
12059 attr, value, inherit);
12060
12061 case T_DEV:
12062 return get_attr_dev(ta_number, module, target, tid.dev,
12063 attr, value, inherit);
12064
12065 case T_IPC:
12066 return get_attr_ipc(ta_number, module, target, &tid,
12067 attr, value, inherit);
12068
12069 case T_USER:
12070 return get_attr_user(ta_number, module, target, &tid,
12071 attr, value, inherit);
12072
12073 case T_PROCESS:
12074 return get_attr_process(ta_number, module, target, &tid,
12075 attr, value, inherit);
12076
12077 #ifdef CONFIG_RSBAC_UM
12078 case T_GROUP:
12079 return get_attr_group(ta_number, module, target, &tid,
12080 attr, value, inherit);
12081 #endif /* CONFIG_RSBAC_UM */
12082
12083 #ifdef CONFIG_RSBAC_NET_DEV
12084 case T_NETDEV:
12085 return get_attr_netdev(ta_number, module, target, &tid,
12086 attr, value, inherit);
12087 #endif
12088
12089 #ifdef CONFIG_RSBAC_NET_OBJ
12090 case T_NETTEMP:
12091 return get_attr_nettemp(ta_number, module, target, &tid,
12092 attr, value, inherit);
12093
12094 case T_NETOBJ:
12095 return get_attr_netobj(ta_number, module, target, &tid,
12096 attr, value, inherit);
12097 #endif /* NET_OBJ */
12098
12099 /* switch target: no valid target */
12100 default:
12101 return -RSBAC_EINVALIDTARGET;
12102 }
12103
12104 return err;
12105 } /* end of rsbac_get_attr() */
|
|
||||||||||||
|
Definition at line 14758 of file aci_data_structures.c. References D_block, D_block_major, dev_handles, dev_major_handles, NULL, RSBAC_ENOMEM, rsbac_ta_list_count(), rsbac_ta_list_exist(), rsbac_ta_list_get_all_desc(), rsbac_vfree, and rsbac_vmalloc. Referenced by sys_rsbac_list_all_dev(). 14759 {
14760 int count=0;
14761 int tmp_count;
14762
14763 tmp_count = rsbac_ta_list_count(ta_number, dev_handles.gen);
14764 if(tmp_count > 0)
14765 count += tmp_count;
14766 #if defined(CONFIG_RSBAC_MAC)
14767 tmp_count = rsbac_ta_list_count(ta_number, dev_handles.mac);
14768 if(tmp_count > 0)
14769 count += tmp_count;
14770 #endif
14771 #if defined(CONFIG_RSBAC_PM)
14772 tmp_count = rsbac_ta_list_count(ta_number, dev_handles.pm);
14773 if(tmp_count > 0)
14774 count += tmp_count;
14775 #endif
14776 #if defined(CONFIG_RSBAC_RC)
14777 tmp_count = rsbac_ta_list_count(ta_number, dev_major_handles.rc);
14778 if(tmp_count > 0)
14779 count += tmp_count;
14780 tmp_count = rsbac_ta_list_count(ta_number, dev_handles.rc);
14781 if(tmp_count > 0)
14782 count += tmp_count;
14783 #endif
14784 if(id_pp)
14785 {
14786 struct rsbac_dev_desc_t * i_id_p = NULL;
14787 char * pos = NULL;
14788 #if defined(CONFIG_RSBAC_MAC) || defined(CONFIG_RSBAC_PM) || defined(CONFIG_RSBAC_RC)
14789 u_int i;
14790 #endif
14791
14792 if(count > 0)
14793 {
14794 int i_count = 0;
14795
14796 i_count = count + 20; /* max value to expect */
14797 *id_pp = rsbac_vmalloc(i_count * sizeof(**id_pp));
14798 if(!*id_pp)
14799 return -RSBAC_ENOMEM;
14800 pos = (char *) *id_pp;
14801 tmp_count = rsbac_ta_list_get_all_desc(ta_number,
14802 dev_handles.gen,
14803 (void **) &i_id_p);
14804 if(tmp_count > 0)
14805 {
14806 if(tmp_count > i_count)
14807 tmp_count = i_count;
14808 memcpy(pos, i_id_p, tmp_count * sizeof(*i_id_p));
14809 rsbac_vfree(i_id_p);
14810 count = tmp_count;
14811 i_count -= tmp_count;
14812 pos += tmp_count * sizeof(*i_id_p);
14813 }
14814 else
14815 count = 0;
14816 #if defined(CONFIG_RSBAC_MAC)
14817 if(i_count)
14818 {
14819 tmp_count = rsbac_ta_list_get_all_desc(ta_number, dev_handles.mac, (void **) &i_id_p);
14820 if(tmp_count > 0)
14821 {
14822 if(tmp_count > i_count)
14823 tmp_count = i_count;
14824 for(i=0; i< tmp_count; i++)
14825 {
14826 if(!rsbac_ta_list_exist(ta_number, dev_handles.gen, &i_id_p[i]))
14827 {
14828 memcpy(pos, &i_id_p[i], sizeof(*i_id_p));
14829 pos += sizeof(*i_id_p);
14830 count++;
14831 i_count--;
14832 }
14833 }
14834 rsbac_vfree(i_id_p);
14835 }
14836 }
14837 #endif
14838 #if defined(CONFIG_RSBAC_PM)
14839 if(i_count)
14840 {
14841 tmp_count = rsbac_ta_list_get_all_desc(ta_number, dev_handles.mac, (void **) &i_id_p);
14842 if(tmp_count > 0)
14843 {
14844 if(tmp_count > i_count)
14845 tmp_count = i_count;
14846 for(i=0; i< tmp_count; i++)
14847 {
14848 if(!rsbac_ta_list_exist(ta_number, dev_handles.gen, &i_id_p[i]))
14849 #if defined(CONFIG_RSBAC_MAC)
14850 if(!rsbac_ta_list_exist(ta_number, dev_handles.mac, &i_id_p[i]))
14851 #endif
14852 {
14853 memcpy(pos, &i_id_p[i], sizeof(*i_id_p));
14854 pos += sizeof(*i_id_p);
14855 count++;
14856 i_count--;
14857 }
14858 }
14859 rsbac_vfree(i_id_p);
14860 }
14861 }
14862 #endif
14863 #if defined(CONFIG_RSBAC_RC)
14864 if(i_count)
14865 {
14866 tmp_count = rsbac_ta_list_get_all_desc(ta_number, dev_major_handles.rc, (void **) &i_id_p);
14867 if(tmp_count > 0)
14868 {
14869 if(tmp_count > i_count)
14870 tmp_count = i_count;
14871 for(i=0; i< tmp_count; i++)
14872 {
14873 i_id_p[i].type += (D_block_major - D_block);
14874 memcpy(pos, &i_id_p[i], sizeof(*i_id_p));
14875 pos += sizeof(*i_id_p);
14876 count++;
14877 i_count--;
14878 }
14879 rsbac_vfree(i_id_p);
14880 }
14881 }
14882 if(i_count)
14883 {
14884 tmp_count = rsbac_ta_list_get_all_desc(ta_number, dev_handles.rc, (void **) &i_id_p);
14885 if(tmp_count > 0)
14886 {
14887 if(tmp_count > i_count)
14888 tmp_count = i_count;
14889 for(i=0; i< tmp_count; i++)
14890 {
14891 if(!rsbac_ta_list_exist(ta_number, dev_handles.gen, &i_id_p[i]))
14892 #if defined(CONFIG_RSBAC_MAC)
14893 if(!rsbac_ta_list_exist(ta_number, dev_handles.mac, &i_id_p[i]))
14894 #endif
14895 #if defined(CONFIG_RSBAC_PM)
14896 if(!rsbac_ta_list_exist(ta_number, dev_handles.pm, &i_id_p[i]))
14897 #endif
14898 {
14899 memcpy(pos, &i_id_p[i], sizeof(*i_id_p));
14900 pos += sizeof(*i_id_p);
14901 count++;
14902 i_count--;
14903 }
14904 }
14905 rsbac_vfree(i_id_p);
14906 }
14907 }
14908 #endif
14909 if(!count)
14910 rsbac_vfree(*id_pp);
14911 }
14912 }
14913 return count;
14914 }
|
|
||||||||||||
|
Definition at line 15083 of file aci_data_structures.c. References NULL, RSBAC_ENOMEM, rsbac_ta_list_count(), rsbac_ta_list_get_all_desc(), rsbac_vfree, and rsbac_vmalloc. Referenced by sys_rsbac_list_all_group(). 15084 {
15085 #if defined(CONFIG_RSBAC_RC_UM_PROT)
15086 int count=0;
15087 int tmp_count;
15088
15089 tmp_count = rsbac_ta_list_count(ta_number, group_handles.rc);
15090 if(tmp_count > 0)
15091 count += tmp_count;
15092 if(id_pp)
15093 {
15094 if(count > 0)
15095 {
15096 int i_count;
15097 rsbac_gid_t * i_id_p = NULL;
15098
15099 i_count = count + 20; /* max value to expect */
15100 *id_pp = rsbac_vmalloc(i_count * sizeof(**id_pp));
15101 if(!*id_pp)
15102 return -RSBAC_ENOMEM;
15103 tmp_count = rsbac_ta_list_get_all_desc(ta_number,
15104 group_handles.rc,
15105 (void **) &i_id_p);
15106 if(tmp_count > 0)
15107 {
15108 if(tmp_count > i_count)
15109 tmp_count = i_count;
15110 memcpy(*id_pp, i_id_p, tmp_count * sizeof(*i_id_p));
15111 rsbac_vfree(i_id_p);
15112 count = tmp_count;
15113 i_count -= tmp_count;
15114 }
15115 else
15116 count = 0;
15117 if(!count)
15118 rsbac_vfree(*id_pp);
15119 }
15120 }
15121 return count;
15122 #else
15123 return 0;
15124 #endif
15125 }
|
|
||||||||||||
|
Definition at line 14963 of file aci_data_structures.c. References copy_new_uids(), NULL, RSBAC_ENOMEM, rsbac_ta_list_count(), rsbac_ta_list_get_all_desc(), rsbac_vfree, rsbac_vmalloc, and user_handles. Referenced by sys_rsbac_list_all_user(). 14964 {
14965 int count=0;
14966 int tmp_count;
14967
14968 tmp_count = rsbac_ta_list_count(ta_number, user_handles.gen);
14969 if(tmp_count > 0)
14970 count += tmp_count;
14971 #if defined(CONFIG_RSBAC_MAC)
14972 tmp_count = rsbac_ta_list_count(ta_number, user_handles.mac);
14973 if(tmp_count > 0)
14974 count += tmp_count;
14975 #endif
14976 #if defined(CONFIG_RSBAC_PM)
14977 tmp_count = rsbac_ta_list_count(ta_number, user_handles.pm);
14978 if(tmp_count > 0)
14979 count += tmp_count;
14980 #endif
14981 #if defined(CONFIG_RSBAC_DAZ)
14982 tmp_count = rsbac_ta_list_count(ta_number, user_handles.daz);
14983 if(tmp_count > 0)
14984 count += tmp_count;
14985 #endif
14986 #if defined(CONFIG_RSBAC_FF)
14987 tmp_count = rsbac_ta_list_count(ta_number, user_handles.ff);
14988 if(tmp_count > 0)
14989 count += tmp_count;
14990 #endif
14991 #if defined(CONFIG_RSBAC_RC)
14992 tmp_count = rsbac_ta_list_count(ta_number, user_handles.rc);
14993 if(tmp_count > 0)
14994 count += tmp_count;
14995 #endif
14996 #if defined(CONFIG_RSBAC_AUTH)
14997 tmp_count = rsbac_ta_list_count(ta_number, user_handles.auth);
14998 if(tmp_count > 0)
14999 count += tmp_count;
15000 #endif
15001 #if defined(CONFIG_RSBAC_CAP)
15002 tmp_count = rsbac_ta_list_count(ta_number, user_handles.cap);
15003 if(tmp_count > 0)
15004 count += tmp_count;
15005 #endif
15006 #if defined(CONFIG_RSBAC_JAIL)
15007 tmp_count = rsbac_ta_list_count(ta_number, user_handles.jail);
15008 if(tmp_count > 0)
15009 count += tmp_count;
15010 #endif
15011 #if defined(CONFIG_RSBAC_PAX)
15012 tmp_count = rsbac_ta_list_count(ta_number, user_handles.pax);
15013 if(tmp_count > 0)
15014 count += tmp_count;
15015 #endif
15016 #if defined(CONFIG_RSBAC_RES)
15017 tmp_count = rsbac_ta_list_count(ta_number, user_handles.res);
15018 if(tmp_count > 0)
15019 count += tmp_count;
15020 #endif
15021 if(id_pp)
15022 {
15023 if(count > 0)
15024 {
15025 int i_count;
15026 rsbac_uid_t * i_id_p = NULL;
15027
15028 i_count = count + 20; /* max value to expect */
15029 *id_pp = rsbac_vmalloc(i_count * sizeof(**id_pp));
15030 if(!*id_pp)
15031 return -RSBAC_ENOMEM;
15032 tmp_count = rsbac_ta_list_get_all_desc(ta_number,
15033 user_handles.gen,
15034 (void **) &i_id_p);
15035 if(tmp_count > 0)
15036 {
15037 if(tmp_count > i_count)
15038 tmp_count = i_count;
15039 memcpy(*id_pp, i_id_p, tmp_count * sizeof(*i_id_p));
15040 rsbac_vfree(i_id_p);
15041 count = tmp_count;
15042 i_count -= tmp_count;
15043 }
15044 else
15045 count = 0;
15046 #if defined(CONFIG_RSBAC_MAC)
15047 copy_new_uids(user_handles.mac, ta_number, &count, &i_count, *id_pp);
15048 #endif
15049 #if defined(CONFIG_RSBAC_PM)
15050 copy_new_uids(user_handles.pm, ta_number, &count, &i_count, *id_pp);
15051 #endif
15052 #if defined(CONFIG_RSBAC_DAZ)
15053 copy_new_uids(user_handles.daz, ta_number, &count, &i_count, *id_pp);
15054 #endif
15055 #if defined(CONFIG_RSBAC_FF)
15056 copy_new_uids(user_handles.ff, ta_number, &count, &i_count, *id_pp);
15057 #endif
15058 #if defined(CONFIG_RSBAC_RC)
15059 copy_new_uids(user_handles.rc, ta_number, &count, &i_count, *id_pp);
15060 #endif
15061 #if defined(CONFIG_RSBAC_AUTH)
15062 copy_new_uids(user_handles.auth, ta_number, &count, &i_count, *id_pp);
15063 #endif
15064 #if defined(CONFIG_RSBAC_CAP)
15065 copy_new_uids(user_handles.cap, ta_number, &count, &i_count, *id_pp);
15066 #endif
15067 #if defined(CONFIG_RSBAC_JAIL)
15068 copy_new_uids(user_handles.jail, ta_number, &count, &i_count, *id_pp);
15069 #endif
15070 #if defined(CONFIG_RSBAC_PAX)
15071 copy_new_uids(user_handles.pax, ta_number, &count, &i_count, *id_pp);
15072 #endif
15073 #if defined(CONFIG_RSBAC_RES)
15074 copy_new_uids(user_handles.res, ta_number, &count, &i_count, *id_pp);
15075 #endif
15076 if(!count)
15077 rsbac_vfree(*id_pp);
15078 }
15079 }
15080 return count;
15081 }
|
|
||||||||||||||||
|
Definition at line 14322 of file aci_data_structures.c. References D_char, rsbac_target_id_t::dev, dev_handles, device_list_head, gen_fd_hash(), gen_p_hash(), rsbac_target_id_t::group, rsbac_target_id_t::ipc, ipc_handles, lookup_device(), rsbac_target_id_t::netdev, rsbac_target_id_t::netobj, rsbac_target_id_t::nettemp, NULL, rsbac_target_id_t::process, process_handles, rsbac_acl_remove_acl(), rsbac_auth_remove_f_capsets(), rsbac_auth_remove_p_capsets(), RSBAC_EINVALIDDEV, RSBAC_EINVALIDTARGET, RSBAC_ENOTINITIALIZED, rsbac_initialized, rsbac_mac_remove_f_trusets(), rsbac_mac_remove_p_trusets(), rsbac_mount(), rsbac_printk(), rsbac_ta_list_remove(), rsbac_net_obj_desc_t::sock_p, T_DEV, T_DIR, T_FIFO, T_FILE, T_GROUP, T_IPC, T_NETDEV, T_NETOBJ, T_NETTEMP, T_NETTEMP_NT, T_PROCESS, T_SYMLINK, T_USER, rsbac_dev_desc_t::type, rsbac_target_id_t::user, and user_handles. Referenced by rsbac_pm(), sys_rsbac_remove_target(), and sys_rsbac_remove_target_n(). 14326 {
14327 int error=0;
14328 struct rsbac_device_list_item_t * device_p;
14329 u_long dflags;
14330
14331 if (!rsbac_initialized)
14332 {
14333 rsbac_printk(KERN_WARNING "rsbac_remove_target(): RSBAC not initialized\n");
14334 return(-RSBAC_ENOTINITIALIZED);
14335 }
14336 if (in_interrupt())
14337 {
14338 rsbac_printk(KERN_WARNING "rsbac_remove_target(): called from interrupt!\n");
14339 }
14340 switch (target)
14341 {
14342 case T_FILE:
14343 case T_DIR:
14344 case T_FIFO:
14345 case T_SYMLINK:
14346 /*
14347 #ifdef CONFIG_RSBAC_DEBUG
14348 if (rsbac_debug_ds)
14349 rsbac_printk(KERN_DEBUG "%s\n",
14350 "rsbac_remove_target(): Removing file/dir/fifo/symlink ACI");
14351 #endif
14352 */
14353 #if defined(CONFIG_RSBAC_MAC)
14354 /* file and dir items can also have mac_f_trusets -> remove first */
14355 if( (target == T_FILE)
14356 || (target == T_DIR)
14357 )
14358 error = rsbac_mac_remove_f_trusets(tid.file);
14359 #endif
14360 #if defined(CONFIG_RSBAC_AUTH)
14361 /* file and dir items can also have auth_f_capsets -> remove first */
14362 if( (target == T_FILE)
14363 || (target == T_DIR)
14364 )
14365 error = rsbac_auth_remove_f_capsets(tid.file);
14366 #endif
14367 #if defined(CONFIG_RSBAC_ACL)
14368 /* items can also have an acl_fd_item -> remove first */
14369 error = rsbac_acl_remove_acl(ta_number, target, tid);
14370 #endif
14371 /* wait for read access to device_list_head */
14372 rsbac_read_lock(&device_list_head.lock, &dflags);
14373 /* OK, go on */
14374
14375 /* lookup device */
14376 device_p = lookup_device(tid.file.device);
14377 if (!device_p)
14378 {
14379 struct super_block * sb_p;
14380
14381 rsbac_read_unlock(&device_list_head.lock, &dflags);
14382 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
14383 sb_p = user_get_super(tid.file.device);
14384 #else
14385 sb_p = get_super(tid.file.device);
14386 #endif
14387 if(sb_p)
14388 {
14389 rsbac_printk(KERN_INFO
14390 "rsbac_remove_target(): auto-mounting device %02u:%02u\n",
14391 RSBAC_MAJOR(tid.file.device), RSBAC_MINOR(tid.file.device));
14392 rsbac_mount(sb_p, NULL);
14393 /* free super_block pointer */
14394 drop_super(sb_p);
14395 rsbac_read_lock(&device_list_head.lock, &dflags);
14396 device_p = lookup_device(tid.file.device);
14397 if (!device_p)
14398 {
14399 rsbac_printk(KERN_WARNING
14400 "rsbac_remove_target(): unknown device %02u:%02u\n",
14401 RSBAC_MAJOR(tid.file.device), RSBAC_MINOR(tid.file.device));
14402 rsbac_read_unlock(&device_list_head.lock, &dflags);
14403 return -RSBAC_EINVALIDDEV;
14404 }
14405 }
14406 else
14407 return -RSBAC_EINVALIDDEV;
14408 }
14409 rsbac_ta_list_remove(ta_number,
14410 device_p->handles.gen[gen_fd_hash(tid.file.inode)],
14411 &tid.file.inode);
14412 #if defined(CONFIG_RSBAC_MAC)
14413 rsbac_ta_list_remove(ta_number,
14414 device_p->handles.mac[mac_fd_hash(tid.file.inode)],
14415 &tid.file.inode);
14416 #endif
14417 #if defined(CONFIG_RSBAC_PM)
14418 rsbac_ta_list_remove(ta_number,
14419 device_p->handles.pm[pm_fd_hash(tid.file.inode)],
14420 &tid.file.inode);
14421 #endif
14422 #if defined(CONFIG_RSBAC_DAZ)
14423 rsbac_ta_list_remove(ta_number,
14424 device_p->handles.daz[daz_fd_hash(tid.file.inode)],
14425 &tid.file.inode);
14426 #if defined(CONFIG_RSBAC_DAZ_CACHE)
14427 rsbac_ta_list_remove(ta_number,
14428 device_p->handles.dazs[daz_scanned_fd_hash(tid.file.inode)],
14429 &tid.file.inode);
14430 #endif
14431 #endif
14432 #if defined(CONFIG_RSBAC_FF)
14433 rsbac_ta_list_remove(ta_number,
14434 device_p->handles.ff[ff_fd_hash(tid.file.inode)],
14435 &tid.file.inode);
14436 #endif
14437 #if defined(CONFIG_RSBAC_RC)
14438 rsbac_ta_list_remove(ta_number,
14439 device_p->handles.rc[rc_fd_hash(tid.file.inode)],
14440 &tid.file.inode);
14441 #endif
14442 #if defined(CONFIG_RSBAC_AUTH)
14443 rsbac_ta_list_remove(ta_number,
14444 device_p->handles.auth[auth_fd_hash(tid.file.inode)],
14445 &tid.file.inode);
14446 #endif
14447 #if defined(CONFIG_RSBAC_CAP)
14448 rsbac_ta_list_remove(ta_number,
14449 device_p->handles.cap[cap_fd_hash(tid.file.inode)],
14450 &tid.file.inode);
14451 #endif
14452 #if defined(CONFIG_RSBAC_PAX)
14453 rsbac_ta_list_remove(ta_number,
14454 device_p->handles.pax[pax_fd_hash(tid.file.inode)],
14455 &tid.file.inode);
14456 #endif
14457 #if defined(CONFIG_RSBAC_RES)
14458 rsbac_ta_list_remove(ta_number,
14459 device_p->handles.res[res_fd_hash(tid.file.inode)],
14460 &tid.file.inode);
14461 #endif
14462
14463 /* free access to device_list_head */
14464 rsbac_read_unlock(&device_list_head.lock, &dflags);
14465 break;
14466
14467 case T_DEV:
14468 {
14469 if(tid.dev.type > D_char)
14470 return -RSBAC_EINVALIDTARGET;
14471 /*
14472 #ifdef CONFIG_RSBAC_DEBUG
14473 if (rsbac_debug_ds) rsbac_printk(KERN_DEBUG "%s\n",
14474 "rsbac_remove_target(): Removing dev ACI");
14475 #endif
14476 */
14477 rsbac_ta_list_remove(ta_number,
14478 dev_handles.gen,
14479 &tid.dev);
14480 #if defined(CONFIG_RSBAC_MAC)
14481 rsbac_ta_list_remove(ta_number,
14482 dev_handles.mac,
14483 &tid.dev);
14484 #endif
14485 #if defined(CONFIG_RSBAC_PM)
14486 rsbac_ta_list_remove(ta_number,
14487 dev_handles.pm,
14488 &tid.dev);
14489 #endif
14490 #if defined(CONFIG_RSBAC_RC)
14491 rsbac_ta_list_remove(ta_number,
14492 dev_handles.rc,
14493 &tid.dev);
14494 #endif
14495 }
14496 break;
14497
14498 case T_IPC:
14499 /*
14500 #ifdef CONFIG_RSBAC_DEBUG
14501 if (rsbac_debug_ds)
14502 rsbac_printk(KERN_DEBUG
14503 "rsbac_remove_target(): Removing ipc ACI\n");
14504 #endif
14505 */
14506 #if defined(CONFIG_RSBAC_MAC)
14507 rsbac_ta_list_remove(ta_number,
14508 ipc_handles.mac,
14509 &tid.ipc);
14510 #endif
14511 #if defined(CONFIG_RSBAC_PM)
14512 rsbac_ta_list_remove(ta_number,
14513 ipc_handles.pm,
14514 &tid.ipc);
14515 #endif
14516 #if defined(CONFIG_RSBAC_RC)
14517 rsbac_ta_list_remove(ta_number,
14518 ipc_handles.rc,
14519 &tid.ipc);
14520 #endif
14521 #if defined(CONFIG_RSBAC_JAIL)
14522 rsbac_ta_list_remove(ta_number,
14523 ipc_handles.jail,
14524 &tid.ipc);
14525 #endif
14526 break;
14527
14528 case T_USER:
14529 /*
14530 #ifdef CONFIG_RSBAC_DEBUG
14531 if (rsbac_debug_ds) rsbac_printk(KERN_DEBUG "%s\n",
14532 "rsbac_remove_target(): Removing user ACI");
14533 #endif
14534 */
14535 rsbac_ta_list_remove(ta_number,
14536 user_handles.gen,
14537 &tid.user);
14538 #if defined(CONFIG_RSBAC_MAC)
14539 rsbac_ta_list_remove(ta_number,
14540 user_handles.mac,
14541 &tid.user);
14542 #endif
14543 #if defined(CONFIG_RSBAC_PM)
14544 rsbac_ta_list_remove(ta_number,
14545 user_handles.pm,
14546 &tid.user);
14547 #endif
14548 #if defined(CONFIG_RSBAC_DAZ)
14549 rsbac_ta_list_remove(ta_number,
14550 user_handles.daz,
14551 &tid.user);
14552 #endif
14553 #if defined(CONFIG_RSBAC_FF)
14554 rsbac_ta_list_remove(ta_number,
14555 user_handles.ff,
14556 &tid.user);
14557 #endif
14558 #if defined(CONFIG_RSBAC_RC)
14559 rsbac_ta_list_remove(ta_number,
14560 user_handles.rc,
14561 &tid.user);
14562 #endif
14563 #if defined(CONFIG_RSBAC_AUTH)
14564 rsbac_ta_list_remove(ta_number,
14565 user_handles.auth,
14566 &tid.user);
14567 #endif
14568 #if defined(CONFIG_RSBAC_CAP)
14569 rsbac_ta_list_remove(ta_number,
14570 user_handles.cap,
14571 &tid.user);
14572 #endif
14573 #if defined(CONFIG_RSBAC_JAIL)
14574 rsbac_ta_list_remove(ta_number,
14575 user_handles.jail,
14576 &tid.user);
14577 #endif
14578 #if defined(CONFIG_RSBAC_PAX)
14579 rsbac_ta_list_remove(ta_number,
14580 user_handles.pax,
14581 &tid.user);
14582 #endif
14583 #if defined(CONFIG_RSBAC_RES)
14584 rsbac_ta_list_remove(ta_number,
14585 user_handles.res,
14586 &tid.user);
14587 #endif
14588 break;
14589
14590 case T_PROCESS:
14591 /* too noisy... kicked out.
14592 #ifdef CONFIG_RSBAC_DEBUG
14593 if (rsbac_debug_ds)
14594 rsbac_printk(KERN_DEBUG
14595 "rsbac_remove_target(): Removing process ACI\n");
14596 #endif
14597 */
14598 #if defined(CONFIG_RSBAC_ACL)
14599 /* process items can also have an acl_p_item -> remove first */
14600 error = rsbac_acl_remove_acl(ta_number, target, tid);
14601 #endif
14602 rsbac_ta_list_remove(ta_number,
14603 process_handles.gen[gen_p_hash(tid.process)],
14604 &tid.process);
14605 #if defined(CONFIG_RSBAC_MAC)
14606 /* process items can also have mac_p_trusets -> remove first */
14607 error = rsbac_mac_remove_p_trusets(tid.process);
14608 rsbac_ta_list_remove(ta_number,
14609 process_handles.mac[mac_p_hash(tid.process)],
14610 &tid.process);
14611 #endif
14612 #if defined(CONFIG_RSBAC_PM)
14613 rsbac_ta_list_remove(ta_number,
14614 process_handles.pm,
14615 &tid.process);
14616 #endif
14617 #if defined(CONFIG_RSBAC_DAZ)
14618 rsbac_ta_list_remove(ta_number,
14619 process_handles.daz,
14620 &tid.process);
14621 #endif
14622 #if defined(CONFIG_RSBAC_RC)
14623 rsbac_ta_list_remove(ta_number,
14624 process_handles.rc[rc_p_hash(tid.process)],
14625 &tid.process);
14626 #endif
14627 #if defined(CONFIG_RSBAC_AUTH)
14628 /* process items can also have auth_p_capsets -> remove first */
14629 error = rsbac_auth_remove_p_capsets(tid.process);
14630 rsbac_ta_list_remove(ta_number,
14631 process_handles.auth,
14632 &tid.process);
14633 #endif
14634 #if defined(CONFIG_RSBAC_CAP)
14635 rsbac_ta_list_remove(ta_number,
14636 process_handles.cap,
14637 &tid.process);
14638 #endif
14639 #if defined(CONFIG_RSBAC_JAIL)
14640 rsbac_ta_list_remove(ta_number,
14641 process_handles.jail[jail_p_hash(tid.process)],
14642 &tid.process);
14643 #endif
14644 break;
14645
14646 #ifdef CONFIG_RSBAC_UM
14647 case T_GROUP:
14648 /*
14649 #ifdef CONFIG_RSBAC_DEBUG
14650 if (rsbac_debug_ds)
14651 rsbac_printk(KERN_DEBUG
14652 "rsbac_remove_target(): Removing group ACI\n");
14653 #endif
14654 */
14655 #if defined(CONFIG_RSBAC_RC_UM_PROT)
14656 rsbac_ta_list_remove(ta_number,
14657 group_handles.rc,
14658 &tid.group);
14659 #endif
14660 break;
14661 #endif /* CONFIG_RSBAC_UM */
14662
14663 #ifdef CONFIG_RSBAC_NET_DEV
14664 case T_NETDEV:
14665 #if defined(CONFIG_RSBAC_IND_NETDEV_LOG)
14666 rsbac_ta_list_remove(ta_number,
14667 netdev_handles.gen,
14668 &tid.netdev);
14669 #endif
14670 #if defined(CONFIG_RSBAC_RC)
14671 rsbac_ta_list_remove(ta_number,
14672 netdev_handles.rc,
14673 &tid.netdev);
14674 #endif
14675 break;
14676 #endif
14677
14678 #ifdef CONFIG_RSBAC_NET_OBJ
14679 case T_NETTEMP:
14680 /* too noisy... kicked out.
14681 #ifdef CONFIG_RSBAC_DEBUG
14682 if (rsbac_debug_ds)
14683 rsbac_printk(KERN_DEBUG
14684 "rsbac_remove_target(): Removing nettemp ACI\n");
14685 #endif
14686 */
14687 #if defined(CONFIG_RSBAC_IND_NETOBJ_LOG)
14688 rsbac_ta_list_remove(ta_number,
14689 nettemp_handles.gen,
14690 &tid.nettemp);
14691 #endif
14692 #if defined(CONFIG_RSBAC_MAC)
14693 rsbac_ta_list_remove(ta_number,
14694 nettemp_handles.mac,
14695 &tid.nettemp);
14696 #endif
14697 #if defined(CONFIG_RSBAC_PM)
14698 rsbac_ta_list_remove(ta_number,
14699 nettemp_handles.pm,
14700 &tid.nettemp);
14701 #endif
14702 #if defined(CONFIG_RSBAC_RC)
14703 rsbac_ta_list_remove(ta_number,
14704 nettemp_handles.rc,
14705 &tid.nettemp);
14706 #endif
14707 #if defined(CONFIG_RSBAC_ACL_NET_OBJ_PROT)
14708 rsbac_acl_remove_acl(ta_number, T_NETTEMP_NT, tid);
14709 rsbac_acl_remove_acl(ta_number, T_NETTEMP, tid);
14710 #endif
14711 break;
14712
14713 case T_NETOBJ:
14714 /* too noisy... kicked out.
14715 #ifdef CONFIG_RSBAC_DEBUG
14716 if (rsbac_debug_ds)
14717 rsbac_printk(KERN_DEBUG
14718 "rsbac_remove_target(): Removing netobj ACI\n");
14719 #endif
14720 */
14721 #if defined(CONFIG_RSBAC_MAC)
14722 rsbac_ta_list_remove(ta_number,
14723 lnetobj_handles.mac,
14724 &tid.netobj.sock_p);
14725 rsbac_ta_list_remove(ta_number,
14726 rnetobj_handles.mac,
14727 &tid.netobj.sock_p);
14728 #endif
14729 #if defined(CONFIG_RSBAC_PM)
14730 rsbac_ta_list_remove(ta_number,
14731 lnetobj_handles.pm,
14732 &tid.netobj.sock_p);
14733 rsbac_ta_list_remove(ta_number,
14734 rnetobj_handles.pm,
14735 &tid.netobj.sock_p);
14736 #endif
14737 #if defined(CONFIG_RSBAC_RC)
14738 rsbac_ta_list_remove(ta_number,
14739 lnetobj_handles.rc,
14740 &tid.netobj.sock_p);
14741 rsbac_ta_list_remove(ta_number,
14742 rnetobj_handles.rc,
14743 &tid.netobj.sock_p);
14744 #endif
14745 break;
14746
14747 #endif /* NET_OBJ */
14748
14749 default:
14750 return(-RSBAC_EINVALIDTARGET);
14751 }
14752 #ifdef CONFIG_RSBAC_XSTATS
14753 remove_count[target]++;
14754 #endif
14755 return(error);
14756 } /* end of rsbac_remove_target() */
|
|
||||||||||||||||||||||||||||
|
Definition at line 14239 of file aci_data_structures.c. References rsbac_target_id_t::dev, RSBAC_EINVALIDTARGET, RSBAC_ENOTINITIALIZED, rsbac_initialized, rsbac_printk(), set_attr_dev(), set_attr_fd(), set_attr_ipc(), set_attr_process(), set_attr_user(), T_DEV, T_DIR, T_FIFO, T_FILE, T_GROUP, T_IPC, T_NETDEV, T_NETOBJ, T_NETTEMP, T_PROCESS, T_SYMLINK, and T_USER. Referenced by rsbac_pm(), sys_rsbac_set_attr(), and sys_rsbac_set_attr_n(). 14246 {
14247 int err = 0;
14248 /*
14249 #ifdef CONFIG_RSBAC_DEBUG
14250 char tmp[RSBAC_MAXNAMELEN];
14251 #endif
14252 */
14253 if (!rsbac_initialized)
14254 {
14255 rsbac_printk(KERN_WARNING "rsbac_set_attr(): RSBAC not initialized\n");
14256 return(-RSBAC_ENOTINITIALIZED);
14257 }
14258 if (in_interrupt())
14259 {
14260 rsbac_printk(KERN_WARNING "rsbac_set_attr(): called from interrupt!\n");
14261 }
14262 switch (target)
14263 {
14264 case T_FILE:
14265 case T_DIR:
14266 case T_FIFO:
14267 case T_SYMLINK:
14268 err = set_attr_fd(ta_number, module, target, &tid, attr, &value);
14269 break;
14270
14271 case T_DEV:
14272 err = set_attr_dev(ta_number, module, target, tid.dev, attr, &value);
14273 break;
14274
14275 case T_IPC:
14276 err = set_attr_ipc(ta_number, module, target, &tid, attr, &value);
14277 break;
14278
14279 case T_USER:
14280 err = set_attr_user(ta_number, module, target, &tid, attr, &value);
14281 break;
14282
14283 case T_PROCESS:
14284 err = set_attr_process(ta_number, module, target, &tid, attr, &value);
14285 break;
14286
14287 #ifdef CONFIG_RSBAC_UM
14288 case T_GROUP:
14289 err = set_attr_group(ta_number, module, target, &tid, attr, &value);
14290 break;
14291 #endif /* CONFIG_RSBAC_UM */
14292
14293 #ifdef CONFIG_RSBAC_NET_DEV
14294 case T_NETDEV:
14295 err = set_attr_netdev(ta_number, module, target, &tid, attr, &value);
14296 break;
14297 #endif
14298
14299 #ifdef CONFIG_RSBAC_NET_OBJ
14300 case T_NETTEMP:
14301 err = set_attr_nettemp(ta_number, module, target, &tid, attr, &value);
14302 break;
14303
14304 case T_NETOBJ:
14305 err = set_attr_netobj(ta_number, module, target, &tid, attr, &value);
14306 break;
14307 #endif /* NET_OBJ */
14308
14309 /* switch(target): no valid target */
14310 default:
14311 return(-RSBAC_EINVALIDTARGET);
14312 }
14313 #ifdef CONFIG_RSBAC_XSTATS
14314 if(!err)
14315 set_attr_count[target]++;
14316 #endif
14317 return(err);
14318 } /* end of rsbac_set_attr() */
|
|
||||||||||||
|
Definition at line 8456 of file aci_data_structures.c. References device_list_head, lookup_device(), NULL, remove_device_item(), rsbac_debug_no_write, RSBAC_EINVALIDPOINTER, RSBAC_ENOTINITIALIZED, rsbac_initialized, rsbac_list_umount(), rsbac_printk(), rsbac_umount_acl(), rsbac_umount_auth(), rsbac_umount_mac(), rsbac_umount_reg(), rsbac_write(), rsbac_write_sem, sysfs_covered_p, SYSFS_MAGIC, sysfs_sb_p, and TRUE. Referenced by rsbac_aef_sb_umount(). 08457 {
08458 u_long flags;
08459 struct rsbac_device_list_item_t * device_p;
08460 kdev_t kdev;
08461
08462 if(!sb_p)
08463 {
08464 rsbac_printk(KERN_WARNING
08465 "rsbac_umount(): called with NULL pointer\n");
08466 return -RSBAC_EINVALIDPOINTER;
08467 }
08468 if (!rsbac_initialized)
08469 {
08470 rsbac_printk(KERN_WARNING "rsbac_umount(): RSBAC not initialized\n");
08471
08472 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
08473 if( (sb_p->s_magic == SYSFS_MAGIC)
08474 && !RSBAC_MAJOR(sb_p->s_dev)
08475 && sysfs_sb_p
08476 && sysfs_covered_p
08477 )
08478 {
08479 rsbac_printk(KERN_WARNING
08480 "rsbac_umount(): sysfs umount detected, removing auto-mount values\n");
08481 sysfs_sb_p = NULL;
08482 sysfs_covered_p = NULL;
08483 }
08484 #endif
08485 #ifdef CONFIG_DEVFS_MOUNT
08486 if( (sb_p->s_magic == DEVFS_SUPER_MAGIC)
08487 && !RSBAC_MAJOR(sb_p->s_dev)
08488 && devfs_sb_p
08489 && devfs_covered_p
08490 )
08491 {
08492 rsbac_printk(KERN_WARNING
08493 "rsbac_umount(): devfs umount detected, removing auto-mount values\n");
08494 devfs_sb_p = NULL;
08495 devfs_covered_p = NULL;
08496 }
08497 #endif
08498
08499 return(-RSBAC_ENOTINITIALIZED);
08500 }
08501
08502 #ifdef CONFIG_RSBAC_DEBUG
08503 if (rsbac_debug_ds)
08504 {
08505 rsbac_printk(KERN_DEBUG "rsbac_umount(): umounting device %02u:%02u\n",
08506 MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev));
08507 }
08508 #endif
08509
08510 kdev = sb_p->s_dev;
08511
08512 /* sync attribute lists */
08513 #if defined(CONFIG_RSBAC_AUTO_WRITE)
08514 if(!rsbac_debug_no_write)
08515 {
08516 down(&rsbac_write_sem);
08517 /* recheck no_write with lock - might have been set in between */
08518 if(!rsbac_debug_no_write)
08519 {
08520 rsbac_write(TRUE);
08521 }
08522 up(&rsbac_write_sem);
08523 }
08524 #endif /* CONFIG_RSBAC_AUTO_WRITE */
08525 /* call other umount functions */
08526 /****** MAC *******/
08527 #if defined(CONFIG_RSBAC_MAC)
08528 rsbac_umount_mac(kdev);
08529 #endif
08530 /****** AUTH *******/
08531 #if defined(CONFIG_RSBAC_AUTH)
08532 rsbac_umount_auth(kdev);
08533 #endif
08534 /****** ACL *******/
08535 #if defined(CONFIG_RSBAC_ACL)
08536 rsbac_umount_acl(kdev);
08537 #endif
08538 /****** REG *******/
08539 #if defined(CONFIG_RSBAC_REG)
08540 rsbac_umount_reg(kdev);
08541 #endif /* REG */
08542
08543 /* wait for write access to device_list_head */
08544 rsbac_write_lock(&device_list_head.lock, &flags);
08545 /* OK, nobody else is working on it... */
08546 device_p = lookup_device(kdev);
08547 if(device_p)
08548 {
08549 if(device_p->mount_count == 1)
08550 {
08551 /* Generic lists */
08552 rsbac_list_umount(kdev);
08553 remove_device_item(kdev);
08554 }
08555 else
08556 {
08557 if(device_p->mount_count > 1)
08558 {
08559 device_p->mount_count--;
08560 if(device_p->d_covers == d_covers)
08561 {
08562 rsbac_printk(KERN_WARNING "rsbac_umount: removed primary mount for device %02u:%02u, inheritance broken!\n",
08563 RSBAC_MAJOR(kdev), RSBAC_MINOR(kdev));
08564 device_p->d_covers = NULL;
08565 }
08566 }
08567 else
08568 {
08569 rsbac_printk(KERN_WARNING "rsbac_umount: device %02u:%02u has mount_count < 1!\n",
08570 RSBAC_MAJOR(kdev), RSBAC_MINOR(kdev));
08571 }
08572 }
08573 }
08574 /* allow access */
08575 rsbac_write_unlock(&device_list_head.lock, &flags);
08576
08577 return(0);
08578 }
|
|
|
Definition at line 2659 of file aci_data_structures.c. References rsbac_read_close(). Referenced by rsbac_list_write_buffers(), rsbac_list_write_lol_buffers(), and write_info(). 02660 {
02661 rsbac_read_close(file_p);
02662 }
|
|
||||||||||||||||
|
Definition at line 2273 of file aci_data_structures.c. References check_parent, init_private_file(), lookup_aci_path_dentry(), NULL, rsbac_clear_file(), RSBAC_EINVALIDDEV, RSBAC_EINVALIDPOINTER, RSBAC_ENOMEM, RSBAC_ENOTWRITABLE, RSBAC_EWRITEFAILED, rsbac_get_super_block(), rsbac_kfree(), rsbac_kmalloc(), rsbac_lookup_one_len(), RSBAC_MAXNAMELEN, rsbac_printk(), TRUE, and writable(). Referenced by rsbac_list_write_buffers(), rsbac_list_write_lol_buffers(), and write_info(). 02276 {
02277 struct dentry * dir_dentry_p = NULL;
02278 struct dentry * ldir_dentry_p = NULL;
02279 struct dentry * file_dentry_p = NULL;
02280 int err = 0;
02281 int tmperr = 0;
02282 struct super_block * sb_p;
02283
02284 if(!file_p || !name)
02285 {
02286 #ifdef CONFIG_RSBAC_DEBUG
02287 if (rsbac_debug_write)
02288 {
02289 rsbac_printk(KERN_DEBUG "rsbac_write_open(): called with NULL pointer!\n");
02290 }
02291 #endif
02292 return(-RSBAC_EINVALIDPOINTER);
02293 }
02294
02295 /* get super_block-pointer */
02296 sb_p = rsbac_get_super_block(kdev);
02297 if (!sb_p)
02298 {
02299 rsbac_printk(KERN_WARNING
02300 "rsbac_write_open(): invalid device %02u:%02u\n",
02301 RSBAC_MAJOR(kdev), RSBAC_MINOR(kdev));
02302 return (-RSBAC_EINVALIDDEV);
02303 }
02304 if(!writable(sb_p))
02305 {
02306 #ifdef CONFIG_RSBAC_DEBUG
02307 if (rsbac_debug_write)
02308 {
02309 rsbac_printk(KERN_DEBUG
02310 "rsbac_write_open(): called for non-writable device\n");
02311 }
02312 #endif
02313 err = -RSBAC_ENOTWRITABLE;
02314 goto out;
02315 }
02316
02317 /* lookup dentry of ACI_PATH on this device (create, if needed and possible),
02318 * returns errorcode, if failed */
02319 if ((tmperr = lookup_aci_path_dentry(sb_p, &dir_dentry_p, TRUE,
02320 kdev)))
02321 {
02322 err = tmperr;
02323 goto out;
02324 }
02325
02326 /* open file for reading - this must be done 'by hand', because */
02327 /* standard system calls are now extended by rsbac decision calls. */
02328 file_dentry_p = rsbac_lookup_one_len(name, dir_dentry_p, strlen(name));
02329 if (!file_dentry_p || IS_ERR(file_dentry_p))
02330 {
02331 #ifdef CONFIG_RSBAC_DEBUG
02332 if (rsbac_debug_write)
02333 {
02334 rsbac_printk(KERN_DEBUG
02335 "rsbac_write_open(): lookup of %s returned error %li\n",
02336 name, PTR_ERR(file_dentry_p));
02337 }
02338 #endif
02339 err = -RSBAC_EWRITEFAILED;
02340 goto out;
02341 }
02342
02343 #if 1
02344 if (file_dentry_p->d_inode)
02345 { /* file was found: try to rename it as backup file */
02346 if ( !dir_dentry_p->d_inode->i_op
02347 || !dir_dentry_p->d_inode->i_op->rename)
02348 {
02349 rsbac_printk(KERN_WARNING
02350 "rsbac_write_open(): File system supports no rename - no backup of %s made!",
02351 name);
02352 }
02353 else
02354 {
02355 char * bname;
02356 int name_len = strlen(name);
02357 struct dentry * new_file_dentry_p = NULL;
02358 struct dentry * old_dir_p, * new_dir_p;
02359
02360 bname = rsbac_kmalloc(RSBAC_MAXNAMELEN);
02361 if(!bname)
02362 {
02363 err = -RSBAC_ENOMEM;
02364 goto out_dput;
02365 }
02366 strcpy(bname,name);
02367 bname[name_len] = 'b';
02368 bname[name_len+1] = (char) 0;
02369 new_file_dentry_p = rsbac_lookup_one_len(bname, dir_dentry_p, strlen(bname));
02370 if(new_file_dentry_p && !IS_ERR(new_file_dentry_p))
02371 {
02372 /* lock parent == rsbac-dir for rest of rename */
02373 old_dir_p = dget(file_dentry_p->d_parent);
02374 new_dir_p = dget(new_file_dentry_p->d_parent);
02375 double_lock(new_dir_p, old_dir_p);
02376
02377 DQUOT_INIT(old_dir_p->d_inode);
02378 DQUOT_INIT(new_dir_p->d_inode);
02379 /* try to rename file in rsbac dir */
02380 /* if (rsbac_debug_write)
02381 * rsbac_printk(KERN_DEBUG "rsbac_write_open(): calling rename function\n");
02382 */
02383 err = dir_dentry_p->d_inode->i_op->rename(old_dir_p->d_inode,
02384 file_dentry_p,
02385 new_dir_p->d_inode,
02386 new_file_dentry_p);
02387 /* unlock dir (dputs both dentries) */
02388 double_unlock(new_dir_p, old_dir_p);
02389 if(err)
02390 {
02391 rsbac_printk(KERN_WARNING
02392 "rsbac_write_open(): could not rename %s to %s on dev %02u:%02u, error %i - no backup!\n",
02393 name,bname, RSBAC_MAJOR(kdev),RSBAC_MINOR(kdev), err);
02394 }
02395 else
02396 {
02397 /* The following d_move() should become unconditional */
02398 if (!(sb_p->s_type->fs_flags & FS_ODD_RENAME))
02399 d_move(file_dentry_p, new_file_dentry_p);
02400 inode_dir_notify(old_dir_p->d_inode, DN_RENAME);
02401 }
02402 dput(new_file_dentry_p);
02403 dput(file_dentry_p);
02404 /* re-init dentry structure */
02405 file_dentry_p = rsbac_lookup_one_len(name, dir_dentry_p, strlen(name));
02406 if (!file_dentry_p || IS_ERR (file_dentry_p))
02407 {
02408 #ifdef CONFIG_RSBAC_DEBUG
02409 if (rsbac_debug_write)
02410 {
02411 rsbac_printk(KERN_DEBUG
02412 "rsbac_write_open(): relookup of %s returned error %li\n",
02413 name, PTR_ERR(file_dentry_p));
02414 }
02415 #endif
02416 err = -RSBAC_EWRITEFAILED;
02417 goto out;
02418 }
02419 if (file_dentry_p->d_inode)
02420 {
02421 rsbac_printk(KERN_WARNING
02422 "rsbac_write_open(): relookup of %s returned dentry with existing inode %li, trying unlink\n",
02423 name, file_dentry_p->d_inode->i_ino);
02424 /* file was found: try to delete it */
02425 if ( !dir_dentry_p->d_inode->i_op
02426 || !dir_dentry_p->d_inode->i_op->unlink)
02427 {
02428 rsbac_printk(KERN_WARNING
02429 "rsbac_write_open(): File system supports no unlink - %s not deleted!",
02430 name);
02431 rsbac_kfree(bname);
02432 err = -RSBAC_EWRITEFAILED;
02433 goto out_dput;
02434 }
02435 else
02436 {
02437 old_dir_p = lock_parent(file_dentry_p);
02438
02439 DQUOT_INIT(old_dir_p->d_inode);
02440 err = -ENOENT;
02441 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
02442 if (check_parent(old_dir_p, file_dentry_p))
02443 {
02444 #endif
02445 err = dir_dentry_p->d_inode->i_op->unlink(old_dir_p->d_inode,
02446 file_dentry_p);
02447 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
02448 }
02449 else
02450 {
02451 rsbac_printk(KERN_WARNING
02452 "rsbac_write_open(): could not unlink %s on dev %02u:%02u, parent check failed!\n",
02453 name, RSBAC_MAJOR(kdev),RSBAC_MINOR(kdev));
02454 }
02455 #endif
02456 /* unlock parent dir */
02457 unlock_dir(old_dir_p);
02458 /* free file dentry */
02459 dput(file_dentry_p);
02460 if(err)
02461 {
02462 rsbac_printk(KERN_WARNING
02463 "rsbac_write_open(): could not unlink %s on dev %02u:%02u, error %i!\n",
02464 name, RSBAC_MAJOR(kdev),RSBAC_MINOR(kdev), err);
02465 }
02466 /* re-init dentry structure */
02467 file_dentry_p = rsbac_lookup_one_len(name, dir_dentry_p, strlen(name));
02468 if (!file_dentry_p || IS_ERR (file_dentry_p))
02469 {
02470 #ifdef CONFIG_RSBAC_DEBUG
02471 if (rsbac_debug_write)
02472 {
02473 rsbac_printk(KERN_DEBUG
02474 "rsbac_write_open(): relookup of %s returned error %li\n",
02475 name, PTR_ERR(file_dentry_p));
02476 }
02477 #endif
02478 rsbac_kfree(bname);
02479 err = -RSBAC_EWRITEFAILED;
02480 goto out;
02481 }
02482 if (file_dentry_p->d_inode)
02483 {
02484 rsbac_printk(KERN_WARNING
02485 "rsbac_write_open(): relookup of %s returned dentry with existing inode %li\n",
02486 name, file_dentry_p->d_inode->i_ino);
02487 rsbac_kfree(bname);
02488 err = -RSBAC_EWRITEFAILED;
02489 goto out_dput;
02490 }
02491 }
02492 }
02493 }
02494 else
02495 {
02496 rsbac_printk(KERN_WARNING
02497 "rsbac_write_open(): rsbac_lookup_(dentry|one) for backup file %s on dev %02u:%02u failed with error %li - no backup!\n",
02498 bname, RSBAC_MAJOR(kdev),RSBAC_MINOR(kdev), PTR_ERR(new_file_dentry_p));
02499 }
02500 rsbac_kfree(bname);
02501 }
02502 }
02503 #endif /* backup part */
02504
02505 if(!file_dentry_p->d_inode)
02506 {
02507 /* file not found or renamed away: try to create a new one */
02508 if ( !dir_dentry_p->d_inode->i_op
02509 || !dir_dentry_p->d_inode->i_op->create)
02510 {
02511 rsbac_printk(KERN_WARNING "%s\n",
02512 "rsbac_write_open(): File system supports no create!");
02513 err = -RSBAC_EWRITEFAILED;
02514 goto out_dput;
02515 }
02516
02517 /* lock parent == rsbac-dir for create */
02518 ldir_dentry_p = lock_parent(file_dentry_p);
02519 if(IS_ERR(ldir_dentry_p))
02520 {
02521 #ifdef CONFIG_RSBAC_DEBUG
02522 if (rsbac_debug_write)
02523 {
02524 rsbac_printk(KERN_DEBUG
02525 "rsbac_write_open(): lock_parent of %s returned error %li\n",
02526 name, PTR_ERR(ldir_dentry_p));
02527 }
02528 #endif
02529 err = -RSBAC_EWRITEFAILED;
02530 goto out_dput;
02531 }
02532 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
02533 if (!check_parent(ldir_dentry_p, file_dentry_p))
02534 {
02535 #ifdef CONFIG_RSBAC_DEBUG
02536 if (rsbac_debug_write)
02537 {
02538 rsbac_printk(KERN_DEBUG
02539 "rsbac_write_open(): check_parent of %s returned error\n",
02540 name);
02541 }
02542 #endif
02543 unlock_dir(ldir_dentry_p);
02544 err = -RSBAC_EWRITEFAILED;
02545 goto out_dput;
02546 }
02547 #endif
02548 /* try to create file in rsbac dir */
02549 /* if (rsbac_debug_write)
02550 * rsbac_printk(KERN_DEBUG "%s\n",
02551 * "rsbac_write_open(): calling create function");
02552 */
02553 DQUOT_INIT(ldir_dentry_p->d_inode);
02554 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
02555 err = dir_dentry_p->d_inode->i_op->create(ldir_dentry_p->d_inode,
02556 file_dentry_p,
02557 RSBAC_ACI_FILE_MODE,
02558 NULL);
02559 #else
02560 err = dir_dentry_p->d_inode->i_op->create(ldir_dentry_p->d_inode,
02561 file_dentry_p,
02562 RSBAC_ACI_FILE_MODE);
02563 #endif
02564 unlock_dir(ldir_dentry_p);
02565
02566 if (err)
02567 {
02568 goto out_dput;
02569 }
02570 /* create was successful */
02571 }
02572
02573 if ( !(S_ISREG(file_dentry_p->d_inode->i_mode)) )
02574 { /* this is not a file! -> error! */
02575 rsbac_printk(KERN_WARNING
02576 "rsbac_write_open(): expected file is not a file, mode is %o!\n",
02577 file_dentry_p->d_inode->i_mode);
02578 err = -RSBAC_EWRITEFAILED;
02579 goto out_dput;
02580 }
02581 /* Now we fill the file structure and */
02582 /* if there is an open func for this file, use it, otherwise ignore */
02583 if ((tmperr = init_private_file(file_p, file_dentry_p,O_RDONLY)))
02584 {
02585 rsbac_printk(KERN_WARNING "rsbac_write_open(): could not init file!\n");
02586 err = -RSBAC_EWRITEFAILED;
02587 goto out_dput;
02588 }
02589
02590 /* Without a write function we get into troubles -> error */
02591 if ((!file_p->f_op) || (!file_p->f_op->write))
02592 {
02593 rsbac_printk(KERN_WARNING
02594 "rsbac_write_open(): file write function missing!\n");
02595 if(file_p->f_op && file_p->f_op->release)
02596 {
02597 file_p->f_op->release(file_dentry_p->d_inode, file_p);
02598 }
02599 err = -RSBAC_EWRITEFAILED;
02600 goto out_dput;
02601 }
02602
02603 /* trying to get write access */
02604 /* if (rsbac_debug_write)
02605 * rsbac_printk(KERN_DEBUG "rsbac_write_open(): trying to get write access!\n");
02606 */
02607 if (get_write_access(file_dentry_p->d_inode))
02608 {
02609 rsbac_printk(KERN_WARNING
02610 "rsbac_write_open(): could not get write access!\n");
02611 if (file_p->f_op->release)
02612 file_p->f_op->release(file_dentry_p->d_inode, file_p);
02613 err = -RSBAC_EWRITEFAILED;
02614 goto out_dput;
02615 }
02616 /* truncating */
02617 if(rsbac_clear_file(file_dentry_p))
02618 {
02619 if (file_p->f_op->release)
02620 file_p->f_op->release(file_dentry_p->d_inode, file_p);
02621 put_write_access(file_dentry_p->d_inode);
02622 rsbac_printk(KERN_WARNING
02623 "rsbac_write_open(): could not truncate!\n");
02624 err = -RSBAC_EWRITEFAILED;
02625 goto out_dput;
02626 }
02627 /* set synchronous mode for this file */
02628 file_p->f_flags |= O_SYNC;
02629
02630 out:
02631 return err;
02632
02633 out_dput:
02634 dput(file_dentry_p);
02635 goto out;
02636 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 12547 of file aci_data_structures.c. References A_log_array_high, A_log_array_low, A_mac_categories, A_mac_check, A_pm_object_class, A_pm_object_type, A_rc_type, A_security_level, D_block, D_block_major, D_char, D_char_major, DEFAULT_GEN_DEV_ACI, dev_handles, dev_major_handles, GEN, handle, rsbac_attribute_value_t::log_array_high, rsbac_gen_dev_aci_t::log_array_high, rsbac_attribute_value_t::log_array_low, rsbac_gen_dev_aci_t::log_array_low, MAC, rsbac_attribute_value_t::mac_categories, rsbac_attribute_value_t::mac_check, rsbac_dev_desc_t::major, rsbac_dev_desc_t::minor, NULL, PM, rsbac_attribute_value_t::pm_object_class, rsbac_attribute_value_t::pm_object_type, RC, rsbac_attribute_value_t::rc_type, RC_type_max_value, RSBAC_EINVALIDATTR, RSBAC_EINVALIDMODULE, RSBAC_EINVALIDTARGET, RSBAC_EINVALIDVALUE, rsbac_ta_list_add_ttl(), rsbac_ta_list_get_data_ttl(), rsbac_attribute_value_t::security_level, and rsbac_dev_desc_t::type. Referenced by rsbac_ta_set_attr(). 12554 {
12555 int err = 0;
12556
12557 /*
12558 #ifdef CONFIG_RSBAC_DEBUG
12559 if (rsbac_debug_ds)
12560 rsbac_printk(KERN_DEBUG
12561 "rsbac_set_attr(): Setting dev attribute\n");
12562 #endif
12563 */
12564 switch(module)
12565 {
12566 case GEN:
12567 {
12568 struct rsbac_gen_dev_aci_t aci = DEFAULT_GEN_DEV_ACI;
12569
12570 if(dev.type > D_char)
12571 return -RSBAC_EINVALIDTARGET;
12572 rsbac_ta_list_get_data_ttl(ta_number,
12573 dev_handles.gen,
12574 NULL,
12575 &dev,
12576 &aci);
12577 switch (attr)
12578 {
12579 case A_log_array_low:
12580 aci.log_array_low = value_p->log_array_low;
12581 break;
12582 case A_log_array_high:
12583 aci.log_array_high = value_p->log_array_high;
12584 break;
12585 default:
12586 err = -RSBAC_EINVALIDATTR;
12587 }
12588 if(!err)
12589 {
12590 err = rsbac_ta_list_add_ttl(ta_number,
12591 dev_handles.gen,
12592 0,
12593 &dev,
12594 &aci);
12595 }
12596 }
12597 break;
12598
12599 #if defined(CONFIG_RSBAC_MAC)
12600 case MAC:
12601 {
12602 struct rsbac_mac_dev_aci_t aci = DEFAULT_MAC_DEV_ACI;
12603
12604 if(dev.type > D_char)
12605 return -RSBAC_EINVALIDTARGET;
12606 rsbac_ta_list_get_data_ttl(ta_number,
12607 dev_handles.mac,
12608 NULL,
12609 &dev,
12610 &aci);
12611 switch (attr)
12612 {
12613 case A_security_level:
12614 aci.sec_level = value_p->security_level;
12615 break;
12616 case A_mac_categories:
12617 aci.mac_categories = value_p->mac_categories;
12618 break;
12619 case A_mac_check:
12620 aci.mac_check = value_p->mac_check;
12621 break;
12622 default:
12623 err = -RSBAC_EINVALIDATTR;
12624 }
12625 if(!err)
12626 {
12627 err = rsbac_ta_list_add_ttl(ta_number,
12628 dev_handles.mac,
12629 0,
12630 &dev,
12631 &aci);
12632 }
12633 }
12634 break;
12635 #endif
12636
12637 #if defined(CONFIG_RSBAC_PM)
12638 case PM:
12639 {
12640 struct rsbac_pm_dev_aci_t aci = DEFAULT_PM_DEV_ACI;
12641
12642 if(dev.type > D_char)
12643 return -RSBAC_EINVALIDTARGET;
12644 rsbac_ta_list_get_data_ttl(ta_number,
12645 dev_handles.pm,
12646 NULL,
12647 &dev,
12648 &aci);
12649 switch (attr)
12650 {
12651 case A_pm_object_type:
12652 aci.pm_object_type = value_p->pm_object_type;
12653 break;
12654 case A_pm_object_class:
12655 aci.pm_object_class = value_p->pm_object_class;
12656 break;
12657 default:
12658 err = -RSBAC_EINVALIDATTR;
12659 }
12660 if(!err)
12661 {
12662 err = rsbac_ta_list_add_ttl(ta_number,
12663 dev_handles.pm,
12664 0,
12665 &dev,
12666 &aci);
12667 }
12668 }
12669 break;
12670 #endif
12671
12672 #if defined(CONFIG_RSBAC_RC)
12673 case RC:
12674 {
12675 rsbac_rc_type_id_t type = value_p->rc_type;
12676 struct rsbac_dev_desc_t dev_desc;
12677 rsbac_list_handle_t handle;
12678
12679 switch(dev.type)
12680 {
12681 case D_char:
12682 dev_desc.type = D_char;
12683 handle = dev_handles.rc;
12684 break;
12685 case D_block:
12686 dev_desc.type = D_block;
12687 handle = dev_handles.rc;
12688 break;
12689 case D_char_major:
12690 if(type > RC_type_max_value)
12691 return -RSBAC_EINVALIDVALUE;
12692 dev_desc.type = D_char;
12693 handle = dev_major_handles.rc;
12694 break;
12695 case D_block_major:
12696 if(type > RC_type_max_value)
12697 return -RSBAC_EINVALIDVALUE;
12698 dev_desc.type = D_block;
12699 handle = dev_major_handles.rc;
12700 break;
12701 default:
12702 return -RSBAC_EINVALIDTARGET;
12703 }
12704 dev_desc.major = dev.major;
12705 dev_desc.minor = dev.minor;
12706
12707 switch (attr)
12708 {
12709 case A_rc_type:
12710 err = rsbac_ta_list_add_ttl(ta_number,
12711 handle,
12712 0,
12713 &dev_desc,
12714 &type);
12715 break;
12716 default:
12717 err = -RSBAC_EINVALIDATTR;
12718 }
12719 }
12720 break;
12721 #endif
12722
12723 default:
12724 err = -RSBAC_EINVALIDMODULE;
12725 }
12726
12727 return err;
12728 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 12109 of file aci_data_structures.c. References A_auid_exempt, A_auth_learn, A_auth_may_set_cap, A_auth_may_setuid, A_daz_scanned, A_daz_scanner, A_fake_root_uid, A_ff_flags, A_linux_dac_disable, A_log_array_high, A_log_array_low, A_log_program_based, A_mac_auto, A_mac_categories, A_mac_file_flags, A_mac_prop_trusted, A_max_caps, A_min_caps, A_pax_flags, A_pm_object_class, A_pm_object_type, A_pm_tp, A_rc_force_role, A_rc_initial_role, A_rc_type_fd, A_res_max, A_res_min, A_security_level, A_symlink_add_mac_level, A_symlink_add_rc_role, A_symlink_add_remote_ip, A_symlink_add_uid, rsbac_attribute_value_t::auid_exempt, rsbac_gen_fd_aci_t::auid_exempt, AUTH, rsbac_attribute_value_t::auth_learn, rsbac_attribute_value_t::auth_may_set_cap, rsbac_attribute_value_t::auth_may_setuid, CAP, DAZ, rsbac_attribute_value_t::daz_scanned, rsbac_attribute_value_t::daz_scanner, DEFAULT_GEN_FD_ACI, device_list_head, rsbac_attribute_value_t::fake_root_uid, rsbac_gen_fd_aci_t::fake_root_uid, FF, rsbac_attribute_value_t::ff_flags, GEN, gen_fd_hash(), rsbac_attribute_value_t::linux_dac_disable, rsbac_gen_fd_aci_t::linux_dac_disable, rsbac_attribute_value_t::log_array_high, rsbac_gen_fd_aci_t::log_array_high, rsbac_attribute_value_t::log_array_low, rsbac_gen_fd_aci_t::log_array_low, rsbac_attribute_value_t::log_program_based, rsbac_gen_fd_aci_t::log_program_based, lookup_device(), MAC, rsbac_attribute_value_t::mac_auto, rsbac_attribute_value_t::mac_categories, rsbac_attribute_value_t::mac_file_flags, rsbac_attribute_value_t::mac_prop_trusted, rsbac_attribute_value_t::max_caps, rsbac_attribute_value_t::min_caps, NULL, PAX, rsbac_attribute_value_t::pax_flags, PM, rsbac_attribute_value_t::pm_object_class, rsbac_attribute_value_t::pm_object_type, rsbac_attribute_value_t::pm_tp, RC, rsbac_attribute_value_t::rc_force_role, rsbac_attribute_value_t::rc_initial_role, rsbac_attribute_value_t::rc_type_fd, RES, rsbac_attribute_value_t::res_array, RSBAC_EINVALIDATTR, RSBAC_EINVALIDDEV, RSBAC_EINVALIDMODULE, rsbac_list_add_ttl(), RSBAC_MAC_F_FLAGS, rsbac_mount(), RSBAC_PAX_ALL_FLAGS, rsbac_printk(), rsbac_ta_list_add_ttl(), rsbac_ta_list_get_data_ttl(), rsbac_ta_list_remove(), rsbac_attribute_value_t::security_level, rsbac_attribute_value_t::symlink_add_mac_level, rsbac_gen_fd_aci_t::symlink_add_mac_level, rsbac_attribute_value_t::symlink_add_rc_role, rsbac_gen_fd_aci_t::symlink_add_rc_role, rsbac_attribute_value_t::symlink_add_remote_ip, rsbac_gen_fd_aci_t::symlink_add_remote_ip, rsbac_attribute_value_t::symlink_add_uid, and rsbac_gen_fd_aci_t::symlink_add_uid. Referenced by rsbac_ta_set_attr(). 12116 {
12117 int err = 0;
12118 struct rsbac_device_list_item_t * device_p;
12119 u_long dflags;
12120
12121 /*
12122 #ifdef CONFIG_RSBAC_DEBUG
12123 if (rsbac_debug_ds)
12124 rsbac_printk(KERN_DEBUG "rsbac_set_attr(): Setting file/dir/fifo/symlink attribute %u for device %02u:%02u, inode %lu, dentry_p %p\n",
12125 attr, RSBAC_MAJOR(tid_p->file.device),RSBAC_MINOR(tid_p->file.device), (u_long) tid_p->file.inode, tid_p->file.dentry_p);
12126 #endif
12127 */
12128 /* wait for read access to device_list_head */
12129 rsbac_read_lock(&device_list_head.lock, &dflags);
12130 /* OK, go on */
12131 /*
12132 #ifdef CONFIG_RSBAC_DEBUG
12133 if (rsbac_debug_ds)
12134 rsbac_printk(KERN_DEBUG
12135 "rsbac_set_attr(): passed device read lock\n");
12136 #endif
12137 */
12138
12139 /* lookup device */
12140 device_p = lookup_device(tid_p->file.device);
12141 if (!device_p)
12142 {
12143 struct super_block * sb_p;
12144
12145 rsbac_read_unlock(&device_list_head.lock, &dflags);
12146 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
12147 sb_p = user_get_super(tid_p->file.device);
12148 #else
12149 sb_p = get_super(tid_p->file.device);
12150 #endif
12151 if(sb_p)
12152 {
12153 rsbac_printk(KERN_INFO
12154 "rsbac_set_attr(): auto-mounting device %02u:%02u\n",
12155 RSBAC_MAJOR(tid_p->file.device), RSBAC_MINOR(tid_p->file.device));
12156 rsbac_mount(sb_p, NULL);
12157 /* free super_block pointer */
12158 drop_super(sb_p);
12159 rsbac_read_lock(&device_list_head.lock, &dflags);
12160 device_p = lookup_device(tid_p->file.device);
12161 if (!device_p)
12162 {
12163 rsbac_printk(KERN_WARNING
12164 "rsbac_set_attr(): unknown device %02u:%02u\n",
12165 RSBAC_MAJOR(tid_p->file.device), RSBAC_MINOR(tid_p->file.device));
12166 rsbac_read_unlock(&device_list_head.lock, &dflags);
12167 return -RSBAC_EINVALIDDEV;
12168 }
12169 }
12170 else
12171 return -RSBAC_EINVALIDDEV;
12172 }
12173 switch(module)
12174 {
12175 case GEN:
12176 {
12177 struct rsbac_gen_fd_aci_t aci = DEFAULT_GEN_FD_ACI;
12178
12179 rsbac_ta_list_get_data_ttl(ta_number,
12180 device_p->handles.gen[gen_fd_hash(tid_p->file.inode)],
12181 NULL,
12182 &tid_p->file.inode,
12183 &aci);
12184 switch (attr)
12185 {
12186 case A_log_array_low:
12187 aci.log_array_low = value_p->log_array_low;
12188 break;
12189 case A_log_array_high:
12190 aci.log_array_high = value_p->log_array_high;
12191 break;
12192 case A_log_program_based:
12193 aci.log_program_based = value_p->log_program_based;
12194 break;
12195 case A_symlink_add_remote_ip:
12196 aci.symlink_add_remote_ip = value_p->symlink_add_remote_ip;
12197 break;
12198 case A_symlink_add_uid:
12199 aci.symlink_add_uid = value_p->symlink_add_uid;
12200 break;
12201 case A_symlink_add_mac_level:
12202 aci.symlink_add_mac_level = value_p->symlink_add_mac_level;
12203 break;
12204 case A_symlink_add_rc_role:
12205 aci.symlink_add_rc_role = value_p->symlink_add_rc_role;
12206 break;
12207 case A_linux_dac_disable:
12208 aci.linux_dac_disable = value_p->linux_dac_disable;
12209 break;
12210 case A_fake_root_uid:
12211 aci.fake_root_uid = value_p->fake_root_uid;
12212 break;
12213 case A_auid_exempt:
12214 aci.auid_exempt = value_p->auid_exempt;
12215 break;
12216 default:
12217 err = -RSBAC_EINVALIDATTR;
12218 }
12219 if(!err)
12220 {
12221 err = rsbac_ta_list_add_ttl(ta_number,
12222 device_p->handles.gen[gen_fd_hash(tid_p->file.inode)],
12223 0,
12224 &tid_p->file.inode,
12225 &aci);
12226 }
12227 }
12228 break;
12229
12230 #if defined(CONFIG_RSBAC_MAC)
12231 case MAC:
12232 {
12233 struct rsbac_mac_fd_aci_t aci = DEFAULT_MAC_FD_ACI;
12234
12235 rsbac_ta_list_get_data_ttl(ta_number,
12236 device_p->handles.mac[mac_fd_hash(tid_p->file.inode)],
12237 NULL,
12238 &tid_p->file.inode,
12239 &aci);
12240 switch (attr)
12241 {
12242 case A_security_level:
12243 aci.sec_level = value_p->security_level;
12244 break;
12245 case A_mac_categories:
12246 aci.mac_categories = value_p->mac_categories;
12247 break;
12248 case A_mac_auto:
12249 aci.mac_auto = value_p->mac_auto;
12250 break;
12251 case A_mac_prop_trusted:
12252 aci.mac_prop_trusted = value_p->mac_prop_trusted;
12253 break;
12254 case A_mac_file_flags:
12255 aci.mac_file_flags = value_p->mac_file_flags & RSBAC_MAC_F_FLAGS;
12256 break;
12257
12258 default:
12259 err = -RSBAC_EINVALIDATTR;
12260 }
12261 if(!err)
12262 {
12263 err = rsbac_ta_list_add_ttl(ta_number,
12264 device_p->handles.mac[mac_fd_hash(tid_p->file.inode)],
12265 0,
12266 &tid_p->file.inode,
12267 &aci);
12268 }
12269 }
12270 break;
12271 #endif /* MAC */
12272
12273 #if defined(CONFIG_RSBAC_PM)
12274 case PM:
12275 {
12276 struct rsbac_pm_fd_aci_t aci = DEFAULT_PM_FD_ACI;
12277
12278 rsbac_ta_list_get_data_ttl(ta_number,
12279 device_p->handles.pm[pm_fd_hash(tid_p->file.inode)],
12280 NULL,
12281 &tid_p->file.inode,
12282 &aci);
12283 switch (attr)
12284 {
12285 case A_pm_object_class:
12286 aci.pm_object_class = value_p->pm_object_class;
12287 break;
12288 case A_pm_tp:
12289 aci.pm_tp = value_p->pm_tp;
12290 break;
12291 case A_pm_object_type:
12292 aci.pm_object_type = value_p->pm_object_type;
12293 break;
12294 default:
12295 err = -RSBAC_EINVALIDATTR;
12296 }
12297 if(!err)
12298 {
12299 err = rsbac_ta_list_add_ttl(ta_number,
12300 device_p->handles.pm[pm_fd_hash(tid_p->file.inode)],
12301 0,
12302 &tid_p->file.inode,
12303 &aci);
12304 }
12305 }
12306 break;
12307 #endif /* PM */
12308
12309 #if defined(CONFIG_RSBAC_DAZ)
12310 case DAZ:
12311 {
12312 #if defined(CONFIG_RSBAC_DAZ_CACHE)
12313 if(attr == A_daz_scanned)
12314 {
12315 err = rsbac_list_add_ttl(device_p->handles.dazs[daz_scanned_fd_hash(tid_p->file.inode)],
12316 rsbac_daz_ttl,
12317 &tid_p->file.inode,
12318 &value_p->daz_scanned);
12319 }
12320 else
12321 #endif
12322 {
12323 struct rsbac_daz_fd_aci_t aci = DEFAULT_DAZ_FD_ACI;
12324
12325 rsbac_ta_list_get_data_ttl(ta_number,
12326 device_p->handles.daz[daz_fd_hash(tid_p->file.inode)],
12327 NULL,
12328 &tid_p->file.inode,
12329 &aci);
12330 switch (attr)
12331 {
12332 case A_daz_scanner:
12333 aci.daz_scanner = value_p->daz_scanner;
12334 break;
12335 default:
12336 err = -RSBAC_EINVALIDATTR;
12337 }
12338 if(!err)
12339 {
12340 err = rsbac_ta_list_add_ttl(ta_number,
12341 device_p->handles.daz[daz_fd_hash(tid_p->file.inode)],
12342 0,
12343 &tid_p->file.inode,
12344 &aci);
12345 }
12346 }
12347 }
12348 break;
12349 #endif /* DAZ */
12350
12351 #if defined(CONFIG_RSBAC_FF)
12352 case FF:
12353 {
12354 switch (attr)
12355 {
12356 case A_ff_flags:
12357 err = rsbac_ta_list_add_ttl(ta_number,
12358 device_p->handles.ff[ff_fd_hash(tid_p->file.inode)],
12359 0,
12360 &tid_p->file.inode,
12361 &value_p->ff_flags);
12362 break;
12363
12364 default:
12365 err = -RSBAC_EINVALIDATTR;
12366 }
12367 }
12368 break;
12369 #endif /* FF */
12370
12371 #if defined(CONFIG_RSBAC_RC)
12372 case RC:
12373 {
12374 struct rsbac_rc_fd_aci_t aci = DEFAULT_RC_FD_ACI;
12375
12376 rsbac_ta_list_get_data_ttl(ta_number,
12377 device_p->handles.rc[rc_fd_hash(tid_p->file.inode)],
12378 NULL,
12379 &tid_p->file.inode,
12380 &aci);
12381 switch (attr)
12382 {
12383 case A_rc_type_fd:
12384 aci.rc_type_fd = value_p->rc_type_fd;
12385 break;
12386 case A_rc_force_role:
12387 aci.rc_force_role = value_p->rc_force_role;
12388 break;
12389 case A_rc_initial_role:
12390 aci.rc_initial_role = value_p->rc_initial_role;
12391 break;
12392
12393 default:
12394 err = -RSBAC_EINVALIDATTR;
12395 }
12396 if(!err)
12397 {
12398 err = rsbac_ta_list_add_ttl(ta_number,
12399 device_p->handles.rc[rc_fd_hash(tid_p->file.inode)],
12400 0,
12401 &tid_p->file.inode,
12402 &aci);
12403 }
12404 }
12405 break;
12406 #endif /* RC */
12407
12408 #if defined(CONFIG_RSBAC_AUTH)
12409 case AUTH:
12410 {
12411 struct rsbac_auth_fd_aci_t aci = DEFAULT_AUTH_FD_ACI;
12412
12413 rsbac_ta_list_get_data_ttl(ta_number,
12414 device_p->handles.auth[auth_fd_hash(tid_p->file.inode)],
12415 NULL,
12416 &tid_p->file.inode,
12417 &aci);
12418 switch (attr)
12419 {
12420 case A_auth_may_setuid:
12421 aci.auth_may_setuid = value_p->auth_may_setuid;
12422 break;
12423 case A_auth_may_set_cap:
12424 aci.auth_may_set_cap = value_p->auth_may_set_cap;
12425 break;
12426 case A_auth_learn:
12427 aci.auth_learn = value_p->auth_learn;
12428 break;
12429 default:
12430 err = -RSBAC_EINVALIDATTR;
12431 }
12432 if(!err)
12433 {
12434 err = rsbac_ta_list_add_ttl(ta_number,
12435 device_p->handles.auth[auth_fd_hash(tid_p->file.inode)],
12436 0,
12437 &tid_p->file.inode,
12438 &aci);
12439 }
12440 }
12441 break;
12442 #endif /* AUTH */
12443
12444 #if defined(CONFIG_RSBAC_CAP)
12445 case CAP:
12446 {
12447 struct rsbac_cap_fd_aci_t aci = DEFAULT_CAP_FD_ACI;
12448
12449 rsbac_ta_list_get_data_ttl(ta_number,
12450 device_p->handles.cap[cap_fd_hash(tid_p->file.inode)],
12451 NULL,
12452 &tid_p->file.inode,
12453 &aci);
12454 switch (attr)
12455 {
12456 case A_min_caps:
12457 aci.min_caps = value_p->min_caps;
12458 break;
12459 case A_max_caps:
12460 aci.max_caps = value_p->max_caps;
12461 break;
12462 default:
12463 err = -RSBAC_EINVALIDATTR;
12464 }
12465 if(!err)
12466 {
12467 err = rsbac_ta_list_add_ttl(ta_number,
12468 device_p->handles.cap[cap_fd_hash(tid_p->file.inode)],
12469 0,
12470 &tid_p->file.inode,
12471 &aci);
12472 }
12473 }
12474 break;
12475 #endif
12476
12477 #if defined(CONFIG_RSBAC_RES)
12478 case RES:
12479 {
12480 struct rsbac_res_fd_aci_t aci = DEFAULT_RES_FD_ACI;
12481
12482 rsbac_ta_list_get_data_ttl(ta_number,
12483 device_p->handles.res[res_fd_hash(tid_p->file.inode)],
12484 NULL,
12485 &tid_p->file.inode,
12486 &aci);
12487 switch (attr)
12488 {
12489 case A_res_min:
12490 memcpy(&aci.res_min, &value_p->res_array, sizeof(aci.res_min));
12491 break;
12492 case A_res_max:
12493 memcpy(&aci.res_max, &value_p->res_array, sizeof(aci.res_max));
12494 break;
12495 default:
12496 err = -RSBAC_EINVALIDATTR;
12497 }
12498 if(!err)
12499 {
12500 struct rsbac_res_fd_aci_t def_aci = DEFAULT_RES_FD_ACI;
12501
12502 if(memcmp(&aci, &def_aci, sizeof(aci)))
12503 err = rsbac_ta_list_add_ttl(ta_number,
12504 device_p->handles.res[res_fd_hash(tid_p->file.inode)],
12505 0,
12506 &tid_p->file.inode,
12507 &aci);
12508 else
12509 err = rsbac_ta_list_remove(ta_number,
12510 device_p->handles.res[res_fd_hash(tid_p->file.inode)],
12511 &tid_p->file.inode);
12512 }
12513 }
12514 break;
12515 #endif
12516
12517 #if defined(CONFIG_RSBAC_PAX)
12518 case PAX:
12519 {
12520 switch (attr)
12521 {
12522 case A_pax_flags:
12523 value_p->pax_flags &= RSBAC_PAX_ALL_FLAGS;
12524 err = rsbac_ta_list_add_ttl(ta_number,
12525 device_p->handles.pax[pax_fd_hash(tid_p->file.inode)],
12526 0,
12527 &tid_p->file.inode,
12528 &value_p->pax_flags);
12529 break;
12530
12531 default:
12532 err = -RSBAC_EINVALIDATTR;
12533 }
12534 }
12535 break;
12536 #endif /* PAX */
12537
12538 default:
12539 err = -RSBAC_EINVALIDMODULE;
12540 }
12541 /* free access to device_list_head */
12542 rsbac_read_unlock(&device_list_head.lock, &dflags);
12543
12544 return err;
12545 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 12730 of file aci_data_structures.c. References A_jail_id, A_mac_categories, A_pm_ipc_purpose, A_pm_object_class, A_pm_object_type, A_rc_type, A_security_level, rsbac_target_id_t::ipc, ipc_handles, JAIL, rsbac_attribute_value_t::jail_id, MAC, rsbac_attribute_value_t::mac_categories, NULL, PM, rsbac_attribute_value_t::pm_ipc_purpose, rsbac_attribute_value_t::pm_object_class, rsbac_attribute_value_t::pm_object_type, RC, rsbac_attribute_value_t::rc_type, RSBAC_EINVALIDATTR, RSBAC_EINVALIDMODULE, rsbac_ta_list_add_ttl(), rsbac_ta_list_get_data_ttl(), and rsbac_attribute_value_t::security_level. Referenced by rsbac_ta_set_attr(). 12737 {
12738 int err = 0;
12739
12740 /*
12741 #ifdef CONFIG_RSBAC_DEBUG
12742 if (rsbac_debug_ds) rsbac_printk(KERN_DEBUG "%s\n",
12743 "rsbac_set_attr(): Setting ipc attribute");
12744 #endif
12745 */
12746 switch(module)
12747 {
12748 #if defined(CONFIG_RSBAC_MAC)
12749 case MAC:
12750 {
12751 struct rsbac_mac_ipc_aci_t aci = DEFAULT_MAC_IPC_ACI;
12752
12753 rsbac_ta_list_get_data_ttl(ta_number,
12754 ipc_handles.mac,
12755 NULL,
12756 &tid_p->ipc,
12757 &aci);
12758 switch (attr)
12759 {
12760 case A_security_level:
12761 aci.sec_level = value_p->security_level;
12762 break;
12763 case A_mac_categories:
12764 aci.mac_categories = value_p->mac_categories;
12765 break;
12766 default:
12767 err = -RSBAC_EINVALIDATTR;
12768 }
12769 if(!err)
12770 {
12771 err = rsbac_ta_list_add_ttl(ta_number,
12772 ipc_handles.mac,
12773 0,
12774 &tid_p->ipc,
12775 &aci);
12776 }
12777 }
12778 break;
12779 #endif
12780
12781 #if defined(CONFIG_RSBAC_PM)
12782 case PM:
12783 {
12784 struct rsbac_pm_ipc_aci_t aci = DEFAULT_PM_IPC_ACI;
12785
12786 rsbac_ta_list_get_data_ttl(ta_number,
12787 ipc_handles.pm,
12788 NULL,
12789 &tid_p->ipc,
12790 &aci);
12791 switch (attr)
12792 {
12793 case A_pm_object_type:
12794 aci.pm_object_type = value_p->pm_object_type;
12795 break;
12796 case A_pm_ipc_purpose:
12797 aci.pm_ipc_purpose = value_p->pm_ipc_purpose;
12798 break;
12799 case A_pm_object_class:
12800 aci.pm_object_class = value_p->pm_object_class;
12801 break;
12802 default:
12803 err = -RSBAC_EINVALIDATTR;
12804 }
12805 if(!err)
12806 {
12807 err = rsbac_ta_list_add_ttl(ta_number,
12808 ipc_handles.pm,
12809 0,
12810 &tid_p->ipc,
12811 &aci);
12812 }
12813 }
12814 break;
12815 #endif
12816
12817 #if defined(CONFIG_RSBAC_RC)
12818 case RC:
12819 {
12820 rsbac_rc_type_id_t type = value_p->rc_type;
12821
12822 switch (attr)
12823 {
12824 case A_rc_type:
12825 err = rsbac_ta_list_add_ttl(ta_number,
12826 ipc_handles.rc,
12827 0,
12828 &tid_p->ipc,
12829 &type);
12830 break;
12831 default:
12832 err = -RSBAC_EINVALIDATTR;
12833 }
12834 }
12835 break;
12836 #endif
12837
12838 #if defined(CONFIG_RSBAC_JAIL)
12839 case JAIL:
12840 {
12841 rsbac_jail_id_t id = value_p->jail_id;
12842
12843 switch (attr)
12844 {
12845 case A_jail_id:
12846 /*
12847 #ifdef CONFIG_RSBAC_DEBUG
12848 if(id)
12849 rsbac_printk(KERN_DEBUG
12850 "rsbac_set_attr(): Setting jail_id for IPC %s %lu to %u\n",
12851 get_ipc_target_name(tmp, tid_p->ipc.type), tid_p->ipc.id.id_nr, id);
12852 #endif
12853 */
12854 err = rsbac_ta_list_add_ttl(ta_number,
12855 ipc_handles.jail,
12856 0,
12857 &tid_p->ipc,
12858 &id);
12859 break;
12860 default:
12861 err = -RSBAC_EINVALIDATTR;
12862 }
12863 }
12864 break;
12865 #endif
12866
12867 default:
12868 err = -RSBAC_EINVALIDMODULE;
12869 }
12870
12871 return err;
12872 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 13273 of file aci_data_structures.c. References A_audit_uid, A_auid_exempt, A_auth_last_auth, A_auth_learn, A_auth_may_set_cap, A_auth_may_setuid, A_cap_process_hiding, A_current_sec_level, A_daz_scanner, A_fake_root_uid, A_initial_security_level, A_jail_flags, A_jail_id, A_jail_ip, A_jail_max_caps, A_jail_scd_get, A_jail_scd_modify, A_log_program_based, A_mac_auto, A_mac_categories, A_mac_curr_categories, A_mac_initial_categories, A_mac_min_categories, A_mac_process_flags, A_max_caps_program, A_max_caps_user, A_max_read_categories, A_max_read_open, A_min_security_level, A_min_write_categories, A_min_write_open, A_pm_current_task, A_pm_process_type, A_pm_tp, A_rc_force_role, A_rc_role, A_rc_type, A_remote_ip, A_security_level, rsbac_attribute_value_t::audit_uid, rsbac_gen_process_aci_t::audit_uid, rsbac_attribute_value_t::auid_exempt, rsbac_gen_process_aci_t::auid_exempt, AUTH, rsbac_attribute_value_t::auth_last_auth, rsbac_attribute_value_t::auth_learn, rsbac_attribute_value_t::auth_may_set_cap, rsbac_attribute_value_t::auth_may_setuid, CAP, rsbac_attribute_value_t::cap_process_hiding, rsbac_attribute_value_t::current_sec_level, DAZ, rsbac_attribute_value_t::daz_scanner, DEFAULT_GEN_P_ACI, rsbac_attribute_value_t::fake_root_uid, rsbac_gen_process_aci_t::fake_root_uid, GEN, gen_p_hash(), JAIL, rsbac_attribute_value_t::jail_flags, rsbac_attribute_value_t::jail_id, rsbac_attribute_value_t::jail_ip, rsbac_attribute_value_t::jail_max_caps, rsbac_attribute_value_t::jail_scd_get, rsbac_attribute_value_t::jail_scd_modify, rsbac_attribute_value_t::log_program_based, rsbac_gen_process_aci_t::log_program_based, MAC, MAC_auto, rsbac_attribute_value_t::mac_auto, rsbac_attribute_value_t::mac_categories, rsbac_attribute_value_t::mac_process_flags, rsbac_attribute_value_t::max_caps_program, rsbac_attribute_value_t::max_caps_user, rsbac_attribute_value_t::max_read_open, rsbac_attribute_value_t::min_write_open, NULL, PM, rsbac_attribute_value_t::pm_current_task, rsbac_attribute_value_t::pm_process_type, rsbac_attribute_value_t::pm_tp, rsbac_target_id_t::process, process_handles, RC, rsbac_attribute_value_t::rc_force_role, rsbac_attribute_value_t::rc_role, rsbac_attribute_value_t::rc_type, rsbac_attribute_value_t::remote_ip, rsbac_gen_process_aci_t::remote_ip, RSBAC_EINVALIDATTR, RSBAC_EINVALIDMODULE, RSBAC_EINVALIDTARGET, RSBAC_MAC_P_FLAGS, rsbac_printk(), rsbac_ta_list_add_ttl(), rsbac_ta_list_get_data_ttl(), and rsbac_attribute_value_t::security_level. Referenced by rsbac_ta_set_attr(). 13280 {
13281 int err = 0;
13282
13283 /*
13284 #ifdef CONFIG_RSBAC_DEBUG
13285 if (rsbac_debug_ds)
13286 rsbac_printk(KERN_DEBUG
13287 "rsbac_set_attr(): Setting process attribute\n");
13288 #endif
13289 */
13290 if (!tid_p->process)
13291 {
13292 rsbac_printk(KERN_WARNING
13293 "rsbac_set_attr(): Trying to set attribute for process 0!\n");
13294 return -RSBAC_EINVALIDTARGET;
13295 }
13296 switch(module)
13297 {
13298 case GEN:
13299 {
13300 struct rsbac_gen_process_aci_t aci = DEFAULT_GEN_P_ACI;
13301
13302 rsbac_ta_list_get_data_ttl(ta_number,
13303 process_handles.gen[gen_p_hash(tid_p->process)],
13304 NULL,
13305 &tid_p->process,
13306 &aci);
13307 switch (attr)
13308 {
13309 case A_log_program_based:
13310 aci.log_program_based = value_p->log_program_based;
13311 break;
13312 case A_fake_root_uid:
13313 aci.fake_root_uid = value_p->fake_root_uid;
13314 break;
13315 case A_audit_uid:
13316 aci.audit_uid = value_p->audit_uid;
13317 break;
13318 case A_auid_exempt:
13319 aci.auid_exempt = value_p->auid_exempt;
13320 break;
13321 case A_remote_ip:
13322 aci.remote_ip = value_p->remote_ip;
13323 break;
13324 default:
13325 err = -RSBAC_EINVALIDATTR;
13326 }
13327 if(!err)
13328 {
13329 err = rsbac_ta_list_add_ttl(ta_number,
13330 process_handles.gen[gen_p_hash(tid_p->process)],
13331 0,
13332 &tid_p->process,
13333 &aci);
13334 }
13335 }
13336 break;
13337
13338 #if defined(CONFIG_RSBAC_MAC)
13339 case MAC:
13340 {
13341 struct rsbac_mac_process_aci_t aci = DEFAULT_MAC_P_ACI;
13342
13343 rsbac_ta_list_get_data_ttl(ta_number,
13344 process_handles.mac[mac_p_hash(tid_p->process)],
13345 NULL,
13346 &tid_p->process,
13347 &aci);
13348 switch (attr)
13349 {
13350 case A_security_level:
13351 aci.owner_sec_level = value_p->security_level;
13352 break;
13353 case A_initial_security_level:
13354 aci.owner_initial_sec_level = value_p->security_level;
13355 break;
13356 case A_min_security_level:
13357 aci.owner_min_sec_level = value_p->security_level;
13358 break;
13359 case A_mac_categories:
13360 aci.mac_owner_categories = value_p->mac_categories;
13361 break;
13362 case A_mac_initial_categories:
13363 aci.mac_owner_initial_categories = value_p->mac_categories;
13364 break;
13365 case A_mac_min_categories:
13366 aci.mac_owner_min_categories = value_p->mac_categories;
13367 break;
13368 case A_current_sec_level:
13369 aci.current_sec_level = value_p->current_sec_level;
13370 break;
13371 case A_mac_curr_categories:
13372 aci.mac_curr_categories = value_p->mac_categories;
13373 break;
13374 case A_min_write_open:
13375 aci.min_write_open = value_p->min_write_open;
13376 break;
13377 case A_min_write_categories:
13378 aci.min_write_categories = value_p->mac_categories;
13379 break;
13380 case A_max_read_open:
13381 aci.max_read_open = value_p->max_read_open;
13382 break;
13383 case A_max_read_categories:
13384 aci.max_read_categories = value_p->mac_categories;
13385 break;
13386 case A_mac_process_flags:
13387 aci.mac_process_flags = value_p->mac_process_flags & RSBAC_MAC_P_FLAGS;
13388 break;
13389 case A_mac_auto:
13390 if(value_p->mac_auto)
13391 aci.mac_process_flags |= MAC_auto;
13392 else
13393 aci.mac_process_flags &= ~MAC_auto;
13394 break;
13395 default:
13396 err = -RSBAC_EINVALIDATTR;
13397 }
13398 if(!err)
13399 {
13400 err = rsbac_ta_list_add_ttl(ta_number,
13401 process_handles.mac[mac_p_hash(tid_p->process)],
13402 0,
13403 &tid_p->process,
13404 &aci);
13405 }
13406 }
13407 break;
13408 #endif
13409
13410 #if defined(CONFIG_RSBAC_PM)
13411 case PM:
13412 {
13413 struct rsbac_pm_process_aci_t aci = DEFAULT_PM_P_ACI;
13414
13415 rsbac_ta_list_get_data_ttl(ta_number,
13416 process_handles.pm,
13417 NULL,
13418 &tid_p->process,
13419 &aci);
13420 switch (attr)
13421 {
13422 case A_pm_tp:
13423 aci.pm_tp = value_p->pm_tp;
13424 break;
13425 case A_pm_current_task:
13426 aci.pm_current_task = value_p->pm_current_task;
13427 break;
13428 case A_pm_process_type:
13429 aci.pm_process_type = value_p->pm_process_type;
13430 break;
13431 default:
13432 err = -RSBAC_EINVALIDATTR;
13433 }
13434 if(!err)
13435 {
13436 err = rsbac_ta_list_add_ttl(ta_number,
13437 process_handles.pm,
13438 0,
13439 &tid_p->process,
13440 &aci);
13441 }
13442 }
13443 break;
13444 #endif
13445
13446 #if defined(CONFIG_RSBAC_DAZ)
13447 case DAZ:
13448 {
13449 struct rsbac_daz_process_aci_t aci = DEFAULT_DAZ_P_ACI;
13450
13451 rsbac_ta_list_get_data_ttl(ta_number,
13452 process_handles.daz,
13453 NULL,
13454 &tid_p->process,
13455 &aci);
13456 switch (attr)
13457 {
13458 case A_daz_scanner:
13459 aci.daz_scanner = value_p->daz_scanner;
13460 break;
13461 default:
13462 err = -RSBAC_EINVALIDATTR;
13463 }
13464 if(!err)
13465 {
13466 err = rsbac_ta_list_add_ttl(ta_number,
13467 process_handles.daz,
13468 0,
13469 &tid_p->process,
13470 &aci);
13471 }
13472 }
13473 break;
13474 #endif
13475
13476 #if defined(CONFIG_RSBAC_RC)
13477 case RC:
13478 {
13479 struct rsbac_rc_process_aci_t aci = DEFAULT_RC_P_ACI;
13480
13481 rsbac_ta_list_get_data_ttl(ta_number,
13482 process_handles.rc[rc_p_hash(tid_p->process)],
13483 NULL,
13484 &tid_p->process,
13485 &aci);
13486 switch (attr)
13487 {
13488 case A_rc_role:
13489 aci.rc_role = value_p->rc_role;
13490 break;
13491 case A_rc_type:
13492 aci.rc_type = value_p->rc_type;
13493 break;
13494 case A_rc_force_role:
13495 aci.rc_force_role = value_p->rc_force_role;
13496 break;
13497 default:
13498 err = -RSBAC_EINVALIDATTR;
13499 }
13500 if(!err)
13501 {
13502 err = rsbac_ta_list_add_ttl(ta_number,
13503 process_handles.rc[rc_p_hash(tid_p->process)],
13504 0,
13505 &tid_p->process,
13506 &aci);
13507 }
13508 }
13509 break;
13510 #endif
13511
13512 #if defined(CONFIG_RSBAC_AUTH)
13513 case AUTH:
13514 {
13515 struct rsbac_auth_process_aci_t aci = DEFAULT_AUTH_P_ACI;
13516
13517 rsbac_ta_list_get_data_ttl(ta_number,
13518 process_handles.auth,
13519 NULL,
13520 &tid_p->process,
13521 &aci);
13522 switch (attr)
13523 {
13524 case A_auth_may_setuid:
13525 aci.auth_may_setuid = value_p->auth_may_setuid;
13526 break;
13527 case A_auth_may_set_cap:
13528 aci.auth_may_set_cap = value_p->auth_may_set_cap;
13529 break;
13530 #if defined(CONFIG_RSBAC_AUTH_LEARN)
13531 case A_auth_program_file:
13532 aci.auth_program_file = value_p->auth_program_file;
13533 break;
13534 case A_auth_start_uid:
13535 aci.auth_start_uid = value_p->auth_start_uid;
13536 break;
13537 #ifdef CONFIG_RSBAC_AUTH_DAC_OWNER
13538 case A_auth_start_euid:
13539 aci.auth_start_euid = value_p->auth_start_euid;
13540 break;
13541 #endif
13542 #ifdef CONFIG_RSBAC_AUTH_GROUP
13543 case A_auth_start_gid:
13544 aci.auth_start_gid = value_p->auth_start_gid;
13545 break;
13546 #ifdef CONFIG_RSBAC_AUTH_DAC_GROUP
13547 case A_auth_start_egid:
13548 aci.auth_start_egid = value_p->auth_start_egid;
13549 break;
13550 #endif
13551 #endif
13552 case A_auth_learn:
13553 aci.auth_learn = value_p->auth_learn;
13554 break;
13555 #endif
13556 case A_auth_last_auth:
13557 aci.auth_last_auth = value_p->auth_last_auth;
13558 break;
13559 default:
13560 err = -RSBAC_EINVALIDATTR;
13561 }
13562 if(!err)
13563 {
13564 err = rsbac_ta_list_add_ttl(ta_number,
13565 process_handles.auth,
13566 0,
13567 &tid_p->process,
13568 &aci);
13569 }
13570 }
13571 break;
13572 #endif
13573
13574 #if defined(CONFIG_RSBAC_CAP)
13575 case CAP:
13576 {
13577 struct rsbac_cap_process_aci_t aci = DEFAULT_CAP_P_ACI;
13578
13579 rsbac_ta_list_get_data_ttl(ta_number,
13580 process_handles.cap,
13581 NULL,
13582 &tid_p->process,
13583 &aci);
13584 switch (attr)
13585 {
13586 case A_cap_process_hiding:
13587 aci.cap_process_hiding = value_p->cap_process_hiding;
13588 break;
13589 #ifdef CONFIG_RSBAC_CAP_LOG_MISSING
13590 case A_max_caps_user:
13591 aci.max_caps_user = value_p->max_caps_user;
13592 break;
13593 case A_max_caps_program:
13594 aci.max_caps_program = value_p->max_caps_program;
13595 break;
13596 #endif
13597 default:
13598 err = -RSBAC_EINVALIDATTR;
13599 }
13600 if(!err)
13601 {
13602 err = rsbac_ta_list_add_ttl(ta_number,
13603 process_handles.cap,
13604 0,
13605 &tid_p->process,
13606 &aci);
13607 }
13608 }
13609 break;
13610 #endif
13611
13612 #if defined(CONFIG_RSBAC_JAIL)
13613 case JAIL:
13614 {
13615 struct rsbac_jail_process_aci_t aci = DEFAULT_JAIL_P_ACI;
13616
13617 rsbac_ta_list_get_data_ttl(ta_number,
13618 process_handles.jail[jail_p_hash(tid_p->process)],
13619 NULL,
13620 &tid_p->process,
13621 &aci);
13622 switch (attr)
13623 {
13624 case A_jail_id:
13625 aci.id = value_p->jail_id;
13626 break;
13627 case A_jail_ip:
13628 aci.ip = value_p->jail_ip;
13629 break;
13630 case A_jail_flags:
13631 aci.flags = value_p->jail_flags;
13632 break;
13633 case A_jail_max_caps:
13634 aci.max_caps = value_p->jail_max_caps;
13635 break;
13636 case A_jail_scd_get:
13637 aci.scd_get = value_p->jail_scd_get;
13638 break;
13639 case A_jail_scd_modify:
13640 aci.scd_modify = value_p->jail_scd_modify;
13641 break;
13642 default:
13643 err = -RSBAC_EINVALIDATTR;
13644 }
13645 if(!err)
13646 {
13647 err = rsbac_ta_list_add_ttl(ta_number,
13648 process_handles.jail[jail_p_hash(tid_p->process)],
13649 0,
13650 &tid_p->process,
13651 &aci);
13652 }
13653 }
13654 break;
13655 #endif
13656
13657 default:
13658 err = -RSBAC_EINVALIDMODULE;
13659 }
13660
13661 return err;
13662 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 12874 of file aci_data_structures.c. References A_auth_role, A_cap_role, A_daz_role, A_ff_role, A_initial_security_level, A_jail_role, A_log_user_based, A_mac_categories, A_mac_initial_categories, A_mac_min_categories, A_mac_role, A_mac_user_flags, A_max_caps, A_min_caps, A_min_security_level, A_pax_role, A_pm_role, A_pm_task_set, A_pseudo, A_rc_def_role, A_rc_type, A_res_max, A_res_min, A_res_role, A_security_level, A_system_role, AUTH, CAP, DAZ, DEFAULT_GEN_U_ACI, FF, GEN, JAIL, rsbac_attribute_value_t::log_user_based, rsbac_gen_user_aci_t::log_user_based, MAC, rsbac_attribute_value_t::mac_categories, rsbac_attribute_value_t::mac_user_flags, rsbac_attribute_value_t::max_caps, rsbac_attribute_value_t::min_caps, NULL, PAX, PM, rsbac_attribute_value_t::pm_role, rsbac_attribute_value_t::pm_task_set, rsbac_attribute_value_t::pseudo, rsbac_gen_user_aci_t::pseudo, RC, rsbac_attribute_value_t::rc_def_role, rsbac_attribute_value_t::rc_type, RES, rsbac_attribute_value_t::res_array, RSBAC_ALL_USERS, RSBAC_EINVALIDATTR, RSBAC_EINVALIDMODULE, RSBAC_EINVALIDVALUE, RSBAC_MAC_U_FLAGS, rsbac_ta_list_add_ttl(), rsbac_ta_list_get_data_ttl(), rsbac_ta_list_remove(), rsbac_attribute_value_t::security_level, rsbac_attribute_value_t::system_role, rsbac_target_id_t::user, and user_handles. Referenced by rsbac_ta_set_attr(). 12881 {
12882 int err = 0;
12883
12884 #ifdef CONFIG_RSBAC_DEBUG
12885 /*
12886 if (rsbac_debug_ds)
12887 rsbac_printk(KERN_DEBUG
12888 "rsbac_set_attr(): Setting %s user attribute %i for %u to %i\n",
12889 get_switch_target_name(tmp, module), attr, tid_p->user, value_p->dummy);
12890 */
12891 #endif
12892 switch(module)
12893 {
12894 case GEN:
12895 {
12896 struct rsbac_gen_user_aci_t aci = DEFAULT_GEN_U_ACI;
12897
12898 rsbac_ta_list_get_data_ttl(ta_number,
12899 user_handles.gen,
12900 NULL,
12901 &tid_p->user,
12902 &aci);
12903 switch (attr)
12904 {
12905 case A_pseudo:
12906 aci.pseudo = value_p->pseudo;
12907 break;
12908 case A_log_user_based:
12909 aci.log_user_based = value_p->log_user_based;
12910 break;
12911 default:
12912 err = -RSBAC_EINVALIDATTR;
12913 }
12914 if(!err)
12915 {
12916 err = rsbac_ta_list_add_ttl(ta_number,
12917 user_handles.gen,
12918 0,
12919 &tid_p->user,
12920 &aci);
12921 }
12922 }
12923 break;
12924
12925 #if defined(CONFIG_RSBAC_MAC)
12926 case MAC:
12927 {
12928 struct rsbac_mac_user_aci_t aci = DEFAULT_MAC_U_ACI;
12929
12930 rsbac_ta_list_get_data_ttl(ta_number,
12931 user_handles.mac,
12932 NULL,
12933 &tid_p->user,
12934 &aci);
12935 switch (attr)
12936 {
12937 case A_security_level:
12938 if(value_p->security_level < aci.min_security_level)
12939 err = -RSBAC_EINVALIDVALUE;
12940 else
12941 aci.security_level = value_p->security_level;
12942 break;
12943 case A_initial_security_level:
12944 if( (value_p->security_level < aci.min_security_level)
12945 || (value_p->security_level > aci.security_level)
12946 )
12947 err = -RSBAC_EINVALIDVALUE;
12948 else
12949 aci.initial_security_level = value_p->security_level;
12950 break;
12951 case A_min_security_level:
12952 if(value_p->security_level > aci.security_level)
12953 err = -RSBAC_EINVALIDVALUE;
12954 else
12955 aci.min_security_level = value_p->security_level;
12956 break;
12957 case A_mac_categories:
12958 if((value_p->mac_categories & aci.mac_min_categories) != aci.mac_min_categories)
12959 err = -RSBAC_EINVALIDVALUE;
12960 else
12961 aci.mac_categories = value_p->mac_categories;
12962 break;
12963 case A_mac_initial_categories:
12964 if( ((value_p->mac_categories & aci.mac_min_categories) != aci.mac_min_categories)
12965 || ((value_p->mac_categories & aci.mac_categories) != value_p->mac_categories)
12966 )
12967 err = -RSBAC_EINVALIDVALUE;
12968 else
12969 aci.mac_initial_categories = value_p->mac_categories;
12970 break;
12971 case A_mac_min_categories:
12972 if((value_p->mac_categories & aci.mac_categories) != value_p->mac_categories)
12973 err = -RSBAC_EINVALIDVALUE;
12974 else
12975 aci.mac_min_categories = value_p->mac_categories;
12976 break;
12977 case A_system_role:
12978 case A_mac_role:
12979 aci.system_role = value_p->system_role;
12980 break;
12981 case A_mac_user_flags:
12982 aci.mac_user_flags = value_p->mac_user_flags & RSBAC_MAC_U_FLAGS;
12983 break;
12984 default:
12985 err = -RSBAC_EINVALIDATTR;
12986 }
12987 if(!err)
12988 {
12989 err = rsbac_ta_list_add_ttl(ta_number,
12990 user_handles.mac,
12991 0,
12992 &tid_p->user,
12993 &aci);
12994 }
12995 }
12996 break;
12997 #endif
12998
12999 #if defined(CONFIG_RSBAC_PM)
13000 case PM:
13001 {
13002 struct rsbac_pm_user_aci_t aci = DEFAULT_PM_U_ACI;
13003
13004 rsbac_ta_list_get_data_ttl(ta_number,
13005 user_handles.pm,
13006 NULL,
13007 &tid_p->user,
13008 &aci);
13009 switch (attr)
13010 {
13011 case A_pm_task_set:
13012 aci.pm_task_set = value_p->pm_task_set;
13013 break;
13014 case A_pm_role:
13015 aci.pm_role = value_p->pm_role;
13016 break;
13017 default:
13018 err = -RSBAC_EINVALIDATTR;
13019 }
13020 if(!err)
13021 {
13022 err = rsbac_ta_list_add_ttl(ta_number,
13023 user_handles.pm,
13024 0,
13025 &tid_p->user,
13026 &aci);
13027 }
13028 }
13029 break;
13030 #endif
13031
13032 #if defined(CONFIG_RSBAC_DAZ)
13033 case DAZ:
13034 {
13035 rsbac_system_role_int_t role = value_p->system_role;
13036
13037 switch (attr)
13038 {
13039 case A_system_role:
13040 case A_daz_role:
13041 err = rsbac_ta_list_add_ttl(ta_number,
13042 user_handles.daz,
13043 0,
13044 &tid_p->user,
13045 &role);
13046 break;
13047 default:
13048 err = -RSBAC_EINVALIDATTR;
13049 }
13050 }
13051 break;
13052 #endif
13053
13054 #if defined(CONFIG_RSBAC_FF)
13055 case FF:
13056 {
13057 rsbac_system_role_int_t role = value_p->system_role;
13058
13059 switch (attr)
13060 {
13061 case A_system_role:
13062 case A_ff_role:
13063 err = rsbac_ta_list_add_ttl(ta_number,
13064 user_handles.ff,
13065 0,
13066 &tid_p->user,
13067 &role);
13068 break;
13069 default:
13070 err = -RSBAC_EINVALIDATTR;
13071 }
13072 }
13073 break;
13074 #endif
13075
13076 #if defined(CONFIG_RSBAC_RC)
13077 case RC:
13078 {
13079 struct rsbac_rc_user_aci_t aci = DEFAULT_RC_U_ACI;
13080
13081 rsbac_ta_list_get_data_ttl(ta_number,
13082 user_handles.rc,
13083 NULL,
13084 &tid_p->user,
13085 &aci);
13086 switch (attr)
13087 {
13088 case A_rc_def_role:
13089 aci.rc_role = value_p->rc_def_role;
13090 break;
13091 case A_rc_type:
13092 aci.rc_type = value_p->rc_type;
13093 break;
13094 default:
13095 err = -RSBAC_EINVALIDATTR;
13096 }
13097 if(!err)
13098 {
13099 err = rsbac_ta_list_add_ttl(ta_number,
13100 user_handles.rc,
13101 0,
13102 &tid_p->user,
13103 &aci);
13104 }
13105 }
13106 break;
13107 #endif
13108
13109 #if defined(CONFIG_RSBAC_AUTH)
13110 case AUTH:
13111 {
13112 rsbac_system_role_int_t role = value_p->system_role;
13113
13114 switch (attr)
13115 {
13116 case A_system_role:
13117 case A_auth_role:
13118 err = rsbac_ta_list_add_ttl(ta_number,
13119 user_handles.auth,
13120 0,
13121 &tid_p->user,
13122 &role);
13123 break;
13124 default:
13125 err = -RSBAC_EINVALIDATTR;
13126 }
13127 }
13128 break;
13129 #endif
13130
13131 #if defined(CONFIG_RSBAC_CAP)
13132 case CAP:
13133 {
13134 struct rsbac_cap_user_aci_t aci = DEFAULT_CAP_U_ACI;
13135
13136 rsbac_ta_list_get_data_ttl(ta_number,
13137 user_handles.cap,
13138 NULL,
13139 &tid_p->user,
13140 &aci);
13141 switch (attr)
13142 {
13143 case A_system_role:
13144 case A_cap_role:
13145 aci.cap_role = value_p->system_role;
13146 break;
13147 case A_min_caps:
13148 aci.min_caps = value_p->min_caps;
13149 break;
13150 case A_max_caps:
13151 aci.max_caps = value_p->max_caps;
13152 break;
13153 default:
13154 err = -RSBAC_EINVALIDATTR;
13155 }
13156 if(!err)
13157 {
13158 err = rsbac_ta_list_add_ttl(ta_number,
13159 user_handles.cap,
13160 0,
13161 &tid_p->user,
13162 &aci);
13163 }
13164 }
13165 break;
13166 #endif
13167
13168 #if defined(CONFIG_RSBAC_JAIL)
13169 case JAIL:
13170 {
13171 rsbac_system_role_int_t role = value_p->system_role;
13172
13173 switch (attr)
13174 {
13175 case A_system_role:
13176 case A_jail_role:
13177 err = rsbac_ta_list_add_ttl(ta_number,
13178 user_handles.jail,
13179 0,
13180 &tid_p->user,
13181 &role);
13182 break;
13183 default:
13184 err = -RSBAC_EINVALIDATTR;
13185 }
13186 }
13187 break;
13188 #endif
13189
13190 #if defined(CONFIG_RSBAC_RES)
13191 case RES:
13192 {
13193 struct rsbac_res_user_aci_t aci = DEFAULT_RES_U_ACI;
13194
13195 rsbac_ta_list_get_data_ttl(ta_number,
13196 user_handles.res,
13197 NULL,
13198 &tid_p->user,
13199 &aci);
13200 switch (attr)
13201 {
13202 case A_system_role:
13203 case A_res_role:
13204 aci.res_role = value_p->system_role;
13205 break;
13206 case A_res_min:
13207 memcpy(&aci.res_min, &value_p->res_array, sizeof(aci.res_min));
13208 break;
13209 case A_res_max:
13210 memcpy(&aci.res_max, &value_p->res_array, sizeof(aci.res_max));
13211 break;
13212 default:
13213 err = -RSBAC_EINVALIDATTR;
13214 }
13215 if(!err)
13216 {
13217 struct rsbac_res_user_aci_t def_aci = DEFAULT_RES_U_ACI;
13218
13219 if(tid_p->user != RSBAC_ALL_USERS)
13220 {
13221 rsbac_uid_t all_users = RSBAC_ALL_USERS;
13222
13223 rsbac_ta_list_get_data_ttl(ta_number,
13224 user_handles.res,
13225 NULL,
13226 &all_users,
13227 &def_aci);
13228 }
13229 if(memcmp(&aci, &def_aci, sizeof(aci)))
13230 err = rsbac_ta_list_add_ttl(ta_number,
13231 user_handles.res,
13232 0,
13233 &tid_p->user,
13234 &aci);
13235 else
13236 err = rsbac_ta_list_remove(ta_number,
13237 user_handles.res,
13238 &tid_p->user);
13239 }
13240 }
13241 break;
13242 #endif
13243
13244 #if defined(CONFIG_RSBAC_PAX)
13245 case PAX:
13246 {
13247 rsbac_system_role_int_t role = value_p->system_role;
13248
13249 switch (attr)
13250 {
13251 case A_system_role:
13252 case A_pax_role:
13253 err = rsbac_ta_list_add_ttl(ta_number,
13254 user_handles.pax,
13255 0,
13256 &tid_p->user,
13257 &role);
13258 break;
13259 default:
13260 err = -RSBAC_EINVALIDATTR;
13261 }
13262 }
13263 break;
13264 #endif
13265
13266 default:
13267 err = -RSBAC_EINVALIDMODULE;
13268 }
13269
13270 return err;
13271 }
|
|
|
Definition at line 2063 of file aci_data_structures.c. Referenced by rsbac_get_super_block(). 02064 {
02065 wake_up((void *) dummy);
02066 }
|
|
|
Definition at line 316 of file aci_data_structures.c. References FALSE, KERNEL_VERSION, rsbac_debug_no_write, SOCKFS_MAGIC, SYSFS_MAGIC, and TRUE. Referenced by lookup_aci_path_dentry(), and rsbac_write_open(). 00317 {
00318 #ifdef CONFIG_RSBAC_NO_WRITE
00319 return(FALSE);
00320 #else
00321 if (!sb_p || !sb_p->s_dev)
00322 return(FALSE);
00323 if (
00324 rsbac_debug_no_write ||
00325 (sb_p->s_flags & MS_RDONLY)
00326 || in_interrupt())
00327 return(FALSE);
00328 if ( !MAJOR(sb_p->s_dev)
00329 #ifndef CONFIG_RSBAC_MSDOS_WRITE
00330 || (sb_p->s_magic == MSDOS_SUPER_MAGIC)
00331 #endif
00332 || (sb_p->s_magic == SOCKFS_MAGIC)
00333 || (sb_p->s_magic == PIPEFS_MAGIC)
00334 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
00335 || (sb_p->s_magic == SYSFS_MAGIC)
00336 #endif
00337 || (sb_p->s_magic == NFS_SUPER_MAGIC)
00338 || (sb_p->s_magic == CODA_SUPER_MAGIC)
00339 || (sb_p->s_magic == NCP_SUPER_MAGIC)
00340 || (sb_p->s_magic == SMB_SUPER_MAGIC)
00341 || (sb_p->s_magic == ISOFS_SUPER_MAGIC))
00342 return(FALSE);
00343 else
00344 return(TRUE);
00345 #endif
00346 }
|
|
|
Definition at line 120 of file aci_data_structures.c. Referenced by rsbac_do_init(). |
|
|
Definition at line 155 of file aci_data_structures.c. |
|
|
Definition at line 154 of file aci_data_structures.c. |
|
|
Definition at line 129 of file aci_data_structures.c. Referenced by get_attr_dev(), register_dev_lists(), rsbac_stats(), rsbac_ta_list_all_dev(), rsbac_ta_remove_target(), and set_attr_dev(). |
|
|
Definition at line 130 of file aci_data_structures.c. Referenced by get_attr_dev(), register_dev_lists(), rsbac_stats(), rsbac_ta_list_all_dev(), and set_attr_dev(). |
|
|
Definition at line 128 of file aci_data_structures.c. Referenced by add_device_item(), get_attr_fd(), lookup_aci_path_dentry(), lookup_device(), remove_device_item(), rsbac_do_init(), rsbac_free_dat_dentries(), rsbac_get_parent(), rsbac_get_super_block(), rsbac_mount(), rsbac_stats(), rsbac_ta_remove_target(), rsbac_umount(), and set_attr_fd(). |
|
|
Definition at line 131 of file aci_data_structures.c. Referenced by get_attr_ipc(), register_ipc_lists(), rsbac_stats(), rsbac_ta_remove_target(), and set_attr_ipc(). |
|
|
Definition at line 136 of file aci_data_structures.c. Referenced by get_attr_process(), register_process_lists(), rsbac_init(), rsbac_kthread_notify(), rsbac_stats(), rsbac_ta_remove_target(), and set_attr_process(). |
|
|
Definition at line 118 of file aci_data_structures.c. Referenced by rsbac_do_init(), rsbac_free_dat_dentries(), rsbac_init(), rsbac_is_initialized(), rsbac_kthread_notify(), rsbac_mount(), rsbac_stats(), rsbac_ta_get_attr(), rsbac_ta_remove_target(), rsbac_ta_set_attr(), and rsbac_umount(). |
|
|
Definition at line 122 of file aci_data_structures.c. Referenced by read_info(), rsbac_do_init(), rsbac_init(), rsbac_init_acl(), rsbac_init_auth(), rsbac_init_mac(), rsbac_list_lol_register(), rsbac_list_register(), rsbac_mount(), and write_info(). |
|
|
Definition at line 203 of file aci_data_structures.c. Referenced by rsbac_do_init(), rsbac_mount(), and rsbac_umount(). |
|
|
Definition at line 204 of file aci_data_structures.c. Referenced by rsbac_do_init(), rsbac_mount(), and rsbac_umount(). |
|
|
Definition at line 132 of file aci_data_structures.c. Referenced by get_attr_user(), register_user_lists(), rsbac_init(), rsbac_stats(), rsbac_ta_list_all_user(), rsbac_ta_remove_target(), and set_attr_user(). |
1.4.2