#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <rsbac/types.h>
#include <rsbac/reg.h>
#include <rsbac/adf.h>
#include <rsbac/aci.h>
#include <rsbac/getname.h>
#include <rsbac/error.h>
#include <rsbac/proc_fs.h>
Go to the source code of this file.
Functions | |
MODULE_AUTHOR ("Amon Ott") | |
MODULE_DESCRIPTION ("RSBAC REG sample decision module 1") | |
MODULE_LICENSE ("GPL") | |
MODULE_PARM (name,"s") | |
MODULE_PARM (syscall_name,"s") | |
MODULE_PARM (handle,"l") | |
MODULE_PARM (syscall_registration_handle,"l") | |
MODULE_PARM (syscall_dispatcher_handle,"l") | |
static int | request_func (enum rsbac_adf_request_t request, rsbac_pid_t owner_pid, enum rsbac_target_t target, union rsbac_target_id_t tid, enum rsbac_attribute_t attr, union rsbac_attribute_value_t attr_val, rsbac_uid_t owner) |
static int | set_attr_func (enum rsbac_adf_request_t request, rsbac_pid_t owner_pid, enum rsbac_target_t target, union rsbac_target_id_t tid, enum rsbac_target_t new_target, union rsbac_target_id_t new_tid, enum rsbac_attribute_t attr, union rsbac_attribute_value_t attr_val, rsbac_uid_t owner) |
static rsbac_boolean_t | need_overwrite_func (struct dentry *dentry_p) |
static int | syscall_func (void *arg) |
int | init_module (void) |
void | cleanup_module (void) |
Variables | |
static u_long | nr_request_calls = 0 |
static u_long | nr_set_attr_calls = 0 |
static u_long | nr_need_overwrite_calls = 0 |
static u_long | nr_system_calls = 0 |
static void * | system_call_arg = NULL |
static char * | name = NULL |
static char | dummy_buf [70] = "To protect against wrong insmod params" |
static char * | syscall_name = NULL |
static char | dummy_buf2 [70] = "To protect against wrong insmod params" |
static long | handle = 123456 |
static long | syscall_registration_handle = 654321 |
static long | syscall_dispatcher_handle = 1 |
|
Definition at line 285 of file reg_sample1.c. References handle, proc_rsbac_root_p, rsbac_printk(), rsbac_reg_unregister(), rsbac_reg_unregister_syscall(), and syscall_registration_handle. 00286 { 00287 rsbac_printk(KERN_INFO "RSBAC REG decision module sample 1: Unregistering.\n"); 00288 #if defined(CONFIG_RSBAC_PROC) 00289 remove_proc_entry(PROC_NAME, proc_rsbac_root_p); 00290 #endif 00291 if(rsbac_reg_unregister_syscall(syscall_registration_handle)) 00292 { 00293 rsbac_printk(KERN_ERR "RSBAC REG decision module sample 1: Unregistering syscall failed - beware of possible system failure!\n"); 00294 } 00295 if(rsbac_reg_unregister(handle)) 00296 { 00297 rsbac_printk(KERN_ERR "RSBAC REG decision module sample 1: Unregistering failed - beware of possible system failure!\n"); 00298 } 00299 rsbac_printk(KERN_INFO "RSBAC REG decision module sample 1: Unloaded.\n"); 00300 }
|
|
Definition at line 190 of file reg_sample1.c. References dummy_buf, dummy_buf2, handle, name, need_overwrite_func(), proc_rsbac_root_p, request_func(), rsbac_printk(), RSBAC_REG_NAME_LEN, rsbac_reg_register(), rsbac_reg_register_syscall(), rsbac_reg_unregister(), rsbac_reg_unregister_syscall(), RSBAC_REG_VERSION, set_attr_func(), syscall_dispatcher_handle, syscall_func(), syscall_name, syscall_registration_handle, and TRUE. 00191 { 00192 struct rsbac_reg_entry_t entry; 00193 struct rsbac_reg_syscall_entry_t syscall_entry; 00194 00195 if(!handle) 00196 handle = 123456; 00197 if(!syscall_registration_handle) 00198 syscall_registration_handle = 654321; 00199 if(!syscall_dispatcher_handle) 00200 syscall_dispatcher_handle = 1; 00201 00202 rsbac_printk(KERN_INFO "RSBAC REG decision module sample 1: Initializing.\n"); 00203 00204 /* clearing registration entries */ 00205 memset(&entry, 0, sizeof(entry)); 00206 memset(&syscall_entry, 0, sizeof(syscall_entry)); 00207 00208 if((dummy_buf[0] != 'T') || (dummy_buf2[0] != 'T')) 00209 { 00210 rsbac_printk(KERN_WARNING "RSBAC REG decision module sample 1: Not loaded due to invalid param string.\n"); 00211 return -ENOEXEC; 00212 } 00213 if(name) 00214 { 00215 strncpy(entry.name, name, RSBAC_REG_NAME_LEN); 00216 entry.name[RSBAC_REG_NAME_LEN] = 0; 00217 } 00218 else 00219 strcpy(entry.name, "RSBAC REG sample 1 ADF module"); 00220 rsbac_printk(KERN_INFO "RSBAC REG decision module sample 1: REG Version: %u, Name: %s, Handle: %li\n", 00221 RSBAC_REG_VERSION, entry.name, handle); 00222 00223 entry.handle = handle; 00224 entry.request_func = request_func; 00225 entry.set_attr_func = set_attr_func; 00226 entry.need_overwrite_func = need_overwrite_func; 00227 entry.switch_on = TRUE; 00228 rsbac_printk(KERN_INFO "RSBAC REG decision module sample 1: Registering to ADF.\n"); 00229 if(rsbac_reg_register(RSBAC_REG_VERSION, entry) < 0) 00230 { 00231 rsbac_printk(KERN_WARNING "RSBAC REG decision module sample 1: Registering failed. Unloading.\n"); 00232 return -ENOEXEC; 00233 } 00234 00235 if(syscall_name) 00236 { 00237 strncpy(syscall_entry.name, syscall_name, RSBAC_REG_NAME_LEN); 00238 syscall_entry.name[RSBAC_REG_NAME_LEN] = 0; 00239 } 00240 else 00241 strcpy(syscall_entry.name, "RSBAC REG sample 1 syscall"); 00242 rsbac_printk(KERN_INFO "RSBAC REG decision module sample 1: REG Version: %u, Name: %s, Dispatcher Handle: %li\n", 00243 RSBAC_REG_VERSION, syscall_entry.name, syscall_dispatcher_handle); 00244 00245 syscall_entry.registration_handle = syscall_registration_handle; 00246 syscall_entry.dispatcher_handle = syscall_dispatcher_handle; 00247 syscall_entry.syscall_func = syscall_func; 00248 rsbac_printk(KERN_INFO "RSBAC REG decision module sample 1: Registering syscall.\n"); 00249 syscall_registration_handle = rsbac_reg_register_syscall(RSBAC_REG_VERSION, syscall_entry); 00250 if(syscall_registration_handle < 0) 00251 { 00252 rsbac_printk(KERN_WARNING "RSBAC REG decision module sample 1: Registering syscall failed. Unloading.\n"); 00253 if(rsbac_reg_unregister(handle)) 00254 { 00255 rsbac_printk(KERN_ERR "RSBAC REG decision module sample 1: Unregistering failed - beware of possible system failure!\n"); 00256 } 00257 return -ENOEXEC; 00258 } 00259 00260 #if defined(CONFIG_RSBAC_PROC) 00261 proc_reg_sample_p = create_proc_entry(PROC_NAME, 00262 S_IFREG | S_IRUGO, 00263 proc_rsbac_root_p); 00264 if(!proc_reg_sample_p) 00265 { 00266 rsbac_printk(KERN_WARNING "%s: Not loaded due to failed proc entry registering.\n", name); 00267 if(rsbac_reg_unregister(handle)) 00268 { 00269 rsbac_printk(KERN_ERR "RSBAC REG decision module sample 1: Unregistering failed - beware of possible system failure!\n"); 00270 } 00271 if(rsbac_reg_unregister_syscall(syscall_registration_handle)) 00272 { 00273 rsbac_printk(KERN_ERR "RSBAC REG decision module sample 1: Unregistering syscall failed - beware of possible system failure!\n"); 00274 } 00275 return -ENOEXEC; 00276 } 00277 proc_reg_sample_p->get_info = adf_sample_proc_info; 00278 #endif 00279 00280 rsbac_printk(KERN_INFO "RSBAC REG decision module sample 1: Loaded.\n"); 00281 00282 return 0; 00283 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 175 of file reg_sample1.c. References FALSE, and nr_need_overwrite_calls. Referenced by init_module(). 00176 { 00177 nr_need_overwrite_calls++; 00178 return FALSE; 00179 }
|
|
Definition at line 145 of file reg_sample1.c. References GRANTED, nr_request_calls, and R_SEARCH. 00152 { 00153 /* count call, but not for SEARCH request */ 00154 if(request != R_SEARCH) 00155 nr_request_calls++; 00156 return GRANTED; 00157 }
|
|
Definition at line 159 of file reg_sample1.c. References nr_set_attr_calls, and R_SEARCH. Referenced by init_module(). 00168 { 00169 /* count call, but not for SEARCH request */ 00170 if(request != R_SEARCH) 00171 nr_set_attr_calls++; 00172 return 0; 00173 }
|
|
Definition at line 181 of file reg_sample1.c. References nr_system_calls, and system_call_arg. Referenced by init_module(). 00182 { 00183 nr_system_calls++; 00184 system_call_arg = arg; 00185 return nr_system_calls; 00186 }
|
|
Definition at line 33 of file reg_sample1.c. Referenced by init_module(). |
|
Definition at line 37 of file reg_sample1.c. Referenced by init_module(). |
|
Definition at line 40 of file reg_sample1.c. |
|
Definition at line 32 of file reg_sample1.c. Referenced by acl_detach_fd_lists(), acl_register_fd_lists(), auth_detach_fd_lists(), auth_register_fd_lists(), group_name_compare(), init_module(), mac_detach_fd_lists(), mac_register_fd_lists(), name_compare(), read_info(), register_fd_lists(), rsbac_init_rc(), rsbac_init_um(), and write_info(). |
|
Definition at line 23 of file reg_sample1.c. Referenced by init_module(), need_overwrite_func(), read_info(), and write_info(). |
|
Definition at line 21 of file reg_sample1.c. Referenced by init_module(), read_info(), request_func(), and write_info(). |
|
Definition at line 22 of file reg_sample1.c. Referenced by init_module(), read_info(), set_attr_func(), and write_info(). |
|
Definition at line 24 of file reg_sample1.c. Referenced by init_module(), and syscall_func(). |
|
Definition at line 45 of file reg_sample1.c. Referenced by init_module(). |
|
Definition at line 36 of file reg_sample1.c. Referenced by init_module(). |
|
Definition at line 43 of file reg_sample1.c. Referenced by cleanup_module(), and init_module(). |
|
Definition at line 25 of file reg_sample1.c. Referenced by syscall_func(). |