I have try next program: example.pl my $user = "root"; my $password = ""; my $database = "mysql"; my $dbh; sub CLONE { $dbh = DBI->connect("dbi:mysql:database=KES;host=10.10.16.6",$user, $password); open(SESAME, ">/rlm_hello"); print SESAME "HELLO\n"; close(SESAME); &radiusd::radlog(0, $users_table ."asdfadf"); } # Function to handle authorize sub authorize { &log_request_attributes; # &radiusd::radlog(0, $users_table); # return RLM_MODULE_OK; my $query = $dbh->prepare(<<"QUERY"); #<<<< This is 58th line SELECT count(*) FROM $users_table WHERE name = $RAD_REQUEST{'User-Name'} QUERY $query->execute(); if (( @count = $query->fetchrow_array) == 1) { $RAD_CHECK{'Auth-Type'} = "RADKES"; return RLM_MODULE_OK; } return RLM_MODULE_REJECT; #&db_logAttributes("authorize"); } and get .... Module: Instantiated perl (kes) Listening on authentication *:1812 Listening on accounting *:1813 Ready to process requests. rad_recv: Access-Request packet from host 10.10.16.5:4877, id=12, length=46 User-Name = "kesddd" User-Password = "\224\275\241T\036;\235\205\271\022\364E\035\203\3317" Processing the authorize section of radiusd.conf modcall: entering group authorize for request 0 Using perl at 0x811b070 rlm_perl: RAD_REQUEST: User-Name = kesddd rlm_perl: RAD_REQUEST: User-Password = \224\275\241T\036;\235\205\271\022\364E\035\203\3317 rlm_perl: perl_embed:: module = /usr/local/etc/raddb/kes.pl , func = authorize exit status= Can't call method "prepare" on an undefined value at /usr/local/etc/raddb/kes.pl line 58. modcall[authorize]: module "kes" returns reject for request 0 modcall: leaving group authorize (returns reject) for request 0 Delaying request 0 for 1 seconds Finished request 0 Going to the next request --- Walking the entire request list --- Waking up in 1 seconds... --- Walking the entire request list --- Waking up in 1 seconds... --- Walking the entire request list --- Sending Access-Reject of id 12 to 10.10.16.5 port 4877 Waking up in 4 seconds... --- Walking the entire request list --- Cleaning up request 0 ID 12 with timestamp 446afece Nothing to do. Sleeping until we see a request. It seems CLONE function didnt called I use 5.8.7 perl newserv# perl -v This is perl, v5.8.7 built for i386-freebsd-64int (with 1 registered patch, see perl -V for more detail) I even try comment out next line in rlm_perl.c 268: //#if PERL_REVISION >= 5 && PERL_VERSION <8 call_pv("CLONE",0); //#endif and make && make install Can any one help? -- С уважением, KES mailto:kes-kes@yandex.ru
On Wed, May 17, 2006 at 05:02:28PM +0300, KES wrote:
I have try next program: rlm_perl: perl_embed:: module = /usr/local/etc/raddb/kes.pl , func = authorize exit status= Can't call method "prepare" on an undefined value at /usr/local/etc/raddb/kes.pl line 58.
Did you check your script before using it with freeradius ? Maybe using the "use" directive will solve your problem ?
It seems CLONE function didnt called I use 5.8.7 perl newserv# perl -v
This is perl, v5.8.7 built for i386-freebsd-64int (with 1 registered patch, see perl -V for more detail)
Check if your perl is compiled with ithreads. perl -V | grep USE_ITHREADS -- Best Regards, Boian Jordanov SNE Orbitel - Next Generation Telecom tel. +359 2 4004 723 tel. +359 2 4004 002
Здравствуйте, Boian. Вы писали 18 мая 2006 г., 11:14:13: BJ> On Wed, May 17, 2006 at 05:02:28PM +0300, KES wrote:
I have try next program: rlm_perl: perl_embed:: module = /usr/local/etc/raddb/kes.pl , func = authorize exit status= Can't call method "prepare" on an undefined value at /usr/local/etc/raddb/kes.pl line 58. As perl was without ITHERADS so sub CLONE was n't called and $dbh was not initialized sub CLONE { $dbh = DBI->connect("dbi:mysql:database=KES;host=10.10.16.6",$user, $password); }
sub authorize { my $query = $dbh->prepare(<<"QUERY"); # Can't call method "prepare" on an undefined value at /usr/local/etc/raddb/kes.pl line 58 .... BJ> Did you check your script before using it with freeradius ? BJ> Maybe using the "use" directive will solve your problem ? BJ> Check if your perl is compiled with ithreads. BJ> perl -V | grep USE_ITHREADS Yes, problem was with ITHREADS # cd /usr/ports/lang/perl5.8 # make clean install clean WITH_THREADS=YES but I see nothing executing "perl -V | grep USE_ITHREADS" May be usage of ITHREADS showed by -D_THREAD_SAFE? # perl -V Summary of my perl5 (revision 5 version 8 subversion 7) configuration: Platform: osname=freebsd, osvers=4.10-stable, archname=i386-freebsd-64int uname='freebsd kserv 4.10-stable freebsd 4.10-stable #11: sat oct 29 19:41:13 gmt 2005 kes@kserv:usrobjusrsrcsyskes_kern i386 ' config_args='-sde -Dprefix=/usr/local -Darchlib=/usr/local/lib/perl5/5.8.7/mach -Dprivlib=/usr/local/lib/perl5/5.8.7 -Dman3dir=/usr/local/lib/perl5/5.8.7/perl/man/man3 -Dman1dir=/usr/local/man/man1 -Dsitearch=/usr/local/lib/perl5/site_perl/5.8.7/mach -Dsitelib=/usr/local/lib/perl5/site_perl/5.8.7 -Dscriptdir=/usr/local/bin -Dsiteman3dir=/usr/local/lib/perl5/5.8.7/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dcc=cc -Duseshrplib -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.7/BSDPAN" -Doptimize=-O -pipe -Ud_dosuid -Ui_gdbm -Dusethreads=n -Dusemymalloc=y -Duse64bitint' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=y, bincompat5005=undef Compiler: cc='cc', ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.7/BSDPAN" -D_THREAD_SAFE -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include', optimize='-O -pipe ', cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.7/BSDPAN" -D_THREAD_SAFE -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='2.95.4 20020320 [FreeBSD]', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags ='-pthread -Wl,-E -L/usr/local/lib' libpth=/usr/lib /usr/local/lib libs=-lgdbm -lm -lcrypt -lutil perllibs=-lm -lcrypt -lutil libc=, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -Wl,-R/usr/local/lib/perl5/5.8.7/mach/CORE' cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_64_BIT_INT USE_LARGE_FILES Locally applied patches: defined-or Built under freebsd Compiled at Dec 27 2005 03:08:31 @INC: /usr/local/lib/perl5/site_perl/5.8.7/mach /usr/local/lib/perl5/site_perl/5.8.7 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.7/BSDPAN /usr/local/lib/perl5/5.8.7/mach /usr/local/lib/perl5/5.8.7 -- С уважением, KES mailto:kes-kes@yandex.ru
On Thu, May 18, 2006 at 04:10:00PM +0300, KES wrote:
Здравствуйте, Boian.
Yes, problem was with ITHREADS # cd /usr/ports/lang/perl5.8 # make clean install clean WITH_THREADS=YES
but I see nothing executing "perl -V | grep USE_ITHREADS" May be usage of ITHREADS showed by -D_THREAD_SAFE?
# perl -V Summary of my perl5 (revision 5 version 8 subversion 7) configuration: Platform: osname=freebsd, osvers=4.10-stable, archname=i386-freebsd-64int uname='freebsd kserv 4.10-stable freebsd 4.10-stable #11: sat oct 29 19:41:13 gmt 2005 kes@kserv:usrobjusrsrcsyskes_kern i386 ' config_args='-sde -Dprefix=/usr/local -Darchlib=/usr/local/lib/perl5/5.8.7/mach -Dprivlib=/usr/local/lib/perl5/5.8.7 -Dman3dir=/usr/local/lib/perl5/5.8.7/perl/man/man3 -Dman1dir=/usr/local/man/man1 -Dsitearch=/usr/local/lib/perl5/site_perl/5.8.7/mach -Dsitelib=/usr/local/lib/perl5/site_perl/5.8.7 -Dscriptdir=/usr/local/bin -Dsiteman3dir=/usr/local/lib/perl5/5.8.7/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dcc=cc -Duseshrplib -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.7/BSDPAN" -Doptimize=-O -pipe -Ud_dosuid -Ui_gdbm -Dusethreads=n -Dusemymalloc=y -Duse64bitint' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
Your perl is still without ithreads *useithreads=undef*
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=y, bincompat5005=undef Compiler: cc='cc', ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.7/BSDPAN" -D_THREAD_SAFE -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include', optimize='-O -pipe ', cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.7/BSDPAN" -D_THREAD_SAFE -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='2.95.4 20020320 [FreeBSD]', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags ='-pthread -Wl,-E -L/usr/local/lib' libpth=/usr/lib /usr/local/lib libs=-lgdbm -lm -lcrypt -lutil perllibs=-lm -lcrypt -lutil libc=, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -Wl,-R/usr/local/lib/perl5/5.8.7/mach/CORE' cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl): Compile-time options: USE_64_BIT_INT USE_LARGE_FILES Locally applied patches: defined-or Built under freebsd Compiled at Dec 27 2005 03:08:31 @INC: /usr/local/lib/perl5/site_perl/5.8.7/mach /usr/local/lib/perl5/site_perl/5.8.7 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.7/BSDPAN /usr/local/lib/perl5/5.8.7/mach /usr/local/lib/perl5/5.8.7
-- С уважением, KES mailto:kes-kes@yandex.ru
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-- Best Regards, Boian Jordanov SNE Orbitel - Next Generation Telecom tel. +359 2 4004 723 tel. +359 2 4004 002
participants (2)
-
Boian Jordanov -
KES