Patches from bug #267 Enhancements for rlm_perl
authorbjordanov <bjordanov>
Mon, 29 Aug 2005 12:44:44 +0000 (12:44 +0000)
committerbjordanov <bjordanov>
Mon, 29 Aug 2005 12:44:44 +0000 (12:44 +0000)
example.pl - added functions in example for pre_proxy, post_proxy and post_auth
rlm_perl.c - added cleanup for pre_proxy, post_proxy and post_auth

src/modules/rlm_perl/example.pl
src/modules/rlm_perl/rlm_perl.c

index f9714ff..96d5fd2 100644 (file)
@@ -37,7 +37,7 @@ use Data::Dumper;
 #my %RAD_CHECK;
 
 #
-# This the remaping of return values 
+# This the remapping of return values 
 #
        use constant    RLM_MODULE_REJECT=>    0;#  /* immediately reject the request */
        use constant    RLM_MODULE_FAIL=>      1;#  /* module failed, don't reply */
@@ -105,6 +105,30 @@ sub checksimul {
        return RLM_MODULE_OK;
 }
 
+# Function to handle pre_proxy
+sub pre_proxy {
+       # For debugging purposes only
+#      &log_request_attributes;
+
+       return RLM_MODULE_OK;
+}
+
+# Function to handle post_proxy
+sub post_proxy {
+       # For debugging purposes only
+#      &log_request_attributes;
+
+       return RLM_MODULE_OK;
+}
+
+# Function to handle post_auth
+sub post_auth {
+       # For debugging purposes only
+#      &log_request_attributes;
+
+       return RLM_MODULE_OK;
+}
+
 # Function to handle xlat
 sub xlat {
        # For debugging purposes only
index 7923992..f8cacbb 100644 (file)
@@ -1273,6 +1273,9 @@ static int perl_detach(void *instance)
        if (inst->func_accounting) free(inst->func_accounting);
        if (inst->func_preacct) free(inst->func_preacct);
        if (inst->func_checksimul) free(inst->func_checksimul);
+       if (inst->func_pre_proxy) free(inst->func_pre_proxy);
+       if (inst->func_post_proxy) free(inst->func_post_proxy);
+       if (inst->func_post_auth) free(inst->func_post_auth);
        if (inst->func_detach) free(inst->func_detach);
 
 #ifdef USE_ITHREADS
@@ -1309,13 +1312,13 @@ module_t rlm_perl = {
        perl_instantiate,               /* instantiation */
        perl_detach,                    /* detach */
        {
-               perl_authenticate,
-               perl_authorize,
-               perl_preacct,
-               perl_accounting,
+               perl_authenticate,      /* authenticate */
+               perl_authorize,         /* authorize */
+               perl_preacct,           /* preacct */
+               perl_accounting,        /* accounting */
                perl_checksimul,        /* check simul */
-               perl_pre_proxy,  /* pre-proxy */
+               perl_pre_proxy,         /* pre-proxy */
                perl_post_proxy,        /* post-proxy */
-               perl_post_auth    /* post-auth */
+               perl_post_auth          /* post-auth */
        },
 };