Hi Clement,

On Jun 25,  2:41pm, Clement wrote:
> Subject: Packet year and month of adjusted packet time
> Hi Mike,
>
> I store account records by the month.  Thus the accounting table is
> defined as
>
>       AccountingTable access_log_%Y%m
>
> Now because the delay in the packets, I found records of the previous
> month were logged in the next month.  Does RADIATOR provide the year and
> month of the packet after the time is adjusted by the delay?

%Y and %m are set according to the _current_time_of_day when the packet is
received, and is not adjusted by Acct-Delay-Time.

For every packet that arrives, the pseudo-attribute Timestamp is set in the
packet and adjusted according to Acct-Delay-Time, so Timestamp is always
available as the time the NAS first tried to send the request.

Timestamp would be available to you in any of the Hooks, but I cant think of an
easy way to make %Y and %m depend on Timestamp instead of current time.

The only way is to modify the code in radiusd, something like this:

sub format_special
{
    my ($s, $current_packet) = @_;

    # Local so the conversion functions will see them
    local $time = time;
    local ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)
        = localtime($time);

# Clement add these lines (untested)
    my $timestamp;
    $timestamp = $current_packet->get_attr('Timestamp')
        if $current_packet;
    $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)
        = localtime($timestamp) if $timestamp;
# End of added lines for Clement


    local $packet = $current_packet;

    $s =~ s/%([%acCdDhHlLmMNnRStTUuyY])/&{$main::conversions{$1}}()/egs;
    $s =~ s/%\{([^{]+)\}/{$packet->get_attr($1)}/egs;

    return $s;
}

Hope that helps.

Cheers.


>
> Or can you suggest the module that I can add these parameters?
>
>
> Regards
>
> Clement
> ANS Communications Pty Ltd
>
>-- End of excerpt from Clement



-- 
Mike McCauley                               [EMAIL PROTECTED]
Open System Consultants Pty. Ltd            Unix, Perl, Motif, C++, WWW
24 Bateman St Hampton, VIC 3188 Australia   http://www.open.com.au
Phone +61 3 9598-0985                       Fax   +61 3 9598-0955

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.

Reply via email to