CUI accounting in policy.conf

Scott Armitage S.P.Armitage at lboro.ac.uk
Wed Jun 27 20:55:31 CEST 2012


All,

I'm using FR3.0 trying to use CUI and am having a few problems with the accounting.  In policy.conf I have:

        #
        #  If we had stored a CUI for the User, add it to the request.
        #
        cui.accounting {
                #
                #  If the CUI isn't in the packet, see if we can find it
                #  in the DB.
                #
               if (!Chargeable-User-Identity) {
                       update control {
                               Chargeable-User-Identity := "%{cui: SELECT cui FROM staffbaseschema.cui WHERE callingstationid = '%{Calling-Station-Id}' AND username = '%{User-Name}'}"
                       }
               }

                #
                #  If it exists now, then write out when we last saw
                #  this CUI.
                #
               if (Chargeable-User-Identity && (Chargeable-User-Identity != "")) {
                      cui
               }
        }

Which is slightly different to the standard policy.conf in that I don't care about the Client-IP-Address in my select.  However, that change should not have an effect on the issue I am seeing.  Basically the update control should set the Chargeable-User-Identity but it appears not to, as the following if evaluates to false:

Wed Jun 27 19:40:59 2012 : Info: (13)    policy cui.accounting {
Wed Jun 27 19:40:59 2012 : Info: (13)   - entering policy cui.accounting {...}
Wed Jun 27 19:40:59 2012 : Info: (13)    ? if (!Chargeable-User-Identity)
Wed Jun 27 19:40:59 2012 : Info: (13) ? Evaluating !(Chargeable-User-Identity) -> TRUE
Wed Jun 27 19:40:59 2012 : Info: (13)    ? if (!Chargeable-User-Identity) -> TRUE
Wed Jun 27 19:40:59 2012 : Info: (13)     if (!Chargeable-User-Identity) {
Wed Jun 27 19:40:59 2012 : Info: (13)    - entering if (!Chargeable-User-Identity) {...}
Wed Jun 27 19:40:59 2012 : Info: (13)     update control {
Wed Jun 27 19:40:59 2012 : Info: (13) sql_xlat
Wed Jun 27 19:40:59 2012 : Info: (13) 	expand: %{User-Name} -> anonymous at eduroam.ac.uk
Wed Jun 27 19:40:59 2012 : Info: (13) sql_set_user escaped user --> 'anonymous at eduroam.ac.uk'
Wed Jun 27 19:40:59 2012 : Info: (13) 	expand:  SELECT cui FROM staffbaseschema.cui WHERE callingstationid = '%{Calling-Station-Id}' AND username = '%{User-Name}' ->  SELECT cui FROM staffbaseschema.cui WHERE callingstationid = '02-00-00-00-00-01' AND username = 'anonymous at eduroam.ac.uk'
Wed Jun 27 19:40:59 2012 : Debug: rlm_sql (cui): Opening additional connection (1)
Wed Jun 27 19:40:59 2012 : Debug: No trigger subsection: ignoring trigger modules.sql.open
Wed Jun 27 19:40:59 2012 : Debug: rlm_sql (cui): Reserved connection (1)
Wed Jun 27 19:40:59 2012 : Debug: rlm_sql_postgresql: Status: PGRES_TUPLES_OK
Wed Jun 27 19:40:59 2012 : Debug: rlm_sql_postgresql: query affected rows = 1 , fields = 1
Wed Jun 27 19:40:59 2012 : Info: (13) sql_xlat finished
Wed Jun 27 19:40:59 2012 : Debug: rlm_sql (cui): Released connection (1)
Wed Jun 27 19:40:59 2012 : Debug: rlm_sql (cui): Closing idle connection (1): Too many free connections (1 > 0)
Wed Jun 27 19:40:59 2012 : Debug: rlm_sql (cui): Closing connection (1)
Wed Jun 27 19:40:59 2012 : Debug: No trigger subsection: ignoring trigger modules.sql.close
Wed Jun 27 19:40:59 2012 : Info: (13) 	expand: %{cui: SELECT cui FROM staffbaseschema.cui WHERE callingstationid = '%{Calling-Station-Id}' AND username = '%{User-Name}'} -> 51311af182a072427aec46c8d4f14844
Wed Jun 27 19:40:59 2012 : Info: (13)     } # update control = ok
Wed Jun 27 19:40:59 2012 : Info: (13)    - if (!Chargeable-User-Identity) returns ok
Wed Jun 27 19:40:59 2012 : Info: (13)    ? if (Chargeable-User-Identity && (Chargeable-User-Identity != ""))
Wed Jun 27 19:40:59 2012 : Info: (13) ? Evaluating (Chargeable-User-Identity ) -> FALSE
Wed Jun 27 19:40:59 2012 : Info: (13) ?? Skipping (Chargeable-User-Identity != "")
Wed Jun 27 19:40:59 2012 : Info: (13)    ? if (Chargeable-User-Identity && (Chargeable-User-Identity != "")) -> FALSE
Wed Jun 27 19:40:59 2012 : Info: (13)   - policy cui.accounting returns ok





I'm I being stupid or is this policy broken.

thanks

Scott Armitage
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20120627/7fac3b71/attachment.pgp>


More information about the Freeradius-Users mailing list