Hi all !

Here is the source code of the PostAuthHook file that I'm using. As you can see the 
Hook only saves basic information of the packets received to a file in the hard disk 
and assigns a fixed IP address to an specific user.

The problem is that the assignation doesn't works. The code for this follows:

  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