(RADIATOR) Question on PreHandlerHook

Hugh Irvine hugh at open.com.au
Sun Aug 31 18:06:49 CDT 2003


Hello Oscar -

You should use "changeUserName()".

	${$_[0]}->changeUserName("new-test-value");

See the code in Radius/Radius.pm->changeUserName().

This is because Radiator does some caching of the username internally.

regards

Hugh


On Monday, Sep 1, 2003, at 04:45 Australia/Melbourne, Oscar Garzón 
wrote:

>  
> Hello, I`m trying to use a PreHandlerHook to modify an Auth Request 
> before it is processed by Handlers. However it doesn't seem to be 
> working and I wonder whether it's on me the mistake.
>  
> ------------------------------------------------
> In radius.cfg I Put:
>  
> <Client localhost>
>     Secret xxx
>     PreHandlerHook file:"/etc/radiator/Hooks/hook2.pl"
> </Client>
>  
> ------------------------------------------------
> In hook2.pl I put:
> sub {
>     ${$_[0]}->change_attr("User-Name","new-test-value");
>     &main::log($main::LOG_DEBUG, "Customized Preprocessing: New Value 
> for Attribute User-Name ".$rq->get_attr("User-Name")  );
>     return;
> }
> ------------------------------------------------
> On Trace 4 I see.
> Code:       Access-Request
> Identifier: 105
> Authentic:  1234567890123456
> Attributes:
>        User-Name = "ogarzon"
>        Service-Type = Framed-User
>        NAS-IP-Address = 127.0.0.1
>        NAS-Port = 1234
>        Called-Station-Id = "123456789"
>        Calling-Station-Id = "987654321"
>        NAS-Port-Type = Async
>        User-Password = 
> "8C<205><151><209><24><167><194><4><30><251>0<131><245><203>O"
>  
> Sun Aug 31 13:18:40 2003: DEBUG: Rewrote user name to ogarzon
> Sun Aug 31 13:18:40 2003: DEBUG: Preprocessing: New Value for 
> Attribute User-Name new-test-value
> Sun Aug 31 13:18:40 2003: DEBUG: Handling request with Handler ''
> Sun Aug 31 13:18:40 2003: DEBUG: sqlsess Deleting session for ogarzon, 
> 127.0.0.1, 1234
> Sun Aug 31 13:18:40 2003: DEBUG: Handling with Radius::AuthSQL
> Sun Aug 31 13:18:40 2003: DEBUG: Query is: SELECT ENCRYPTEDPASSWORD, 
> CHECKATTR, REPLYATTR FROM USER WHERE USERNAME = 'ogarzon'
> Sun Aug 31 13:18:40 2003: DEBUG: Radius::AuthSQL looks for match with 
> ogarzon
>  
> -------------------
>  
> Since the Log entry is written, I guess it is getting inside the 
> Hook, log also says the value was effectively changed to 
> ''new-test-value", but handler is still trying to authenticate 
> original User-Name...
>  
> I was expecting the request to arrive modified to the Handler, but, It 
> looks like its value is kept unmodified outside the hook. Is it 
> supposed to be like that? or..What am I missing? does it have 
> something to do with per value/reference parameters?
>  
> Thanks in advance.
>  
> Oscar L . Garzón.
>  
>
>  
>  
>  
>  
>  
>  
>

NB: have you included a copy of your configuration file (no secrets),
together with a trace 4 debug showing what is happening?

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

===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list