In this pull request I`d correct work with retrieved from RADIUS AV pairs for modules auth_radius, misc_radius and peering. Now this modules correctly put to $avp() all retrieved params: - integer name and integer value - integer name and string value - string name and integer value - string name and string value All above said and for SIP-AVP params too. You can merge this Pull Request by running:
git pull https://github.com/borikinternet/kamailio master
Or you can view, comment on it, or merge it online at:
https://github.com/kamailio/kamailio/pull/14
-- Commit Summary --
* Improve for correct working with all RADIUS AV pairs
-- File Changes --
M modules/auth_radius/sterman.c (180) M modules/misc_radius/functions.c (228) M modules/peering/verify.c (205)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/14.patch https://github.com/kamailio/kamailio/pull/14.diff
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/14
Thanks, your recomendations are implemented in new commits. Realy, I think, that free() is called in function, that destroys avp, but when I inspect usr_avp, I understood that I done a mistake. Similary, I added correct processing of malloc() errors, malloc() and free() was replaced to pkg_malloc() and pkg_free() respectively. I look at SIP-AVP processing and found one mistake (for '#' in string value case, I`m not considered this option), and this corrected too in new commits. In my oppinion, not using memory allocation in this section will be very traumatic for kamailio, because we don`t know, in which place in memory we place our string values.
Discussion question: some vendors (as Cisco) put name in value too. Cisco placed '=' between name part of value and value part of value. Some other vendors may put some other symbols. In my code I checking '=',':' and '#' by analogy with SIP-AVP pair syntax. Whether it is necessary or not?
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/14#issuecomment-68535016
pkg_malloc() for name and value is not needed. It is more traumatic to allocate in pkg, then copy there and then free after adding as Kamailio AVP (there is no benefit, only a lot of operations here for nothing good). When adding as a K AVP, the name and value are cloned in shared memory. Copying the values directly from the RADIUS AVP is ok (like it was so far) and faster.
The new patches are on top of the old one, this is not what we want to commit, because there must be a patch per module, starting from the existing code. Now it is hard to review the contribution, because we have to analyse patches to patches, not being easy to spot eventual bugs. These patches in the pull request must be discarded and create new ones against Kamailio master.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/14#issuecomment-68605236
Closed #14.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/14#event-221671072