/daten/src/linux-2.4.27-rsbac-v1.2.3/rsbac/help/cap_getname.c

Go to the documentation of this file.
00001 /********************************** */ 00002 /* Rule Set Based Access Control */ 00003 /* Author and (c) 1999-2001: */ 00004 /* Amon Ott <ao@rsbac.org> */ 00005 /* Getname functions for CAP module */ 00006 /* Last modified: 03/Sep/2001 */ 00007 /********************************** */ 00008 00009 #ifndef __KERNEL__ 00010 00011 #include <rsbac/getname.h> 00012 #include <rsbac/cap_getname.h> 00013 #include <rsbac/helpers.h> 00014 #include <rsbac/error.h> 00015 00016 #include <string.h> 00017 00018 static char cap_list[RSBAC_CAP_MAX+1][17] = { 00019 "CHOWN", 00020 "DAC_OVERRIDE", 00021 "DAC_READ_SEARCH", 00022 "FOWNER", 00023 "FSETID", 00024 "KILL", 00025 "SETGID", 00026 "SETUID", 00027 "SETPCAP", 00028 "LINUX_IMMUTABLE", 00029 "NET_BIND_SERVICE", 00030 "NET_BROADCAST", 00031 "NET_ADMIN", 00032 "NET_RAW", 00033 "IPC_LOCK", 00034 "IPC_OWNER", 00035 "SYS_MODULE", 00036 "SYS_RAWIO", 00037 "SYS_CHROOT", 00038 "SYS_PTRACE", 00039 "SYS_PACCT", 00040 "SYS_ADMIN", 00041 "SYS_BOOT", 00042 "SYS_NICE", 00043 "SYS_RESOURCE", 00044 "SYS_TIME", 00045 "SYS_TTY_CONFIG", 00046 "MKNOD", 00047 "LEASE", 00048 "NONE" }; 00049 00050 /*****************************************/ 00051 00052 char * get_cap_name(char * name, 00053 u_int value) 00054 { 00055 if(!name) 00056 return(NULL); 00057 if(value > CAP_NONE) 00058 strcpy(name, "ERROR!"); 00059 else 00060 strcpy(name, cap_list[value]); 00061 return(name); 00062 }; 00063 00064 int get_cap_nr(const char * name) 00065 { 00066 int i; 00067 00068 if(!name) 00069 return(RT_NONE); 00070 for (i = 0; i < CAP_NONE; i++) 00071 { 00072 if (!strcmp(name, cap_list[i])) 00073 { 00074 return(i); 00075 } 00076 } 00077 return(CAP_NONE); 00078 }; 00079 00080 #endif /* !__KERNEL__ */

Generated on Tue Aug 31 10:05:26 2004 for RSBAC by doxygen 1.3.8