(RADIATOR) Possible bug in AuthRADIUS.pm

Nuno Nunes nfn at isp.novis.pt
Thu Feb 7 11:48:26 CST 2002


Hi, I've sent this mail before but for some unknown reason it seems I was kicked out of the list for some time now and had to re-susbcribe.
So if you are seing this mail repeated I'm realy sorry...
My original message follows:

===============================================
Hello,

I found what I think is a bug (or is it a feature? :) ) in module AuthRADIUS.pm shipped with version 2.19 of Radiator.
The behaviour that I think is wrong is that when it first tries to forward an accounting (stop) packet it must set the delay time. And it does so by calculating delay time as (now - time the packet
+was first received).
Now this totaly discards any AcctDelayTime that the packet might already have on it.
This is an issue because if we have a proxy chain (as is our case) and we try to rate the users according to the time of day that they connected and disconnected, zeroing the acct delay on a proxy
+can put the user on a diferent rate time zone.
To correct this issue I did a little hack on AuthRADIUS.pm that sets things straight on a one shot basis, but maybe you think that this is ugly and prefer to revise the code to do it better? It
+shouldn't be very straightforward though, as you recalculate the delay time everytime you retry the packet and by then you have no ideia what the original AcctDelayTime was to begin with...
Anyway, here is my patch:
------------------------------------------------
*** AuthRADIUS-orig.pm  Thu Feb  7 15:48:52 2002
--- AuthRADIUS-new.pm   Thu Feb  7 15:48:27 2002
***************
*** 211,220 ****
--- 211,223 ----
      $fp->add_attr_list($p);

      if ($fp->code eq 'Accounting-Request')
      {
        # Change or set the Acct-Delay
+       # Somewhat ugly hack. We must not discard previous delay time that might exist.
+       my $origdelay = $p->getAttrByNum($Radius::Radius::ACCT_DELAY_TIME);
+       $p->{RecvTime} = $p->{RecvTime} - $origdelay if $origdelay;
        $fp->changeAttrByNum($Radius::Radius::ACCT_DELAY_TIME,
                             time - $p->{RecvTime});
      }
      else
      {
------------------------------------------------

Regards,
Nuno Nunes

-- 
Nuno Nunes (nuno.nunes at isp.novis.pt)
PGP Public Key: http://nunonunes.online.pt/pubkey.txt
NOVIS - Engenharia/Redes Técnicas
Edifício Novis
Estrada da Outurela, 118  - A
2795-606 Carnaxide
tel: +351-210104426 | fax: +351-210104301
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: <http://www.open.com.au/pipermail/radiator/attachments/20020207/2d86dfac/attachment.bin>


More information about the radiator mailing list