rlm_perl problems]

Igor Smitran sigor at blic.net
Fri Jul 24 16:08:14 CEST 2009



Ivan Kalik wrote:
>> perl perl_script_1 {
>>         module = ${confdir}/config_dialup/perl_script_1.pl
>>         func_authorize = authorize_check_username
>>         func_accounting = accounting_check_username
>> }
>>
>> perl perl_script_2 {
>>
>>         module = ${confdir}/config_dialup/perl_script_2.pl
>> }
>>     
>
> Is that a no? Neither of these instances you have posted has
> func_post_auth defined.
>
> Ivan Kalik
> Kalik Informatika ISP

Yes, that is a no. I only defined functions for which i changed names.
Didn't define functions that are left with default name. I did it that
way because in original perl all func_* are commented out.
Here is an example. i was using authorize section for this:
Just tested it. It doesn't work in both cases, with func_authorize
defined and without it.

In authorize section i have put dummy:

authorize {
        *****
        dummy
        *****
}


in modules/perl:

perl dummy {
        module = ${confdir}/scripts/dummy.pl
        func_authorize = authorize
}

in dummy.pl:

use strict;
use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK);
use Data::Dumper;
#my %RAD_REQUEST;
#my %RAD_REPLY;
#my %RAD_CHECK;
        use constant    RLM_MODULE_REJECT=>    0;#  /* immediately
reject the request */
        use constant    RLM_MODULE_FAIL=>      1;#  /* module failed,
don't reply */
        use constant    RLM_MODULE_OK=>        2;#  /* the module is OK,
continue */
        use constant    RLM_MODULE_HANDLED=>   3;#  /* the module
handled the request, so stop. */
        use constant    RLM_MODULE_INVALID=>   4;#  /* the module
considers the request invalid. */
        use constant    RLM_MODULE_USERLOCK=>  5;#  /* reject the
request (user is locked out) */
        use constant    RLM_MODULE_NOTFOUND=>  6;#  /* user not found */
        use constant    RLM_MODULE_NOOP=>      7;#  /* module succeeded
without doing anything */
        use constant    RLM_MODULE_UPDATED=>   8;#  /* OK (pairs
modified) */
        use constant    RLM_MODULE_NUMCODES=>  9;#  /* How many return
codes there are */

sub authorize {
&radiusd::radlog(0, "DUMMY");
        return RLM_MODULE_OK;
}


It ends with freeradius crashing. If i disable all other perl calls and
leave only dummy.pl works with no problems. Same goes for other way
around. Basicaly, any combination that involves only one perl script
works without any problems. If i use two perl scripts in any combination
freeradius crashes.



More information about the Freeradius-Users mailing list