[asterisk-dev] [Code Review] SIP URI comparison test (plus some bug fixes)
Simon Perreault
simon.perreault at viagenie.ca
Tue Jul 20 11:40:54 CDT 2010
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/792/#review2434
-----------------------------------------------------------
/trunk/channels/sip/reqresp_parser.c
<https://reviewboard.asterisk.org/r/792/#comment5367>
There is a race condition between the moment setlocale() is called and the moment strcasecmp() is called. The LC_CTYPE environment variable could have changed in the meantime.
Also, it is very possible that newlocale() + freelocale() would be faster than setlocale(), since the latter involves at least one system call for reading an environment variable.
A better fix would be to just call newlocale() once and store c_locale in a static variable.
- Simon
On 2010-07-20 11:31:14, Mark Michelson wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/792/
> -----------------------------------------------------------
>
> (Updated 2010-07-20 11:31:14)
>
>
> Review request for Asterisk Developers and Olle E Johansson.
>
>
> Summary
> -------
>
> Issue 17662 was opened by oej since he discovered that using a string comparison for domains was not a viable solution since IPv6 addresses may be represented in many different ways, all of which are considered to be the same address. The patch attached on that issue was my initial attempt at solving the issue.
>
> While I was dabbling in the area, I felt it would be a good idea to add a SIP URI comparison internal test to be sure that all the logic was correct. What I found was that in many regards, the comparison of URI parameters was not working as it should be. That being the case, I largely rewrote the logic of sip_uri_params_cmp() to work correctly.
>
> All SIP URI comparison code has been moved to channels/sip/reqresp_parser.c, including the new test. If you have good ideas for test cases that I haven't thought of yet, please feel free to add comments to the review request.
>
> Also of note, the bugs I found in sip_uri_params_cmp() affect 1.4 and 1.6.2 as well. My plan is to backport the bugfixes to those branches as well once I get a "Ship it!" on this review.
>
>
> This addresses bug 17662.
> https://issues.asterisk.org/view.php?id=17662
>
>
> Diffs
> -----
>
> /trunk/channels/chan_sip.c 277873
> /trunk/channels/sip/include/reqresp_parser.h 277813
> /trunk/channels/sip/reqresp_parser.c 277813
>
> Diff: https://reviewboard.asterisk.org/r/792/diff
>
>
> Testing
> -------
>
> The new set of tests passes.
>
>
> Thanks,
>
> Mark
>
>
More information about the asterisk-dev
mailing list