Hello Antonio -
On Tue, 30 Nov 1999, Antonio Navarro Navarro wrote:
> 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;
> }
> }
> }
> }
>
You access the parameters like this:
# get the parameters passed to this hook
my $p = ${$_[0]}; # current request packet
my $rp = ${$_[1]}; # current reply packet
my $code = ${$_[2]}; # authentication result
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.