rlm_perl
KES
kes-kes at yandex.ru
Wed May 17 16:02:28 CEST 2006
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 at yandex.ru
More information about the Freeradius-Users
mailing list