Hi All !

I have discovered the PostuthHook file:"filename" and works fine. I have read the 
documentation, about the PostAuthHooks, and was trying to write a Hook for assigning 
IP Addresses from a limited pool.

I think there are three parameters passed to the hook: the current request, the reply 
packet currently being construted and the result of the authentication. How can I 
access the contents of this three parameters ?

My actual PostAuthHook is a very simple program that only writes to an external file:

 open(trace, '>>/trace.txt');
 print trace "PostAuthHook working...\n";
 close(trace);

I need to obtain the following in order to assign a Fixed IP Address:

- The result of the authentication: Only will continue with the 
  process if the authentication is right (ACCEPT).

- The Fixed IP Address assigned to the user (if exists).

- The number of users actually conected and the IP Addresses 
  assigned to all of them.

I use the RADONLINE database in MySQL for tracking the users connected. The 
PostAuthHook will assignt he first IP Address not used from the pool to the user 
(pseudo-code follows):

  if (authentication_is_ok()) {
    if (resultpacket_doesn't_contain_a_fixed_IP_Address) {
      iplist=obtain_list_of_current_IP_Addresses();
      for( ip=begin_of_pool; ip<end_of_pool; ip++) {
        if not_in_use(ip, list) {
          ad_to_reply_packet(ip);
          exit for;
        }
      } 
    }
  }

Thanks in advance, best regards,

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