On Fri, 30 Jul 1999, tom wrote:
> I put the following in <Realm DEFAULT> right
> before the <AuthBy> clause.
> 
>     PreAuthHook sub {
> 
>       open(L, ">> /tmp/tmp.log");
>         printf L "(%s)\n", $_[0]->getUserName();
>       close(L);
> 
>     }
> 
> 
> And I don't see any tmp.log file get created. What did I 
> do wrong?
> 

Here is an example from the FAQ (which uses a file, but you don't have to).

Notice that $p must be de-referenced:  my $p = ${$_[0]}; (there was an error in
the documentation about this that has now been corrected).

<Realm xxxxx>
           PreAuthHook      file:"preauthhook"
              ...
</Realm>

And in the file preauthhook: 

sub
{
          my $p = ${$_[0]};

          return unless $p->code() eq 'Access-Request';

          my $username = $p->getAttrByNum($Radius::Radius::USER_NAME);
          my $nasaddress = $p->getAttrByNum($Radius::Radius::NAS_IP_ADDRESS);
          my $timestamp = time;
          # etc;

          if (open(LOGFILE, ">filename"))
          {
                  print LOGFILE "$timestamp:$username:$nasaddress\n";
                  close(LOGFILE);
          }
}

hth

Hugh

--
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
Platypus, Freeside, TACACS+, PAM, external, etc etc on Unix, Win95/8,
NT, Rhapsody

===
Archive at http://www.thesite.com.au/~radiator/
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.

Reply via email to