--- radiusd/src/modules/rlm_perl/rlm_perl.c.orig	Thu Jul  3 13:49:38 2003
+++ radiusd/src/modules/rlm_perl/rlm_perl.c	Thu Jul  3 14:00:38 2003
@@ -72,6 +72,9 @@
 	char	*func_stop_accounting;
 	char	*func_preacct;
 	char	*func_checksimul;
+	char	*func_preproxy;
+	char	*func_postproxy;
+	char	*func_postauth;
 	char	*func_detach;
 	char	*func_xlat;
 	char	*xlat_name;
@@ -99,6 +102,12 @@
 	  offsetof(PERL_INST,func_preacct), NULL, "preacct"},
 	{ "func_checksimul", PW_TYPE_STRING_PTR,
 	  offsetof(PERL_INST,func_checksimul), NULL, "checksimul"},
+	{ "func_preproxy", PW_TYPE_STRING_PTR,
+	  offsetof(PERL_INST,func_preproxy), NULL, "preproxy"},
+	{ "func_postproxy", PW_TYPE_STRING_PTR,
+	  offsetof(PERL_INST,func_postproxy), NULL, "postproxy"},
+	{ "func_postauth", PW_TYPE_STRING_PTR,
+	  offsetof(PERL_INST,func_postauth), NULL, "postauth"},
 	{ "func_detach", PW_TYPE_STRING_PTR,
 	  offsetof(PERL_INST,func_detach), NULL, "detach"},
 	{ "func_xlat", PW_TYPE_STRING_PTR,
@@ -1053,6 +1062,33 @@
 }
 
 /*
+ *	Allow perl magic in pre-proxy
+ */
+static int perl_preproxy(void *instance, REQUEST *request)
+{
+	return rlmperl_call(instance, request,
+			((PERL_INST *)instance)->func_preproxy);
+}
+
+/*
+ *	Allow perl magic in post-proxy
+ */
+static int perl_postproxy(void *instance, REQUEST *request)
+{
+	return rlmperl_call(instance, request,
+			((PERL_INST *)instance)->func_postproxy);
+}
+
+/*
+ *	Allow perl magic in post-auth
+ */
+static int perl_postauth(void *instance, REQUEST *request)
+{
+	return rlmperl_call(instance, request,
+			((PERL_INST *)instance)->func_postauth);
+}
+
+/*
  * Detach a instance give a chance to a module to make some internal setup ... 
  */
 static int perl_detach(void *instance)
@@ -1138,6 +1174,9 @@
 	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_preproxy) free(inst->func_preproxy);
+	if (inst->func_postproxy) free(inst->func_postproxy);
+	if (inst->func_postauth) free(inst->func_postauth);
 	if (inst->func_detach) free(inst->func_detach);
 
 	free(inst);
@@ -1168,9 +1207,9 @@
 		perl_preacct,
 		perl_accounting, 
 		perl_checksimul,      	/* check simul */
-		NULL,                   /* pre-proxy */
-		NULL,                   /* post-proxy */
-		NULL                    /* post-auth */
+		perl_preproxy,          /* pre-proxy */
+		perl_postproxy,         /* post-proxy */
+		perl_postauth           /* post-auth */
 	},
 	perl_detach,			/* detach */
 	NULL,				/* destroy */
