Hello Antonio -
On Thu, 30 Dec 1999, Antonio Navarro Navarro wrote:
> Hi all !
>
> I am writing a PostAuthHook program in perl in order to assign IP addresses
from a pool to the users. I can get all the information about the request
packet, but the repky packet is always empty and I am unable to assign a fixed
IP Address to the connected user.
>
> if ($user eq 'bemar@bemarnet') {
> $q->add_attr('Framed-IP-Address', '212.87.203.1');
> }
>
> Where am I wrong ?
>
> Here is the full code for the Hook.
>
> sub {
>
> my $p=${$_[0]}; # Reference to the current request
> my $q=${$_[1]}; # Reply packet being constructed
> my $r=${$_[2]}; # Result of the authentication
>
> my $user=$p->getAttrByNum($Radius::Radius::USER_NAME);
> my $frip=$p->getAttrByNum($Radius::Radius::FRAMED_IP_ADDRESS);
> my $stat=$p->getAttrByNum($Radius::Radius::ACCT_STATUS_TYPE);
>
> open(trace, '>>/trace.txt');
> if ($stat eq 'Start') {
> print trace "Start: $user - $stat - $frip\n";
> if ($user eq 'bemar@bemarnet') {
> $q->add_attr('Framed-IP-Address', '212.87.203.1');
> }
> } elsif ($stat eq 'Stop') {
> print trace "Stop: $user - $stat - $frip\n";
> } elsif ($stat eq 'Alive') {
> print trace "Alive: $user - $stat - $frip\n";
> } else {
> print trace "Error: $user - $stat - $frip\n";
> }
> close(trace);
>
> }
>
Hmmm - your code above will only look at accounting packets (Start, Stop, etc.)
which are only sent *after* the connection has been set up. I suspect what you
want to do is process the Access-Request packets to return an IP address in the
Access-Accept.
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.