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} -> anonym...@eduroam.ac.uk Wed Jun 27 19:40:59 2012 : Info: (13) sql_set_user escaped user --> 'anonym...@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 = 'anonym...@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
signature.asc
Description: Message signed with OpenPGP using GPGMail
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html