Hello Elliot -

On Monday 08 January 2001 10:34, Elliot Finley wrote:
> On Sun, 7 Jan 2001 12:05:24 +1100, Hugh Irvine wrote:
> >On Sunday 07 January 2001 06:09, Elliot Finley wrote:
> >> Hello fellow radiator users,
> >>      I'm in the process of consolidating 4 ISPs into one.  I'm setting
> >> up AuthBy SQL to handle this.  We don't have the passwords to all of
> >> the users, so I'm trying to set up the following.  If the user has a
> >> NULL password in the database, then they can get in using _any_
> >> password.  This should work according to TFM.  The thing that I want
> >> to do that I'm not sure how to do is; if they have a NULL password in
> >> the database, it'll let them in, then it will update the database with
> >> the password that they used.
> >
> >You will need to write a PreAuthHook to do this. There are some example
> > hooks in the Radiator 2.17.1 distribution in the file
> > "goodies/hooks.txt".
> >
> >>      If anyone knows how to do this using AuthBy SQL, I would
> >> appreciate a hint.  If this is not possible, I guess I'll be writing a
> >> new AuthBy module.
> >
> >No need for a complete AuthBy module - just a hook will do fine.
>
> I don't see a way inside of a PreAuthHook to use the existing database
> handle.  Do I need to re-connect to the database each time?

As mentioned previously, there is some example code in the file 
"goodies/hooks.txt", however here it is again:

.....

    # Get the Identifier for this Realm/Handler
    my $identifier = Radius::Util::format_special('%{Handler:Identifier}', 
$p, $rp);
    &main::log($main::LOG_DEBUG, "Using Identifier $identifier");
 
    # Now find the AuthBy clause with the same Identifier
    # and call its handle_request function.
    # Set the correct reply code in the reply packet
    # or if the AuthBy is not found set to Access-Reject.
    my $authby;
    if ($authby = Radius::AuthGeneric::find($identifier))
    {
        &main::log($main::LOG_DEBUG, "Found AuthBy with Identifier 
$identifier");      
    
    $authby->.....

.....
                                                       

This code is based on having the same Identifier in both the AuthBy clause 
and in the Realm or Handler (which allows you to use the same hook in 
multiple places in the configuration file).

It is used like this:

# configure AuthBy clause with Identifier

<AuthBy SQL>
        Identifier CheckSQL
        .....
</AuthBy>

# configure Realm(s) or Handler(s)

<Realm ...>
        Identifier CheckSQL
        PreAuthHook file:"%D/YourHook"
        .....
</Realm>


As shown in the hook code above, once you have the reference to the AuthBy 
($authby), you can use it to call any of the functions in AuthSQL.pm or any 
of the routines that it inherits.

hth

Hugh


-- 
Radiator: the most portable, flexible and configurable RADIUS server 
anywhere. Available on *NIX, *BSD, Windows 95/98/2000, NT, MacOS X.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.

===
Archive at http://www.starport.net/~radiator/
Announcements on [EMAIL PROTECTED]
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.

Reply via email to