debug.c

Go to the documentation of this file.
00001 /************************************ */
00002 /* Rule Set Based Access Control      */
00003 /*                                    */
00004 /* Author and (c) 1999-2005:          */
00005 /*   Amon Ott <ao@rsbac.org>          */
00006 /*                                    */
00007 /* Debug and logging functions for all parts */
00008 /*                                    */
00009 /* Last modified: 11/Mar/2005         */
00010 /************************************ */
00011  
00012 #include <asm/uaccess.h>
00013 #include <rsbac/types.h>
00014 #include <rsbac/aci.h>
00015 #include <rsbac/aci_data_structures.h>
00016 #include <rsbac/debug.h>
00017 #include <rsbac/error.h>
00018 #include <rsbac/proc_fs.h>
00019 #include <rsbac/getname.h>
00020 #include <rsbac/net_getname.h>
00021 #include <rsbac/adf.h>
00022 #include <rsbac/rkmem.h>
00023 #if defined(CONFIG_RSBAC_DAZ)
00024 #include <rsbac/daz.h>
00025 #endif
00026 #include <linux/smp_lock.h>
00027 #include <linux/init.h>
00028 #include <linux/config.h>
00029 #include <linux/module.h>
00030 #include <linux/console.h>
00031 #include <linux/net.h>
00032 #include <linux/in.h>
00033 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
00034 #include <linux/moduleparam.h>
00035 #include <linux/syscalls.h>
00036 #endif
00037 
00038 /* Boolean debug switch for NO_WRITE (global) */
00039 int  rsbac_debug_no_write = 0;
00040 
00041 static rsbac_boolean_t debug_initialized = FALSE;
00042 
00043 #ifdef CONFIG_RSBAC_DEBUG
00044 /* Boolean debug switch for data structures */
00045 int  rsbac_debug_ds = 0;
00046 
00047 /* Boolean debug switch for writing of data structures */
00048 int  rsbac_debug_write = 0;
00049 
00050 /* Boolean debug switch for AEF */
00051 EXPORT_SYMBOL(rsbac_debug_aef);
00052 int  rsbac_debug_aef = 0;
00053 
00054 /* Boolean debug switch for stack debugging */
00055 int  rsbac_debug_stack = 0;
00056 
00057 /* Boolean debug switch for generic lists */
00058 int  rsbac_debug_lists = 0;
00059 
00060 #ifdef CONFIG_RSBAC_NET
00061 int rsbac_debug_ds_net = 0;
00062 int rsbac_debug_adf_net = 0;
00063 int rsbac_debug_aef_net = 0;
00064 #endif
00065 
00066 #if defined(CONFIG_RSBAC_MAC)
00067 /* Boolean debug switch for MAC data structures */
00068 int  rsbac_debug_ds_mac = 0;
00069 /* Boolean debug switch for MAC syscalls / AEF */
00070 int  rsbac_debug_aef_mac = 0;
00071 /* Boolean debug switch for MAC decisions / ADF */
00072 int  rsbac_debug_adf_mac = 0;
00073 #endif
00074 
00075 #if defined(CONFIG_RSBAC_PM) || defined(CONFIG_RSBAC_PM_MAINT)
00076 /* Boolean debug switch for PM data structures */
00077 int  rsbac_debug_ds_pm = 0;
00078 /* Boolean debug switch for PM syscalls / AEF */
00079 int  rsbac_debug_aef_pm = 0;
00080 /* Boolean debug switch for PM decisions / ADF */
00081 int  rsbac_debug_adf_pm = 0;
00082 #endif
00083 
00084 #if defined(CONFIG_RSBAC_DAZ)
00085 /* Boolean debug switch for DAZ decisions / ADF */
00086 int  rsbac_debug_adf_daz = 0;
00087 #endif
00088 
00089 #if defined(CONFIG_RSBAC_RC) || defined(CONFIG_RSBAC_RC_MAINT)
00090 /* Boolean debug switch for RC data structures */
00091 int  rsbac_debug_ds_rc = 0;
00092 /* Boolean debug switch for RC syscalls / AEF */
00093 int  rsbac_debug_aef_rc = 0;
00094 /* Boolean debug switch for RC decisions / ADF */
00095 int  rsbac_debug_adf_rc = 0;
00096 #endif
00097 
00098 #if defined(CONFIG_RSBAC_AUTH) || defined(CONFIG_RSBAC_AUTH_MAINT)
00099 /* Boolean debug switch for AUTH data structures */
00100 int  rsbac_debug_ds_auth = 0;
00101 /* Boolean debug switch for AUTH syscalls / AEF */
00102 int  rsbac_debug_aef_auth = 0;
00103 /* Boolean debug switch for AUTH decisions / ADF */
00104 int  rsbac_debug_adf_auth = 0;
00105 #endif
00106 
00107 #if defined(CONFIG_RSBAC_REG) || defined(CONFIG_RSBAC_REG_MAINT)
00108 /* Boolean debug switch for REG */
00109 int  rsbac_debug_reg = 0;
00110 #endif
00111 
00112 #if defined(CONFIG_RSBAC_ACL) || defined(CONFIG_RSBAC_ACL_MAINT)
00113 /* Boolean debug switch for ACL data structures */
00114 int  rsbac_debug_ds_acl = 0;
00115 /* Boolean debug switch for ACL syscalls / AEF */
00116 int  rsbac_debug_aef_acl = 0;
00117 /* Boolean debug switch for ACL decisions / ADF */
00118 int  rsbac_debug_adf_acl = 0;
00119 #endif
00120 
00121 #if defined(CONFIG_RSBAC_JAIL)
00122 /* Boolean debug switch for JAIL syscalls / AEF */
00123 int  rsbac_debug_aef_jail = 0;
00124 /* Boolean debug switch for JAIL decisions / ADF */
00125 int  rsbac_debug_adf_jail = 0;
00126 #endif
00127 
00128 #if defined(CONFIG_RSBAC_PAX)
00129 /* Boolean debug switch for PAX decisions / ADF */
00130 int  rsbac_debug_adf_pax = 0;
00131 #endif
00132 
00133 #if defined(CONFIG_RSBAC_UM)
00134 /* Boolean debug switch for UM data structures */
00135 int  rsbac_debug_ds_um = 0;
00136 /* Boolean debug switch for UM syscalls / AEF */
00137 int  rsbac_debug_aef_um = 0;
00138 /* Boolean debug switch for UM decisions / ADF */
00139 int  rsbac_debug_adf_um = 0;
00140 #endif
00141 
00142 #if defined(CONFIG_RSBAC_AUTO_WRITE) && (CONFIG_RSBAC_AUTO_WRITE > 0)
00143   int  rsbac_debug_auto = 0;
00144 #endif /* CONFIG_RSBAC_AUTO_WRITE > 0 */
00145 
00146 #endif /* DEBUG */
00147 
00148 #if defined(CONFIG_RSBAC_UM_EXCL)
00149 int  rsbac_um_no_excl = 0;
00150 #endif
00151 
00152 #if defined(CONFIG_RSBAC_AUTH) || defined(CONFIG_RSBAC_AUTH_MAINT)
00153 /* Boolean switch for AUTH init: set may_setuid for /bin/login */
00154 int  rsbac_auth_enable_login = 0;
00155 #if defined(CONFIG_RSBAC_AUTH_LEARN)
00156 int  rsbac_auth_learn = 0;
00157 #endif
00158 #endif
00159 
00160 #if defined(CONFIG_RSBAC_ACL_LEARN)
00161 int  rsbac_acl_learn_fd = 0;
00162 #endif
00163 
00164 /* Suppress default list creation for complete restore */
00165 int  rsbac_no_defaults = 0;
00166 
00167 static rsbac_list_handle_t log_levels_handle = NULL;
00168 
00169 #ifdef CONFIG_RSBAC_SOFTMODE
00170 /* Boolean switch for RSBAC soft mode */
00171 int  rsbac_softmode = 0;
00172 int  rsbac_softmode_prohibit = 0;
00173 #ifdef CONFIG_RSBAC_SOFTMODE_IND
00174 int  rsbac_ind_softmode[SW_NONE] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
00175 #endif
00176 
00177 #if defined(CONFIG_RSBAC_REG) || defined(CONFIG_RSBAC_REG_MAINT)
00178 EXPORT_SYMBOL(rsbac_in_softmode);
00179 #endif
00180 int rsbac_in_softmode(void)
00181   {
00182     return rsbac_softmode;
00183   }
00184 #endif
00185 
00186 #ifdef CONFIG_RSBAC_FREEZE
00187 int rsbac_freeze = 0;
00188 #endif
00189 
00190 #if defined(CONFIG_RSBAC_CAP_PROC_HIDE)
00191 int rsbac_cap_process_hiding = 0;
00192 #endif
00193 #ifdef CONFIG_RSBAC_CAP_LOG_MISSING
00194 int rsbac_cap_log_missing = 0;
00195 #endif
00196 
00197 #ifdef CONFIG_RSBAC_ALLOW_DAC_DISABLE_FULL
00198 /* Boolean switch for disabling Linux DAC */
00199 int  rsbac_dac_disable = 0;
00200 
00201 #if defined(CONFIG_RSBAC_REG) || defined(CONFIG_RSBAC_REG_MAINT)
00202 EXPORT_SYMBOL(rsbac_dac_is_disabled);
00203 #endif
00204 int rsbac_dac_is_disabled(void)
00205   {
00206     return rsbac_dac_disable;
00207   }
00208 #endif
00209 
00210 /* Boolean switch for no syslog option*/
00211 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
00212 int  rsbac_nosyslog = 0;
00213 #endif
00214 
00215 /* Boolean switch for delayed init option*/
00216 #ifdef CONFIG_RSBAC_INIT_DELAY
00217 int  rsbac_no_delay_init = 0;
00218 kdev_t rsbac_delayed_root = RSBAC_MKDEV(0,0);
00219 #endif
00220 
00221 /* Array of Boolean debug switches for ADF */
00222 int  rsbac_debug_adf_default = 1;
00223 rsbac_log_entry_t  rsbac_log_levels[R_NONE+1];
00224 
00225 rsbac_boolean_t rsbac_debug_adf_dirty = FALSE;
00226 
00227 /* variables for rsbac_logging */
00228 #if defined(CONFIG_RSBAC_RMSG)
00229 #include <linux/poll.h>
00230 #include <linux/smp.h>
00231 #define RLOG_BUF_LEN (1 << 14)
00232 #define RLOG_BUF_MASK (RLOG_BUF_LEN-1)
00233 DECLARE_WAIT_QUEUE_HEAD(rlog_wait);
00234 static unsigned long log_end = 0;               /* Index into log_buf: most-recently-written-char + 1 */
00235 static char rlog_buf[RLOG_BUF_LEN];
00236 #define RLOG_BUF(idx) (rlog_buf[(idx) & RLOG_BUF_MASK])
00237 static unsigned long log_start = 0;
00238 static unsigned long logged_chars = 0;
00239 
00240 #if defined(CONFIG_RSBAC_LOG_REMOTE)
00241 #define REMOTE_RLOG_BUF_LEN (16384)
00242 #define REMOTE_RLOG_BUF_MASK (REMOTE_RLOG_BUF_LEN-1)
00243 static DECLARE_WAIT_QUEUE_HEAD(rsbaclogd_wait);
00244 #ifndef CONFIG_RSBAC_LOG_REMOTE_SYNC
00245 static struct timer_list rsbac_log_remote_timer;
00246 u_int rsbac_log_remote_interval = CONFIG_RSBAC_LOG_INTERVAL;
00247 #endif
00248 rsbac_pid_t rsbaclogd_pid=0;
00249 #define REMOTE_SEND_BUF_LEN 1024
00250 static unsigned long remote_log_end;
00251 static char remote_rlog_buf[REMOTE_RLOG_BUF_LEN];
00252 static unsigned long remote_log_start = 0;
00253 static unsigned long remote_logged_chars = 0;
00254 #define REMOTE_RLOG_BUF(idx) (remote_rlog_buf[(idx) & REMOTE_RLOG_BUF_MASK])
00255 static __u16 rsbac_log_remote_port = 0;
00256 static __u32 rsbac_log_remote_addr = 0;
00257 static char rsbac_log_remote_addr_string[RSBAC_MAXNAMELEN] = CONFIG_RSBAC_LOG_REMOTE_ADDR;
00258 #endif
00259 
00260 #endif
00261 
00262 void  rsbac_adf_log_switch(rsbac_adf_request_int_t request,
00263                            enum rsbac_target_t target,
00264                            rsbac_enum_t value)
00265   {
00266     if(   (request < R_NONE)
00267        && (target <= T_NONE)
00268        && (value <= LL_full)
00269       )
00270       {
00271         rsbac_log_levels[request][target] = value;
00272         if(log_levels_handle)
00273           rsbac_list_add(log_levels_handle, &request, rsbac_log_levels[request]);
00274       }
00275   };
00276 
00277 int rsbac_get_adf_log(rsbac_adf_request_int_t request,
00278                       enum rsbac_target_t target,
00279                       u_int * value_p)
00280   {
00281     if(   (request < R_NONE)
00282        && (target <= T_NONE)
00283       )
00284       {
00285         *value_p = rsbac_log_levels[request][target];
00286         return 0;
00287       }
00288     else
00289       return -RSBAC_EINVALIDVALUE;
00290   }
00291 
00292 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
00293 inline rsbac_boolean_t rsbac_parse_koptions(char * line)
00294   {
00295     /* RSBAC: suppress defaults? */
00296     if (!strcmp(line,"rsbac_no_defaults"))
00297       {
00298         rsbac_no_defaults = 1;
00299         return(TRUE);
00300       }
00301     #if defined(CONFIG_RSBAC_UM_EXCL)
00302     if (!strcmp(line,"rsbac_um_no_excl"))
00303       {
00304         rsbac_um_no_excl = 1;
00305         return(TRUE);
00306       }
00307     #endif
00308     #if defined(CONFIG_RSBAC_DAZ_CACHE)
00309     /* RSBAC: DAZ - set cache ttl */
00310     if (!strncmp(line,"rsbac_daz_ttl=",14))
00311       {
00312         char * p = line+14;
00313 
00314         if(*p)
00315           {
00316             rsbac_daz_set_ttl(simple_strtoul(p, NULL, 0));
00317           }
00318         return(TRUE);
00319       }
00320     #endif
00321     #if defined(CONFIG_RSBAC_AUTH) || defined(CONFIG_RSBAC_AUTH_MAINT)
00322     /* RSBAC: AUTH - set auth_may_setuid for /bin/login? */
00323     if (!strcmp(line,"rsbac_auth_enable_login"))
00324       {
00325         rsbac_auth_enable_login = 1;
00326         return(TRUE);
00327       }
00328     #if defined(CONFIG_RSBAC_AUTH_LEARN)
00329     if (!strcmp(line,"rsbac_auth_learn"))
00330       {
00331         rsbac_auth_learn = 1;
00332         return(TRUE);
00333       }
00334     #endif
00335     #endif
00336     #if defined(CONFIG_RSBAC_ACL_LEARN)
00337     /* Learn for all target types */
00338     if (!strcmp(line,"rsbac_acl_learn"))
00339       {
00340         rsbac_acl_learn_fd = 1;
00341         return(TRUE);
00342       }
00343     if (!strcmp(line,"rsbac_acl_learn_fd"))
00344       {
00345         rsbac_acl_learn_fd = 1;
00346         return(TRUE);
00347       }
00348     #endif
00349     #if defined(CONFIG_RSBAC_SOFTMODE)
00350     /* RSBAC: softmode on? */
00351     if (!strcmp(line,"rsbac_softmode_once"))
00352       {
00353         rsbac_softmode = 1;
00354         rsbac_softmode_prohibit = 1;
00355         return(TRUE);
00356       }
00357     if (!strcmp(line,"rsbac_softmode_never"))
00358       {
00359         rsbac_softmode_prohibit = 1;
00360         return(TRUE);
00361       }
00362     if (!strcmp(line,"rsbac_softmode"))
00363       {
00364         rsbac_softmode = 1;
00365         return(TRUE);
00366       }
00367     #if defined(CONFIG_RSBAC_SOFTMODE_IND)
00368     /* RSBAC: softmode on for a module? */
00369     if (!strcmp(line,"rsbac_softmode_mac"))
00370       {
00371         rsbac_ind_softmode[MAC] = 1;
00372         return(TRUE);
00373       }
00374     if (!strcmp(line,"rsbac_softmode_fc"))
00375       {
00376         rsbac_ind_softmode[FC] = 1;
00377         return(TRUE);
00378       }
00379     if (!strcmp(line,"rsbac_softmode_sim"))
00380       {
00381         rsbac_ind_softmode[SIM] = 1;
00382         return(TRUE);
00383       }
00384     if (!strcmp(line,"rsbac_softmode_pm"))
00385       {
00386         rsbac_ind_softmode[PM] = 1;
00387         return(TRUE);
00388       }
00389     if (!strcmp(line,"rsbac_softmode_daz"))
00390       {
00391         rsbac_ind_softmode[DAZ] = 1;
00392         return(TRUE);
00393       }
00394     if (!strcmp(line,"rsbac_softmode_ff"))
00395       {
00396         rsbac_ind_softmode[FF] = 1;
00397         return(TRUE);
00398       }
00399     if (!strcmp(line,"rsbac_softmode_rc"))
00400       {
00401         rsbac_ind_softmode[RC] = 1;
00402         return(TRUE);
00403       }
00404     if (!strcmp(line,"rsbac_softmode_auth"))
00405       {
00406         rsbac_ind_softmode[AUTH] = 1;
00407         return(TRUE);
00408       }
00409     if (!strcmp(line,"rsbac_softmode_reg"))
00410       {
00411         rsbac_ind_softmode[REG] = 1;
00412         return(TRUE);
00413       }
00414     if (!strcmp(line,"rsbac_softmode_acl"))
00415       {
00416         rsbac_ind_softmode[ACL] = 1;
00417         return(TRUE);
00418       }
00419     if (!strcmp(line,"rsbac_softmode_cap"))
00420       {
00421         rsbac_ind_softmode[CAP] = 1;
00422         return(TRUE);
00423       }
00424     if (!strcmp(line,"rsbac_softmode_jail"))
00425       {
00426         rsbac_ind_softmode[JAIL] = 1;
00427         return(TRUE);
00428       }
00429     if (!strcmp(line,"rsbac_softmode_res"))
00430       {
00431         rsbac_ind_softmode[RES] = 1;
00432         return(TRUE);
00433       }
00434     #endif
00435     #endif
00436     #if defined(CONFIG_RSBAC_CAP_PROC_HIDE)
00437     /* RSBAC: hide processes? */
00438     if (!strcmp(line,"rsbac_cap_process_hiding"))
00439       {
00440         rsbac_cap_process_hiding = 1;
00441         return(TRUE);
00442       }
00443     #endif
00444     #ifdef CONFIG_RSBAC_CAP_LOG_MISSING
00445     /* RSBAC: log missing caps? */
00446     if (!strcmp(line,"rsbac_cap_log_missing"))
00447       {
00448         rsbac_cap_log_missing = 1;
00449         return(TRUE);
00450       }
00451     #endif
00452     #if defined(CONFIG_RSBAC_FREEZE)
00453     /* RSBAC: freeze config? */
00454     if (!strcmp(line,"rsbac_freeze"))
00455       {
00456         rsbac_freeze = 1;
00457         return(TRUE);
00458       }
00459     #endif
00460     #ifdef CONFIG_RSBAC_ALLOW_DAC_DISABLE_FULL
00461     /* RSBAC: disable Linux DAC? */
00462     if (!strcmp(line,"rsbac_dac_disable"))
00463       {
00464         rsbac_dac_disable = 1;
00465         return(TRUE);
00466       }
00467     #endif
00468     #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
00469     if (   !strcmp(line,"rsbac_nosyslog")
00470         || !strcmp(line,"rsbac_no_syslog")
00471        )
00472       {
00473         rsbac_nosyslog = 1;
00474         return(TRUE);
00475       }
00476     #endif
00477     #if defined(CONFIG_RSBAC_LOG_REMOTE)
00478     /* Set remote address */
00479     if (   !strncmp(line,"rsbac_log_remote_addr=",22)
00480        )
00481       {
00482         char * p = line+22;
00483 
00484         if(*p)
00485           {
00486             strncpy(rsbac_log_remote_addr_string, p, RSBAC_MAXNAMELEN - 1);
00487             rsbac_log_remote_addr_string[RSBAC_MAXNAMELEN -1] = 0;
00488           }
00489         return(TRUE);
00490       }
00491     /* Set remote port */
00492     if (   !strncmp(line,"rsbac_log_remote_port=",22)
00493        )
00494       {
00495         char * p = line+22;
00496 
00497         if(*p)
00498           {
00499             rsbac_log_remote_port = htons(simple_strtoul(p, NULL, 0));
00500           }
00501         return(TRUE);
00502       }
00503     #endif
00504     #ifdef CONFIG_RSBAC_INIT_DELAY
00505     if (   !strcmp(line,"rsbac_delay_init")
00506        )
00507       {
00508         rsbac_no_delay_init = 0;
00509         return(TRUE);
00510       }
00511     if (   !strcmp(line,"rsbac_no_delay_init")
00512         || !strcmp(line,"rsbac_no_init_delay")
00513        )
00514       {
00515         rsbac_no_delay_init = 1;
00516         return(TRUE);
00517       }
00518     if (   !strncmp(line,"rsbac_delayed_root=",19)
00519        )
00520       {
00521         char * p = line+19;
00522         u_int major = 0;
00523         u_int minor = 0;
00524 
00525         if(*p)
00526           {
00527             major = simple_strtoul(p, NULL, 0);
00528             while((*p != ':') && (*p != '\0'))
00529               p++;
00530             if(*p)
00531               {
00532                 p++;
00533                 minor = simple_strtoul(p, NULL, 0);
00534               }
00535             rsbac_delayed_root = RSBAC_MKDEV(major,minor);
00536           }
00537         return(TRUE);
00538       }
00539     #endif
00540 
00541 #ifdef CONFIG_RSBAC_DEBUG
00542     #ifdef CONFIG_RSBAC_NET
00543     /* RSBAC: debug for all of net? */
00544     if (!strcmp(line,"rsbac_debug_net"))
00545       {
00546         rsbac_debug_ds_net = 1;
00547         rsbac_debug_aef_net = 1;
00548         rsbac_debug_adf_net = 1;
00549         return(TRUE);
00550       }
00551     /* RSBAC: debug for net data structures? */
00552     if (!strcmp(line,"rsbac_debug_ds_net"))
00553       {
00554         rsbac_debug_ds_net = 1;
00555         return(TRUE);
00556       }
00557     /* RSBAC: debug for net syscalls/AEF? */
00558     if (!strcmp(line,"rsbac_debug_aef_net"))
00559       {
00560         rsbac_debug_aef_net = 1;
00561         return(TRUE);
00562       }
00563     /* RSBAC: debug for net decisions/ADF? */
00564     if (!strcmp(line,"rsbac_debug_adf_net"))
00565       {
00566         rsbac_debug_adf_net = 1;
00567         return(TRUE);
00568       }
00569     #endif
00570 
00571     #if defined(CONFIG_RSBAC_MAC)
00572     /* RSBAC: debug for all of mac? */
00573     if (!strcmp(line,"rsbac_debug_mac"))
00574       {
00575         rsbac_debug_ds_mac = 1;
00576         rsbac_debug_aef_mac = 1;
00577         rsbac_debug_adf_mac = 1;
00578         return(TRUE);
00579       }
00580     /* RSBAC: debug for mac data structures? */
00581     if (!strcmp(line,"rsbac_debug_ds_mac"))
00582       {
00583         rsbac_debug_ds_mac = 1;
00584         return(TRUE);
00585       }
00586     /* RSBAC: debug for MAC-syscalls/AEF? */
00587     if (!strcmp(line,"rsbac_debug_aef_mac"))
00588       {
00589         rsbac_debug_aef_mac = 1;
00590         return(TRUE);
00591       }
00592     /* RSBAC: debug for MAC-decisions/ADF? */
00593     if (!strcmp(line,"rsbac_debug_adf_mac"))
00594       {
00595         rsbac_debug_adf_mac = 1;
00596         return(TRUE);
00597       }
00598     #endif
00599     #if defined(CONFIG_RSBAC_PM) || defined(CONFIG_RSBAC_PM_MAINT)
00600     /* RSBAC: debug for all of pm? */
00601     if (!strcmp(line,"rsbac_debug_pm"))
00602       {
00603         rsbac_debug_ds_pm = 1;
00604         rsbac_debug_aef_pm = 1;
00605         rsbac_debug_adf_pm = 1;
00606         return(TRUE);
00607       }
00608     /* RSBAC: debug for pm data structures? */
00609     if (!strcmp(line,"rsbac_debug_ds_pm"))
00610       {
00611         rsbac_debug_ds_pm = 1;
00612         return(TRUE);
00613       }
00614     /* RSBAC: debug for PM-syscalls/AEF? */
00615     if (!strcmp(line,"rsbac_debug_aef_pm"))
00616       {
00617         rsbac_debug_aef_pm = 1;
00618         return(TRUE);
00619       }
00620     /* RSBAC: debug for PM-decisions/ADF? */
00621     if (!strcmp(line,"rsbac_debug_adf_pm"))
00622       {
00623         rsbac_debug_adf_pm = 1;
00624         return(TRUE);
00625       }
00626     #endif
00627     #if defined(CONFIG_RSBAC_DAZ)
00628     /* RSBAC: debug for DAZ decisions/ADF? */
00629     if (   !strcmp(line,"rsbac_debug_adf_daz")
00630         || !strcmp(line,"rsbac_debug_daz")
00631        )
00632       {
00633         rsbac_debug_adf_daz = 1;
00634         return(TRUE);
00635       }
00636     #endif
00637     #if defined(CONFIG_RSBAC_RC) || defined(CONFIG_RSBAC_RC_MAINT)
00638     /* RSBAC: debug for all of rc? */
00639     if (!strcmp(line,"rsbac_debug_rc"))
00640       {
00641         rsbac_debug_ds_rc = 1;
00642         rsbac_debug_aef_rc = 1;
00643         rsbac_debug_adf_rc = 1;
00644         return(TRUE);
00645       }
00646     /* RSBAC: debug for rc data structures? */
00647     if (!strcmp(line,"rsbac_debug_ds_rc"))
00648       {
00649         rsbac_debug_ds_rc = 1;
00650         return(TRUE);
00651       }
00652     /* RSBAC: debug for RC-syscalls/AEF? */
00653     if (!strcmp(line,"rsbac_debug_aef_rc"))
00654       {
00655         rsbac_debug_aef_rc = 1;
00656         return(TRUE);
00657       }
00658     /* RSBAC: debug for RC-decisions/ADF? */
00659     if (!strcmp(line,"rsbac_debug_adf_rc"))
00660       {
00661         rsbac_debug_adf_rc = 1;
00662         return(TRUE);
00663       }
00664     #endif
00665     #if defined(CONFIG_RSBAC_AUTH) || defined(CONFIG_RSBAC_AUTH_MAINT)
00666     /* RSBAC: debug for all of auth? */
00667     if (!strcmp(line,"rsbac_debug_auth"))
00668       {
00669         rsbac_debug_ds_auth = 1;
00670         rsbac_debug_aef_auth = 1;
00671         rsbac_debug_adf_auth = 1;
00672         return(TRUE);
00673       }
00674     /* RSBAC: debug for auth data structures? */
00675     if (!strcmp(line,"rsbac_debug_ds_auth"))
00676       {
00677         rsbac_debug_ds_auth = 1;
00678         return(TRUE);
00679       }
00680     /* RSBAC: debug for AUTH-syscalls/AEF? */
00681     if (!strcmp(line,"rsbac_debug_aef_auth"))
00682       {
00683         rsbac_debug_aef_auth = 1;
00684         return(TRUE);
00685       }
00686     /* RSBAC: debug for AUTH-decisions/ADF? */
00687     if (!strcmp(line,"rsbac_debug_adf_auth"))
00688       {
00689         rsbac_debug_adf_auth = 1;
00690         return(TRUE);
00691       }
00692     #endif
00693     #if defined(CONFIG_RSBAC_REG) || defined(CONFIG_RSBAC_REG_MAINT)
00694     /* RSBAC: debug for all of reg? */
00695     if (!strcmp(line,"rsbac_debug_reg"))
00696       {
00697         rsbac_debug_reg = 1;
00698         return(TRUE);
00699       }
00700     #endif
00701     #if defined(CONFIG_RSBAC_ACL) || defined(CONFIG_RSBAC_ACL_MAINT)
00702     /* RSBAC: debug for all of acl? */
00703     if (!strcmp(line,"rsbac_debug_acl"))
00704       {
00705         rsbac_debug_ds_acl = 1;
00706         rsbac_debug_aef_acl = 1;
00707         rsbac_debug_adf_acl = 1;
00708         return(TRUE);
00709       }
00710     /* RSBAC: debug for ACL data structures? */
00711     if (!strcmp(line,"rsbac_debug_ds_acl"))
00712       {
00713         rsbac_debug_ds_acl = 1;
00714         return(TRUE);
00715       }
00716     /* RSBAC: debug for ACL-syscalls/AEF? */
00717     if (!strcmp(line,"rsbac_debug_aef_acl"))
00718       {
00719         rsbac_debug_aef_acl = 1;
00720         return(TRUE);
00721       }
00722     /* RSBAC: debug for ACL-decisions/ADF? */
00723     if (!strcmp(line,"rsbac_debug_adf_acl"))
00724       {
00725         rsbac_debug_adf_acl = 1;
00726         return(TRUE);
00727       }
00728     #endif
00729     #if defined(CONFIG_RSBAC_JAIL)
00730     /* RSBAC: debug for all of jail? */
00731     if (!strcmp(line,"rsbac_debug_jail"))
00732       {
00733         rsbac_debug_aef_jail = 1;
00734         rsbac_debug_adf_jail = 1;
00735         return(TRUE);
00736       }
00737     /* RSBAC: debug for JAIL-syscalls/AEF? */
00738     if (!strcmp(line,"rsbac_debug_aef_jail"))
00739       {
00740         rsbac_debug_aef_jail = 1;
00741         return(TRUE);
00742       }
00743     /* RSBAC: debug for JAIL-decisions/ADF? */
00744     if (!strcmp(line,"rsbac_debug_adf_jail"))
00745       {
00746         rsbac_debug_adf_jail = 1;
00747         return(TRUE);
00748       }
00749     #endif
00750     #if defined(CONFIG_RSBAC_PAX)
00751     /* RSBAC: debug for all of pax? */
00752     if (!strcmp(line,"rsbac_debug_pax"))
00753       {
00754         rsbac_debug_adf_pax = 1;
00755         return(TRUE);
00756       }
00757     /* RSBAC: debug for PAX-decisions/ADF? */
00758     if (!strcmp(line,"rsbac_debug_adf_pax"))
00759       {
00760         rsbac_debug_adf_pax = 1;
00761         return(TRUE);
00762       }
00763     #endif
00764     #if defined(CONFIG_RSBAC_UM)
00765     /* RSBAC: debug for all of um? */
00766     if (!strcmp(line,"rsbac_debug_um"))
00767       {
00768         rsbac_debug_ds_um = 1;
00769         rsbac_debug_aef_um = 1;
00770         rsbac_debug_adf_um = 1;
00771         return(TRUE);
00772       }
00773     /* RSBAC: debug for um data structures? */
00774     if (!strcmp(line,"rsbac_debug_ds_um"))
00775       {
00776         rsbac_debug_ds_um = 1;
00777         return(TRUE);
00778       }
00779     /* RSBAC: debug for UM-syscalls/AEF? */
00780     if (!strcmp(line,"rsbac_debug_aef_um"))
00781       {
00782         rsbac_debug_aef_um = 1;
00783         return(TRUE);
00784       }
00785     /* RSBAC: debug for UM-decisions/ADF? */
00786     if (!strcmp(line,"rsbac_debug_adf_um"))
00787       {
00788         rsbac_debug_adf_um = 1;
00789         return(TRUE);
00790       }
00791     #endif
00792     #if defined(CONFIG_RSBAC_AUTO_WRITE) && (CONFIG_RSBAC_AUTO_WRITE > 0)
00793     /* RSBAC: debug for auto-write? */
00794     if (!strcmp(line,"rsbac_debug_auto"))
00795       {
00796         rsbac_debug_auto = 1;
00797         return(TRUE);
00798       }
00799     #endif
00800     /* RSBAC: debug for all? */
00801     if (!strcmp(line,"rsbac_debug_all"))
00802       {
00803         rsbac_debug_ds = 1;
00804         rsbac_debug_write = 1;
00805         rsbac_debug_aef = 1;
00806         rsbac_debug_adf_default = 2;
00807         #if defined(CONFIG_RSBAC_MAC)
00808         rsbac_debug_ds_mac = 1;
00809         rsbac_debug_aef_mac = 1;
00810         rsbac_debug_adf_mac = 1;
00811         #endif
00812         #if defined(CONFIG_RSBAC_PM)
00813         rsbac_debug_ds_pm = 1;
00814         rsbac_debug_aef_pm = 1;
00815         rsbac_debug_adf_pm = 1;
00816         #endif
00817         #if defined(CONFIG_RSBAC_DAZ)
00818         rsbac_debug_adf_daz = 1;
00819         #endif
00820         #if defined(CONFIG_RSBAC_RC)
00821         rsbac_debug_ds_rc = 1;
00822         rsbac_debug_aef_rc = 1;
00823         rsbac_debug_adf_rc = 1;
00824         #endif
00825         #if defined(CONFIG_RSBAC_AUTH)
00826         rsbac_debug_ds_auth = 1;
00827         rsbac_debug_aef_auth = 1;
00828         rsbac_debug_adf_auth = 1;
00829         #endif
00830         #if defined(CONFIG_RSBAC_ACL)
00831         rsbac_debug_ds_acl = 1;
00832         rsbac_debug_aef_acl = 1;
00833         rsbac_debug_adf_acl = 1;
00834         #endif
00835         #if defined(CONFIG_RSBAC_JAIL)
00836         rsbac_debug_aef_jail = 1;
00837         rsbac_debug_adf_jail = 1;
00838         #endif
00839         #if defined(CONFIG_RSBAC_PAX)
00840         rsbac_debug_adf_pax = 1;
00841         #endif
00842         #if defined(CONFIG_RSBAC_UM)
00843         rsbac_debug_ds_um = 1;
00844         rsbac_debug_aef_um = 1;
00845         rsbac_debug_adf_um = 1;
00846         #endif
00847         #if defined(CONFIG_RSBAC_AUTO_WRITE) && (CONFIG_RSBAC_AUTO_WRITE > 0)
00848         rsbac_debug_auto = 1;
00849         #endif
00850 
00851         return(TRUE);
00852       }
00853     /* RSBAC: debug_lists */
00854     if (!strcmp(line,"rsbac_debug_lists"))
00855       {
00856         rsbac_debug_lists = 1;
00857         return(TRUE);
00858       }
00859     /* RSBAC: debug_stack */
00860     if (!strcmp(line,"rsbac_debug_stack"))
00861       {
00862         rsbac_debug_stack = 1;
00863         return(TRUE);
00864       }
00865     /* RSBAC: debug for data structures? */
00866     if (!strcmp(line,"rsbac_debug_ds"))
00867       {
00868         rsbac_debug_ds = 1;
00869         return(TRUE);
00870       }
00871     /* RSBAC: debug for writing of data structures? */
00872     if (!strcmp(line,"rsbac_debug_write"))
00873       {
00874         rsbac_debug_write = 1;
00875         return(TRUE);
00876       }
00877     /* RSBAC: debug for AEF? */
00878     if (!strcmp(line,"rsbac_debug_aef"))
00879       {
00880         rsbac_debug_aef = 1;
00881         return(TRUE);
00882       }
00883     /* RSBAC: debug_no_write for ds */
00884     if (!strcmp(line,"rsbac_debug_no_write"))
00885       {
00886         rsbac_debug_no_write = 1;
00887         return(TRUE);
00888       }
00889     /* RSBAC: debug default 0 for ADF */
00890     if (!strcmp(line,"rsbac_debug_no_adf"))
00891       {
00892         rsbac_debug_adf_default = 0;
00893         return(TRUE);
00894       }
00895     /* RSBAC: debug default 1 for ADF, log denied requests? (default value) */
00896     if (!strcmp(line,"rsbac_debug_adf"))
00897       {
00898         rsbac_debug_adf_default = 1;
00899         return(TRUE);
00900       }
00901     /* RSBAC: debug: log all for ADF, even GRANTED and DO_NOT_CARE? */
00902     if (!strcmp(line,"rsbac_debug_adf_all"))
00903       {
00904         rsbac_debug_adf_default = 2;
00905         return(TRUE);
00906       }
00907 #endif /* DEBUG */
00908 
00909     /* nothing matched */
00910     return(FALSE);
00911   }
00912 
00913 #else /* KERNEL_VERSION >= 2.6.0 */
00914 
00915 //  module_param(rsbac_no_defaults, bool, S_IRUGO);
00916   static int R_INIT no_defaults_setup(char *line)
00917     {
00918       rsbac_no_defaults = 1;
00919       return 1;
00920     }
00921 __setup("rsbac_no_defaults", no_defaults_setup);
00922 
00923   #if defined(CONFIG_RSBAC_UM_EXCL)
00924   static int R_INIT um_no_excl_setup(char *line)
00925     {
00926       rsbac_um_no_excl = 1;
00927       return 1;
00928     }
00929   __setup("rsbac_um_no_excl", um_no_excl_setup);
00930   #endif
00931   #if defined(CONFIG_RSBAC_DAZ_CACHE)
00932   /* RSBAC: DAZ - set cache ttl */
00933 //    module_param(rsbac_daz_ttl,
00934 //                 int,
00935 //                 S_IRUGO);
00936   static int R_INIT daz_ttl_setup(char *line)
00937     {
00938       rsbac_daz_set_ttl(simple_strtoul(line, NULL, 0));
00939       return 1;
00940     }
00941   __setup("rsbac_daz_ttl=", daz_ttl_setup);
00942   #endif
00943   #if defined(CONFIG_RSBAC_AUTH) || defined(CONFIG_RSBAC_AUTH_MAINT)
00944   /* RSBAC: AUTH - set auth_may_setuid for /bin/login? */
00945 //    module_param(rsbac_auth_enable_login, int, S_IRUGO);
00946   static int R_INIT auth_enable_login_setup(char *line)
00947     {
00948       rsbac_auth_enable_login = 1;
00949       return 1;
00950     }
00951   __setup("rsbac_auth_enable_login", auth_enable_login_setup);
00952     #if defined(CONFIG_RSBAC_AUTH_LEARN)
00953   static int R_INIT auth_learn_setup(char *line)
00954     {
00955       rsbac_auth_learn = 1;
00956       return 1;
00957     }
00958   __setup("rsbac_auth_learn", auth_learn_setup);
00959     #endif
00960   #endif
00961   #if defined(CONFIG_RSBAC_ACL_LEARN)
00962   /* learn all target types */
00963   static int R_INIT acl_learn_setup(char *line)
00964     {
00965       rsbac_acl_learn_fd = 1;
00966       return 1;
00967     }
00968   __setup("rsbac_acl_learn", acl_learn_setup);
00969   static int R_INIT acl_learn_fd_setup(char *line)
00970     {
00971       rsbac_acl_learn_fd = 1;
00972       return 1;
00973     }
00974   __setup("rsbac_acl_learn_fd", acl_learn_fd_setup);
00975   #endif
00976 
00977   #if defined(CONFIG_RSBAC_SOFTMODE)
00978   /* RSBAC: softmode on? */
00979 //    module_param(rsbac_softmode_once, bool, S_IRUGO);
00980   static int R_INIT softmode_once_setup(char *line)
00981     {
00982       rsbac_softmode = 1;
00983       rsbac_softmode_prohibit = 1;
00984       return 1;
00985     }
00986   __setup("rsbac_softmode_once", softmode_once_setup);
00987 //    module_param(rsbac_softmode_never, bool, S_IRUGO);
00988   static int R_INIT softmode_never_setup(char *line)
00989     {
00990       rsbac_softmode_prohibit = 1;
00991       return 1;
00992     }
00993   __setup("rsbac_softmode_never", softmode_never_setup);
00994 //    module_param(rsbac_softmode, bool, S_IRUGO);
00995   static int R_INIT softmode_setup(char *line)
00996     {
00997       rsbac_softmode = 1;
00998       return 1;
00999     }
01000   __setup("rsbac_softmode", softmode_setup);
01001 
01002     #if defined(CONFIG_RSBAC_SOFTMODE_IND)
01003     /* RSBAC: softmode on for a module? */
01004 //    module_param_named(rsbac_softmode_mac, rsbac_ind_softmode[MAC], bool, S_IRUGO);
01005   static int R_INIT softmode_mac_setup(char *line)
01006     {
01007       rsbac_ind_softmode[MAC] = 1;
01008       return 1;
01009     }
01010   __setup("rsbac_softmode_mac", softmode_mac_setup);
01011 //    module_param_named(rsbac_softmode_fc, rsbac_ind_softmode[FC], bool, S_IRUGO);
01012   static int R_INIT softmode_fc_setup(char *line)
01013     {
01014       rsbac_ind_softmode[FC] = 1;
01015       return 1;
01016     }
01017   __setup("rsbac_softmode_fc", softmode_fc_setup);
01018 //    module_param_named(rsbac_softmode_sim, rsbac_ind_softmode[SIM], bool, S_IRUGO);
01019   static int R_INIT softmode_sim_setup(char *line)
01020     {
01021       rsbac_ind_softmode[SIM] = 1;
01022       return 1;
01023     }
01024   __setup("rsbac_softmode_sim", softmode_sim_setup);
01025 //    module_param_named(rsbac_softmode_pm, rsbac_ind_softmode[PM], bool, S_IRUGO);
01026   static int R_INIT softmode_pm_setup(char *line)
01027     {
01028       rsbac_ind_softmode[PM] = 1;
01029       return 1;
01030     }
01031   __setup("rsbac_softmode_pm", softmode_pm_setup);
01032 //    module_param_named(rsbac_softmode_daz, rsbac_ind_softmode[DAZ], bool, S_IRUGO);
01033   static int R_INIT softmode_daz_setup(char *line)
01034     {
01035       rsbac_ind_softmode[DAZ] = 1;
01036       return 1;
01037     }
01038   __setup("rsbac_softmode_daz", softmode_daz_setup);
01039 //    module_param_named(rsbac_softmode_ff, rsbac_ind_softmode[FF], bool, S_IRUGO);
01040   static int R_INIT softmode_ff_setup(char *line)
01041     {
01042       rsbac_ind_softmode[FF] = 1;
01043       return 1;
01044     }
01045   __setup("rsbac_softmode_ff", softmode_ff_setup);
01046 //    module_param_named(rsbac_softmode_rc, rsbac_ind_softmode[RC], bool, S_IRUGO);
01047   static int R_INIT softmode_rc_setup(char *line)
01048     {
01049       rsbac_ind_softmode[RC] = 1;
01050       return 1;
01051     }
01052   __setup("rsbac_softmode_rc", softmode_rc_setup);
01053 //    module_param_named(rsbac_softmode_auth, rsbac_ind_softmode[AUTH], bool, S_IRUGO);
01054   static int R_INIT softmode_auth_setup(char *line)
01055     {
01056       rsbac_ind_softmode[AUTH] = 1;
01057       return 1;
01058     }
01059   __setup("rsbac_softmode_auth", softmode_auth_setup);
01060 //    module_param_named(rsbac_softmode_reg, rsbac_ind_softmode[REG], bool, S_IRUGO);
01061   static int R_INIT softmode_reg_setup(char *line)
01062     {
01063       rsbac_ind_softmode[REG] = 1;
01064       return 1;
01065     }
01066   __setup("rsbac_softmode_reg", softmode_reg_setup);
01067 //    module_param_named(rsbac_softmode_acl, rsbac_ind_softmode[ACL], bool, S_IRUGO);
01068   static int R_INIT softmode_acl_setup(char *line)
01069     {
01070       rsbac_ind_softmode[ACL] = 1;
01071       return 1;
01072     }
01073   __setup("rsbac_softmode_acl", softmode_acl_setup);
01074 //    module_param_named(rsbac_softmode_cap, rsbac_ind_softmode[CAP], bool, S_IRUGO);
01075   static int R_INIT softmode_cap_setup(char *line)
01076     {
01077       rsbac_ind_softmode[CAP] = 1;
01078       return 1;
01079     }
01080   __setup("rsbac_softmode_cap", softmode_cap_setup);
01081 //    module_param_named(rsbac_softmode_jail, rsbac_ind_softmode[JAIL], bool, S_IRUGO);
01082   static int R_INIT softmode_jail_setup(char *line)
01083     {
01084       rsbac_ind_softmode[JAIL] = 1;
01085       return 1;
01086     }
01087   __setup("rsbac_softmode_jail", softmode_jail_setup);
01088 //    module_param_named(rsbac_softmode_res, rsbac_ind_softmode[RES], bool, S_IRUGO);
01089   static int R_INIT softmode_res_setup(char *line)
01090     {
01091       rsbac_ind_softmode[RES] = 1;
01092       return 1;
01093     }
01094   __setup("rsbac_softmode_res", softmode_res_setup);
01095     #endif
01096     #endif
01097 
01098     #if defined(CONFIG_RSBAC_CAP_PROC_HIDE)
01099     /* RSBAC: hide processes? */
01100 //    module_param(rsbac_cap_process_hiding, bool, S_IRUGO);
01101   static int R_INIT cap_process_hiding_setup(char *line)
01102     {
01103       rsbac_cap_process_hiding = 1;
01104       return 1;
01105     }
01106   __setup("rsbac_cap_process_hiding", cap_process_hiding_setup);
01107     #endif
01108     #ifdef CONFIG_RSBAC_CAP_LOG_MISSING
01109     /* RSBAC: log missing caps? */
01110 //    module_param(rsbac_cap_log_missing, bool, S_IRUGO);
01111   static int R_INIT cap_log_missing_setup(char *line)
01112     {
01113       rsbac_cap_log_missing = 1;
01114       return 1;
01115     }
01116   __setup("rsbac_cap_log_missing", cap_log_missing_setup);
01117     #endif
01118     #if defined(CONFIG_RSBAC_FREEZE)
01119     /* RSBAC: freeze config? */
01120 //    module_param(rsbac_freeze, bool, S_IRUGO);
01121   static int R_INIT freeze_setup(char *line)
01122     {
01123       rsbac_freeze = 1;
01124       return 1;
01125     }
01126   __setup("rsbac_freeze", freeze_setup);
01127     #endif
01128     #ifdef CONFIG_RSBAC_ALLOW_DAC_DISABLE_FULL
01129     /* RSBAC: disable Linux DAC? */
01130 //    module_param(rsbac_dac_disable, bool, S_IRUGO);
01131   static int R_INIT dac_disable_setup(char *line)
01132     {
01133       rsbac_dac_disable = 1;
01134       return 1;
01135     }
01136   __setup("rsbac_dac_disable", dac_disable_setup);
01137     #endif
01138     #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
01139 //    module_param(rsbac_nosyslog, bool, S_IRUGO);
01140   static int R_INIT nosyslog_setup(char *line)
01141     {
01142       rsbac_nosyslog = 1;
01143       return 1;
01144     }
01145   __setup("rsbac_nosyslog", nosyslog_setup);
01146 //    module_param_named(rsbac_no_syslog, rsbac_nosyslog, bool, S_IRUGO);
01147   static int R_INIT no_syslog_setup(char *line)
01148     {
01149       rsbac_nosyslog = 1;
01150       return 1;
01151     }
01152   __setup("rsbac_no_syslog", no_syslog_setup);
01153     #endif
01154     #if defined(CONFIG_RSBAC_LOG_REMOTE)
01155 //    module_param_string(rsbac_log_remote_addr,
01156 //                        rsbac_log_remote_addr_string,
01157 //                        sizeof(rsbac_log_remote_addr_string),
01158 //                        S_IRUGO);
01159   static int R_INIT log_remote_addr_setup(char *line)
01160     {
01161       strncpy(rsbac_log_remote_addr_string, line, RSBAC_MAXNAMELEN - 1);
01162       rsbac_log_remote_addr_string[RSBAC_MAXNAMELEN - 1]=0;
01163       return 1;
01164     }
01165   __setup("rsbac_log_remote_addr=", log_remote_addr_setup);
01166 //    module_param(rsbac_log_remote_port,
01167 //                 int,
01168 //                 S_IRUGO);
01169   static int R_INIT log_remote_port_setup(char *line)
01170     {
01171       __u16 tmp_port;
01172 
01173       tmp_port = simple_strtoul(line, NULL, 0);
01174       rsbac_log_remote_port = htons(tmp_port);
01175       return 1;
01176     }
01177   __setup("rsbac_log_remote_port=", log_remote_port_setup);
01178     #endif
01179     #ifdef CONFIG_RSBAC_INIT_DELAY
01180 //    module_param(rsbac_no_delay_init, bool, S_IRUGO);
01181   static int R_INIT no_delay_init_setup(char *line)
01182     {
01183       rsbac_no_delay_init = 1;
01184       return 1;
01185     }
01186   __setup("rsbac_no_delay_init", no_delay_init_setup);
01187 //    module_param_named(rsbac_no_init_delay, rsbac_no_delay_init, bool, S_IRUGO);
01188   static int R_INIT no_init_delay_setup(char *line)
01189     {
01190       rsbac_no_delay_init = 1;
01191       return 1;
01192     }
01193   __setup("rsbac_no_init_delay", no_init_delay_setup);
01194     char rsbac_delayed_root_str[20] = "";
01195 //    module_param_string(rsbac_delayed_root,
01196 //                        rsbac_delayed_root_str,
01197 //                        sizeof(rsbac_delayed_root_str),
01198 //                        S_IRUGO);
01199   static int R_INIT delayed_root_setup(char *line)
01200     {
01201       strncpy(rsbac_delayed_root_str, line, 19);
01202       rsbac_delayed_root_str[19]=0;
01203       return 1;
01204     }
01205   __setup("rsbac_delayed_root=", delayed_root_setup);
01206     #endif
01207 
01208 #ifdef CONFIG_RSBAC_DEBUG
01209     #ifdef CONFIG_RSBAC_NET
01210     /* RSBAC: debug for net data structures? */
01211 //    module_param(rsbac_debug_ds_net, bool, S_IRUGO);
01212   static int R_INIT debug_ds_net_setup(char *line)
01213     {
01214       rsbac_debug_ds_net = 1;
01215       return 1;
01216     }
01217   __setup("rsbac_debug_ds_net", debug_ds_net_setup);
01218     /* RSBAC: debug for net syscalls/AEF? */
01219 //    module_param(rsbac_debug_aef_net, bool, S_IRUGO);
01220   static int R_INIT debug_aef_net_setup(char *line)
01221     {
01222       rsbac_debug_aef_net = 1;
01223       return 1;
01224     }
01225   __setup("rsbac_debug_aef_net", debug_aef_net_setup);
01226     /* RSBAC: debug for net decisions/ADF? */
01227 //    module_param(rsbac_debug_adf_net, bool, S_IRUGO);
01228   static int R_INIT debug_adf_net_setup(char *line)
01229     {
01230       rsbac_debug_adf_net = 1;
01231       return 1;
01232     }
01233   __setup("rsbac_debug_adf_net", debug_adf_net_setup);
01234     #endif
01235 
01236     #if defined(CONFIG_RSBAC_MAC)
01237 //    module_param(rsbac_debug_ds_mac, bool, S_IRUGO);
01238   static int R_INIT debug_ds_mac_setup(char *line)
01239     {
01240       rsbac_debug_ds_mac = 1;
01241       return 1;
01242     }
01243   __setup("rsbac_debug_ds_mac", debug_ds_mac_setup);
01244 //    module_param(rsbac_debug_aef_mac, bool, S_IRUGO);
01245   static int R_INIT debug_aef_mac_setup(char *line)
01246     {
01247       rsbac_debug_aef_mac = 1;
01248       return 1;
01249     }
01250   __setup("rsbac_debug_aef_mac", debug_aef_mac_setup);
01251 //    module_param(rsbac_debug_adf_mac, bool, S_IRUGO);
01252   static int R_INIT debug_adf_mac_setup(char *line)
01253     {
01254       rsbac_debug_adf_mac = 1;
01255       return 1;
01256     }
01257   __setup("rsbac_debug_adf_mac", debug_adf_mac_setup);
01258     #endif
01259     #if defined(CONFIG_RSBAC_PM) || defined(CONFIG_RSBAC_PM_MAINT)
01260 //    module_param(rsbac_debug_ds_pm, bool, S_IRUGO);
01261   static int R_INIT debug_ds_pm_setup(char *line)
01262     {
01263       rsbac_debug_ds_pm = 1;
01264       return 1;
01265     }
01266   __setup("rsbac_debug_ds_pm", debug_ds_pm_setup);
01267 //    module_param(rsbac_debug_aef_pm, bool, S_IRUGO);
01268   static int R_INIT debug_aef_pm_setup(char *line)
01269     {
01270       rsbac_debug_aef_pm = 1;
01271       return 1;
01272     }
01273   __setup("rsbac_debug_aef_pm", debug_aef_pm_setup);
01274 //    module_param(rsbac_debug_adf_pm, bool, S_IRUGO);
01275   static int R_INIT debug_adf_pm_setup(char *line)
01276     {
01277       rsbac_debug_adf_pm = 1;
01278       return 1;
01279     }
01280   __setup("rsbac_debug_adf_pm", debug_adf_pm_setup);
01281     #endif
01282     #if defined(CONFIG_RSBAC_DAZ)
01283 //    module_param(rsbac_debug_adf_daz, bool, S_IRUGO);
01284   static int R_INIT debug_adf_daz_setup(char *line)
01285     {
01286       rsbac_debug_adf_daz = 1;
01287       return 1;
01288     }
01289   __setup("rsbac_debug_adf_daz", debug_adf_daz_setup);
01290     #endif
01291     #if defined(CONFIG_RSBAC_RC) || defined(CONFIG_RSBAC_RC_MAINT)
01292 //    module_param(rsbac_debug_ds_rc, bool, S_IRUGO);
01293   static int R_INIT debug_ds_rc_setup(char *line)
01294     {
01295       rsbac_debug_ds_rc = 1;
01296       return 1;
01297     }
01298   __setup("rsbac_debug_ds_rc", debug_ds_rc_setup);
01299 //    module_param(rsbac_debug_aef_rc, bool, S_IRUGO);
01300   static int R_INIT debug_aef_rc_setup(char *line)
01301     {
01302       rsbac_debug_aef_rc = 1;
01303       return 1;
01304     }
01305   __setup("rsbac_debug_aef_rc", debug_aef_rc_setup);
01306 //    module_param(rsbac_debug_adf_rc, bool, S_IRUGO);
01307   static int R_INIT debug_adf_rc_setup(char *line)
01308     {
01309       rsbac_debug_adf_rc = 1;
01310       return 1;
01311     }
01312   __setup("rsbac_debug_adf_rc", debug_adf_rc_setup);
01313     #endif
01314     #if defined(CONFIG_RSBAC_AUTH) || defined(CONFIG_RSBAC_AUTH_MAINT)
01315 //    module_param(rsbac_debug_ds_auth, bool, S_IRUGO);
01316   static int R_INIT debug_ds_auth_setup(char *line)
01317     {
01318       rsbac_debug_ds_auth = 1;
01319       return 1;
01320     }
01321   __setup("rsbac_debug_ds_auth", debug_ds_auth_setup);
01322 //    module_param(rsbac_debug_aef_auth, bool, S_IRUGO);
01323   static int R_INIT debug_aef_auth_setup(char *line)
01324     {
01325       rsbac_debug_aef_auth = 1;
01326       return 1;
01327     }
01328   __setup("rsbac_debug_aef_auth", debug_aef_auth_setup);
01329 //    module_param(rsbac_debug_adf_auth, bool, S_IRUGO);
01330   static int R_INIT debug_adf_auth_setup(char *line)
01331     {
01332       rsbac_debug_adf_auth = 1;
01333       return 1;
01334     }
01335   __setup("rsbac_debug_adf_auth", debug_adf_auth_setup);
01336     #endif
01337     #if defined(CONFIG_RSBAC_REG) || defined(CONFIG_RSBAC_REG_MAINT)
01338 //    module_param(rsbac_debug_reg, bool, S_IRUGO);
01339   static int R_INIT debug_reg_setup(char *line)
01340     {
01341       rsbac_debug_reg = 1;
01342       return 1;
01343     }
01344   __setup("rsbac_debug_reg", debug_reg_setup);
01345     #endif
01346     #if defined(CONFIG_RSBAC_ACL) || defined(CONFIG_RSBAC_ACL_MAINT)
01347 //    module_param(rsbac_debug_ds_acl, bool, S_IRUGO);
01348   static int R_INIT debug_ds_acl_setup(char *line)
01349     {
01350       rsbac_debug_ds_acl = 1;
01351       return 1;
01352     }
01353   __setup("rsbac_debug_ds_acl", debug_ds_acl_setup);
01354 //    module_param(rsbac_debug_aef_acl, bool, S_IRUGO);
01355   static int R_INIT debug_aef_acl_setup(char *line)
01356     {
01357       rsbac_debug_aef_acl = 1;
01358       return 1;
01359     }
01360   __setup("rsbac_debug_aef_acl", debug_aef_acl_setup);
01361 //    module_param(rsbac_debug_adf_acl, bool, S_IRUGO);
01362   static int R_INIT debug_adf_acl_setup(char *line)
01363     {
01364       rsbac_debug_adf_acl = 1;
01365       return 1;
01366     }
01367   __setup("rsbac_debug_adf_acl", debug_adf_acl_setup);
01368     #endif
01369     #if defined(CONFIG_RSBAC_JAIL)
01370 //    module_param(rsbac_debug_aef_jail, bool, S_IRUGO);
01371   static int R_INIT debug_aef_jail_setup(char *line)
01372     {
01373       rsbac_debug_aef_jail = 1;
01374       return 1;
01375     }
01376   __setup("rsbac_debug_aef_jail", debug_aef_jail_setup);
01377 //    module_param(rsbac_debug_adf_jail, bool, S_IRUGO);
01378   static int R_INIT debug_adf_jail_setup(char *line)
01379     {
01380       rsbac_debug_adf_jail = 1;
01381       return 1;
01382     }
01383   __setup("rsbac_debug_adf_jail", debug_adf_jail_setup);
01384     #endif
01385     #if defined(CONFIG_RSBAC_PAX)
01386 //    module_param(rsbac_debug_adf_pax, bool, S_IRUGO);
01387   static int R_INIT debug_adf_pax_setup(char *line)
01388     {
01389       rsbac_debug_adf_pax = 1;
01390       return 1;
01391     }
01392   __setup("rsbac_debug_adf_pax", debug_adf_pax_setup);
01393     #endif
01394     #if defined(CONFIG_RSBAC_UM)
01395 //    module_param(rsbac_debug_ds_um, bool, S_IRUGO);
01396   static int R_INIT debug_ds_um_setup(char *line)
01397     {
01398       rsbac_debug_ds_um = 1;
01399       return 1;
01400     }
01401   __setup("rsbac_debug_ds_um", debug_ds_um_setup);
01402 //    module_param(rsbac_debug_aef_um, bool, S_IRUGO);
01403   static int R_INIT debug_aef_um_setup(char *line)
01404     {
01405       rsbac_debug_aef_um = 1;
01406       return 1;
01407     }
01408   __setup("rsbac_debug_aef_um", debug_aef_um_setup);
01409 //    module_param(rsbac_debug_adf_um, bool, S_IRUGO);
01410   static int R_INIT debug_adf_um_setup(char *line)
01411     {
01412       rsbac_debug_adf_um = 1;
01413       return 1;
01414     }
01415   __setup("rsbac_debug_adf_um", debug_adf_um_setup);
01416     #endif
01417     #if defined(CONFIG_RSBAC_AUTO_WRITE) && (CONFIG_RSBAC_AUTO_WRITE > 0)
01418 //    module_param(rsbac_debug_auto, bool, S_IRUGO);
01419   static int R_INIT debug_auto_setup(char *line)
01420     {
01421       rsbac_debug_auto = 1;
01422       return 1;
01423     }
01424   __setup("rsbac_debug_auto", debug_auto_setup);
01425     #endif
01426     /* RSBAC: debug_lists */
01427 //    module_param(rsbac_debug_lists, bool, S_IRUGO);
01428   static int R_INIT debug_lists_setup(char *line)
01429     {
01430       rsbac_debug_lists = 1;
01431       return 1;
01432     }
01433   __setup("rsbac_debug_lists", debug_lists_setup);
01434     /* RSBAC: debug_stack */
01435 //    module_param(rsbac_debug_stack, bool, S_IRUGO);
01436   static int R_INIT debug_stack_setup(char *line)
01437     {
01438       rsbac_debug_stack = 1;
01439       return 1;
01440     }
01441   __setup("rsbac_debug_stack", debug_stack_setup);
01442     /* RSBAC: debug for data structures? */
01443 //    module_param(rsbac_debug_ds, bool, S_IRUGO);
01444   static int R_INIT debug_ds_setup(char *line)
01445     {
01446       rsbac_debug_ds = 1;
01447       return 1;
01448     }
01449   __setup("rsbac_debug_ds", debug_ds_setup);
01450     /* RSBAC: debug for writing of data structures? */
01451 //    module_param(rsbac_debug_write, bool, S_IRUGO);
01452   static int R_INIT debug_write_setup(char *line)
01453     {
01454       rsbac_debug_write = 1;
01455       return 1;
01456     }
01457   __setup("rsbac_debug_write", debug_write_setup);
01458     /* RSBAC: debug for AEF? */
01459 //    module_param(rsbac_debug_aef, bool, S_IRUGO);
01460   static int R_INIT debug_aef_setup(char *line)
01461     {
01462       rsbac_debug_aef = 1;
01463       return 1;
01464     }
01465   __setup("rsbac_debug_aef", debug_aef_setup);
01466     /* RSBAC: debug_no_write for ds */
01467 //    module_param(rsbac_debug_no_write, bool, S_IRUGO);
01468   static int R_INIT debug_no_write_setup(char *line)
01469     {
01470       rsbac_debug_no_write = 1;
01471       return 1;
01472     }
01473   __setup("rsbac_debug_no_write", debug_no_write_setup);
01474     /* RSBAC: debug default for ADF */
01475 //    module_param(rsbac_debug_adf_default, int, S_IRUGO);
01476   static int R_INIT debug_adf_default_setup(char *line)
01477     {
01478       rsbac_debug_adf_default = 1;
01479       return 1;
01480     }
01481   __setup("rsbac_debug_adf_default", debug_adf_default_setup);
01482 #endif /* DEBUG */
01483 
01484 #endif /* KERNEL_VERSION < or >= 2.6.0 */
01485 
01486 #if defined(CONFIG_RSBAC_RMSG)
01487 
01488 static spinlock_t rsbac_log_lock = SPIN_LOCK_UNLOCKED;
01489 
01490 #if defined(CONFIG_RSBAC_LOG_REMOTE)
01491 static spinlock_t rsbac_log_remote_lock = SPIN_LOCK_UNLOCKED;
01492 #endif
01493 
01494 /*
01495  * Commands to do_syslog:
01496  *
01497  *      0 -- Close the log.  Currently a NOP.
01498  *      1 -- Open the log. Currently a NOP.
01499  *      2 -- Read from the log.
01500  *      3 -- Read all messages remaining in the ring buffer.
01501  *      4 -- Read and clear all messages remaining in the ring buffer
01502  *      5 -- Clear ring buffer.
01503  *      9 -- Return number of unread characters in the log buffer
01504  */
01505 int rsbac_log(int type, char * buf, int len)
01506 {
01507         unsigned long i, j, limit, count;
01508         int do_clear = 0;
01509         char c;
01510         int error = 0;
01511 
01512         union rsbac_target_id_t       rsbac_target_id;
01513         union rsbac_attribute_value_t rsbac_attribute_value;
01514 
01515         /* RSBAC */
01516         rsbac_target_id.scd = ST_rsbaclog;
01517         rsbac_attribute_value.dummy = 0;
01518         if ((type == 4) || (type == 5))
01519           {
01520 #ifdef CONFIG_RSBAC_DEBUG
01521             if (rsbac_debug_aef)
01522               {
01523 #ifdef CONFIG_RSBAC_RMSG
01524                 rsbac_printk(KERN_DEBUG "rsbac_log(): function %u, calling ADF for MODIFY_SYSTEM_DATA\n", type);
01525 #endif
01526 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
01527                 if (!rsbac_nosyslog)
01528 #endif
01529                 printk(KERN_DEBUG "rsbac_log(): function %u, calling ADF for MODIFY_SYSTEM_DATA\n", type);
01530               }
01531 #endif
01532             if (!rsbac_adf_request(R_MODIFY_SYSTEM_DATA,
01533                                    current->pid,
01534                                    T_SCD,
01535                                    rsbac_target_id,
01536                                    A_none,
01537                                    rsbac_attribute_value))
01538               {
01539                 error = -EPERM;
01540                 goto out;
01541               }
01542           }
01543         else
01544         if(type >= 1)
01545           {
01546 #ifdef CONFIG_RSBAC_DEBUG
01547             if (rsbac_debug_aef)
01548               {
01549 #ifdef CONFIG_RSBAC_RMSG
01550                 rsbac_printk(KERN_DEBUG "rsbac_log(): function %u, calling ADF for GET_STATUS_DATA\n", type);
01551 #endif
01552 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
01553                 if (!rsbac_nosyslog)
01554 #endif
01555                 printk(KERN_DEBUG "rsbac_log(): function %u, calling ADF for GET_STATUS_DATA\n", type);
01556               }
01557 #endif
01558             if (!rsbac_adf_request(R_GET_STATUS_DATA,
01559                                    current->pid,
01560                                    T_SCD,
01561                                    rsbac_target_id,
01562                                    A_none,
01563                                    rsbac_attribute_value))
01564               {
01565                 error = -EPERM;
01566                 goto out;
01567               }
01568           }
01569 
01570         switch (type) {
01571         case 0:         /* Close log */
01572                 break;
01573         case 1:         /* Open log */
01574                 break;
01575         case 2:         /* Read from log */
01576                 error = -EINVAL;
01577                 if (!buf || len < 0)
01578                         goto out;
01579                 error = 0;
01580                 if (!len)
01581                         goto out;
01582                 error = verify_area(VERIFY_WRITE,buf,len);
01583                 if (error)
01584                         goto out;
01585                 error = wait_event_interruptible(rlog_wait, (log_start - log_end));
01586                 if (error)
01587                         goto out;
01588                 i = 0;
01589                 spin_lock_irq(&rsbac_log_lock);
01590                 while ((log_start != log_end) && i < len) {
01591                         c = RLOG_BUF(log_start);
01592                         log_start++;
01593                         spin_unlock_irq(&rsbac_log_lock);
01594                         __put_user(c,buf);
01595                         buf++;
01596                         i++;
01597                         spin_lock_irq(&rsbac_log_lock);
01598                 }
01599                 spin_unlock_irq(&rsbac_log_lock);
01600                 error = i;
01601                 break;
01602         case 4:         /* Read/clear last kernel messages */
01603                 do_clear = 1; 
01604                 /* FALL THRU */
01605         case 3:         /* Read last kernel messages */
01606                 error = -EINVAL;
01607                 if (!buf || len < 0)
01608                         goto out;
01609                 error = 0;
01610                 if (!len)
01611                         goto out;
01612                 error = verify_area(VERIFY_WRITE,buf,len);
01613                 if (error)
01614                         goto out;
01615                 count = len;
01616                 if (count > RLOG_BUF_LEN)
01617                         count = RLOG_BUF_LEN;
01618                 spin_lock_irq(&rsbac_log_lock);
01619                 if (count > logged_chars)
01620                         count = logged_chars;
01621                 if (do_clear)
01622                         logged_chars = 0;
01623                 limit = log_end;
01624                 /*
01625                  * __put_user() could sleep, and while we sleep
01626                  * printk() could overwrite the messages 
01627                  * we try to copy to user space. Therefore
01628                  * the messages are copied in reverse. <manfreds>
01629                  */
01630                 for(i=0;i < count;i++) {
01631                         j = limit-1-i;
01632                         if (j+RLOG_BUF_LEN < log_end)
01633                                 break;
01634                         c = RLOG_BUF(j);
01635                         spin_unlock_irq(&rsbac_log_lock);
01636                         __put_user(c,&buf[count-1-i]);
01637                         spin_lock_irq(&rsbac_log_lock);
01638                 }
01639                 spin_unlock_irq(&rsbac_log_lock);
01640                 error = i;
01641                 if(i != count) {
01642                         int offset = count-error;
01643                         /* buffer overflow during copy, correct user buffer. */
01644                         for(i=0;i<error;i++) {
01645                                 __get_user(c,&buf[i+offset]);
01646                                 __put_user(c,&buf[i]);
01647                         }
01648                 }
01649 
01650                 break;
01651         case 5:         /* Clear ring buffer */
01652                 spin_lock_irq(&rsbac_log_lock);
01653                 logged_chars = 0;
01654                 spin_unlock_irq(&rsbac_log_lock);
01655                 break;
01656         case 9:         /* Number of chars in the log buffer */
01657                 spin_lock_irq(&rsbac_log_lock);
01658                 error = log_end - log_start;
01659                 spin_unlock_irq(&rsbac_log_lock);
01660                 break;
01661         default:
01662                 error = -EINVAL;
01663                 break;
01664         }
01665 out:
01666         return error;
01667 }
01668 
01669 #if defined(CONFIG_RSBAC_REG) || defined(CONFIG_RSBAC_REG_MAINT)
01670 EXPORT_SYMBOL(rsbac_printk);
01671 #endif
01672 
01673 static void emit_log_char(char c)
01674 {
01675         RLOG_BUF(log_end) = c;
01676         log_end++;
01677         if (log_end - log_start > RLOG_BUF_LEN)
01678                 log_start = log_end - RLOG_BUF_LEN;
01679         if (logged_chars < RLOG_BUF_LEN)
01680                 logged_chars++;
01681 }
01682 
01683 #if defined(CONFIG_RSBAC_LOG_REMOTE)
01684 static void emit_remote_log_char(char c)
01685 {
01686         REMOTE_RLOG_BUF(remote_log_end) = c;
01687         remote_log_end++;
01688         if (remote_log_end - remote_log_start > REMOTE_RLOG_BUF_LEN)
01689                 remote_log_start = remote_log_end - REMOTE_RLOG_BUF_LEN;
01690         if (remote_logged_chars < REMOTE_RLOG_BUF_LEN)
01691                 remote_logged_chars++;
01692 }
01693 #endif
01694 
01695 int rsbac_printk(const char *fmt, ...)
01696 {
01697         va_list args;
01698         unsigned long flags;
01699         int printed_len;
01700         char *p;
01701         static char buf[2048];
01702         static int log_level_unknown = 1;
01703         static u_int log_seq = 0;
01704 #if defined(CONFIG_RSBAC_LOG_REMOTE)
01705         static u_int remote_log_seq = 0;
01706         static int remote_log_level_unknown = 1;
01707 #endif
01708 
01709         if (oops_in_progress) {
01710                 /* If a crash is occurring, make sure we can't deadlock */
01711                 spin_lock_init(&rsbac_log_lock);
01712         }
01713 
01714         /* This stops the holder of console_sem just where we want him */
01715         spin_lock_irqsave(&rsbac_log_lock, flags);
01716 
01717         /* Emit the output into the temporary buffer */
01718         va_start(args, fmt);
01719         printed_len = vsnprintf(buf + 14, sizeof(buf) - 14, fmt, args);
01720         va_end(args);
01721 
01722         /*
01723          * Copy the output into log_buf.  If the caller didn't provide
01724          * appropriate log level tags, we insert them here
01725          */
01726         for (p = buf + 14; *p; p++) {
01727                 if (log_level_unknown) {
01728                         if (p[0] != '<' || p[1] < '0' || p[1] > '7' || p[2] != '>') {
01729                                 p -= 14;
01730                                 p[0] = '<';
01731                                 p[1] = RSBAC_DEF_MESS_LOGLEVEL + '0';
01732                                 p[2] = '>';
01733                                 sprintf(p + 3, "%010u", log_seq++);
01734                                 p[13] = '|';
01735                         } else {
01736                                 p -= 11;
01737                                 p[0] = '<';
01738                                 p[1] = p[12];
01739                                 p[2] = '>';
01740                                 sprintf(p + 3, "%010u", log_seq++);
01741                                 p[13] = '|';
01742                         }
01743                         log_level_unknown = 0;
01744                 }
01745                 emit_log_char(*p);
01746                 if (*p == '\n')
01747                         log_level_unknown = 1;
01748         }
01749         spin_unlock_irqrestore(&rsbac_log_lock, flags);
01750         wake_up_interruptible(&rlog_wait);
01751 
01752 #if defined(CONFIG_RSBAC_LOG_REMOTE)
01753         if (oops_in_progress) {
01754                 /* If a crash is occurring, make sure we can't deadlock */
01755                 spin_lock_init(&rsbac_log_remote_lock);
01756         }
01757 
01758         /* This stops the holder of console_sem just where we want him */
01759         spin_lock_irqsave(&rsbac_log_remote_lock, flags);
01760 
01761         /* Emit the output into the temporary buffer */
01762         va_start(args, fmt);
01763         printed_len = vsnprintf(buf + 14, sizeof(buf) - 14, fmt, args);
01764         va_end(args);
01765 
01766         /*
01767          * Copy the output into log_buf.  If the caller didn't provide
01768          * appropriate log level tags, we insert them here
01769          */
01770         for (p = buf + 14; *p; p++) {
01771                 if (remote_log_level_unknown) {
01772                         if (p[0] != '<' || p[1] < '0' || p[1] > '7' || p[2] != '>') {
01773                                 p -= 14;
01774                                 p[0] = '<';
01775                                 p[1] = RSBAC_DEF_MESS_LOGLEVEL + '0';
01776                                 p[2] = '>';
01777                                 sprintf(p + 3, "%010u", remote_log_seq++);
01778                                 p[13] = '|';
01779                         } else {
01780                                 p -= 11;
01781                                 p[0] = '<';
01782                                 p[1] = p[12];
01783                                 p[2] = '>';
01784                                 sprintf(p + 3, "%010u", remote_log_seq++);
01785                                 p[13] = '|';
01786                         }
01787                         remote_log_level_unknown = 0;
01788                 }
01789                 emit_remote_log_char(*p);
01790                 if (*p == '\n')
01791                         remote_log_level_unknown = 1;
01792         }
01793         spin_unlock_irqrestore(&rsbac_log_remote_lock, flags);
01794 #ifdef CONFIG_RSBAC_LOG_REMOTE_SYNC
01795         wake_up_interruptible(&rsbaclogd_wait);
01796 #endif
01797 #endif
01798 
01799         return printed_len;
01800 }
01801 
01802 #if defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS)
01803 static int rmsg_open(struct inode * inode, struct file * file)
01804 {
01805         return rsbac_log(1,NULL,0);
01806 }
01807 
01808 static int rmsg_release(struct inode * inode, struct file * file)
01809 {
01810         (void) rsbac_log(0,NULL,0);
01811         return 0;
01812 }
01813 
01814 static ssize_t rmsg_read(struct file * file, char * buf,
01815                          size_t count, loff_t *ppos)
01816 {
01817         return rsbac_log(2,buf,count);
01818 }
01819 
01820 static unsigned int rmsg_poll(struct file *file, poll_table * wait)
01821 {
01822         poll_wait(file, &rlog_wait, wait);
01823         if (rsbac_log(9, 0, 0))
01824                 return POLLIN | POLLRDNORM;
01825         return 0;
01826 }
01827 
01828 static struct file_operations proc_rmsg_operations = {
01829         .read = rmsg_read,
01830         .poll = rmsg_poll,      /* rmsg_poll */
01831         .open = rmsg_open,
01832         .release = rmsg_release
01833 };
01834 
01835 #endif /* PROC */
01836 #endif /* RMSG */
01837 
01838 #if defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS)
01839 #ifndef PROC_BLOCK_SIZE
01840 #define PROC_BLOCK_SIZE (3*1024)  /* 4K page size but our output routines use some slack for overruns */
01841 #endif
01842 
01843 static int
01844 log_levels_proc_info(char *buffer, char **start, off_t offset, int length)
01845 {
01846   int len = 0;
01847   int i,j;
01848   off_t pos   = 0;
01849   off_t begin = 0;
01850   char * name;
01851   char * name2;
01852 
01853   union rsbac_target_id_t       rsbac_target_id;
01854   union rsbac_attribute_value_t rsbac_attribute_value;
01855 
01856   if (!rsbac_is_initialized())
01857     return (-ENOSYS);
01858 
01859 #ifdef CONFIG_RSBAC_DEBUG
01860   if (rsbac_debug_aef)
01861     {
01862 #ifdef CONFIG_RSBAC_RMSG
01863       rsbac_printk(KERN_DEBUG "log_levels_proc_info(): calling ADF\n");
01864 #endif
01865 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
01866       if (!rsbac_nosyslog)
01867 #endif
01868       printk(KERN_DEBUG "log_levels_proc_info(): calling ADF\n");
01869     }
01870 #endif
01871   rsbac_target_id.scd = ST_rsbac;
01872   rsbac_attribute_value.dummy = 0;
01873   if (!rsbac_adf_request(R_GET_STATUS_DATA,
01874                          current->pid,
01875                          T_SCD,
01876                          rsbac_target_id,
01877                          A_none,
01878                          rsbac_attribute_value))
01879     {
01880       return -EPERM;
01881     }
01882 
01883   name = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01884   if(!name)
01885     return -ENOMEM;
01886   name2 = rsbac_kmalloc(RSBAC_MAXNAMELEN);
01887   if(!name2)
01888     {
01889       rsbac_kfree(name);
01890       return -ENOMEM;
01891     }
01892     
01893   len += sprintf(buffer, "RSBAC Log Levels\n----------------\n");
01894   len += sprintf(buffer+len, "Name\t\t\tFILE\tDIR\tFIFO\tSYMLINK\tDEV\tIPC\tSCD\tUSER\tPROCESS\tNETDEV\tNETTEMP\tNETOBJ\tNETT_NT\tNONE\n");
01895 
01896   for (i = 0; i<R_NONE; i++)
01897     {
01898       len += sprintf(buffer + len, "%-23s",
01899                      get_request_name(name, i));
01900       for(j = 0; j<=T_NONE; j++)
01901         {
01902           if(j != T_FD)
01903             len += sprintf(buffer + len, "\t%u",
01904                            rsbac_log_levels[i][j]);
01905         }
01906       len += sprintf(buffer + len, "\n");
01907       pos = begin + len;
01908       if (pos < offset)
01909         {
01910           len = 0;
01911           begin = pos;
01912         }
01913       if (pos > offset+length)
01914         break;
01915     }
01916 
01917   *start = buffer + (offset - begin);
01918   len -= (offset - begin);
01919   
01920   if (len > length)
01921     len = length;
01922   rsbac_kfree(name);
01923   rsbac_kfree(name2);
01924 
01925   return len;
01926 }
01927 
01928 static ssize_t log_levels_proc_write(struct file * file, const char * buf,
01929                                      u_long count, void *ppos)
01930 {
01931     ssize_t err;
01932     char * k_buf;
01933     char * p;
01934     unsigned int log_level;
01935     char rname[RSBAC_MAXNAMELEN];
01936     int i,j;
01937 
01938     union rsbac_target_id_t       rsbac_target_id;
01939     union rsbac_attribute_value_t rsbac_attribute_value;
01940 
01941     if(count > PROC_BLOCK_SIZE) {
01942         return(-EOVERFLOW);
01943     }
01944 
01945     if (!(k_buf = (char *) __get_free_page(GFP_KERNEL)))
01946       return(-ENOMEM);
01947     err = copy_from_user(k_buf, buf, count);
01948     if(err < 0)
01949       return err;
01950 
01951   err = count;
01952   if(count < 15 || strncmp("log_levels", k_buf, 10))
01953     {
01954       goto out;
01955     }
01956   if (!rsbac_is_initialized())
01957     {
01958       err=-ENOSYS;
01959       goto out;
01960     }
01961 
01962     /*
01963      * Usage: echo "log_levels request #N" > /proc/rsbac_info/log_levels
01964      *   to set log level for request to given value
01965      */
01966     for(i=0; i<R_NONE; i++)
01967       {
01968         get_request_name(rname,i);
01969         if(!strncmp(rname, k_buf + 11, strlen(rname))) 
01970           {
01971 #ifdef CONFIG_RSBAC_DEBUG
01972             if (rsbac_debug_aef)
01973               {
01974 #ifdef CONFIG_RSBAC_RMSG
01975                 rsbac_printk(KERN_DEBUG "log_levels_proc_write(): calling ADF\n");
01976 #endif
01977 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
01978                 if (!rsbac_nosyslog)
01979 #endif
01980                 printk(KERN_DEBUG "log_levels_proc_write(): calling ADF\n");
01981               }
01982 #endif
01983             rsbac_target_id.dummy = 0;
01984             rsbac_attribute_value.request = i;
01985             if (!rsbac_adf_request(R_SWITCH_LOG,
01986                                    current->pid,
01987                                    T_NONE,
01988                                    rsbac_target_id,
01989                                    A_request,
01990                                    rsbac_attribute_value))
01991               {
01992                 err = -EPERM;
01993                 goto out;
01994               }
01995             p = k_buf + 11 + strlen(rname)+1;
01996 
01997             if( *p == '\0' )
01998               goto out;
01999 
02000             log_level = simple_strtoul(p, NULL, 0);
02001             /* only accept 0 or 1 */
02002             if(   (log_level == LL_none)
02003                || (log_level == LL_denied)
02004                || (log_level == LL_full)
02005               )
02006               {
02007 #ifdef CONFIG_RSBAC_RMSG
02008                 rsbac_printk(KERN_INFO
02009                        "log_levels_proc_write(): setting %s log level for all target types to %u\n",
02010                        rname, log_level);
02011 #endif
02012 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
02013                 if (!rsbac_nosyslog)
02014 #endif
02015                 printk(KERN_INFO
02016                        "log_levels_proc_write(): setting %s log level for all target types to %u\n",
02017                        rname, log_level);
02018                 for(j = 0; j<=T_NONE; j++)
02019                   {
02020                     rsbac_log_levels[i][j] = log_level;
02021                   }
02022                 err = count;
02023                 goto out;
02024               }
02025             else
02026               {
02027 #ifdef CONFIG_RSBAC_RMSG
02028                 rsbac_printk(KERN_INFO
02029                        "log_levels_proc_write(): rejecting invalid log level (should be %u, %u or %u)\n",
02030                        LL_none, LL_denied, LL_full);
02031 #endif
02032 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
02033                 if (!rsbac_nosyslog)
02034 #endif
02035                 printk(KERN_INFO
02036                        "log_levels_proc_write(): rejecting invalid log level (should be %u, %u or %u)\n",
02037                        LL_none, LL_denied, LL_full);
02038                 goto out;
02039               }
02040           }
02041       }
02042 
02043 out:
02044   free_page((ulong) k_buf);
02045   return(err);
02046   }
02047 
02048 
02049 static int
02050 debug_proc_info(char *buffer, char **start, off_t offset, int length)
02051 {
02052   int len = 0;
02053   off_t pos   = 0;
02054   off_t begin = 0;
02055 
02056   union rsbac_target_id_t       rsbac_target_id;
02057   union rsbac_attribute_value_t rsbac_attribute_value;
02058 
02059   if (!rsbac_is_initialized())
02060     return (-ENOSYS);
02061 
02062 #ifdef CONFIG_RSBAC_DEBUG
02063   if (rsbac_debug_aef)
02064     {
02065 #ifdef CONFIG_RSBAC_RMSG
02066       rsbac_printk(KERN_DEBUG "debug_proc_info(): calling ADF\n");
02067 #endif
02068 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
02069       if (!rsbac_nosyslog)
02070 #endif
02071       printk(KERN_DEBUG "debug_proc_info(): calling ADF\n");
02072     }
02073 #endif
02074   rsbac_target_id.scd = ST_rsbac;
02075   rsbac_attribute_value.dummy = 0;
02076   if (!rsbac_adf_request(R_GET_STATUS_DATA,
02077                          current->pid,
02078                          T_SCD,
02079                          rsbac_target_id,
02080                          A_none,
02081                          rsbac_attribute_value))
02082     {
02083       return -EPERM;
02084     }
02085   len += sprintf(buffer, "RSBAC Debug Settings\n--------------------\n");
02086 
02087 #ifdef CONFIG_RSBAC_SOFTMODE
02088   len += sprintf(buffer + len, "rsbac_softmode is %i\n",
02089                  rsbac_softmode);
02090   pos = begin + len;
02091   if (pos < offset)
02092     {
02093       len = 0;
02094       begin = pos;
02095     }
02096   if (pos > offset+length)
02097     goto out;
02098   len += sprintf(buffer + len, "rsbac_softmode_prohibit is %i\n",
02099                  rsbac_softmode_prohibit);
02100   pos = begin + len;
02101   if (pos < offset)
02102     {
02103       len = 0;
02104       begin = pos;
02105     }
02106   if (pos > offset+length)
02107     goto out;
02108 #ifdef CONFIG_RSBAC_SOFTMODE_IND
02109 #ifdef CONFIG_RSBAC_MAC
02110   len += sprintf(buffer + len, "rsbac_ind_softmode[MAC] is %i\n",
02111                  rsbac_ind_softmode[MAC]);
02112 #endif
02113 #ifdef CONFIG_RSBAC_FC
02114   len += sprintf(buffer + len, "rsbac_ind_softmode[FC] is %i\n",
02115                  rsbac_ind_softmode[FC]);
02116 #endif
02117 #ifdef CONFIG_RSBAC_SIM
02118   len += sprintf(buffer + len, "rsbac_ind_softmode[SIM] is %i\n",
02119                  rsbac_ind_softmode[SIM]);
02120 #endif
02121 #ifdef CONFIG_RSBAC_PM
02122   len += sprintf(buffer + len, "rsbac_ind_softmode[PM] is %i\n",
02123                  rsbac_ind_softmode[PM]);
02124 #endif
02125 #ifdef CONFIG_RSBAC_DAZ
02126   len += sprintf(buffer + len, "rsbac_ind_softmode[DAZ] is %i\n",
02127                  rsbac_ind_softmode[DAZ]);
02128 #endif
02129 #ifdef CONFIG_RSBAC_FF
02130   len += sprintf(buffer + len, "rsbac_ind_softmode[FF] is %i\n",
02131                  rsbac_ind_softmode[FF]);
02132 #endif
02133 #ifdef CONFIG_RSBAC_RC
02134   len += sprintf(buffer + len, "rsbac_ind_softmode[RC] is %i\n",
02135                  rsbac_ind_softmode[RC]);
02136 #endif
02137 #ifdef CONFIG_RSBAC_AUTH
02138   len += sprintf(buffer + len, "rsbac_ind_softmode[AUTH] is %i\n",
02139                  rsbac_ind_softmode[AUTH]);
02140 #endif
02141 #ifdef CONFIG_RSBAC_REG
02142   len += sprintf(buffer + len, "rsbac_ind_softmode[REG] is %i\n",
02143                  rsbac_ind_softmode[REG]);
02144 #endif
02145 #ifdef CONFIG_RSBAC_ACL
02146   len += sprintf(buffer + len, "rsbac_ind_softmode[ACL] is %i\n",
02147                  rsbac_ind_softmode[ACL]);
02148 #endif
02149 #ifdef CONFIG_RSBAC_CAP
02150   len += sprintf(buffer + len, "rsbac_ind_softmode[CAP] is %i\n",
02151                  rsbac_ind_softmode[CAP]);
02152 #endif
02153 #ifdef CONFIG_RSBAC_JAIL
02154   len += sprintf(buffer + len, "rsbac_ind_softmode[JAIL] is %i\n",
02155                  rsbac_ind_softmode[JAIL]);
02156 #endif
02157 #ifdef CONFIG_RSBAC_RES
02158   len += sprintf(buffer + len, "rsbac_ind_softmode[RES] is %i\n",
02159                  rsbac_ind_softmode[RES]);
02160 #endif
02161   pos = begin + len;
02162   if (pos < offset)
02163     {
02164       len = 0;
02165       begin = pos;
02166     }
02167   if (pos > offset+length)
02168     goto out;
02169 
02170 #endif
02171 #endif
02172 #ifdef CONFIG_RSBAC_FREEZE
02173   len += sprintf(buffer + len, "rsbac_freeze is %i\n",
02174                  rsbac_freeze);
02175   pos = begin + len;
02176   if (pos < offset)
02177     {
02178       len = 0;
02179       begin = pos;
02180     }
02181   if (pos > offset+length)
02182     goto out;
02183 #endif
02184 #if defined(CONFIG_RSBAC_DAZ_CACHE)
02185   /* RSBAC: DAZ - set cache ttl */
02186   len += sprintf(buffer + len, "rsbac_daz_ttl is %u\n",
02187                  rsbac_daz_get_ttl());
02188   pos = begin + len;
02189   if (pos < offset)
02190     {
02191       len = 0;
02192       begin = pos;
02193     }
02194   if (pos > offset+length)
02195     goto out;
02196 #endif
02197 #ifdef CONFIG_RSBAC_CAP_PROC_HIDE
02198   len += sprintf(buffer + len, "rsbac_cap_process_hiding is %i\n",
02199                  rsbac_cap_process_hiding);
02200   pos = begin + len;
02201   if (pos < offset)
02202     {
02203       len = 0;
02204       begin = pos;
02205     }
02206   if (pos > offset+length)
02207     goto out;
02208 #endif
02209 #ifdef CONFIG_RSBAC_CAP_LOG_MISSING
02210   len += sprintf(buffer + len, "rsbac_cap_log_missing is %i\n",
02211                  rsbac_cap_log_missing);
02212   pos = begin + len;
02213   if (pos < offset)
02214     {
02215       len = 0;
02216       begin = pos;
02217     }
02218   if (pos > offset+length)
02219     goto out;
02220 #endif
02221 
02222 #ifdef CONFIG_RSBAC_ALLOW_DAC_DISABLE_FULL
02223   len += sprintf(buffer + len, "rsbac_dac_disable is %i\n",
02224                  rsbac_dac_disable);
02225   pos = begin + len;
02226   if (pos < offset)
02227     {
02228       len = 0;
02229       begin = pos;
02230     }
02231   if (pos > offset+length)
02232     goto out;
02233 #endif
02234 
02235 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
02236   len += sprintf(buffer + len, "rsbac_nosyslog is %i\n",
02237                  rsbac_nosyslog);
02238   pos = begin + len;
02239   if (pos < offset)
02240     {
02241       len = 0;
02242       begin = pos;
02243     }
02244   if (pos > offset+length)
02245     goto out;
02246 #endif
02247 
02248 #if defined(CONFIG_RSBAC_LOG_REMOTE)
02249   len += sprintf(buffer + len, "rsbac_log_remote_addr is %u.%u.%u.%u\n",
02250                  NIPQUAD(rsbac_log_remote_addr));
02251   pos = begin + len;
02252   if (pos < offset)
02253     {
02254       len = 0;
02255       begin = pos;
02256     }
02257   if (pos > offset+length)
02258     goto out;
02259   len += sprintf(buffer + len, "rsbac_log_remote_port is %u\n",
02260                  ntohs(rsbac_log_remote_port));
02261   pos = begin + len;
02262   if (pos < offset)
02263     {
02264       len = 0;
02265       begin = pos;
02266     }
02267   if (pos > offset+length)
02268     goto out;
02269 #endif
02270 
02271 #ifdef CONFIG_RSBAC_INIT_DELAY
02272   len += sprintf(buffer + len, "rsbac_no_delay_init is %i\n",
02273                  rsbac_no_delay_init);
02274   pos = begin + len;
02275   if (pos < offset)
02276     {
02277       len = 0;
02278       begin = pos;
02279     }
02280   if (pos > offset+length)
02281     goto out;
02282   len += sprintf(buffer + len, "rsbac_delayed_root is %02u:%02u\n",
02283                  RSBAC_MAJOR(rsbac_delayed_root), RSBAC_MINOR(rsbac_delayed_root));
02284   pos = begin + len;
02285   if (pos < offset)
02286     {
02287       len = 0;
02288       begin = pos;
02289     }
02290   if (pos > offset+length)
02291     goto out;
02292 #endif
02293 
02294 #if defined(CONFIG_RSBAC_UM_EXCL)
02295   len += sprintf(buffer + len, "rsbac_um_no_excl is %i\n",
02296                  rsbac_um_no_excl);
02297   pos = begin + len;
02298   if (pos < offset)
02299     {
02300       len = 0;
02301       begin = pos;
02302     }
02303   if (pos > offset+length)
02304     goto out;
02305 #endif
02306 
02307 #if defined(CONFIG_RSBAC_AUTH)
02308   len += sprintf(buffer + len, "rsbac_auth_enable_login is %i\n",
02309                  rsbac_auth_enable_login);
02310   pos = begin + len;
02311   if (pos < offset)
02312     {
02313       len = 0;
02314       begin = pos;
02315     }
02316   if (pos > offset+length)
02317     goto out;
02318 
02319 #if defined(CONFIG_RSBAC_AUTH_LEARN)
02320   len += sprintf(buffer + len, "rsbac_auth_learn is %i\n",
02321                  rsbac_auth_learn);
02322   pos = begin + len;
02323   if (pos < offset)
02324     {
02325       len = 0;
02326       begin = pos;
02327     }
02328   if (pos > offset+length)
02329     goto out;
02330 #endif
02331 #endif
02332 
02333 #if defined(CONFIG_RSBAC_ACL_LEARN)
02334   len += sprintf(buffer + len, "rsbac_acl_learn_fd is %i\n",
02335                  rsbac_acl_learn_fd);
02336   pos = begin + len;
02337   if (pos < offset)
02338     {
02339       len = 0;
02340       begin = pos;
02341     }
02342   if (pos > offset+length)
02343     goto out;
02344 #endif
02345 
02346   len += sprintf(buffer + len, "rsbac_no_defaults is %i\n",
02347                  rsbac_no_defaults);
02348   pos = begin + len;
02349   if (pos < offset)
02350     {
02351       len = 0;
02352       begin = pos;
02353     }
02354   if (pos > offset+length)
02355     goto out;
02356 
02357 #ifdef CONFIG_RSBAC_DEBUG
02358   len += sprintf(buffer + len, "rsbac_debug_write is %i\n",
02359                  rsbac_debug_write);
02360   pos = begin + len;
02361   if (pos < offset)
02362     {
02363       len = 0;
02364       begin = pos;
02365     }
02366   if (pos > offset+length)
02367     goto out;
02368 
02369   len += sprintf(buffer + len, "rsbac_debug_stack is %i\n",
02370                  rsbac_debug_stack);
02371   pos = begin + len;
02372   if (pos < offset)
02373     {
02374       len = 0;
02375       begin = pos;
02376     }
02377   if (pos > offset+length)
02378     goto out;
02379 
02380   len += sprintf(buffer + len, "rsbac_debug_lists is %i\n",
02381                  rsbac_debug_lists);
02382   pos = begin + len;
02383   if (pos < offset)
02384     {
02385       len = 0;
02386       begin = pos;
02387     }
02388   if (pos > offset+length)
02389     goto out;
02390 
02391   len += sprintf(buffer + len, "rsbac_debug_ds is %i\n",
02392                  rsbac_debug_ds);
02393   pos = begin + len;
02394   if (pos < offset)
02395     {
02396       len = 0;
02397       begin = pos;
02398     }
02399   if (pos > offset+length)
02400     goto out;
02401 
02402   len += sprintf(buffer + len, "rsbac_debug_aef is %i\n",
02403                  rsbac_debug_aef);
02404   pos = begin + len;
02405   if (pos < offset)
02406     {
02407       len = 0;
02408       begin = pos;
02409     }
02410   if (pos > offset+length)
02411     goto out;
02412 
02413   len += sprintf(buffer + len, "rsbac_debug_no_write is %i\n",
02414                  rsbac_debug_no_write);
02415   pos = begin + len;
02416   if (pos < offset)
02417     {
02418       len = 0;
02419       begin = pos;
02420     }
02421   if (pos > offset+length)
02422     goto out;
02423 
02424 #if defined(CONFIG_RSBAC_REG) || defined(CONFIG_RSBAC_REG_MAINT)
02425 /* Boolean debug switch for REG */
02426   len += sprintf(buffer + len, "rsbac_debug_reg is %i\n",
02427                  rsbac_debug_reg);
02428   pos = begin + len;
02429   if (pos < offset)
02430     {
02431       len = 0;
02432       begin = pos;
02433     }
02434   if (pos > offset+length)
02435     goto out;
02436 #endif
02437 
02438 #if defined(CONFIG_RSBAC_NET)
02439 /* Boolean debug switch for NET data structures */
02440   len += sprintf(buffer + len, "rsbac_debug_ds_net is %i\n",
02441                  rsbac_debug_ds_net);
02442   pos = begin + len;
02443   if (pos < offset)
02444     {
02445       len = 0;
02446       begin = pos;
02447     }
02448   if (pos > offset+length)
02449     goto out;
02450 
02451 /* Boolean debug switch for NET syscalls / AEF */
02452   len += sprintf(buffer + len, "rsbac_debug_aef_net is %i\n",
02453                  rsbac_debug_aef_net);
02454   pos = begin + len;
02455   if (pos < offset)
02456     {
02457       len = 0;
02458       begin = pos;
02459     }
02460   if (pos > offset+length)
02461     goto out;
02462 
02463 /* Boolean debug switch for NET decisions / ADF */
02464   len += sprintf(buffer + len, "rsbac_debug_adf_net is %i\n",
02465                  rsbac_debug_adf_net);
02466   pos = begin + len;
02467   if (pos < offset)
02468     {
02469       len = 0;
02470       begin = pos;
02471     }
02472   if (pos > offset+length)
02473     goto out;
02474 #endif
02475 
02476 #if defined(CONFIG_RSBAC_MAC)
02477 /* Boolean debug switch for MAC data structures */
02478   len += sprintf(buffer + len, "rsbac_debug_ds_mac is %i\n",
02479                  rsbac_debug_ds_mac);
02480   pos = begin + len;
02481   if (pos < offset)
02482     {
02483       len = 0;
02484       begin = pos;
02485     }
02486   if (pos > offset+length)
02487     goto out;
02488 
02489 /* Boolean debug switch for MAC syscalls / AEF */
02490   len += sprintf(buffer + len, "rsbac_debug_aef_mac is %i\n",
02491                  rsbac_debug_aef_mac);
02492   pos = begin + len;
02493   if (pos < offset)
02494     {
02495       len = 0;
02496       begin = pos;
02497     }
02498   if (pos > offset+length)
02499     goto out;
02500 
02501 /* Boolean debug switch for MAC decisions / ADF */
02502   len += sprintf(buffer + len, "rsbac_debug_adf_mac is %i\n",
02503                  rsbac_debug_adf_mac);
02504   pos = begin + len;
02505   if (pos < offset)
02506     {
02507       len = 0;
02508       begin = pos;
02509     }
02510   if (pos > offset+length)
02511     goto out;
02512 #endif
02513 
02514 #if defined(CONFIG_RSBAC_PM) || defined(CONFIG_RSBAC_PM_MAINT)
02515 /* Boolean debug switch for PM data structures */
02516   len += sprintf(buffer + len, "rsbac_debug_ds_pm is %i\n",
02517                  rsbac_debug_ds_pm);
02518   pos = begin + len;
02519   if (pos < offset)
02520     {
02521       len = 0;
02522       begin = pos;
02523     }
02524   if (pos > offset+length)
02525     goto out;
02526 
02527 /* Boolean debug switch for PM syscalls / AEF */
02528   len += sprintf(buffer + len, "rsbac_debug_aef_pm is %i\n",
02529                  rsbac_debug_aef_pm);
02530   pos = begin + len;
02531   if (pos < offset)
02532     {
02533       len = 0;
02534       begin = pos;
02535     }
02536   if (pos > offset+length)
02537     goto out;
02538 
02539 /* Boolean debug switch for PM decisions / ADF */
02540   len += sprintf(buffer + len, "rsbac_debug_adf_pm is %i\n",
02541                  rsbac_debug_adf_pm);
02542   pos = begin + len;
02543   if (pos < offset)
02544     {
02545       len = 0;
02546       begin = pos;
02547     }
02548   if (pos > offset+length)
02549     goto out;
02550 #endif
02551 
02552 #if defined(CONFIG_RSBAC_DAZ)
02553 /* Boolean debug switch for DAZ decisions / ADF */
02554   len += sprintf(buffer + len, "rsbac_debug_adf_daz is %i\n",
02555                  rsbac_debug_adf_daz);
02556   pos = begin + len;
02557   if (pos < offset)
02558     {
02559       len = 0;
02560       begin = pos;
02561     }
02562   if (pos > offset+length)
02563     goto out;
02564 #endif
02565 
02566 #if defined(CONFIG_RSBAC_RC) || defined(CONFIG_RSBAC_RC_MAINT)
02567 /* Boolean debug switch for RC data structures */
02568   len += sprintf(buffer + len, "rsbac_debug_ds_rc is %i\n",
02569                  rsbac_debug_ds_rc);
02570   pos = begin + len;
02571   if (pos < offset)
02572     {
02573       len = 0;
02574       begin = pos;
02575     }
02576   if (pos > offset+length)
02577     goto out;
02578 
02579 /* Boolean debug switch for RC syscalls / AEF */
02580   len += sprintf(buffer + len, "rsbac_debug_aef_rc is %i\n",
02581                  rsbac_debug_aef_rc);
02582   pos = begin + len;
02583   if (pos < offset)
02584     {
02585       len = 0;
02586       begin = pos;
02587     }
02588   if (pos > offset+length)
02589     goto out;
02590 
02591 /* Boolean debug switch for RC decisions / ADF */
02592   len += sprintf(buffer + len, "rsbac_debug_adf_rc is %i\n",
02593                  rsbac_debug_adf_rc);
02594   pos = begin + len;
02595   if (pos < offset)
02596     {
02597       len = 0;
02598       begin = pos;
02599     }
02600   if (pos > offset+length)
02601     goto out;
02602 #endif
02603 
02604 #if defined(CONFIG_RSBAC_AUTH)
02605 /* Boolean debug switch for AUTH data structures */
02606   len += sprintf(buffer + len, "rsbac_debug_ds_auth is %i\n",
02607                  rsbac_debug_ds_auth);
02608   pos = begin + len;
02609   if (pos < offset)
02610     {
02611       len = 0;
02612       begin = pos;
02613     }
02614   if (pos > offset+length)
02615     goto out;
02616 
02617 /* Boolean debug switch for AUTH syscalls / AEF */
02618   len += sprintf(buffer + len, "rsbac_debug_aef_auth is %i\n",
02619                  rsbac_debug_aef_auth);
02620   pos = begin + len;
02621   if (pos < offset)
02622     {
02623       len = 0;
02624       begin = pos;
02625     }
02626   if (pos > offset+length)
02627     goto out;
02628 
02629 /* Boolean debug switch for AUTH decisions / ADF */
02630   len += sprintf(buffer + len, "rsbac_debug_adf_auth is %i\n",
02631                  rsbac_debug_adf_auth);
02632   pos = begin + len;
02633   if (pos < offset)
02634     {
02635       len = 0;
02636       begin = pos;
02637     }
02638   if (pos > offset+length)
02639     goto out;
02640 #endif
02641 
02642 #if defined(CONFIG_RSBAC_ACL)
02643 /* Boolean debug switch for ACL data structures */
02644   len += sprintf(buffer + len, "rsbac_debug_ds_acl is %i\n",
02645                  rsbac_debug_ds_acl);
02646   pos = begin + len;
02647   if (pos < offset)
02648     {
02649       len = 0;
02650       begin = pos;
02651     }
02652   if (pos > offset+length)
02653     goto out;
02654 
02655 /* Boolean debug switch for ACL syscalls / AEF */
02656   len += sprintf(buffer + len, "rsbac_debug_aef_acl is %i\n",
02657                  rsbac_debug_aef_acl);
02658   pos = begin + len;
02659   if (pos < offset)
02660     {
02661       len = 0;
02662       begin = pos;
02663     }
02664   if (pos > offset+length)
02665     goto out;
02666 
02667 /* Boolean debug switch for ACL decisions / ADF */
02668   len += sprintf(buffer + len, "rsbac_debug_adf_acl is %i\n",
02669                  rsbac_debug_adf_acl);
02670   pos = begin + len;
02671   if (pos < offset)
02672     {
02673       len = 0;
02674       begin = pos;
02675     }
02676   if (pos > offset+length)
02677     goto out;
02678 #endif
02679 
02680 #if defined(CONFIG_RSBAC_JAIL)
02681 /* Boolean debug switch for JAIL syscalls / AEF */
02682   len += sprintf(buffer + len, "rsbac_debug_aef_jail is %i\n",
02683                  rsbac_debug_aef_jail);
02684   pos = begin + len;
02685   if (pos < offset)
02686     {
02687       len = 0;
02688       begin = pos;
02689     }
02690   if (pos > offset+length)
02691     goto out;
02692 
02693 /* Boolean debug switch for JAIL decisions / ADF */
02694   len += sprintf(buffer + len, "rsbac_debug_adf_jail is %i\n",
02695                  rsbac_debug_adf_jail);
02696   pos = begin + len;
02697   if (pos < offset)
02698     {
02699       len = 0;
02700       begin = pos;
02701     }
02702   if (pos > offset+length)
02703     goto out;
02704 #endif
02705 
02706 #if defined(CONFIG_RSBAC_PAX)
02707 /* Boolean debug switch for PAX decisions / ADF */
02708   len += sprintf(buffer + len, "rsbac_debug_adf_pax is %i\n",
02709                  rsbac_debug_adf_pax);
02710   pos = begin + len;
02711   if (pos < offset)
02712     {
02713       len = 0;
02714       begin = pos;
02715     }
02716   if (pos > offset+length)
02717     goto out;
02718 #endif
02719 
02720 #if defined(CONFIG_RSBAC_UM)
02721 /* Boolean debug switch for UM data structures */
02722   len += sprintf(buffer + len, "rsbac_debug_ds_um is %i\n",
02723                  rsbac_debug_ds_um);
02724   pos = begin + len;
02725   if (pos < offset)
02726     {
02727       len = 0;
02728       begin = pos;
02729     }
02730   if (pos > offset+length)
02731     goto out;
02732 
02733 /* Boolean debug switch for UM syscalls / AEF */
02734   len += sprintf(buffer + len, "rsbac_debug_aef_um is %i\n",
02735                  rsbac_debug_aef_um);
02736   pos = begin + len;
02737   if (pos < offset)
02738     {
02739       len = 0;
02740       begin = pos;
02741     }
02742   if (pos > offset+length)
02743     goto out;
02744 
02745 /* Boolean debug switch for UM decisions / ADF */
02746   len += sprintf(buffer + len, "rsbac_debug_adf_um is %i\n",
02747                  rsbac_debug_adf_um);
02748   pos = begin + len;
02749   if (pos < offset)
02750     {
02751       len = 0;
02752       begin = pos;
02753     }
02754   if (pos > offset+length)
02755     goto out;
02756 #endif
02757 
02758 #if defined(CONFIG_RSBAC_AUTO_WRITE) && (CONFIG_RSBAC_AUTO_WRITE > 0)
02759   len += sprintf(buffer + len, "rsbac_debug_auto is %i\n",
02760                  rsbac_debug_auto);
02761   pos = begin + len;
02762   if (pos < offset)
02763     {
02764       len = 0;
02765       begin = pos;
02766     }
02767   if (pos > offset+length)
02768     goto out;
02769 #endif /* CONFIG_RSBAC_AUTO_WRITE > 0 */
02770 #endif /* DEBUG */
02771 
02772 out:
02773   *start = buffer + (offset - begin);
02774   len -= (offset - begin);
02775   
02776   if (len > length)
02777     len = length;
02778   return len;
02779 }
02780 
02781 static ssize_t debug_proc_write(struct file * file, const char * buf,
02782                                 u_long count, void *ppos)
02783 {
02784     ssize_t err;
02785     char * k_buf;
02786     char * p;
02787     unsigned int debug_level;
02788 #ifdef CONFIG_RSBAC_SOFTMODE_IND
02789     enum rsbac_switch_target_t sw_target;
02790 #endif
02791 
02792     union rsbac_target_id_t       rsbac_target_id;
02793     union rsbac_attribute_value_t rsbac_attribute_value;
02794 
02795     if(count > PROC_BLOCK_SIZE) {
02796         return(-EOVERFLOW);
02797     }
02798     if(count < 10)
02799       return -EINVAL;
02800 
02801     if (!(k_buf = (char *) __get_free_page(GFP_KERNEL)))
02802       return(-ENOMEM);
02803     err = copy_from_user(k_buf, buf, count);
02804     if(err < 0)
02805       return err;
02806 
02807   err = count;
02808 
02809   if(!strncmp("debug", k_buf, 5))
02810     {
02811       p = k_buf + 6;
02812     }
02813   else
02814   if(!strncmp("rsbac_debug", k_buf, 11))
02815     {
02816       p = k_buf + 12;
02817     }
02818   else
02819     goto out;
02820 
02821   if (!rsbac_is_initialized())
02822     {
02823       err=-ENOSYS;
02824       goto out;
02825     }
02826 
02827 
02828 #ifdef CONFIG_RSBAC_SOFTMODE
02829 #ifdef CONFIG_RSBAC_SOFTMODE_IND
02830 /* Boolean switch for RSBAC individual soft mode */
02831     /*
02832      * Usage: echo "debug ind_softmode modname #N" > /proc/rsbac_info/debug
02833      *   to set rsbac_ind_softmode[module] to given value
02834      */
02835     if(!strncmp("ind_softmode", k_buf + 6, 12)) 
02836       {
02837         char tmp[20];
02838 
02839         p += 13;
02840 
02841         if( *p == '\0' )
02842           goto out;
02843 
02844         sw_target = get_switch_target_nr(p);
02845         if(sw_target == SW_NONE)
02846           goto out;
02847         get_switch_target_name(tmp, sw_target);
02848         p += strlen(tmp)+1;
02849         if( *p == '\0' )
02850           goto out;
02851         debug_level = simple_strtoul(p, NULL, 0);
02852         /* only accept 0 or 1 */
02853         if(!debug_level || (debug_level == 1))
02854           {
02855             if(debug_level && rsbac_softmode_prohibit)
02856               {
02857 #ifdef CONFIG_RSBAC_RMSG
02858                 rsbac_printk(KERN_WARNING
02859                              "debug_proc_write(): setting of softmode prohibited!\n");
02860 #endif
02861 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
02862                 if (!rsbac_nosyslog)
02863 #endif
02864                 printk(KERN_WARNING
02865                        "debug_proc_write(): setting of softmode prohibited!\n");
02866                 err = -EPERM;
02867                 goto out;
02868               }
02869 #if defined(CONFIG_RSBAC_DEBUG)
02870             if (rsbac_debug_aef)
02871               {
02872 #ifdef CONFIG_RSBAC_RMSG
02873                 rsbac_printk(KERN_DEBUG "debug_proc_write(): calling ADF for switching\n");
02874 #endif
02875 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
02876                 if (!rsbac_nosyslog)
02877 #endif
02878                 printk(KERN_DEBUG "debug_proc_write(): calling ADF for switching\n");
02879               }
02880 #endif
02881             rsbac_target_id.dummy = 0;
02882             rsbac_attribute_value.switch_target = sw_target;
02883             if (!rsbac_adf_request(R_SWITCH_MODULE,
02884                                    current->pid,
02885                                    T_NONE,
02886                                    rsbac_target_id,
02887                                    A_switch_target,
02888                                    rsbac_attribute_value))
02889               {
02890                 err = -EPERM;
02891                 goto out;
02892               }
02893 #ifdef CONFIG_RSBAC_RMSG
02894             rsbac_printk(KERN_INFO
02895                    "debug_proc_write(): setting rsbac_ind_softmode[%s] to %u\n",
02896                    tmp,
02897                    debug_level);
02898 #endif
02899 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
02900             if (!rsbac_nosyslog)
02901 #endif
02902             printk(KERN_INFO
02903                    "debug_proc_write(): setting rsbac_ind_softmode[%s] to %u\n",
02904                    tmp,
02905                    debug_level);
02906             rsbac_ind_softmode[sw_target] = debug_level;
02907             err = count;
02908             goto out;
02909           }
02910         else
02911           {
02912 #ifdef CONFIG_RSBAC_RMSG
02913             rsbac_printk(KERN_INFO
02914                    "debug_proc_write(): rejecting invalid ind_softmode value (should be 0 or 1)\n");
02915 #endif
02916 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
02917             if (!rsbac_nosyslog)
02918 #endif
02919             printk(KERN_INFO
02920                    "debug_proc_write(): rejecting invalid ind_softmode value (should be 0 or 1)\n");
02921             err =-EINVAL;
02922             goto out;
02923           }
02924       }
02925 #endif
02926 
02927 /* Boolean switch for RSBAC soft mode prohibit */
02928     /*
02929      * Usage: echo "debug softmode_prohibit #N" > /proc/rsbac_info/debug
02930      *   to set rsbac_softmode to given value
02931      */
02932     if(!strncmp("softmode_prohibit", k_buf + 6, 17)) 
02933       {
02934         p += 18;
02935 
02936         if( *p == '\0' )
02937           goto out;
02938 
02939         debug_level = simple_strtoul(p, NULL, 0);
02940         /* only accept 0 or 1 */
02941         if(!debug_level || (debug_level == 1))
02942           {
02943             if(!debug_level && rsbac_softmode_prohibit)
02944               {
02945 #ifdef CONFIG_RSBAC_RMSG
02946                 rsbac_printk(KERN_WARNING
02947                              "debug_proc_write(): setting of softmode prohibited!\n");
02948 #endif
02949 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
02950                 if (!rsbac_nosyslog)
02951 #endif
02952                 printk(KERN_WARNING
02953                        "debug_proc_write(): setting of softmode prohibited!\n");
02954                 err = -EPERM;
02955                 goto out;
02956               }
02957 #if defined(CONFIG_RSBAC_DEBUG)
02958             if (rsbac_debug_aef)
02959               {
02960 #ifdef CONFIG_RSBAC_RMSG
02961                 rsbac_printk(KERN_DEBUG "debug_proc_write(): calling ADF for softmode\n");
02962 #endif
02963 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
02964                 if (!rsbac_nosyslog)
02965 #endif
02966                 printk(KERN_DEBUG "debug_proc_write(): calling ADF for softmode\n");
02967               }
02968 #endif
02969             rsbac_target_id.dummy = 0;
02970             rsbac_attribute_value.switch_target = SOFTMODE;
02971             if (!rsbac_adf_request(R_SWITCH_MODULE,
02972                                    current->pid,
02973                                    T_NONE,
02974                                    rsbac_target_id,
02975                                    A_switch_target,
02976                                    rsbac_attribute_value))
02977               {
02978                 err = -EPERM;
02979                 goto out;
02980               }
02981 #ifdef CONFIG_RSBAC_RMSG
02982             rsbac_printk(KERN_INFO
02983                    "debug_proc_write(): setting rsbac_softmode_prohibit to %u\n",
02984                    debug_level);
02985 #endif
02986 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
02987             if (!rsbac_nosyslog)
02988 #endif
02989             printk(KERN_INFO
02990                    "debug_proc_write(): setting rsbac_softmode_prohibit to %u\n",
02991                    debug_level);
02992             rsbac_softmode_prohibit = debug_level;
02993             err = count;
02994             goto out;
02995           }
02996         else
02997           {
02998 #ifdef CONFIG_RSBAC_RMSG
02999             rsbac_printk(KERN_INFO
03000                    "debug_proc_write(): rejecting invalid softmode_prohibit value (should be 0 or 1)\n");
03001 #endif
03002 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03003             if (!rsbac_nosyslog)
03004 #endif
03005             printk(KERN_INFO
03006                    "debug_proc_write(): rejecting invalid softmode_prohibit value (should be 0 or 1)\n");
03007             err =-EINVAL;
03008             goto out;
03009           }
03010       }
03011 /* Boolean switch for RSBAC soft mode */
03012     /*
03013      * Usage: echo "debug softmode #N" > /proc/rsbac_info/debug
03014      *   to set rsbac_softmode to given value
03015      */
03016     if(!strncmp("softmode", k_buf + 6, 8)) 
03017       {
03018         p += 9;
03019 
03020         if( *p == '\0' )
03021           goto out;
03022 
03023         debug_level = simple_strtoul(p, NULL, 0);
03024         /* only accept 0 or 1 */
03025         if(!debug_level || (debug_level == 1))
03026           {
03027             if(debug_level && rsbac_softmode_prohibit)
03028               {
03029 #ifdef CONFIG_RSBAC_RMSG
03030                 rsbac_printk(KERN_WARNING
03031                              "debug_proc_write(): setting of softmode prohibited!\n");
03032 #endif
03033 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03034                 if (!rsbac_nosyslog)
03035 #endif
03036                 printk(KERN_WARNING
03037                        "debug_proc_write(): setting of softmode prohibited!\n");
03038                 err = -EPERM;
03039                 goto out;
03040               }
03041 #if defined(CONFIG_RSBAC_DEBUG)
03042             if (rsbac_debug_aef)
03043               {
03044 #ifdef CONFIG_RSBAC_RMSG
03045                 rsbac_printk(KERN_DEBUG "debug_proc_write(): calling ADF for softmode\n");
03046 #endif
03047 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03048                 if (!rsbac_nosyslog)
03049 #endif
03050                 printk(KERN_DEBUG "debug_proc_write(): calling ADF for softmode\n");
03051               }
03052 #endif
03053             rsbac_target_id.dummy = 0;
03054             rsbac_attribute_value.switch_target = SOFTMODE;
03055             if (!rsbac_adf_request(R_SWITCH_MODULE,
03056                                    current->pid,
03057                                    T_NONE,
03058                                    rsbac_target_id,
03059                                    A_switch_target,
03060                                    rsbac_attribute_value))
03061               {
03062                 err = -EPERM;
03063                 goto out;
03064               }
03065 #ifdef CONFIG_RSBAC_RMSG
03066             rsbac_printk(KERN_INFO
03067                    "debug_proc_write(): setting rsbac_softmode to %u\n",
03068                    debug_level);
03069 #endif
03070 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03071             if (!rsbac_nosyslog)
03072 #endif
03073             printk(KERN_INFO
03074                    "debug_proc_write(): setting rsbac_softmode to %u\n",
03075                    debug_level);
03076             rsbac_softmode = debug_level;
03077             err = count;
03078             goto out;
03079           }
03080         else
03081           {
03082 #ifdef CONFIG_RSBAC_RMSG
03083             rsbac_printk(KERN_INFO
03084                    "debug_proc_write(): rejecting invalid softmode value (should be 0 or 1)\n");
03085 #endif
03086 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03087             if (!rsbac_nosyslog)
03088 #endif
03089             printk(KERN_INFO
03090                    "debug_proc_write(): rejecting invalid softmode value (should be 0 or 1)\n");
03091             err =-EINVAL;
03092             goto out;
03093           }
03094       }
03095 #endif
03096 
03097 #ifdef CONFIG_RSBAC_ALLOW_DAC_DISABLE_FULL
03098 /* Boolean switch for disabling Linux DAC */
03099     /*
03100      * Usage: echo "debug dac_disable #N" > /proc/rsbac_info/debug
03101      *   to set dac_disable to given value
03102      */
03103     if(!strncmp("dac_disable", k_buf + 6, 11)) 
03104       {
03105         p += 12;
03106 
03107         if( *p == '\0' )
03108           goto out;
03109 
03110         debug_level = simple_strtoul(p, NULL, 0);
03111         /* only accept 0 or 1 */
03112         if(!debug_level || (debug_level == 1))
03113           {
03114 #if defined(CONFIG_RSBAC_DEBUG)
03115             if (rsbac_debug_aef)
03116               {
03117 #ifdef CONFIG_RSBAC_RMSG
03118                 rsbac_printk(KERN_DEBUG "debug_proc_write(): calling ADF for dac_disable\n");
03119 #endif
03120 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03121                 if (!rsbac_nosyslog)
03122 #endif
03123                 printk(KERN_DEBUG "debug_proc_write(): calling ADF for dac_disable\n");
03124               }
03125 #endif
03126             rsbac_target_id.dummy = 0;
03127             rsbac_attribute_value.dummy = 0;
03128             if (!rsbac_adf_request(R_MODIFY_PERMISSIONS_DATA,
03129                                    current->pid,
03130                                    T_NONE,
03131                                    rsbac_target_id,
03132                                    A_none,
03133                                    rsbac_attribute_value))
03134               {
03135                 err = -EPERM;
03136                 goto out;
03137               }
03138 #ifdef CONFIG_RSBAC_RMSG
03139             rsbac_printk(KERN_INFO
03140                    "debug_proc_write(): setting rsbac_dac_disable to %u\n",
03141                    debug_level);
03142 #endif
03143 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03144             if (!rsbac_nosyslog)
03145 #endif
03146             printk(KERN_INFO
03147                    "debug_proc_write(): setting rsbac_dac_disable to %u\n",
03148                    debug_level);
03149             rsbac_dac_disable = debug_level;
03150             err = count;
03151             goto out;
03152           }
03153         else
03154           {
03155 #ifdef CONFIG_RSBAC_RMSG
03156             rsbac_printk(KERN_INFO
03157                    "debug_proc_write(): rejecting invalid dac_disabled value (should be 0 or 1)\n");
03158 #endif
03159 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03160             if (!rsbac_nosyslog)
03161 #endif
03162             printk(KERN_INFO
03163                    "debug_proc_write(): rejecting invalid dac_disabled value (should be 0 or 1)\n");
03164             err =-EINVAL;
03165             goto out;
03166           }
03167       }
03168 #endif
03169 
03170 #ifdef CONFIG_RSBAC_FREEZE
03171 /* Boolean switch to enable freezing */
03172     /*
03173      * Usage: echo "debug freeze #N" > /proc/rsbac_info/debug
03174      *   to set freeze to given value
03175      */
03176     if(!strncmp("freeze", k_buf + 6, 6)) 
03177       {
03178         p += 7;
03179 
03180         if( *p == '\0' )
03181           goto out;
03182 
03183         debug_level = simple_strtoul(p, NULL, 0);
03184         /* only accept 0 or 1 */
03185         if(!debug_level || (debug_level == 1))
03186           {
03187             if(!debug_level && rsbac_freeze)
03188               {
03189 #ifdef CONFIG_RSBAC_RMSG
03190                 rsbac_printk(KERN_WARNING
03191                              "debug_proc_write(): RSBAC configuration frozen, no administration allowed!\n");
03192 #endif
03193 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03194                 if (!rsbac_nosyslog)
03195 #endif
03196                 printk(KERN_WARNING
03197                        "debug_proc_write(): RSBAC configuration frozen, no administration allowed!\n");
03198                 err = -EPERM;
03199                 goto out;
03200               }
03201 
03202 #if defined(CONFIG_RSBAC_DEBUG)
03203             if (rsbac_debug_aef)
03204               {
03205 #ifdef CONFIG_RSBAC_RMSG
03206                 rsbac_printk(KERN_DEBUG "debug_proc_write(): calling ADF for freeze\n");
03207 #endif
03208 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03209                 if (!rsbac_nosyslog)
03210 #endif
03211                 printk(KERN_DEBUG "debug_proc_write(): calling ADF for freeze\n");
03212               }
03213 #endif
03214             rsbac_target_id.dummy = 0;
03215             rsbac_attribute_value.switch_target = FREEZE;
03216             if (!rsbac_adf_request(R_SWITCH_MODULE,
03217                                    current->pid,
03218                                    T_NONE,
03219                                    rsbac_target_id,
03220                                    A_switch_target,
03221                                    rsbac_attribute_value))
03222               {
03223                 err = -EPERM;
03224                 goto out;
03225               }
03226 #ifdef CONFIG_RSBAC_RMSG
03227             rsbac_printk(KERN_INFO
03228                    "debug_proc_write(): setting rsbac_freeze to %u\n",
03229                    debug_level);
03230 #endif
03231 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03232             if (!rsbac_nosyslog)
03233 #endif
03234             printk(KERN_INFO
03235                    "debug_proc_write(): setting rsbac_freeze to %u\n",
03236                    debug_level);
03237             rsbac_freeze = debug_level;
03238             err = count;
03239             goto out;
03240           }
03241         else
03242           {
03243 #ifdef CONFIG_RSBAC_RMSG
03244             rsbac_printk(KERN_INFO
03245                    "debug_proc_write(): rejecting invalid freeze value (should be 0 or 1)\n");
03246 #endif
03247 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03248             if (!rsbac_nosyslog)
03249 #endif
03250             printk(KERN_INFO
03251                    "debug_proc_write(): rejecting invalid freeze value (should be 0 or 1)\n");
03252             err =-EINVAL;
03253             goto out;
03254           }
03255       }
03256 #endif
03257 
03258 #ifdef CONFIG_RSBAC_DAZ_CACHE
03259 /* Set DAZ cache ttl */
03260     /*
03261      * Usage: echo "debug daz_ttl #n" > /proc/rsbac_info/debug
03262      *   to set log_remote_port to given value
03263      */
03264     if(!strncmp("daz_ttl", k_buf + 6, 7)) 
03265       {
03266         rsbac_time_t tmp_ttl;
03267 #ifndef CONFIG_RSBAC_MAINT
03268         union rsbac_target_id_t       i_tid;
03269         union rsbac_attribute_value_t i_attr_val1;
03270 #endif
03271 
03272         p += 8;
03273         if( *p == '\0' )
03274           goto out;
03275 
03276         tmp_ttl = simple_strtoul(p, NULL, 0);
03277 #if defined(CONFIG_RSBAC_DEBUG)
03278             if (rsbac_debug_aef)
03279               {
03280 #ifdef CONFIG_RSBAC_RMSG
03281                 rsbac_printk(KERN_DEBUG "debug_proc_write(): calling ADF for daz_ttl\n");
03282 #endif
03283 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03284                 if (!rsbac_nosyslog)
03285 #endif
03286                 printk(KERN_DEBUG "debug_proc_write(): calling ADF for remote_log_addr\n");
03287               }
03288 #endif
03289 #ifndef CONFIG_RSBAC_MAINT
03290         /* Security Officer? */
03291         i_tid.user = current->uid;
03292         if (rsbac_get_attr(DAZ,
03293                            T_USER,
03294                            i_tid,
03295                            A_daz_role,
03296                            &i_attr_val1,
03297                            TRUE))
03298           {
03299 #ifdef CONFIG_RSBAC_RMSG
03300             rsbac_printk(KERN_WARNING
03301                          "debug_proc_write(): rsbac_get_attr() returned error!\n");
03302 #endif
03303 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03304             if (!rsbac_nosyslog)
03305 #endif
03306               printk(KERN_WARNING
03307                      "debug_proc_write(): rsbac_get_attr() returned error!\n");
03308             return -EPERM;
03309           }
03310         /* if not sec_officer or admin, deny */
03311         if (i_attr_val1.system_role != SR_security_officer)
03312           #ifdef CONFIG_RSBAC_SOFTMODE
03313           if(   !rsbac_softmode
03314           #ifdef CONFIG_RSBAC_SOFTMODE_IND
03315              && !rsbac_ind_softmode[DAZ]
03316           #endif
03317             )
03318           #endif
03319           return -EPERM;
03320 #endif
03321 #ifdef CONFIG_RSBAC_RMSG
03322             rsbac_printk(KERN_INFO
03323                    "debug_proc_write(): setting rsbac_daz_ttl to %u\n",
03324                    tmp_ttl);
03325 #endif
03326 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03327             if (!rsbac_nosyslog)
03328 #endif
03329             printk(KERN_INFO
03330                    "debug_proc_write(): setting rsbac_daz_ttl to %u\n",
03331                    tmp_ttl);
03332             rsbac_daz_set_ttl(tmp_ttl);
03333             err = count;
03334             goto out;
03335       }
03336 #endif
03337 
03338 #if defined(CONFIG_RSBAC_LOG_REMOTE)
03339 /* Set remote address for remote logging */
03340     /*
03341      * Usage: echo "debug log_remote_addr a.b.c.d" > /proc/rsbac_info/debug
03342      *   to set log_remote_addr to given value
03343      */
03344     if(!strncmp("log_remote_addr", k_buf + 6, 15)) 
03345       {
03346         __u32 tmp_addr;
03347         char * tmp;
03348 
03349         p += 16;
03350         if( *p == '\0' )
03351           goto out;
03352 
03353         tmp=p;
03354         while(*tmp)
03355           {
03356             if(   (*tmp != '.')
03357                && (   (*tmp < '0')
03358                    || (*tmp > '9')
03359                   )
03360               )
03361               {
03362                 *tmp = 0;
03363                 break;
03364               }
03365             tmp++;
03366           }
03367         err = rsbac_net_str_to_inet(p, &tmp_addr);
03368         if(!err)
03369           {
03370 #if defined(CONFIG_RSBAC_DEBUG)
03371             if (rsbac_debug_aef)
03372               {
03373 #ifdef CONFIG_RSBAC_RMSG
03374                 rsbac_printk(KERN_DEBUG "debug_proc_write(): calling ADF for remote_log_addr\n");
03375 #endif
03376 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03377                 if (!rsbac_nosyslog)
03378 #endif
03379                 printk(KERN_DEBUG "debug_proc_write(): calling ADF for remote_log_addr\n");
03380               }
03381 #endif
03382             rsbac_target_id.scd = ST_rsbac_remote_log;
03383             rsbac_attribute_value.dummy = 0;
03384             if (!rsbac_adf_request(R_MODIFY_SYSTEM_DATA,
03385                                    current->pid,
03386                                    T_SCD,
03387                                    rsbac_target_id,
03388                                    A_none,
03389                                    rsbac_attribute_value))
03390               {
03391                 err = -EPERM;
03392                 goto out;
03393               }
03394 #ifdef CONFIG_RSBAC_RMSG
03395             rsbac_printk(KERN_INFO
03396                    "debug_proc_write(): setting rsbac_log_remote_addr to %u.%u.%u.%u\n",
03397                    NIPQUAD(tmp_addr));
03398 #endif
03399 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03400             if (!rsbac_nosyslog)
03401 #endif
03402             printk(KERN_INFO
03403                    "debug_proc_write(): setting rsbac_log_remote_addr to %u.%u.%u.%u\n",
03404                    NIPQUAD(tmp_addr));
03405             rsbac_log_remote_addr = tmp_addr;
03406             err = count;
03407             goto out;
03408           }
03409         else
03410           {
03411             char * tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
03412 
03413             if(tmp)
03414               {
03415                 get_error_name(tmp, err);
03416 #ifdef CONFIG_RSBAC_RMSG
03417                 rsbac_printk(KERN_INFO
03418                              "debug_proc_write(): converting remote socket address %s failed with error %s, exiting!\n",
03419                              p,
03420                              tmp);
03421 #endif
03422 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03423                 if (!rsbac_nosyslog)
03424 #endif
03425                   printk(KERN_INFO
03426                          "debug_proc_write(): converting remote socket address %s failed with error %s, exiting!\n",
03427                          p,
03428                          tmp);
03429                 rsbac_kfree(tmp);
03430               }
03431             err =-EINVAL;
03432             goto out;
03433           }
03434       }
03435 /* Set remote port for remote logging */
03436     /*
03437      * Usage: echo "debug log_remote_port #n" > /proc/rsbac_info/debug
03438      *   to set log_remote_port to given value
03439      */
03440     if(!strncmp("log_remote_port", k_buf + 6, 15)) 
03441       {
03442         __u16 tmp_port;
03443 
03444         p += 16;
03445         if( *p == '\0' )
03446           goto out;
03447 
03448         tmp_port = simple_strtoul(p, NULL, 0);
03449 #if defined(CONFIG_RSBAC_DEBUG)
03450             if (rsbac_debug_aef)
03451               {
03452 #ifdef CONFIG_RSBAC_RMSG
03453                 rsbac_printk(KERN_DEBUG "debug_proc_write(): calling ADF for remote_log_addr\n");
03454 #endif
03455 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03456                 if (!rsbac_nosyslog)
03457 #endif
03458                 printk(KERN_DEBUG "debug_proc_write(): calling ADF for remote_log_addr\n");
03459               }
03460 #endif
03461             rsbac_target_id.scd = ST_rsbac_remote_log;
03462             rsbac_attribute_value.dummy = 0;
03463             if (!rsbac_adf_request(R_MODIFY_SYSTEM_DATA,
03464                                    current->pid,
03465                                    T_SCD,
03466                                    rsbac_target_id,
03467                                    A_none,
03468                                    rsbac_attribute_value))
03469               {
03470                 err = -EPERM;
03471                 goto out;
03472               }
03473 #ifdef CONFIG_RSBAC_RMSG
03474             rsbac_printk(KERN_INFO
03475                    "debug_proc_write(): setting rsbac_log_remote_port to %u\n",
03476                    tmp_port);
03477 #endif
03478 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03479             if (!rsbac_nosyslog)
03480 #endif
03481             printk(KERN_INFO
03482                    "debug_proc_write(): setting rsbac_log_remote_port to %u\n",
03483                    tmp_port);
03484             rsbac_log_remote_port = htons(tmp_port);
03485             err = count;
03486             goto out;
03487       }
03488 #endif
03489 
03490 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03491 /* Boolean switch for disabling logging to syslog */
03492     /*
03493      * Usage: echo "debug nosyslog #N" > /proc/rsbac_info/debug
03494      *   to set rsbac_nosyslog to given value
03495      */
03496     if(!strncmp("nosyslog", k_buf + 6, 8)) 
03497       {
03498         p += 9;
03499 
03500         if( *p == '\0' )
03501           goto out;
03502 
03503         debug_level = simple_strtoul(p, NULL, 0);
03504         /* only accept 0 or 1 */
03505         if(!debug_level || (debug_level == 1))
03506           {
03507 #if defined(CONFIG_RSBAC_DEBUG)
03508             if (rsbac_debug_aef)
03509               {
03510 #ifdef CONFIG_RSBAC_RMSG
03511                 rsbac_printk(KERN_DEBUG "debug_proc_write(): calling ADF for nosyslog\n");
03512 #endif
03513 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03514                 if (!rsbac_nosyslog)
03515 #endif
03516                 printk(KERN_DEBUG "debug_proc_write(): calling ADF for nosyslog\n");
03517               }
03518 #endif
03519             rsbac_target_id.dummy = 0;
03520             rsbac_attribute_value.dummy = 0;
03521             if (!rsbac_adf_request(R_SWITCH_LOG,
03522                                    current->pid,
03523                                    T_NONE,
03524                                    rsbac_target_id,
03525                                    A_none,
03526                                    rsbac_attribute_value))
03527               {
03528                 err = -EPERM;
03529                 goto out;
03530               }
03531 #ifdef CONFIG_RSBAC_RMSG
03532             rsbac_printk(KERN_INFO
03533                    "debug_proc_write(): setting rsbac_nosyslog to %u\n",
03534                    debug_level);
03535 #endif
03536 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03537             if (!rsbac_nosyslog)
03538 #endif
03539             printk(KERN_INFO
03540                    "debug_proc_write(): setting rsbac_nosyslog to %u\n",
03541                    debug_level);
03542             rsbac_nosyslog = debug_level;
03543             err = count;
03544             goto out;
03545           }
03546         else
03547           {
03548 #ifdef CONFIG_RSBAC_RMSG
03549             rsbac_printk(KERN_INFO
03550                    "debug_proc_write(): rejecting invalid nosyslog value (should be 0 or 1)\n");
03551 #endif
03552 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03553             if (!rsbac_nosyslog)
03554 #endif
03555             printk(KERN_INFO
03556                    "debug_proc_write(): rejecting invalid nosyslog value (should be 0 or 1)\n");
03557             err =-EINVAL;
03558             goto out;
03559           }
03560       }
03561 #endif
03562 
03563 #if defined(CONFIG_RSBAC_AUTH_LEARN)
03564 /* Boolean switch for AUTH learning mode */
03565     /*
03566      * Usage: echo "debug auth_learn #N" > /proc/rsbac_info/debug
03567      *   to set rsbac_auth_learn to given value
03568      */
03569     if(!strncmp("auth_learn", k_buf + 6, 10)) 
03570       {
03571         p += 11;
03572 
03573         if( *p == '\0' )
03574             goto out;
03575 
03576         debug_level = simple_strtoul(p, NULL, 0);
03577         /* only accept 0 or 1 */
03578         if(!debug_level || (debug_level == 1))
03579           {
03580             rsbac_target_id.dummy = 0;
03581             rsbac_attribute_value.auth_learn = debug_level;
03582             if (!rsbac_adf_request(R_MODIFY_ATTRIBUTE,
03583                                    current->pid,
03584                                    T_NONE,
03585                                    rsbac_target_id,
03586                                    A_auth_learn,
03587                                    rsbac_attribute_value))
03588               {
03589                 err = -EPERM;
03590                 goto out;
03591               }
03592 #ifdef CONFIG_RSBAC_RMSG
03593             rsbac_printk(KERN_INFO
03594                    "debug_proc_write(): setting rsbac_auth_learn to %u\n",
03595                    debug_level);
03596 #endif
03597 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03598             if (!rsbac_nosyslog)
03599 #endif
03600             printk(KERN_INFO
03601                    "debug_proc_write(): setting rsbac_auth_learn to %u\n",
03602                    debug_level);
03603             rsbac_auth_learn = debug_level;
03604             err = count;
03605             goto out;
03606           }
03607         else
03608           {
03609             goto out_inv;
03610           }
03611       }
03612 #endif
03613 
03614 #ifdef CONFIG_RSBAC_CAP_LOG_MISSING
03615 /* Boolean switch for CAP logging of missing caps */
03616     /*
03617      * Usage: echo "debug cap_log_missing #N" > /proc/rsbac_info/debug
03618      *   to set rsbac_cap_log_missing to given value
03619      */
03620     if(!strncmp("cap_log_missing", k_buf + 6, 15)) 
03621       {
03622         p += 16;
03623 
03624         if( *p == '\0' )
03625             goto out;
03626 
03627         debug_level = simple_strtoul(p, NULL, 0);
03628         /* only accept 0 or 1 */
03629         if(!debug_level || (debug_level == 1))
03630           {
03631             rsbac_target_id.scd = ST_rsbac;
03632             rsbac_attribute_value.dummy = 0;
03633             if (!rsbac_adf_request(R_MODIFY_SYSTEM_DATA,
03634                                    current->pid,
03635                                    T_SCD,
03636                                    rsbac_target_id,
03637                                    A_none,
03638                                    rsbac_attribute_value))
03639               {
03640                 err = -EPERM;
03641                 goto out;
03642               }
03643 #ifdef CONFIG_RSBAC_RMSG
03644             rsbac_printk(KERN_INFO
03645                    "debug_proc_write(): setting rsbac_cap_log_missing to %u\n",
03646                    debug_level);
03647 #endif
03648 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03649             if (!rsbac_nosyslog)
03650 #endif
03651             printk(KERN_INFO
03652                    "debug_proc_write(): setting rsbac_cap_log_missing to %u\n",
03653                    debug_level);
03654             rsbac_cap_log_missing = debug_level;
03655             err = count;
03656             goto out;
03657           }
03658         else
03659           {
03660             goto out_inv;
03661           }
03662       }
03663 #endif
03664 
03665 
03666 #if defined(CONFIG_RSBAC_ACL_LEARN)
03667 /* Boolean switch for ACL FD learning mode */
03668     /*
03669      * Usage: echo "debug acl_learn_fd #N" > /proc/rsbac_info/debug
03670      *   to set rsbac_acl_learn_fd to given value
03671      */
03672     if(!strncmp("acl_learn_fd", k_buf + 6, 12)) 
03673       {
03674         p += 13;
03675 
03676         if( *p == '\0' )
03677             goto out;
03678 
03679         debug_level = simple_strtoul(p, NULL, 0);
03680         /* only accept 0 or 1 */
03681         if(!debug_level || (debug_level == 1))
03682           {
03683             /* use default acls */
03684             rsbac_target_id.file.device = RSBAC_ZERO_DEV;
03685             rsbac_target_id.file.inode = 0;
03686             rsbac_target_id.file.dentry_p = NULL;
03687 
03688             if (!rsbac_adf_request(R_MODIFY_ATTRIBUTE,
03689                                    current->pid,
03690                                    T_FILE,
03691                                    rsbac_target_id,
03692                                    A_acl_learn,
03693                                    rsbac_attribute_value))
03694               {
03695                 err = -EPERM;
03696                 goto out;
03697               }
03698 #ifdef CONFIG_RSBAC_RMSG
03699             rsbac_printk(KERN_INFO
03700                    "debug_proc_write(): setting rsbac_acl_learn_fd to %u\n",
03701                    debug_level);
03702 #endif
03703 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03704             if (!rsbac_nosyslog)
03705 #endif
03706             printk(KERN_INFO
03707                    "debug_proc_write(): setting rsbac_acl_learn_fd to %u\n",
03708                    debug_level);
03709             rsbac_acl_learn_fd = debug_level;
03710             err = count;
03711             goto out;
03712           }
03713         else
03714           {
03715             goto out_inv;
03716           }
03717       }
03718 #endif
03719 
03720 #if defined(CONFIG_RSBAC_DEBUG)
03721     if (rsbac_debug_aef)
03722       {
03723 #ifdef CONFIG_RSBAC_RMSG
03724         rsbac_printk(KERN_DEBUG "debug_proc_write(): calling ADF\n");
03725 #endif
03726 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03727         if (!rsbac_nosyslog)
03728 #endif
03729         printk(KERN_DEBUG "debug_proc_write(): calling ADF\n");
03730       }
03731     rsbac_target_id.scd = ST_rsbac;
03732     rsbac_attribute_value.dummy = 0;
03733     if (!rsbac_adf_request(R_MODIFY_SYSTEM_DATA,
03734                            current->pid,
03735                            T_SCD,
03736                            rsbac_target_id,
03737                            A_none,
03738                            rsbac_attribute_value))
03739       {
03740         err = -EPERM;
03741         goto out;
03742       }
03743 
03744 #if defined(CONFIG_RSBAC_NET)
03745 /* Boolean debug switch for NET data structures */
03746     /*
03747      * Usage: echo "debug ds_net #N" > /proc/rsbac_info/debug
03748      *   to set rsbac_debug_ds_net to given value
03749      */
03750     if(!strncmp("ds_net", k_buf + 6, 6)) 
03751       {
03752         p += 7;
03753 
03754         if( *p == '\0' )
03755           goto out;
03756 
03757         debug_level = simple_strtoul(p, NULL, 0);
03758         /* only accept 0 or 1 */
03759         if(!debug_level || (debug_level == 1))
03760           {
03761 #ifdef CONFIG_RSBAC_RMSG
03762             rsbac_printk(KERN_INFO
03763                    "debug_proc_write(): setting rsbac_debug_ds_net to %u\n",
03764                    debug_level);
03765 #endif
03766 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03767             if (!rsbac_nosyslog)
03768 #endif
03769             printk(KERN_INFO
03770                    "debug_proc_write(): setting rsbac_debug_ds_net to %u\n",
03771                    debug_level);
03772             rsbac_debug_ds_net = debug_level;
03773             err = count;
03774             goto out;
03775           }
03776         else
03777           {
03778             goto out_inv;
03779           }
03780       }
03781 /* Boolean debug switch for NET syscalls / AEF */
03782     /*
03783      * Usage: echo "debug aef_net #N" > /proc/rsbac_info/debug
03784      *   to set rsbac_debug_aef_net to given value
03785      */
03786     if(!strncmp("aef_net", k_buf + 6, 7)) 
03787       {
03788         p += 8;
03789 
03790         if( *p == '\0' )
03791             goto out;
03792 
03793         debug_level = simple_strtoul(p, NULL, 0);
03794         /* only accept 0 or 1 */
03795         if(!debug_level || (debug_level == 1))
03796           {
03797 #ifdef CONFIG_RSBAC_RMSG
03798             rsbac_printk(KERN_INFO
03799                    "debug_proc_write(): setting rsbac_debug_aef_net to %u\n",
03800                    debug_level);
03801 #endif
03802 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03803             if (!rsbac_nosyslog)
03804 #endif
03805             printk(KERN_INFO
03806                    "debug_proc_write(): setting rsbac_debug_aef_net to %u\n",
03807                    debug_level);
03808             rsbac_debug_aef_net = debug_level;
03809             err = count;
03810             goto out;
03811           }
03812         else
03813           {
03814             goto out_inv;
03815           }
03816       }
03817 
03818 /* Boolean debug switch for NET decisions / ADF */
03819     /*
03820      * Usage: echo "debug adf_net #N" > /proc/rsbac_info/debug
03821      *   to set rsbac_debug_adf_net to given value
03822      */
03823     if(!strncmp("adf_net", k_buf + 6, 7)) 
03824       {
03825         p += 8;
03826 
03827         if( *p == '\0' )
03828             goto out;
03829 
03830         debug_level = simple_strtoul(p, NULL, 0);
03831         /* only accept 0 or 1 */
03832         if(!debug_level || (debug_level == 1))
03833           {
03834 #ifdef CONFIG_RSBAC_RMSG
03835             rsbac_printk(KERN_INFO
03836                    "debug_proc_write(): setting rsbac_debug_adf_net to %u\n",
03837                    debug_level);
03838 #endif
03839 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03840             if (!rsbac_nosyslog)
03841 #endif
03842             printk(KERN_INFO
03843                    "debug_proc_write(): setting rsbac_debug_adf_net to %u\n",
03844                    debug_level);
03845             rsbac_debug_adf_net = debug_level;
03846             err = count;
03847             goto out;
03848           }
03849         else
03850           {
03851             goto out_inv;
03852           }
03853       }
03854 #endif
03855 
03856 #if defined(CONFIG_RSBAC_MAC)
03857 /* Boolean debug switch for MAC data structures */
03858     /*
03859      * Usage: echo "debug ds_mac #N" > /proc/rsbac_info/debug
03860      *   to set rsbac_debug_ds_mac to given value
03861      */
03862     if(!strncmp("ds_mac", k_buf + 6, 6)) 
03863       {
03864         p += 7;
03865 
03866         if( *p == '\0' )
03867           goto out;
03868 
03869         debug_level = simple_strtoul(p, NULL, 0);
03870         /* only accept 0 or 1 */
03871         if(!debug_level || (debug_level == 1))
03872           {
03873 #ifdef CONFIG_RSBAC_RMSG
03874             rsbac_printk(KERN_INFO
03875                    "debug_proc_write(): setting rsbac_debug_ds_mac to %u\n",
03876                    debug_level);
03877 #endif
03878 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03879             if (!rsbac_nosyslog)
03880 #endif
03881             printk(KERN_INFO
03882                    "debug_proc_write(): setting rsbac_debug_ds_mac to %u\n",
03883                    debug_level);
03884             rsbac_debug_ds_mac = debug_level;
03885             err = count;
03886             goto out;
03887           }
03888         else
03889           {
03890             goto out_inv;
03891           }
03892       }
03893 /* Boolean debug switch for MAC syscalls / AEF */
03894     /*
03895      * Usage: echo "debug aef_mac #N" > /proc/rsbac_info/debug
03896      *   to set rsbac_debug_aef_mac to given value
03897      */
03898     if(!strncmp("aef_mac", k_buf + 6, 7)) 
03899       {
03900         p += 8;
03901 
03902         if( *p == '\0' )
03903             goto out;
03904 
03905         debug_level = simple_strtoul(p, NULL, 0);
03906         /* only accept 0 or 1 */
03907         if(!debug_level || (debug_level == 1))
03908           {
03909 #ifdef CONFIG_RSBAC_RMSG
03910             rsbac_printk(KERN_INFO
03911                    "debug_proc_write(): setting rsbac_debug_aef_mac to %u\n",
03912                    debug_level);
03913 #endif
03914 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03915             if (!rsbac_nosyslog)
03916 #endif
03917             printk(KERN_INFO
03918                    "debug_proc_write(): setting rsbac_debug_aef_mac to %u\n",
03919                    debug_level);
03920             rsbac_debug_aef_mac = debug_level;
03921             err = count;
03922             goto out;
03923           }
03924         else
03925           {
03926             goto out_inv;
03927           }
03928       }
03929 
03930 /* Boolean debug switch for MAC decisions / ADF */
03931     /*
03932      * Usage: echo "debug adf_mac #N" > /proc/rsbac_info/debug
03933      *   to set rsbac_debug_adf_mac to given value
03934      */
03935     if(!strncmp("adf_mac", k_buf + 6, 7)) 
03936       {
03937         p += 8;
03938 
03939         if( *p == '\0' )
03940             goto out;
03941 
03942         debug_level = simple_strtoul(p, NULL, 0);
03943         /* only accept 0 or 1 */
03944         if(!debug_level || (debug_level == 1))
03945           {
03946 #ifdef CONFIG_RSBAC_RMSG
03947             rsbac_printk(KERN_INFO
03948                    "debug_proc_write(): setting rsbac_debug_adf_mac to %u\n",
03949                    debug_level);
03950 #endif
03951 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03952             if (!rsbac_nosyslog)
03953 #endif
03954             printk(KERN_INFO
03955                    "debug_proc_write(): setting rsbac_debug_adf_mac to %u\n",
03956                    debug_level);
03957             rsbac_debug_adf_mac = debug_level;
03958             err = count;
03959             goto out;
03960           }
03961         else
03962           {
03963             goto out_inv;
03964           }
03965       }
03966 #endif
03967 
03968 #if defined(CONFIG_RSBAC_PM) || defined(CONFIG_RSBAC_PM_MAINT)
03969 /* Boolean debug switch for PM data structures */
03970     /*
03971      * Usage: echo "debug ds_pm #N" > /proc/rsbac_info/debug
03972      *   to set rsbac_debug_ds_pm to given value
03973      */
03974     if(!strncmp("ds_pm", k_buf + 6, 5)) 
03975       {
03976         p += 6;
03977 
03978         if( *p == '\0' )
03979           goto out;
03980 
03981         debug_level = simple_strtoul(p, NULL, 0);
03982         /* only accept 0 or 1 */
03983         if(!debug_level || (debug_level == 1))
03984           {
03985 #ifdef CONFIG_RSBAC_RMSG
03986             rsbac_printk(KERN_INFO
03987                    "debug_proc_write(): setting rsbac_debug_ds_pm to %u\n",
03988                    debug_level);
03989 #endif
03990 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
03991             if (!rsbac_nosyslog)
03992 #endif
03993             printk(KERN_INFO
03994                    "debug_proc_write(): setting rsbac_debug_ds_pm to %u\n",
03995                    debug_level);
03996             rsbac_debug_ds_pm = debug_level;
03997             err = count;
03998             goto out;
03999           }
04000         else
04001           {
04002             goto out_inv;
04003           }
04004       }
04005 /* Boolean debug switch for PM syscalls / AEF */
04006     /*
04007      * Usage: echo "debug aef_pm #N" > /proc/rsbac_info/debug
04008      *   to set rsbac_debug_aef_pm to given value
04009      */
04010     if(!strncmp("aef_pm", k_buf + 6, 6)) 
04011       {
04012         p += 7;
04013 
04014         if( *p == '\0' )
04015             goto out;
04016 
04017         debug_level = simple_strtoul(p, NULL, 0);
04018         /* only accept 0 or 1 */
04019         if(!debug_level || (debug_level == 1))
04020           {
04021 #ifdef CONFIG_RSBAC_RMSG
04022             rsbac_printk(KERN_INFO
04023                    "debug_proc_write(): setting rsbac_debug_aef_pm to %u\n",
04024                    debug_level);
04025 #endif
04026 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04027             if (!rsbac_nosyslog)
04028 #endif
04029             printk(KERN_INFO
04030                    "debug_proc_write(): setting rsbac_debug_aef_pm to %u\n",
04031                    debug_level);
04032             rsbac_debug_aef_pm = debug_level;
04033             err = count;
04034             goto out;
04035           }
04036         else
04037           {
04038             goto out_inv;
04039           }
04040       }
04041 
04042 /* Boolean debug switch for PM decisions / ADF */
04043     /*
04044      * Usage: echo "debug adf_pm #N" > /proc/rsbac_info/debug
04045      *   to set rsbac_debug_adf_pm to given value
04046      */
04047     if(!strncmp("adf_pm", k_buf + 6, 6)) 
04048       {
04049         p += 7;
04050 
04051         if( *p == '\0' )
04052             goto out;
04053 
04054         debug_level = simple_strtoul(p, NULL, 0);
04055         /* only accept 0 or 1 */
04056         if(!debug_level || (debug_level == 1))
04057           {
04058 #ifdef CONFIG_RSBAC_RMSG
04059             rsbac_printk(KERN_INFO
04060                    "debug_proc_write(): setting rsbac_debug_adf_pm to %u\n",
04061                    debug_level);
04062 #endif
04063 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04064             if (!rsbac_nosyslog)
04065 #endif
04066             printk(KERN_INFO
04067                    "debug_proc_write(): setting rsbac_debug_adf_pm to %u\n",
04068                    debug_level);
04069             rsbac_debug_adf_pm = debug_level;
04070             err = count;
04071             goto out;
04072           }
04073         else
04074           {
04075             goto out_inv;
04076           }
04077       }
04078 #endif
04079 
04080 #if defined(CONFIG_RSBAC_DAZ)
04081 /* Boolean debug switch for DAZ decisions / ADF */
04082     /*
04083      * Usage: echo "debug adf_daz #N" > /proc/rsbac_info/debug
04084      *   to set rsbac_debug_adf_daz to given value
04085      */
04086     if(!strncmp("adf_daz", k_buf + 6, 7)) 
04087       {
04088         p += 8;
04089 
04090         if( *p == '\0' )
04091             goto out;
04092 
04093         debug_level = simple_strtoul(p, NULL, 0);
04094         /* only accept 0 or 1 */
04095         if(!debug_level || (debug_level == 1))
04096           {
04097 #ifdef CONFIG_RSBAC_RMSG
04098             rsbac_printk(KERN_INFO
04099                    "debug_proc_write(): setting rsbac_debug_adf_daz to %u\n",
04100                    debug_level);
04101 #endif
04102 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04103             if (!rsbac_nosyslog)
04104 #endif
04105             printk(KERN_INFO
04106                    "debug_proc_write(): setting rsbac_debug_adf_daz to %u\n",
04107                    debug_level);
04108             rsbac_debug_adf_daz = debug_level;
04109             err = count;
04110             goto out;
04111           }
04112         else
04113           {
04114             goto out_inv;
04115           }
04116       }
04117 #endif
04118 
04119 #if defined(CONFIG_RSBAC_RC) || defined(CONFIG_RSBAC_RC_MAINT)
04120 /* Boolean debug switch for RC data structures */
04121     /*
04122      * Usage: echo "debug ds_rc #N" > /proc/rsbac_info/debug
04123      *   to set rsbac_debug_ds_rc to given value
04124      */
04125     if(!strncmp("ds_rc", k_buf + 6, 5)) 
04126       {
04127         p += 6;
04128 
04129         if( *p == '\0' )
04130             goto out;
04131 
04132         debug_level = simple_strtoul(p, NULL, 0);
04133         /* only accept 0 or 1 */
04134         if(!debug_level || (debug_level == 1))
04135           {
04136 #ifdef CONFIG_RSBAC_RMSG
04137             rsbac_printk(KERN_INFO
04138                    "debug_proc_write(): setting rsbac_debug_ds_rc to %u\n",
04139                    debug_level);
04140 #endif
04141 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04142             if (!rsbac_nosyslog)
04143 #endif
04144             printk(KERN_INFO
04145                    "debug_proc_write(): setting rsbac_debug_ds_rc to %u\n",
04146                    debug_level);
04147             rsbac_debug_ds_rc = debug_level;
04148             err = count;
04149             goto out;
04150           }
04151         else
04152           {
04153             goto out_inv;
04154           }
04155       }
04156 /* Boolean debug switch for RC syscalls / AEF */
04157     /*
04158      * Usage: echo "debug aef_rc #N" > /proc/rsbac_info/debug
04159      *   to set rsbac_debug_aef_rc to given value
04160      */
04161     if(!strncmp("aef_rc", k_buf + 6, 6)) 
04162       {
04163         p += 7;
04164 
04165         if( *p == '\0' )
04166             goto out;
04167 
04168         debug_level = simple_strtoul(p, NULL, 0);
04169         /* only accept 0 or 1 */
04170         if(!debug_level || (debug_level == 1))
04171           {
04172 #ifdef CONFIG_RSBAC_RMSG
04173             rsbac_printk(KERN_INFO
04174                    "debug_proc_write(): setting rsbac_debug_aef_rc to %u\n",
04175                    debug_level);
04176 #endif
04177 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04178             if (!rsbac_nosyslog)
04179 #endif
04180             printk(KERN_INFO
04181                    "debug_proc_write(): setting rsbac_debug_aef_rc to %u\n",
04182                    debug_level);
04183             rsbac_debug_aef_rc = debug_level;
04184             err = count;
04185             goto out;
04186           }
04187         else
04188           {
04189             goto out_inv;
04190           }
04191       }
04192 
04193 /* Boolean debug switch for RC decisions / ADF */
04194     /*
04195      * Usage: echo "debug adf_rc #N" > /proc/rsbac_info/debug
04196      *   to set rsbac_debug_adf_rc to given value
04197      */
04198     if(!strncmp("adf_rc", k_buf + 6, 6)) 
04199       {
04200         p += 7;
04201 
04202         if( *p == '\0' )
04203             goto out;
04204 
04205         debug_level = simple_strtoul(p, NULL, 0);
04206         /* only accept 0 or 1 */
04207         if(!debug_level || (debug_level == 1))
04208           {
04209 #ifdef CONFIG_RSBAC_RMSG
04210             rsbac_printk(KERN_INFO
04211                    "debug_proc_write(): setting rsbac_debug_adf_rc to %u\n",
04212                    debug_level);
04213 #endif
04214 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04215             if (!rsbac_nosyslog)
04216 #endif
04217             printk(KERN_INFO
04218                    "debug_proc_write(): setting rsbac_debug_adf_rc to %u\n",
04219                    debug_level);
04220             rsbac_debug_adf_rc = debug_level;
04221             err = count;
04222             goto out;
04223           }
04224         else
04225           {
04226             goto out_inv;
04227           }
04228       }
04229 #endif
04230 
04231 #if defined(CONFIG_RSBAC_AUTH)
04232 /* Boolean debug switch for AUTH data structures */
04233     /*
04234      * Usage: echo "debug ds_auth #N" > /proc/rsbac_info/debug
04235      *   to set rsbac_debug_ds_auth to given value
04236      */
04237     if(!strncmp("ds_auth", k_buf + 6, 7)) 
04238       {
04239         p += 8;
04240 
04241         if( *p == '\0' )
04242             goto out;
04243 
04244         debug_level = simple_strtoul(p, NULL, 0);
04245         /* only accept 0 or 1 */
04246         if(!debug_level || (debug_level == 1))
04247           {
04248 #ifdef CONFIG_RSBAC_RMSG
04249             rsbac_printk(KERN_INFO
04250                    "debug_proc_write(): setting rsbac_debug_ds_auth to %u\n",
04251                    debug_level);
04252 #endif
04253 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04254             if (!rsbac_nosyslog)
04255 #endif
04256             printk(KERN_INFO
04257                    "debug_proc_write(): setting rsbac_debug_ds_auth to %u\n",
04258                    debug_level);
04259             rsbac_debug_ds_auth = debug_level;
04260             err = count;
04261             goto out;
04262           }
04263         else
04264           {
04265             goto out_inv;
04266           }
04267       }
04268 /* Boolean debug switch for AUTH syscalls / AEF */
04269     /*
04270      * Usage: echo "debug aef_auth #N" > /proc/rsbac_info/debug
04271      *   to set rsbac_debug_aef_auth to given value
04272      */
04273     if(!strncmp("aef_auth", k_buf + 6, 8)) 
04274       {
04275         p += 9;
04276 
04277         if( *p == '\0' )
04278             goto out;
04279 
04280         debug_level = simple_strtoul(p, NULL, 0);
04281         /* only accept 0 or 1 */
04282         if(!debug_level || (debug_level == 1))
04283           {
04284 #ifdef CONFIG_RSBAC_RMSG
04285             rsbac_printk(KERN_INFO
04286                    "debug_proc_write(): setting rsbac_debug_aef_auth to %u\n",
04287                    debug_level);
04288 #endif
04289 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04290             if (!rsbac_nosyslog)
04291 #endif
04292             printk(KERN_INFO
04293                    "debug_proc_write(): setting rsbac_debug_aef_auth to %u\n",
04294                    debug_level);
04295             rsbac_debug_aef_auth = debug_level;
04296             err = count;
04297             goto out;
04298           }
04299         else
04300           {
04301             goto out_inv;
04302           }
04303       }
04304 
04305 /* Boolean debug switch for AUTH decisions / ADF */
04306     /*
04307      * Usage: echo "debug adf_auth #N" > /proc/rsbac_info/debug
04308      *   to set rsbac_debug_adf_auth to given value
04309      */
04310     if(!strncmp("adf_auth", k_buf + 6, 8)) 
04311       {
04312         p += 9;
04313 
04314         if( *p == '\0' )
04315             goto out;
04316 
04317         debug_level = simple_strtoul(p, NULL, 0);
04318         /* only accept 0 or 1 */
04319         if(!debug_level || (debug_level == 1))
04320           {
04321 #ifdef CONFIG_RSBAC_RMSG
04322             rsbac_printk(KERN_INFO
04323                    "debug_proc_write(): setting rsbac_debug_adf_auth to %u\n",
04324                    debug_level);
04325 #endif
04326 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04327             if (!rsbac_nosyslog)
04328 #endif
04329             printk(KERN_INFO
04330                    "debug_proc_write(): setting rsbac_debug_adf_auth to %u\n",
04331                    debug_level);
04332             rsbac_debug_adf_auth = debug_level;
04333             err = count;
04334             goto out;
04335           }
04336         else
04337           {
04338             goto out_inv;
04339           }
04340       }
04341 
04342 #endif
04343 
04344 #if defined(CONFIG_RSBAC_REG) || defined(CONFIG_RSBAC_REG_MAINT)
04345 /* Boolean debug switch for REG */
04346     /*
04347      * Usage: echo "debug reg #N" > /proc/rsbac_info/debug
04348      *   to set rsbac_debug_reg to given value
04349      */
04350     if(!strncmp("reg", k_buf + 6, 3)) 
04351       {
04352         p += 3;
04353 
04354         if( *p == '\0' )
04355             goto out;
04356 
04357         debug_level = simple_strtoul(p, NULL, 0);
04358         /* only accept 0 or 1 */
04359         if(!debug_level || (debug_level == 1))
04360           {
04361 #ifdef CONFIG_RSBAC_RMSG
04362             rsbac_printk(KERN_INFO
04363                    "debug_proc_write(): setting rsbac_debug_reg to %u\n",
04364                    debug_level);
04365 #endif
04366 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04367             if (!rsbac_nosyslog)
04368 #endif
04369             printk(KERN_INFO
04370                    "debug_proc_write(): setting rsbac_debug_reg to %u\n",
04371                    debug_level);
04372             rsbac_debug_reg = debug_level;
04373             err = count;
04374             goto out;
04375           }
04376         else
04377           {
04378             goto out_inv;
04379           }
04380       }
04381 #endif
04382 
04383 #if defined(CONFIG_RSBAC_ACL)
04384 /* Boolean debug switch for ACL data structures */
04385     /*
04386      * Usage: echo "debug ds_acl #N" > /proc/rsbac_info/debug
04387      *   to set rsbac_debug_ds_acl to given value
04388      */
04389     if(!strncmp("ds_acl", k_buf + 6, 6)) 
04390       {
04391         p += 7;
04392 
04393         if( *p == '\0' )
04394             goto out;
04395 
04396         debug_level = simple_strtoul(p, NULL, 0);
04397         /* only accept 0 or 1 */
04398         if(!debug_level || (debug_level == 1))
04399           {
04400 #ifdef CONFIG_RSBAC_RMSG
04401             rsbac_printk(KERN_INFO
04402                    "debug_proc_write(): setting rsbac_debug_ds_acl to %u\n",
04403                    debug_level);
04404 #endif
04405 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04406             if (!rsbac_nosyslog)
04407 #endif
04408             printk(KERN_INFO
04409                    "debug_proc_write(): setting rsbac_debug_ds_acl to %u\n",
04410                    debug_level);
04411             rsbac_debug_ds_acl = debug_level;
04412             err = count;
04413             goto out;
04414           }
04415         else
04416           {
04417             goto out_inv;
04418           }
04419       }
04420 /* Boolean debug switch for ACL syscalls / AEF */
04421     /*
04422      * Usage: echo "debug aef_acl #N" > /proc/rsbac_info/debug
04423      *   to set rsbac_debug_aef_acl to given value
04424      */
04425     if(!strncmp("aef_acl", k_buf + 6, 7)) 
04426       {
04427         p += 8;
04428 
04429         if( *p == '\0' )
04430             goto out;
04431 
04432         debug_level = simple_strtoul(p, NULL, 0);
04433         /* only accept 0 or 1 */
04434         if(!debug_level || (debug_level == 1))
04435           {
04436 #ifdef CONFIG_RSBAC_RMSG
04437             rsbac_printk(KERN_INFO
04438                    "debug_proc_write(): setting rsbac_debug_aef_acl to %u\n",
04439                    debug_level);
04440 #endif
04441 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04442             if (!rsbac_nosyslog)
04443 #endif
04444             printk(KERN_INFO
04445                    "debug_proc_write(): setting rsbac_debug_aef_acl to %u\n",
04446                    debug_level);
04447             rsbac_debug_aef_acl = debug_level;
04448             err = count;
04449             goto out;
04450           }
04451         else
04452           {
04453             goto out_inv;
04454           }
04455       }
04456 
04457 /* Boolean debug switch for ACL decisions / ADF */
04458     /*
04459      * Usage: echo "debug adf_acl #N" > /proc/rsbac_info/debug
04460      *   to set rsbac_debug_adf_acl to given value
04461      */
04462     if(!strncmp("adf_acl", k_buf + 6, 7)) 
04463       {
04464         p += 8;
04465 
04466         if( *p == '\0' )
04467             goto out;
04468 
04469         debug_level = simple_strtoul(p, NULL, 0);
04470         /* only accept 0 or 1 */
04471         if(!debug_level || (debug_level == 1))
04472           {
04473 #ifdef CONFIG_RSBAC_RMSG
04474             rsbac_printk(KERN_INFO
04475                    "debug_proc_write(): setting rsbac_debug_adf_acl to %u\n",
04476                    debug_level);
04477 #endif
04478 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04479             if (!rsbac_nosyslog)
04480 #endif
04481             printk(KERN_INFO
04482                    "debug_proc_write(): setting rsbac_debug_adf_acl to %u\n",
04483                    debug_level);
04484             rsbac_debug_adf_acl = debug_level;
04485             err = count;
04486             goto out;
04487           }
04488         else
04489           {
04490             goto out_inv;
04491           }
04492       }
04493 #endif
04494 
04495 #if defined(CONFIG_RSBAC_JAIL)
04496 /* Boolean debug switch for JAIL syscalls / AEF */
04497     /*
04498      * Usage: echo "debug aef_jail #N" > /proc/rsbac_info/debug
04499      *   to set rsbac_debug_aef_jail to given value
04500      */
04501     if(!strncmp("aef_jail", k_buf + 6, 8)) 
04502       {
04503         p += 9;
04504 
04505         if( *p == '\0' )
04506             goto out;
04507 
04508         debug_level = simple_strtoul(p, NULL, 0);
04509         /* only accept 0 or 1 */
04510         if(!debug_level || (debug_level == 1))
04511           {
04512 #ifdef CONFIG_RSBAC_RMSG
04513             rsbac_printk(KERN_INFO
04514                    "debug_proc_write(): setting rsbac_debug_aef_jail to %u\n",
04515                    debug_level);
04516 #endif
04517 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04518             if (!rsbac_nosyslog)
04519 #endif
04520             printk(KERN_INFO
04521                    "debug_proc_write(): setting rsbac_debug_aef_jail to %u\n",
04522                    debug_level);
04523             rsbac_debug_aef_jail = debug_level;
04524             err = count;
04525             goto out;
04526           }
04527         else
04528           {
04529             goto out_inv;
04530           }
04531       }
04532 
04533 /* Boolean debug switch for JAIL decisions / ADF */
04534     /*
04535      * Usage: echo "debug adf_jail #N" > /proc/rsbac_info/debug
04536      *   to set rsbac_debug_adf_jail to given value
04537      */
04538     if(!strncmp("adf_jail", k_buf + 6, 8)) 
04539       {
04540         p += 9;
04541 
04542         if( *p == '\0' )
04543             goto out;
04544 
04545         debug_level = simple_strtoul(p, NULL, 0);
04546         /* only accept 0 or 1 */
04547         if(!debug_level || (debug_level == 1))
04548           {
04549 #ifdef CONFIG_RSBAC_RMSG
04550             rsbac_printk(KERN_INFO
04551                    "debug_proc_write(): setting rsbac_debug_adf_jail to %u\n",
04552                    debug_level);
04553 #endif
04554 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04555             if (!rsbac_nosyslog)
04556 #endif
04557             printk(KERN_INFO
04558                    "debug_proc_write(): setting rsbac_debug_adf_jail to %u\n",
04559                    debug_level);
04560             rsbac_debug_adf_jail = debug_level;
04561             err = count;
04562             goto out;
04563           }
04564         else
04565           {
04566             goto out_inv;
04567           }
04568       }
04569 #endif
04570 
04571 #if defined(CONFIG_RSBAC_PAX)
04572 /* Boolean debug switch for PAX decisions / ADF */
04573     /*
04574      * Usage: echo "debug adf_pax #N" > /proc/rsbac_info/debug
04575      *   to set rsbac_debug_adf_pax to given value
04576      */
04577     if(!strncmp("adf_pax", k_buf + 6, 7)) 
04578       {
04579         p += 8;
04580 
04581         if( *p == '\0' )
04582             goto out;
04583 
04584         debug_level = simple_strtoul(p, NULL, 0);
04585         /* only accept 0 or 1 */
04586         if(!debug_level || (debug_level == 1))
04587           {
04588 #ifdef CONFIG_RSBAC_RMSG
04589             rsbac_printk(KERN_INFO
04590                    "debug_proc_write(): setting rsbac_debug_adf_pax to %u\n",
04591                    debug_level);
04592 #endif
04593 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04594             if (!rsbac_nosyslog)
04595 #endif
04596             printk(KERN_INFO
04597                    "debug_proc_write(): setting rsbac_debug_adf_pax to %u\n",
04598                    debug_level);
04599             rsbac_debug_adf_pax = debug_level;
04600             err = count;
04601             goto out;
04602           }
04603         else
04604           {
04605             goto out_inv;
04606           }
04607       }
04608 #endif
04609 
04610 #if defined(CONFIG_RSBAC_UM)
04611 /* Boolean debug switch for UM data structures */
04612     /*
04613      * Usage: echo "debug ds_um #N" > /proc/rsbac_info/debug
04614      *   to set rsbac_debug_ds_um to given value
04615      */
04616     if(!strncmp("ds_um", k_buf + 6, 5)) 
04617       {
04618         p += 6;
04619 
04620         if( *p == '\0' )
04621           goto out;
04622 
04623         debug_level = simple_strtoul(p, NULL, 0);
04624         /* only accept 0 or 1 */
04625         if(!debug_level || (debug_level == 1))
04626           {
04627 #ifdef CONFIG_RSBAC_RMSG
04628             rsbac_printk(KERN_INFO
04629                    "debug_proc_write(): setting rsbac_debug_ds_um to %u\n",
04630                    debug_level);
04631 #endif
04632 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04633             if (!rsbac_nosyslog)
04634 #endif
04635             printk(KERN_INFO
04636                    "debug_proc_write(): setting rsbac_debug_ds_um to %u\n",
04637                    debug_level);
04638             rsbac_debug_ds_um = debug_level;
04639             err = count;
04640             goto out;
04641           }
04642         else
04643           {
04644             goto out_inv;
04645           }
04646       }
04647 /* Boolean debug switch for UM syscalls / AEF */
04648     /*
04649      * Usage: echo "debug aef_um #N" > /proc/rsbac_info/debug
04650      *   to set rsbac_debug_aef_um to given value
04651      */
04652     if(!strncmp("aef_um", k_buf + 6, 6)) 
04653       {
04654         p += 7;
04655 
04656         if( *p == '\0' )
04657             goto out;
04658 
04659         debug_level = simple_strtoul(p, NULL, 0);
04660         /* only accept 0 or 1 */
04661         if(!debug_level || (debug_level == 1))
04662           {
04663 #ifdef CONFIG_RSBAC_RMSG
04664             rsbac_printk(KERN_INFO
04665                    "debug_proc_write(): setting rsbac_debug_aef_um to %u\n",
04666                    debug_level);
04667 #endif
04668 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04669             if (!rsbac_nosyslog)
04670 #endif
04671             printk(KERN_INFO
04672                    "debug_proc_write(): setting rsbac_debug_aef_um to %u\n",
04673                    debug_level);
04674             rsbac_debug_aef_um = debug_level;
04675             err = count;
04676             goto out;
04677           }
04678         else
04679           {
04680             goto out_inv;
04681           }
04682       }
04683 
04684 /* Boolean debug switch for UM decisions / ADF */
04685     /*
04686      * Usage: echo "debug adf_um #N" > /proc/rsbac_info/debug
04687      *   to set rsbac_debug_adf_um to given value
04688      */
04689     if(!strncmp("adf_um", k_buf + 6, 6)) 
04690       {
04691         p += 7;
04692 
04693         if( *p == '\0' )
04694             goto out;
04695 
04696         debug_level = simple_strtoul(p, NULL, 0);
04697         /* only accept 0 or 1 */
04698         if(!debug_level || (debug_level == 1))
04699           {
04700 #ifdef CONFIG_RSBAC_RMSG
04701             rsbac_printk(KERN_INFO
04702                    "debug_proc_write(): setting rsbac_debug_adf_um to %u\n",
04703                    debug_level);
04704 #endif
04705 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04706             if (!rsbac_nosyslog)
04707 #endif
04708             printk(KERN_INFO
04709                    "debug_proc_write(): setting rsbac_debug_adf_um to %u\n",
04710                    debug_level);
04711             rsbac_debug_adf_um = debug_level;
04712             err = count;
04713             goto out;
04714           }
04715         else
04716           {
04717             goto out_inv;
04718           }
04719       }
04720 #endif
04721 
04722     /*
04723      * Usage: echo "debug ds #N" > /proc/rsbac_info/debug
04724      *   to set rsbac_debug_ds to given value
04725      */
04726     if(!strncmp("ds", k_buf + 6, 2)) 
04727       {
04728         p += 3;
04729 
04730         if( *p == '\0' )
04731             goto out;
04732 
04733         debug_level = simple_strtoul(p, NULL, 0);
04734         /* only accept 0 or 1 */
04735         if(!debug_level || (debug_level == 1))
04736           {
04737 #ifdef CONFIG_RSBAC_RMSG
04738             rsbac_printk(KERN_INFO
04739                    "debug_proc_write(): setting rsbac_debug_ds to %u\n",
04740                    debug_level);
04741 #endif
04742 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04743             if (!rsbac_nosyslog)
04744 #endif
04745             printk(KERN_INFO
04746                    "debug_proc_write(): setting rsbac_debug_ds to %u\n",
04747                    debug_level);
04748             rsbac_debug_ds = debug_level;
04749             err = count;
04750             goto out;
04751           }
04752         else
04753           {
04754             goto out_inv;
04755           }
04756       }
04757 
04758     /*
04759      * Usage: echo "debug write #N" > /proc/rsbac_info/debug
04760      *   to set rsbac_debug_write to given value
04761      */
04762     if(!strncmp("write", k_buf + 6, 5)) 
04763       {
04764         p += 6;
04765 
04766         if( *p == '\0' )
04767             goto out;
04768 
04769         debug_level = simple_strtoul(p, NULL, 0);
04770         /* only accept 0 or 1 */
04771         if(!debug_level || (debug_level == 1))
04772           {
04773 #ifdef CONFIG_RSBAC_RMSG
04774             rsbac_printk(KERN_INFO
04775                    "debug_proc_write(): setting rsbac_debug_write to %u\n",
04776                    debug_level);
04777 #endif
04778 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04779             if (!rsbac_nosyslog)
04780 #endif
04781             printk(KERN_INFO
04782                    "debug_proc_write(): setting rsbac_debug_write to %u\n",
04783                    debug_level);
04784             rsbac_debug_write = debug_level;
04785             err = count;
04786             goto out;
04787           }
04788         else
04789           {
04790             goto out_inv;
04791           }
04792       }
04793 
04794     /*
04795      * Usage: echo "debug stack #N" > /proc/rsbac_info/debug
04796      *   to set rsbac_debug_stack to given value
04797      */
04798     if(!strncmp("stack", k_buf + 6, 5)) 
04799       {
04800         p += 6;
04801 
04802         if( *p == '\0' )
04803             goto out;
04804 
04805         debug_level = simple_strtoul(p, NULL, 0);
04806         /* only accept 0 or 1 */
04807         if(!debug_level || (debug_level == 1))
04808           {
04809 #ifdef CONFIG_RSBAC_RMSG
04810             rsbac_printk(KERN_INFO
04811                    "debug_proc_write(): setting rsbac_debug_stack to %u\n",
04812                    debug_level);
04813 #endif
04814 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04815             if (!rsbac_nosyslog)
04816 #endif
04817             printk(KERN_INFO
04818                    "debug_proc_write(): setting rsbac_debug_stack to %u\n",
04819                    debug_level);
04820             rsbac_debug_stack = debug_level;
04821             err = count;
04822             goto out;
04823           }
04824         else
04825           {
04826             goto out_inv;
04827           }
04828       }
04829 
04830     /*
04831      * Usage: echo "debug lists #N" > /proc/rsbac_info/debug
04832      *   to set rsbac_debug_lists to given value
04833      */
04834     if(!strncmp("lists", k_buf + 6, 5)) 
04835       {
04836         p += 6;
04837 
04838         if( *p == '\0' )
04839             goto out;
04840 
04841         debug_level = simple_strtoul(p, NULL, 0);
04842         /* only accept 0 or 1 */
04843         if(!debug_level || (debug_level == 1))
04844           {
04845 #ifdef CONFIG_RSBAC_RMSG
04846             rsbac_printk(KERN_INFO
04847                    "debug_proc_write(): setting rsbac_debug_lists to %u\n",
04848                    debug_level);
04849 #endif
04850 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04851             if (!rsbac_nosyslog)
04852 #endif
04853             printk(KERN_INFO
04854                    "debug_proc_write(): setting rsbac_debug_lists to %u\n",
04855                    debug_level);
04856             rsbac_debug_lists = debug_level;
04857             err = count;
04858             goto out;
04859           }
04860         else
04861           {
04862             goto out_inv;
04863           }
04864       }
04865 
04866     /* Boolean debug switch for AEF */
04867     /*
04868      * Usage: echo "debug aef #N" > /proc/rsbac_info/debug
04869      *   to set rsbac_debug_aef to given value
04870      */
04871     if(!strncmp("aef", k_buf + 6, 3)) 
04872       {
04873         p += 4;
04874 
04875         if( *p == '\0' )
04876             goto out;
04877 
04878         debug_level = simple_strtoul(p, NULL, 0);
04879         /* only accept 0 or 1 */
04880         if(!debug_level || (debug_level == 1))
04881           {
04882 #ifdef CONFIG_RSBAC_RMSG
04883             rsbac_printk(KERN_INFO
04884                    "debug_proc_write(): setting rsbac_debug_aef to %u\n",
04885                    debug_level);
04886 #endif
04887 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04888             if (!rsbac_nosyslog)
04889 #endif
04890             printk(KERN_INFO
04891                    "debug_proc_write(): setting rsbac_debug_aef to %u\n",
04892                    debug_level);
04893             rsbac_debug_aef = debug_level;
04894             err = count;
04895             goto out;
04896           }
04897         else
04898           {
04899             goto out_inv;
04900           }
04901       }
04902 
04903 /* Boolean debug switch for NO_WRITE */
04904     /*
04905      * Usage: echo "debug no_write #N" > /proc/rsbac_info/debug
04906      *   to set rsbac_debug_no_write to given value
04907      */
04908     if(!strncmp("no_write", k_buf + 6, 8)) 
04909       {
04910         p += 9;
04911 
04912         if( *p == '\0' )
04913             goto out;
04914 
04915         debug_level = simple_strtoul(p, NULL, 0);
04916         /* only accept 0 or 1 */
04917         if(!debug_level || (debug_level == 1))
04918           {
04919 #ifdef CONFIG_RSBAC_RMSG
04920             rsbac_printk(KERN_INFO
04921                    "debug_proc_write(): setting rsbac_debug_no_write to %u\n",
04922                    debug_level);
04923 #endif
04924 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04925             if (!rsbac_nosyslog)
04926 #endif
04927             printk(KERN_INFO
04928                    "debug_proc_write(): setting rsbac_debug_no_write to %u\n",
04929                    debug_level);
04930             rsbac_debug_no_write = debug_level;
04931             err = count;
04932             goto out;
04933           }
04934         else
04935           {
04936             goto out_inv;
04937           }
04938       }
04939 
04940 #if defined(CONFIG_RSBAC_AUTO_WRITE) && (CONFIG_RSBAC_AUTO_WRITE > 0)
04941     /*
04942      * Usage: echo "debug auto #N" > /proc/rsbac_info/debug
04943      *   to set rsbac_debug_auto to given value
04944      */
04945     if(!strncmp("auto", k_buf + 6, 4)) 
04946       {
04947         p += 5;
04948 
04949         if( *p == '\0' )
04950             goto out;
04951 
04952         debug_level = simple_strtoul(p, NULL, 0);
04953         /* only accept 0 or 1 */
04954         if(!debug_level || (debug_level == 1))
04955           {
04956 #ifdef CONFIG_RSBAC_RMSG
04957             rsbac_printk(KERN_INFO
04958                    "debug_proc_write(): setting rsbac_debug_auto to %u\n",
04959                    debug_level);
04960 #endif
04961 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04962             if (!rsbac_nosyslog)
04963 #endif
04964             printk(KERN_INFO
04965                    "debug_proc_write(): setting rsbac_debug_auto to %u\n",
04966                    debug_level);
04967             rsbac_debug_auto = debug_level;
04968             err = count;
04969             goto out;
04970           }
04971         else
04972           {
04973             goto out_inv;
04974           }
04975       }
04976 #endif /* CONFIG_RSBAC_AUTO_WRITE > 0 */
04977 #endif /* DEBUG */
04978 
04979 out:
04980   free_page((ulong) k_buf);
04981   return(err);
04982 
04983 out_inv:
04984 #ifdef CONFIG_RSBAC_RMSG
04985     rsbac_printk(KERN_INFO
04986                  "debug_proc_write(): rejecting invalid debug level (should be 0 or 1)\n");
04987 #endif
04988 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
04989     if (!rsbac_nosyslog)
04990 #endif
04991       printk(KERN_INFO
04992              "debug_proc_write(): rejecting invalid debug level (should be 0 or 1)\n");
04993     err = -EINVAL;
04994     goto out;
04995   }
04996 #endif /* defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS) */
04997 
04998 #if defined(CONFIG_RSBAC_LOG_REMOTE)
04999 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
05000 /* declare net functions */
05001 long sys_socket(int family, int type, int protocol);
05002 long sys_bind(int fd, struct sockaddr *umyaddr, int addrlen);
05003 long sys_sendto(int fd, void * buff, size_t len, unsigned flags,
05004                 struct sockaddr *addr, int addr_len);
05005 #endif
05006 
05007 #ifndef CONFIG_RSBAC_LOG_REMOTE_SYNC
05008 /* rsbac kernel timer for auto-write */
05009 static void wakeup_rsbaclogd(u_long dummy)
05010   {
05011     wake_up(&rsbaclogd_wait);
05012   }
05013 #endif
05014 
05015 /* rsbac kernel daemon for remote logging */
05016 static int rsbaclogd(void * dummy)
05017   {
05018     struct task_struct *tsk = current;
05019     int err;
05020     int i;
05021     char c;
05022     int sock_fd;
05023     struct sockaddr_in addr;
05024     char * tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
05025     static char remote_send_buf[REMOTE_SEND_BUF_LEN];
05026     mm_segment_t oldfs;
05027 
05028 #ifdef CONFIG_RSBAC_RMSG
05029     rsbac_printk(KERN_INFO "rsbaclogd(): Initializing.\n");
05030 #endif
05031 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05032             if (!rsbac_nosyslog)
05033 #endif
05034     printk(KERN_INFO "rsbaclogd(): Initializing.\n");
05035 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
05036     daemonize("rsbaclogd");
05037 #else
05038     tsk->session = 1;
05039     tsk->pgrp = 1;
05040     strcpy(tsk->comm, "rsbaclogd");
05041 #endif
05042 /*    lock_kernel(); */
05043 
05044 #ifdef CONFIG_RSBAC_DEBUG
05045 #ifdef CONFIG_RSBAC_RMSG
05046     rsbac_printk(KERN_DEBUG "rsbaclogd(): Setting auto timer.\n");
05047 #endif
05048 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05049     if (!rsbac_nosyslog)
05050 #endif
05051     printk(KERN_DEBUG "rsbaclogd(): Setting auto timer.\n");
05052 #endif
05053 #ifndef CONFIG_RSBAC_LOG_REMOTE_SYNC
05054     init_timer(&rsbac_log_remote_timer);
05055     rsbac_log_remote_timer.function = wakeup_rsbaclogd;
05056     rsbac_log_remote_timer.data = 0;
05057     rsbac_log_remote_timer.expires = jiffies + rsbac_log_remote_interval;
05058     add_timer(&rsbac_log_remote_timer);
05059 #endif
05060     interruptible_sleep_on(&rsbaclogd_wait);
05061 
05062     /* create a socket */
05063     sock_fd = sys_socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
05064     if(sock_fd < 0)
05065       {
05066 #ifdef CONFIG_RSBAC_RMSG
05067         rsbac_printk(KERN_WARNING
05068                "rsbaclogd(): creating local log socket failed with error %s, exiting!\n",
05069                get_error_name(tmp, sock_fd));
05070 #endif
05071 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05072         if (!rsbac_nosyslog)
05073 #endif
05074         printk(KERN_WARNING
05075                "rsbaclogd(): creating local log socket failed with error %s, exiting!\n",
05076                get_error_name(tmp, sock_fd));
05077         rsbaclogd_pid = 0;
05078         return -RSBAC_EWRITEFAILED;
05079       }
05080     /* bind local address */
05081     addr.sin_family = PF_INET;
05082     addr.sin_port = htons(CONFIG_RSBAC_LOG_LOCAL_PORT);
05083     err = rsbac_net_str_to_inet(CONFIG_RSBAC_LOG_LOCAL_ADDR,
05084                                 &addr.sin_addr.s_addr);
05085     if(err < 0)
05086       {
05087 #ifdef CONFIG_RSBAC_RMSG
05088         rsbac_printk(KERN_WARNING
05089                "rsbaclogd(): converting local socket address %s failed with error %s, exiting!\n",
05090                CONFIG_RSBAC_LOG_LOCAL_ADDR,
05091                get_error_name(tmp, err));
05092 #endif
05093 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05094         if (!rsbac_nosyslog)
05095 #endif
05096         printk(KERN_WARNING
05097                "rsbaclogd(): converting local socket address %s failed with error %s, exiting!\n",
05098                CONFIG_RSBAC_LOG_LOCAL_ADDR,
05099                get_error_name(tmp, err));
05100         sys_close(sock_fd);
05101         rsbaclogd_pid = 0;
05102         return -RSBAC_EINVALIDVALUE;
05103       }
05104     /* change data segment - sys_bind reads address from user space */
05105     oldfs = get_fs();
05106     set_fs(KERNEL_DS);
05107     err = sys_bind(sock_fd, (struct sockaddr *)&addr, sizeof(addr));
05108     set_fs(oldfs);
05109     if(err < 0)
05110       {
05111 #ifdef CONFIG_RSBAC_RMSG
05112         rsbac_printk(KERN_WARNING
05113                "rsbaclogd(): binding local socket address %u.%u.%u.%u:%u failed with error %s, exiting!\n",
05114                NIPQUAD(addr.sin_addr.s_addr),
05115                CONFIG_RSBAC_LOG_LOCAL_PORT,
05116                get_error_name(tmp, err));
05117 #endif
05118 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05119         if (!rsbac_nosyslog)
05120 #endif
05121         printk(KERN_WARNING
05122                "rsbaclogd(): binding local socket address %u.%u.%u.%u:%u failed with error %s, exiting!\n",
05123                NIPQUAD(addr.sin_addr.s_addr),
05124                CONFIG_RSBAC_LOG_LOCAL_PORT,
05125                get_error_name(tmp, err));
05126         sys_close(sock_fd);
05127         rsbaclogd_pid = 0;
05128         return -RSBAC_EWRITEFAILED;
05129       }
05130 #ifdef CONFIG_RSBAC_DEBUG
05131     if(rsbac_debug_stack)
05132       {
05133         unsigned long * n = (unsigned long *) (current+1);
05134 
05135         while (!*n)
05136           n++;
05137 #ifdef CONFIG_RSBAC_RMSG
05138         rsbac_printk(KERN_DEBUG "rsbaclogd: free stack: %lu\n",
05139                (unsigned long) n - (unsigned long)(current+1));
05140 #endif
05141 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05142         if (!rsbac_nosyslog)
05143 #endif
05144         printk(KERN_DEBUG "rsbaclogd: free stack: %lu\n",
05145                (unsigned long) n - (unsigned long)(current+1));
05146       }
05147 #endif
05148     for(;;)
05149       {
05150         /* wait */
05151 #ifndef CONFIG_RSBAC_LOG_REMOTE_SYNC
05152         /* set new timer (only, if not woken up by rsbac_printk()) */
05153         mod_timer(&rsbac_log_remote_timer, jiffies + rsbac_log_remote_interval);
05154 #endif
05155         interruptible_sleep_on(&rsbaclogd_wait);
05156         /* sleep */
05157 
05158 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
05159         /* Unblock all signals. */
05160         flush_signals(tsk);
05161         spin_lock_irq(&tsk->sighand->siglock);
05162         flush_signal_handlers(tsk, 1);
05163         sigemptyset(&tsk->blocked);
05164         recalc_sigpending();
05165         spin_unlock_irq(&tsk->sighand->siglock);
05166 #else
05167         spin_lock_irq(&tsk->sigmask_lock);
05168         flush_signals(tsk);
05169         sigfillset(&tsk->blocked);
05170         recalc_sigpending(tsk);
05171         spin_unlock_irq(&tsk->sigmask_lock);
05172 #endif
05173 /*
05174 #ifdef CONFIG_RSBAC_DEBUG
05175         if (rsbac_debug_auto)
05176           {
05177 #ifdef CONFIG_RSBAC_RMSG
05178             rsbac_printk(KERN_DEBUG
05179                    "rsbacd(): calling rsbac_write()\n");
05180 #endif
05181 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05182             if (!rsbac_nosyslog)
05183 #endif
05184             printk(KERN_DEBUG
05185                    "rsbacd(): calling rsbac_write()\n");
05186           }
05187 #endif
05188 */
05189 
05190         /* Do nothing without remote address */
05191         if(!rsbac_log_remote_addr || !rsbac_log_remote_port)
05192           continue;
05193 
05194         while(remote_log_start != remote_log_end)
05195           {
05196             /* Target address might have changed */
05197             addr.sin_family = PF_INET;
05198             addr.sin_port = rsbac_log_remote_port;
05199             addr.sin_addr.s_addr = rsbac_log_remote_addr;
05200             i = 0;
05201             c = 0;
05202             spin_lock_irq(&rsbac_log_remote_lock);
05203             while (   (remote_log_start != remote_log_end)
05204                    && (i < sizeof(remote_send_buf))
05205                    && (c != '\n')
05206                   )
05207               {
05208                 c = REMOTE_RLOG_BUF(remote_log_start);
05209                 remote_log_start++;
05210                 remote_logged_chars--;
05211                 remote_send_buf[i] = c;
05212 //                spin_unlock_irq(&rsbac_log_remote_lock);
05213                 i++;
05214 //                spin_lock_irq(&rsbac_log_remote_lock);
05215               }
05216             spin_unlock_irq(&rsbac_log_remote_lock);
05217 
05218             /* change data segment - sys_sendto reads data and address from user space */
05219             oldfs = get_fs();
05220             set_fs(KERNEL_DS);
05221             err = sys_sendto(sock_fd,
05222                              remote_send_buf,
05223                              i,
05224                              MSG_DONTWAIT,
05225                              (struct sockaddr *)&addr,
05226                              sizeof(addr));
05227             set_fs(oldfs);
05228             if(   (err < 0)
05229 //               && (err != -EPERM)
05230               )
05231               {
05232 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05233                 if (!rsbac_nosyslog)
05234 #endif
05235                 printk(KERN_WARNING
05236                        "rsbaclogd(): sending to remote socket address %u.%u.%u.%u:%u failed with error %i!\n",
05237                        NIPQUAD(addr.sin_addr.s_addr),
05238                        CONFIG_RSBAC_LOG_REMOTE_PORT,
05239                        err);
05240                 continue;
05241               }
05242           }
05243       }
05244   }
05245 #endif
05246 
05247 static int ll_conv(
05248         void * old_desc,
05249         void * old_data,
05250         void * new_desc,
05251         void * new_data)
05252   {
05253     rsbac_log_entry_t     * new_aci = new_data;
05254     rsbac_old_log_entry_t * old_aci = old_data;
05255     int i;
05256 
05257     memcpy(new_desc, old_desc, sizeof(rsbac_adf_request_int_t));
05258     for(i=0; i < T_NONE - 1; i++)
05259       (*new_aci)[i] = (*old_aci)[i];
05260     (*new_aci)[T_NONE - 1] = LL_denied;
05261     (*new_aci)[T_NONE] = (*old_aci)[T_NONE - 1];
05262     return 0;
05263   }
05264 
05265 rsbac_list_conv_function_t * ll_get_conv(rsbac_version_t old_version)
05266   {
05267     switch(old_version)
05268       {
05269         case RSBAC_LOG_LEVEL_OLD_VERSION:
05270           return ll_conv;
05271         default:
05272           return NULL;
05273       }
05274   }
05275 
05276 
05277 /********************************/
05278 /*             Init             */
05279 /********************************/
05280 
05281 #ifdef CONFIG_RSBAC_INIT_DELAY
05282 inline void rsbac_init_debug(void)
05283 #else
05284 inline void __init rsbac_init_debug(void)
05285 #endif
05286   {
05287     int i;
05288     #if defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS)
05289     struct proc_dir_entry * tmp_entry_p;
05290     #endif
05291     
05292     if (!debug_initialized)
05293       {
05294         struct rsbac_list_info_t * info_p;
05295         int tmperr;
05296         rsbac_enum_t * def_data_p;
05297 
05298 #ifdef CONFIG_RSBAC_RMSG
05299         rsbac_printk(KERN_INFO "rsbac_init_debug(): Initializing\n");
05300 #endif
05301 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05302         if (!rsbac_nosyslog)
05303 #endif
05304         printk(KERN_INFO "rsbac_init_debug(): Initializing\n");
05305 #if 0 && defined(CONFIG_RSBAC_RMSG)
05306         /* init rsbac_log_lock */
05307         spin_lock_init(&rsbac_log_lock);
05308 #endif
05309         info_p = rsbac_kmalloc(sizeof(*info_p));
05310         if(!info_p)
05311           {
05312             memset(rsbac_log_levels, LL_denied, sizeof(rsbac_log_levels));
05313             return;
05314           }
05315         def_data_p = rsbac_kmalloc(sizeof(rsbac_log_entry_t));
05316         if(!def_data_p)
05317           {
05318             memset(rsbac_log_levels, LL_denied, sizeof(rsbac_log_levels));
05319             rsbac_kfree(info_p);
05320             return;
05321           }
05322         /* register log_levels list */
05323         for(i=0; i<=T_NONE; i++)
05324           def_data_p[i] = LL_denied;
05325         info_p->version = RSBAC_LOG_LEVEL_VERSION;
05326         info_p->key = RSBAC_LOG_LEVEL_KEY;
05327         info_p->desc_size = sizeof(rsbac_adf_request_int_t);
05328         info_p->data_size = sizeof(rsbac_log_entry_t);
05329         info_p->max_age = 0;
05330         tmperr = rsbac_list_register(RSBAC_LIST_VERSION,
05331                                      &log_levels_handle,
05332                                      info_p,
05333                                      RSBAC_LIST_PERSIST | RSBAC_LIST_DEF_DATA,
05334                                      NULL,
05335                                      ll_get_conv,
05336                                      def_data_p,
05337                                      RSBAC_LOG_LEVEL_LIST_NAME,
05338                                      RSBAC_AUTO_DEV);
05339         if(tmperr)
05340           {
05341             char * tmp;
05342 
05343             tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
05344             if(tmp)
05345               {
05346                 printk(KERN_WARNING
05347                        "rsbac_init_debug(): registering log levels list ll failed with error %s!\n",
05348                        get_error_name(tmp, tmperr));
05349                 rsbac_kfree(tmp);
05350               }
05351             memset(rsbac_log_levels, LL_denied, sizeof(rsbac_log_levels));
05352           }
05353         else
05354           {
05355             rsbac_adf_request_int_t req;
05356 
05357             for(req = 0; req < R_NONE; req++)
05358               rsbac_list_get_data(log_levels_handle, &req, rsbac_log_levels[req]);
05359           }
05360 
05361         #if defined(CONFIG_RSBAC_PROC) && defined(CONFIG_PROC_FS)
05362         tmp_entry_p = create_proc_entry("log_levels",
05363                                         S_IFREG | S_IRUGO | S_IWUGO,
05364                                         proc_rsbac_root_p);
05365         if(tmp_entry_p)
05366           {
05367             tmp_entry_p->get_info = log_levels_proc_info;
05368             tmp_entry_p->write_proc = log_levels_proc_write;
05369           }
05370 
05371         tmp_entry_p = create_proc_entry("debug",
05372                                         S_IFREG | S_IRUGO | S_IWUGO,
05373                                         proc_rsbac_root_p);
05374         if(tmp_entry_p)
05375           {
05376             tmp_entry_p->get_info = debug_proc_info;
05377             tmp_entry_p->write_proc = debug_proc_write;
05378           }
05379 
05380         #if defined(CONFIG_RSBAC_RMSG)
05381         tmp_entry_p = create_proc_entry("rmsg",
05382                                         S_IFREG | S_IRUGO,
05383                                         proc_rsbac_root_p);
05384         if(tmp_entry_p)
05385           {
05386             tmp_entry_p->proc_fops = &proc_rmsg_operations;
05387           }
05388         #endif
05389         #endif
05390 
05391         #if defined(CONFIG_RSBAC_LOG_REMOTE)
05392         /* init rsbac_console lock */
05393 //        spin_lock_init(&rsbac_log_remote_lock);
05394         /* init the rsbaclogd wait queue head */
05395 //        init_waitqueue_head(&rsbaclogd_wait);
05396         /* Start rsbac logging thread for auto write */
05397         if(!rsbac_log_remote_port)
05398           rsbac_log_remote_port = htons(CONFIG_RSBAC_LOG_REMOTE_PORT);
05399         tmperr = rsbac_net_str_to_inet(rsbac_log_remote_addr_string,
05400                                     &rsbac_log_remote_addr);
05401         if(tmperr < 0)
05402           {
05403             char * tmp = rsbac_kmalloc(RSBAC_MAXNAMELEN);
05404 
05405             if(tmp)
05406               {
05407                 get_error_name(tmp, tmperr);
05408 #ifdef CONFIG_RSBAC_RMSG
05409                 rsbac_printk(KERN_WARNING
05410                              "rsbac_init_debug(): converting remote socket address %s failed with error %s, exiting!\n",
05411                              rsbac_log_remote_addr_string,
05412                              tmp);
05413 #endif
05414 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05415                 if (!rsbac_nosyslog)
05416 #endif
05417                   printk(KERN_WARNING
05418                          "rsbac_init_debug(): converting remote socket address %s failed with error %s, exiting!\n",
05419                          rsbac_log_remote_addr_string,
05420                          tmp);
05421                 rsbac_log_remote_addr = 0;
05422                 rsbac_kfree(tmp);
05423               }
05424           }
05425         rsbaclogd_pid = kernel_thread(rsbaclogd, NULL, 0);
05426 #ifdef CONFIG_RSBAC_RMSG
05427         rsbac_printk(KERN_INFO "rsbac_init_debug(): Started rsbaclogd thread with pid %u\n",
05428                rsbaclogd_pid);
05429 #endif
05430 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05431         if (!rsbac_nosyslog)
05432 #endif
05433         printk(KERN_INFO "rsbac_init_debug(): Started rsbaclogd thread with pid %u\n",
05434                rsbaclogd_pid);
05435         #endif
05436 
05437         debug_initialized = TRUE;
05438       }
05439 
05440 #ifdef CONFIG_RSBAC_RMSG
05441     #ifdef CONFIG_RSBAC_SOFTMODE
05442     if(rsbac_softmode)
05443       rsbac_printk(KERN_DEBUG "rsbac_softmode is set\n");
05444     if(rsbac_softmode_prohibit)
05445       rsbac_printk(KERN_DEBUG "rsbac_softmode_prohibit is set\n");
05446     #endif
05447     #ifdef CONFIG_RSBAC_FREEZE
05448     if(rsbac_freeze)
05449       rsbac_printk(KERN_DEBUG "rsbac_freeze is set\n");
05450     #endif
05451     #if defined(CONFIG_RSBAC_UM_EXCL)
05452     if(rsbac_um_no_excl)
05453       rsbac_printk(KERN_DEBUG "rsbac_um_no_excl is set\n");
05454     #endif
05455     #if defined(CONFIG_RSBAC_DAZ_CACHE)
05456     rsbac_printk(KERN_DEBUG "rsbac_daz_ttl is %u\n",
05457                  rsbac_daz_get_ttl());
05458     #endif
05459     #if defined(CONFIG_RSBAC_AUTH_LEARN)
05460     if(rsbac_auth_learn)
05461       rsbac_printk(KERN_DEBUG "rsbac_auth_learn is set\n");
05462     #endif
05463     #if defined(CONFIG_RSBAC_ACL_LEARN)
05464     if(rsbac_acl_learn_fd)
05465       rsbac_printk(KERN_DEBUG "rsbac_acl_learn_fd is set\n");
05466     #endif
05467     #ifdef CONFIG_RSBAC_CAP_PROC_HIDE
05468     if(rsbac_cap_process_hiding)
05469       rsbac_printk(KERN_DEBUG "rsbac_cap_process_hiding is set\n");
05470     #endif
05471     #ifdef CONFIG_RSBAC_CAP_LOG_MISSING
05472     if(rsbac_cap_log_missing)
05473       rsbac_printk(KERN_DEBUG "rsbac_cap_log_missing is set\n");
05474     #endif
05475     #ifdef CONFIG_RSBAC_ALLOW_DAC_DISABLE_FULL
05476     if(rsbac_dac_disable)
05477       rsbac_printk(KERN_DEBUG "rsbac_dac_disable is set\n");
05478     #endif
05479     #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05480     if(rsbac_nosyslog)
05481       rsbac_printk(KERN_DEBUG "rsbac_nosyslog is set\n");
05482     #endif
05483     #ifdef CONFIG_RSBAC_INIT_DELAY
05484     if(rsbac_no_delay_init)
05485       rsbac_printk(KERN_DEBUG "rsbac_no_delay_init is set\n");
05486 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
05487     if(rsbac_delayed_root_str[0])
05488       rsbac_printk(KERN_DEBUG "rsbac_delayed_root is %s\n",
05489              rsbac_delayed_root_str);
05490 #else
05491     if(rsbac_delayed_root)
05492       rsbac_printk(KERN_DEBUG "rsbac_delayed_root is %02u:%02u\n",
05493              MAJOR(rsbac_delayed_root), MINOR(rsbac_delayed_root));
05494 #endif
05495     #endif
05496     if(rsbac_no_defaults)
05497       rsbac_printk(KERN_DEBUG "rsbac_no_defaults is set\n");
05498 
05499 #if defined(CONFIG_RSBAC_DEBUG)
05500     if(rsbac_debug_ds)
05501       rsbac_printk(KERN_DEBUG "rsbac_debug_ds is set\n");
05502     if(rsbac_debug_write)
05503       rsbac_printk(KERN_DEBUG "rsbac_debug_write is set\n");
05504     if(rsbac_debug_no_write)
05505       rsbac_printk(KERN_DEBUG "rsbac_debug_no_write is set\n");
05506     if(rsbac_debug_stack)
05507       rsbac_printk(KERN_DEBUG "rsbac_debug_stack is set\n");
05508     if(rsbac_debug_lists)
05509       rsbac_printk(KERN_DEBUG "rsbac_debug_lists is set\n");
05510     if(rsbac_debug_aef)
05511       rsbac_printk(KERN_DEBUG "rsbac_debug_aef is set\n");
05512     if(rsbac_debug_adf_default != 1)
05513       rsbac_printk(KERN_DEBUG "rsbac_debug_adf_default is set to %i\n",
05514              rsbac_debug_adf_default);
05515 
05516     #if defined(CONFIG_RSBAC_REG)
05517     if(rsbac_debug_reg)
05518       rsbac_printk(KERN_DEBUG "rsbac_debug_reg is set\n");
05519     #endif
05520 
05521     #if defined(CONFIG_RSBAC_NET)
05522     if(rsbac_debug_ds_net)
05523       rsbac_printk(KERN_DEBUG "rsbac_debug_ds_net is set\n");
05524     if(rsbac_debug_aef_net)
05525       rsbac_printk(KERN_DEBUG "rsbac_debug_aef_net is set\n");
05526     if(rsbac_debug_adf_net)
05527       rsbac_printk(KERN_DEBUG "rsbac_debug_adf_net is set\n");
05528     #endif
05529 
05530     #if defined(CONFIG_RSBAC_MAC)
05531     if(rsbac_debug_ds_mac)
05532       rsbac_printk(KERN_DEBUG "rsbac_debug_ds_mac is set\n");
05533     if(rsbac_debug_aef_mac)
05534       rsbac_printk(KERN_DEBUG "rsbac_debug_aef_mac is set\n");
05535     if(rsbac_debug_adf_mac)
05536       rsbac_printk(KERN_DEBUG "rsbac_debug_adf_mac is set\n");
05537     #endif
05538 
05539     #if defined(CONFIG_RSBAC_PM)
05540     if(rsbac_debug_ds_pm)
05541       rsbac_printk(KERN_DEBUG "rsbac_debug_ds_pm is set\n");
05542     if(rsbac_debug_aef_pm)
05543       rsbac_printk(KERN_DEBUG "rsbac_debug_aef_pm is set\n");
05544     if(rsbac_debug_adf_pm)
05545       rsbac_printk(KERN_DEBUG "rsbac_debug_adf_pm is set\n");
05546     #endif
05547 
05548     #if defined(CONFIG_RSBAC_DAZ)
05549     if(rsbac_debug_adf_daz)
05550       rsbac_printk(KERN_DEBUG "rsbac_debug_adf_daz is set\n");
05551     #endif
05552 
05553     #if defined(CONFIG_RSBAC_RC)
05554     if(rsbac_debug_ds_rc)
05555       rsbac_printk(KERN_DEBUG "rsbac_debug_ds_rc is set\n");
05556     if(rsbac_debug_aef_rc)
05557       rsbac_printk(KERN_DEBUG "rsbac_debug_aef_rc is set\n");
05558     if(rsbac_debug_adf_rc)
05559       rsbac_printk(KERN_DEBUG "rsbac_debug_adf_rc is set\n");
05560     #endif
05561 
05562     #if defined(CONFIG_RSBAC_AUTH)
05563     if(rsbac_debug_ds_auth)
05564       rsbac_printk(KERN_DEBUG "rsbac_debug_ds_auth is set\n");
05565     if(rsbac_debug_aef_auth)
05566       rsbac_printk(KERN_DEBUG "rsbac_debug_aef_auth is set\n");
05567     if(rsbac_debug_adf_auth)
05568       rsbac_printk(KERN_DEBUG "rsbac_debug_adf_auth is set\n");
05569     #endif
05570 
05571     #if defined(CONFIG_RSBAC_ACL)
05572     if(rsbac_debug_ds_acl)
05573       rsbac_printk(KERN_DEBUG "rsbac_debug_ds_acl is set\n");
05574     if(rsbac_debug_aef_acl)
05575       rsbac_printk(KERN_DEBUG "rsbac_debug_aef_acl is set\n");
05576     if(rsbac_debug_adf_acl)
05577       rsbac_printk(KERN_DEBUG "rsbac_debug_adf_acl is set\n");
05578     #endif
05579 
05580     #if defined(CONFIG_RSBAC_JAIL)
05581     if(rsbac_debug_aef_jail)
05582       rsbac_printk(KERN_DEBUG "rsbac_debug_aef_jail is set\n");
05583     if(rsbac_debug_adf_jail)
05584       rsbac_printk(KERN_DEBUG "rsbac_debug_adf_jail is set\n");
05585     #endif
05586 
05587     #if defined(CONFIG_RSBAC_PAX)
05588     if(rsbac_debug_adf_pax)
05589       rsbac_printk(KERN_DEBUG "rsbac_debug_adf_pax is set\n");
05590     #endif
05591 
05592     #if defined(CONFIG_RSBAC_UM)
05593     if(rsbac_debug_ds_um)
05594       rsbac_printk(KERN_DEBUG "rsbac_debug_ds_um is set\n");
05595     if(rsbac_debug_aef_um)
05596       rsbac_printk(KERN_DEBUG "rsbac_debug_aef_um is set\n");
05597     if(rsbac_debug_adf_um)
05598       rsbac_printk(KERN_DEBUG "rsbac_debug_adf_um is set\n");
05599     #endif
05600 
05601     #if defined(CONFIG_RSBAC_AUTO_WRITE) && (CONFIG_RSBAC_AUTO_WRITE > 0)
05602     if(rsbac_debug_auto)
05603       rsbac_printk(KERN_DEBUG "rsbac_debug_auto is set\n");
05604     #endif
05605 #endif /* DEBUG */
05606 #endif /* RMSG */
05607 
05608 #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05609     if (!rsbac_nosyslog)
05610 #endif
05611     {
05612     #ifdef CONFIG_RSBAC_SOFTMODE
05613     if(rsbac_softmode)
05614       printk(KERN_DEBUG "rsbac_softmode is set\n");
05615     if(rsbac_softmode_prohibit)
05616       printk(KERN_DEBUG "rsbac_softmode_prohibit is set\n");
05617     #endif
05618     #ifdef CONFIG_RSBAC_FREEZE
05619     if(rsbac_freeze)
05620       printk(KERN_DEBUG "rsbac_freeze is set\n");
05621     #endif
05622     #if defined(CONFIG_RSBAC_UM_EXCL)
05623     if(rsbac_um_no_excl)
05624       printk(KERN_DEBUG "rsbac_um_no_excl is set\n");
05625     #endif
05626     #if defined(CONFIG_RSBAC_DAZ_CACHE)
05627     printk(KERN_DEBUG "rsbac_daz_ttl is %u\n",
05628           rsbac_daz_get_ttl());
05629     #endif
05630     #if defined(CONFIG_RSBAC_AUTH_LEARN)
05631     if(rsbac_auth_learn)
05632       printk(KERN_DEBUG "rsbac_auth_learn is set\n");
05633     #endif
05634     #if defined(CONFIG_RSBAC_ACL_LEARN)
05635     if(rsbac_acl_learn_fd)
05636       printk(KERN_DEBUG "rsbac_acl_learn_fd is set\n");
05637     #endif
05638     #ifdef CONFIG_RSBAC_CAP_PROC_HIDE
05639     if(rsbac_cap_process_hiding)
05640       printk(KERN_DEBUG "rsbac_cap_process_hiding is set\n");
05641     #endif
05642     #ifdef CONFIG_RSBAC_CAP_LOG_MISSING
05643     if(rsbac_cap_log_missing)
05644       printk(KERN_DEBUG "rsbac_cap_log_missing is set\n");
05645     #endif
05646     #ifdef CONFIG_RSBAC_ALLOW_DAC_DISABLE_FULL
05647     if(rsbac_dac_disable)
05648       printk(KERN_DEBUG "rsbac_dac_disable is set\n");
05649     #endif
05650     #ifdef CONFIG_RSBAC_RMSG_NOSYSLOG
05651     if(rsbac_nosyslog)
05652       printk(KERN_DEBUG "rsbac_nosyslog is set\n");
05653     #endif
05654     #ifdef CONFIG_RSBAC_INIT_DELAY
05655     if(rsbac_no_delay_init)
05656       printk(KERN_DEBUG "rsbac_no_delay_init is set\n");
05657 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
05658     if(rsbac_delayed_root_str[0])
05659       printk(KERN_DEBUG "rsbac_delayed_root is %s\n",
05660              rsbac_delayed_root_str);
05661 #else
05662     if(rsbac_delayed_root)
05663       printk(KERN_DEBUG "rsbac_delayed_root is %02u:%02u\n",
05664              MAJOR(rsbac_delayed_root), MINOR(rsbac_delayed_root));
05665 #endif
05666     #endif
05667     if(rsbac_no_defaults)
05668       printk(KERN_DEBUG "rsbac_no_defaults is set\n");
05669 
05670 #if defined(CONFIG_RSBAC_DEBUG)
05671     if(rsbac_debug_ds)
05672       printk(KERN_DEBUG "rsbac_debug_ds is set\n");
05673     if(rsbac_debug_write)
05674       printk(KERN_DEBUG "rsbac_debug_write is set\n");
05675     if(rsbac_debug_no_write)
05676       printk(KERN_DEBUG "rsbac_debug_no_write is set\n");
05677     if(rsbac_debug_stack)
05678       printk(KERN_DEBUG "rsbac_debug_stack is set\n");
05679     if(rsbac_debug_lists)
05680       printk(KERN_DEBUG "rsbac_debug_lists is set\n");
05681     if(rsbac_debug_aef)
05682       printk(KERN_DEBUG "rsbac_debug_aef is set\n");
05683     if(rsbac_debug_adf_default != 1)
05684       printk(KERN_DEBUG "rsbac_debug_adf_default is set to %i\n",
05685              rsbac_debug_adf_default);
05686 
05687     #if defined(CONFIG_RSBAC_REG) || defined(CONFIG_RSBAC_REG_MAINT)
05688     if(rsbac_debug_reg)
05689       printk(KERN_DEBUG "rsbac_debug_reg is set\n");
05690     #endif
05691 
05692     #if defined(CONFIG_RSBAC_NET)
05693     if(rsbac_debug_ds_net)
05694       printk(KERN_DEBUG "rsbac_debug_ds_net is set\n");
05695     if(rsbac_debug_aef_net)
05696       printk(KERN_DEBUG "rsbac_debug_aef_net is set\n");
05697     if(rsbac_debug_adf_net)
05698       printk(KERN_DEBUG "rsbac_debug_adf_net is set\n");
05699     #endif
05700 
05701     #if defined(CONFIG_RSBAC_MAC)
05702     if(rsbac_debug_ds_mac)
05703       printk(KERN_DEBUG "rsbac_debug_ds_mac is set\n");
05704     if(rsbac_debug_aef_mac)
05705       printk(KERN_DEBUG "rsbac_debug_aef_mac is set\n");
05706     if(rsbac_debug_adf_mac)
05707       printk(KERN_DEBUG "rsbac_debug_adf_mac is set\n");
05708     #endif
05709 
05710     #if defined(CONFIG_RSBAC_PM) || defined(CONFIG_RSBAC_PM_MAINT)
05711     if(rsbac_debug_ds_pm)
05712       printk(KERN_DEBUG "rsbac_debug_ds_pm is set\n");
05713     if(rsbac_debug_aef_pm)
05714       printk(KERN_DEBUG "rsbac_debug_aef_pm is set\n");
05715     if(rsbac_debug_adf_pm)
05716       printk(KERN_DEBUG "rsbac_debug_adf_pm is set\n");
05717     #endif
05718 
05719     #if defined(CONFIG_RSBAC_DAZ)
05720     if(rsbac_debug_adf_daz)
05721       printk(KERN_DEBUG "rsbac_debug_adf_daz is set\n");
05722     #endif
05723 
05724     #if defined(CONFIG_RSBAC_RC) || defined(CONFIG_RSBAC_RC_MAINT)
05725     if(rsbac_debug_ds_rc)
05726       printk(KERN_DEBUG "rsbac_debug_ds_rc is set\n");
05727     if(rsbac_debug_aef_rc)
05728       printk(KERN_DEBUG "rsbac_debug_aef_rc is set\n");
05729     if(rsbac_debug_adf_rc)
05730       printk(KERN_DEBUG "rsbac_debug_adf_rc is set\n");
05731     #endif
05732 
05733     #if defined(CONFIG_RSBAC_AUTH) || defined(CONFIG_RSBAC_AUTH_MAINT)
05734     if(rsbac_debug_ds_auth)
05735       printk(KERN_DEBUG "rsbac_debug_ds_auth is set\n");
05736     if(rsbac_debug_aef_auth)
05737       printk(KERN_DEBUG "rsbac_debug_aef_auth is set\n");
05738     if(rsbac_debug_adf_auth)
05739       printk(KERN_DEBUG "rsbac_debug_adf_auth is set\n");
05740     #endif
05741 
05742     #if defined(CONFIG_RSBAC_ACL) || defined(CONFIG_RSBAC_ACL_MAINT)
05743     if(rsbac_debug_ds_acl)
05744       printk(KERN_DEBUG "rsbac_debug_ds_acl is set\n");
05745     if(rsbac_debug_aef_acl)
05746       printk(KERN_DEBUG "rsbac_debug_aef_acl is set\n");
05747     if(rsbac_debug_adf_acl)
05748       printk(KERN_DEBUG "rsbac_debug_adf_acl is set\n");
05749     #endif
05750 
05751     #if defined(CONFIG_RSBAC_JAIL)
05752     if(rsbac_debug_aef_jail)
05753       printk(KERN_DEBUG "rsbac_debug_aef_jail is set\n");
05754     if(rsbac_debug_adf_jail)
05755       printk(KERN_DEBUG "rsbac_debug_adf_jail is set\n");
05756     #endif
05757 
05758     #if defined(CONFIG_RSBAC_PAX)
05759     if(rsbac_debug_adf_pax)
05760       printk(KERN_DEBUG "rsbac_debug_adf_pax is set\n");
05761     #endif
05762 
05763     #if defined(CONFIG_RSBAC_UM)
05764     if(rsbac_debug_ds_um)
05765       printk(KERN_DEBUG "rsbac_debug_ds_um is set\n");
05766     if(rsbac_debug_aef_um)
05767       printk(KERN_DEBUG "rsbac_debug_aef_um is set\n");
05768     if(rsbac_debug_adf_um)
05769       printk(KERN_DEBUG "rsbac_debug_adf_um is set\n");
05770     #endif
05771 
05772     #if defined(CONFIG_RSBAC_AUTO_WRITE) && (CONFIG_RSBAC_AUTO_WRITE > 0)
05773     if(rsbac_debug_auto)
05774       printk(KERN_DEBUG "rsbac_debug_auto is set\n");
05775     #endif
05776 #endif /* DEBUG */
05777     }
05778   };
05779 

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