I've changed the example.pl perl script so it 'use DBI;' to query a Sybase server via freetds.
It works fine when running in foreground "radiusd -X" while testing.
However, if ran in background, the perl script gets triggered, but the dbi connect fails:
my $dbh = DBI->connect("dbi:Sybase:server=*****", $user, $passwd, {PrintError => 0});
Error: rlm_perl: perl_embed:: module = /etc/raddb/
myperlscript.pm
, func = authenticate exit status= Unable for connect to server
OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY = (78) NUMBER =
(41) Server ******, database Message String: Server is unavailable or
does not exist.
* Tethereal shows that there is no network activity towards the Sybase server.
*
At first I guessed using user radiusd instead of root would sabotage
access to /etc/freetds.conf and/or freetds libraries, but changing
radiusd.conf so it keep root priviledges didn't help.
* I've been checking environment parameters between foreground and background, but could not find a discriminator.
*
Assuming some chroot'ing getting done by radiusd I have moved
freetds.conf inside /etc/raddb ( and /etc/raddb/etc ) to no avail.
* I have ran strace -f -p <pid> in the hope to see what the
perlscript tries to do when invoked by a radius request, but I only see
it writing the error to the /var/log/radius/radius.log
* Changed the hostname towards ip address in /etc/freetds.conf to avoid a failing name resolving.
Any hints welcome for solution or better tools to debug/strace into the perl script.