(RADIATOR) radiator hooks

Jason Stechschulte jasons at wcoil.com
Thu Jun 2 19:28:00 CDT 2005


On Fri, Jun 03, 2005 at 09:44:14AM +1000, Hugh Irvine wrote:
> What exactly are you trying to do with the Stop record? If it is just  
> to update an SQL table you can use an AcctSQLStatement directly in  
> your AuthBy SQL clause.

We are allowing people to purchase time.  If someone purchases 4 hours,
but logs out after using 2, we want to calculate how much time they
used, and subtract it from their remaining time.  Basically, the plan is
to set Session-Timeout to however much time they purchased, and update
that when the stop record is received.  If they used all of their time,
we will set Expiration to the previous day so that they can't login
anymore until purchasing more time.  I don't think an AcctSQLStatement
will work since I think this will involve multiple queries and
calculations.  I could be wrong though.

> If you do want to use a hook, you should  realise that there are two
> different things happening with the radius  protocol - the first is
> authentication and the second is accounting.  You will want your hook
> code to check that it is in fact dealing with  a Stop
> (Acct-Status-Type = Stop) and then do whatever you wish.

I am aware of that, but I can't seem to check the Acct-Status-Type.  So
far, I haven't been able to access anything from the request.  Using
your example, I get the request variable and dereference it using:

my $p = ${$_[0]};

Then I try to just see if I can get the identifier using:

my $identifier = $p->{Client}->{Identifier};

Then I print it using:

print "********\nJason's Client Identifier = $identifier\n********\n";

When I run radiusd from the command line as you recommended, I see the
following for the different requests:

********
Jason's Client Identifier = 
********

> I wrote most of the example hooks so if you have any questions please  
> ask.

If you see anything blatantly wrong with the above, I would appreciate
some help with it.  I'll look at the Radiator source as you mentioned
and look at some more examples to see if I can find out what I'm
missing.  Thanks for the help.


-- 
Jason Stechschulte
Network Administrator
West Central Ohio Internet Link
Lima, OH USA

--
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