(RADIATOR) Session-Timeout PostAuthHook
Hugh Irvine
hugh at open.com.au
Fri Dec 19 17:39:35 CST 2003
Hello Herman -
What you show below looks fine.
BTW - in all of the Radiator code, $p refers to the incoming request
packet and $rp refers to the reply packet.
Just to avoid confusion I would probably change $p to $rp.
See the example hooks in "goodies/hooks.txt".
There are also lots of utility routines in Radiator itself and in CPAN
that may be useful.
BTW - you do not need two "if" statements, you can just do this:
my $SessionTimeout = $p->get_attr('Session-Timeout');
if( $SessionTimeout eq 'EM')
{
.....
regards
Hugh
On 20/12/2003, at 3:04 AM, Herman verschooten wrote:
> Hi,
>
> I was looking for a way to dynamically set the session-timeout to the
> end of the month. Since this does not seem to be standard, I made an
> attempt to write a PostAuthHook:
>
> use Time::Local;
> # If Session-Timeout=EM then set it to the number of seconds left in
> this month.
> sub
> {
> my $p = ${$_[1]};
>
> my $SessionTimeout = $p->get_attr('Session-Timeout');
> if (defined $SessionTimeout)
> {
> if( $SessionTimeout eq 'EM')
> {
> my $sec;
> my $min;
> my $hour;
> my $mday;
> my $mon;
> my $year;
> my $wday;
> my $yday;
> my $isdst;
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> localtime(time);
>
> $mon++;
> $year+=1900;
>
> if($mon eq 12)
> {
> $mon = 0;
> $year++;
> }
>
> my $Timeout = timelocal(0,0,0,1,$mon,$year) -1 - time;
> $p->change_attr('Session-Timeout',$Timeout);
> }
> }
> }
> If anybody knows a better way to do this, please let me know.
>
> Greetings,
>
>
> Herman verschooten
>
>
> WebVisie bvba
> Een klare kijk op interne en externe communicatie
> _______________________________________________
> Oudaan 15 / 33 2000 Antwerpen http://www.webvisie.net
> tel 03/206.72.70 fax
> 03/234.93.82 h.verschooten at webvisie.net
>
>
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.
-
CATool: Private Certificate Authority for Unix and Unix-like systems.
===
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