Hi all,
        
        I just tried the latest CVS (couple of hours ago) version and found a
bug when using 2 instances of the module.
        I noticed that using 2 different instances the perl code of second
instance replaces the code of the first instance, i give a couple of
examples bellow to show the results i got.

Thanks,
Manuel Sousa

=====RADIUSD.CONF=====
modules {
...
        perl perl1{
                module = ${sbindir}/perl1.pl
                func_accounting = accounting
                func_authentication = authenticate
                func_preacct = preacct
                func_checksimul = checksimul
                func_xlat = xlat
        }


        perl perl2{
                module = ${sbindir}/perl2.pl
                func_accounting = accounting
                func_authentication = authenticate
                func_preacct = preacct
                func_checksimul = checksimul
                func_xlat = xlat
        }
...
}
accounting {
        acct_unique
        redundant{
                group{
                        perl1{
                                fail     = return
                                notfound = 1
                                noop     = 2
                                ok       = 3
                                updated  = 4
                                reject   = return       # useful for the
examples bellow
                                userlock = 6
                                invalid  = 7
                                handled  = 8
                        }
                        primarysqlserver{
                                fail     = return
                                notfound = 1
                                noop     = 2
                                ok       = 3
                                updated  = 4
                                reject   = 5
                                userlock = 6
                                invalid  = 7
                                handled  = 8
                        }
                        fail  = 1
                        notfound = return
                        noop  = 2
                        ok  = return
                        updated = 3
                        reject = 7      # for the examples 2 
                        userlock = 4
                        invalid = 5
                        handled = 6
                }
                perl2
        }
}
=====END RADIUSD.CONF=====
=====SCRIPTS=====
perl1
        sub accounting{
                radiusd::radlog(1,"rlm_perl:: PERL1");
                return RLM_MODULE_FAIL;
        }       

perl2
        sub accounting{
                &radiusd::radlog(1,"rlm_perl:: PERL2");
                return RLM_MODULE_OK;
        }
=====END SCRIPTS=====
=====LOGS=====
with 1st version of both scripts and radiusd.conf

perl1 script should have printed PERL1 and returned failed
>...
>rlm_perl: rlm_perl:: PERL2
>  modcall[accounting]: module "perl1" returns ok
>...

Changing perl2 function to accounting2 both in radiusd.conf and script
the results are:

>rlm_perl: perl_embed:: module = /servicos/freeradius-cvs/sbin/perl1.pl
, func = accounting exit status= Undefined subroutine &main::accounting
>called.
>  modcall[accounting]: module "perl1" returns reject
>modcall: group group returns reject
>rlm_perl: rlm_perl:: PERL2
>  modcall[accounting]: module "perl2" returns ok

Note that the perl1 script still has the accounting sub, but perl2
doesn't have it, and in my opinion all of perl1 code was replaced by
perl2.

Finaly i defined functions accounting and accounting2 on perl1 script,
and replaced on module perl2 : module = ${sbindir}/perl2.pl => module =
${sbindir}/perl1.pl.
This way it works as perl1.pl has both the functions and perl1 module
perl code is replaced by module perl2 perl code which is the same.
It's a crude way to get it working, but if some1 else got the same
problems i did might help while a the bug isn't fixed.

>modcall: entering group group
>rlm_perl: rlm_perl:: PERL1
>  modcall[accounting]: module "perl1" returns fail
>modcall: group group returns fail
>rlm_perl: rlm_perl:: PERL2
>  modcall[accounting]: module "perl2" returns ok
>modcall: group redundant returns ok
=====END LOGS=====


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to