ENV variables in external scripts
Escobar, Emilio
emilio.escobar at hp.com
Fri Mar 7 16:47:44 CET 2008
You still need to grab the value of that environment variable properly. Perl uses the $ENV hash list to store all the environment variables. So for example you'd have to use, $ENV{"CALLING_STATION_ID"}.
Regards,
Emilio
-----Original Message-----
From: freeradius-users-bounces+emilio.escobar=hp.com at lists.freeradius.org [mailto:freeradius-users-bounces+emilio.escobar=hp.com at lists.freeradius.org] On Behalf Of rsg
Sent: Friday, March 07, 2008 10:37 AM
To: FreeRadius users mailing list
Subject: Re: ENV variables in external scripts
Well.. What I meant was I actually would like to call an environmental
variable as a variable in my simple perl script.
Following "Attributes as environment variables in executed programs"
in variables.txt for instance I tried the below.
---------------------------------------
#!/usr/bin/perl -w
use Mysql;
$Check = $CALLING_STATION_ID;
print STDERR "\t: $Check\n";
$db = Mysql->connect("localhost","radius","root","");
$status = $db->Mysql::query("select if((select CallingStationId from
radcheck where CallingStationId='$Check' order by Id limit
1),'y','n')");
($chk)= $status->FetchRow();
print STDERR "\t: $chk\n";
if($chk eq 'n'){
exit 255;
}
--------------------------------------------------
But I see nothing for the -> print STDERR "\t: $Check\n"; which should
ideally give the Calling-Station-Id.
And the Sql check obviously gives "n".
P.S. In the context, I have nothing that I cannot share with you. So
my apologies if I sounded so, in my previous mail.
Thanks for your help,
On Fri, Mar 7, 2008 at 4:07 PM, Alan DeKok <aland at deployingradius.com> wrote:
> rsg wrote:
> > I unsuccessfully attempted the options given by ../docs/variables.txt.
> > Please help with the correct syntax.
>
> Q: I won't tell you what I did, or what happened when I did it, but I
> need to know why it doesn't work.
>
> A: Damned if I know.
>
> Alan DeKok.
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
>
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
More information about the Freeradius-Users
mailing list