auth.h

Go to the documentation of this file.
00001 /************************************ */
00002 /* Rule Set Based Access Control      */
00003 /* Author and (c) 1999-2005:          */
00004 /*   Amon Ott <ao@rsbac.org>          */
00005 /* API: Data structures               */
00006 /* and functions for Access           */
00007 /* Control Information / AUTH         */
00008 /* Last modified: 09/Feb/2005         */
00009 /************************************ */
00010 
00011 #ifndef __RSBAC_AUTH_H
00012 #define __RSBAC_AUTH_H
00013 
00014 #include <linux/init.h>
00015 #include <rsbac/types.h>
00016 
00017 /***************************************************/
00018 /*               General Prototypes                */
00019 /***************************************************/
00020 
00021 /* All functions return 0, if no error occurred, and a negative error code  */
00022 /* otherwise. The error codes are defined in rsbac_error.h.                 */
00023 
00024 /****************************************************************************/
00025 /* Initialization, including ACI restoration for all mounted devices from   */
00026 /* disk. After this call, all ACI is kept in memory for performance reasons,*/
00027 /* but user and file/dir object ACI are written to disk on every change.    */
00028 
00029 #ifdef CONFIG_RSBAC_INIT_DELAY
00030 extern int rsbac_init_auth(void);
00031 #else
00032 extern int rsbac_init_auth(void) __init;
00033 #endif
00034 
00035 /* mounting and umounting */
00036 int rsbac_mount_auth(kdev_t kdev);
00037 int rsbac_umount_auth(kdev_t kdev);
00038 
00039 /* Some information about the current status is also available */
00040 extern int rsbac_stats_auth(void);
00041 
00042 /* Status checking */
00043 extern int rsbac_check_auth(int correct, int check_inode);
00044 
00045 /* RSBAC attribute saving to disk can be triggered from outside
00046  * param: call lock_kernel() before writing?
00047  */
00048 #if defined(CONFIG_RSBAC_MAINT) || defined(CONFIG_RSBAC_AUTO_WRITE)
00049 extern int rsbac_write_auth(rsbac_boolean_t);
00050 #endif /* CONFIG_RSBAC_AUTO_WRITE */
00051 
00052 /************************************************* */
00053 /*               Access functions                  */
00054 /************************************************* */
00055 
00056 /* All these procedures handle the semaphores to protect the targets during */
00057 /* access.                                                                  */
00058 /* Trying to access a never created or removed set returns an error!        */
00059 
00060 /* rsbac_auth_add_to_p_capset */
00061 /* Add a set member to a set sublist. Set behaviour: also returns success, */
00062 /* if member was already in set! */
00063 
00064 int rsbac_auth_add_to_p_capset(
00065          rsbac_list_ta_number_t ta_number,
00066          rsbac_pid_t pid,
00067   enum   rsbac_auth_cap_type_t cap_type,
00068   struct rsbac_auth_cap_range_t cap_range,
00069          rsbac_time_t ttl);
00070 
00071 int rsbac_auth_add_to_f_capset(
00072          rsbac_list_ta_number_t ta_number,
00073          rsbac_auth_file_t file,
00074   enum   rsbac_auth_cap_type_t cap_type,
00075   struct rsbac_auth_cap_range_t cap_range,
00076          rsbac_time_t ttl);
00077 
00078 /* rsbac_auth_remove_from_p_capset */
00079 /* Remove a set member from a sublist. Set behaviour: Returns no error, if */
00080 /* member is not in list.                                                  */
00081 
00082 int rsbac_auth_remove_from_p_capset(
00083          rsbac_list_ta_number_t ta_number,
00084          rsbac_pid_t pid,
00085   enum   rsbac_auth_cap_type_t cap_type,
00086   struct rsbac_auth_cap_range_t cap_range);
00087 
00088 int rsbac_auth_remove_from_f_capset(
00089         rsbac_list_ta_number_t ta_number,
00090         rsbac_auth_file_t file,
00091   enum  rsbac_auth_cap_type_t cap_type,
00092   struct rsbac_auth_cap_range_t cap_range);
00093 
00094 /* rsbac_auth_clear_p_capset */
00095 /* Remove all set members from a sublist. Set behaviour: Returns no error, */
00096 /* if list is empty.                                                       */
00097 
00098 int rsbac_auth_clear_p_capset(
00099        rsbac_list_ta_number_t ta_number,
00100        rsbac_pid_t pid,
00101   enum rsbac_auth_cap_type_t cap_type);
00102 
00103 int rsbac_auth_clear_f_capset(
00104        rsbac_list_ta_number_t ta_number,
00105        rsbac_auth_file_t file,
00106   enum rsbac_auth_cap_type_t cap_type);
00107 
00108 /* rsbac_auth_p_capset_member */
00109 /* Return truth value, whether member is in set */
00110 
00111 rsbac_boolean_t  rsbac_auth_p_capset_member(rsbac_pid_t pid,
00112                                     enum rsbac_auth_cap_type_t cap_type,
00113                                     rsbac_uid_t member);
00114 
00115 /* rsbac_auth_remove_p_capset */
00116 /* Remove a full set. After this call the given id can only be used for */
00117 /* creating a new set, anything else returns an error.                  */
00118 /* To empty an existing set use rsbac_auth_clear_p_capset.                */
00119 
00120 int rsbac_auth_remove_p_capsets(rsbac_pid_t pid);
00121 
00122 int rsbac_auth_remove_f_capsets(rsbac_auth_file_t file);
00123 
00124 /* rsbac_auth_copy_fp_capset */
00125 /* copy a file capset to a process capset */
00126 int rsbac_auth_copy_fp_capset(rsbac_auth_file_t    file,
00127                               rsbac_pid_t p_cap_set_id);
00128 
00129 /* rsbac_auth_copy_pp_capset */
00130 /* copy a process capset to another process capset */
00131 int rsbac_auth_copy_pp_capset(rsbac_pid_t old_p_set_id,
00132                               rsbac_pid_t new_p_set_id);
00133 
00134 /* rsbac_auth_get_f_caplist */
00135 /* copy a file/dir capset to an array of length 2 * maxnum (first+last), */
00136 /* returns number of caps copied */
00137 int rsbac_auth_get_f_caplist(
00138          rsbac_list_ta_number_t ta_number,
00139          rsbac_auth_file_t file,
00140   enum   rsbac_auth_cap_type_t cap_type,
00141   struct rsbac_auth_cap_range_t **caplist_p,
00142          rsbac_time_t **ttllist_p);
00143 
00144 /* rsbac_auth_get_p_caplist */
00145 /* copy a process capset to an array of length 2 * maxnum (first+last), */
00146 /* returns number of caps copied */
00147 int rsbac_auth_get_p_caplist(
00148          rsbac_list_ta_number_t ta_number,
00149          rsbac_pid_t pid,
00150   enum   rsbac_auth_cap_type_t cap_type,
00151   struct rsbac_auth_cap_range_t **caplist_p,
00152          rsbac_time_t **ttllist_p);
00153 
00154 #endif

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