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);

}


Antonio Navarro Navarro
BemarNet Management
[EMAIL PROTECTED]
http://www.bemarnet.es

===
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