my apology. It was a copy/paste typo: sub authorize { print "TEST1\n"; # For debugging purposes only # &log_request_attributes; # Here's where your authorization code comes # You can call another function from here: &test_call; return RLM_MODULE_OK; } # Function to handle authenticate sub authenticate { print "TEST2\n"; # For debugging purposes only # &log_request_attributes; if ($RAD_REQUEST{'User-Name'} =~ /^baduser/i) { # Reject user and tell him why $RAD_REPLY{'Reply-Message'} = "Denied access by rlm_perl function"; return RLM_MODULE_REJECT; } else { # Accept user and set some attribute $RAD_REPLY{'h323-credit-amount'} = "100"; return RLM_MODULE_OK; } }
Date: Fri, 30 Sep 2011 17:36:32 +0200 From: aland@deployingradius.com To: freeradius-users@lists.freeradius.org Subject: Re: "authentication" sub in perl
Alex rsm wrote:
I am trying to call an external perl function within "authentication" sub"
- functions are uncommented in modules/perl file ... func_authenticate = authenticate func_authorize = authorize ...
The default example works.
- subs are modified in /raddb/example.pl sub authenticate{ print "TEST1\n"; }
sub authenticate { print "TEST2\n"; /usr/local/etc/raddb/test.pl; }
When freeradius receives a REQUEST, only "authenticate" sub is called and not "authenticate" sub.
That makes NO sense at all.
You have TWO "authenticate" subroutines, and you expect that Perl will magically call the one you want?
Computers don't work that way.
How can I enable "authenticate" to be called when a REQUEST is arrived?
Ask a question that makes sense.
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html