[asterisk-dev] [Code Review] get_pai function doesnt work correct, using reqresp_parser functions solves this problem

wdoekes reviewboard at asterisk.org
Tue Jan 17 06:17:44 CST 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1673/#review5190
-----------------------------------------------------------



team/schmidts/unleash-the-beast/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/1673/#comment9676>

    s/praser/parser/
    
    .. and remove the comment about 'doing it wrong'. Use those comments to the svn:log instead.
    
    Future readers of this code will not be interested in the fact that it was once broken.



team/schmidts/unleash-the-beast/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/1673/#comment9678>

    I haven't looked at the code, but why is a call to is_shrinkable needed before doing the shrinking?
    
    (And is cid_num guaranteed to be set? Or can it still be NULL?)



team/schmidts/unleash-the-beast/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/1673/#comment9677>

    This cannot succeed, since you overwrote pai (get_name_and_number will have been setting NULs here and there).
    
    You should replace the get_name_and_number with something that hands you the host as well, so you can do strcmp(host, "anonymous.invalid").



team/schmidts/unleash-the-beast/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/1673/#comment9679>

    This is wrong too. The cid_num declaration should be 'const' instead. But that would break the shrinking part, so I'll forgive you for keeping it.


- wdoekes


On Jan. 17, 2012, 5:56 a.m., schmidts wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1673/
> -----------------------------------------------------------
> 
> (Updated Jan. 17, 2012, 5:56 a.m.)
> 
> 
> Review request for Asterisk Developers and wdoekes.
> 
> 
> Summary
> -------
> 
> the get_pai function in chan_sip.c fails to parse a PAI header with a display name set but without ". There are also some wrong char pointer initialisations used.
> By replacing the self made header parsing functions by reqresp_parser functions everything works fine.
> 
> 
> Diffs
> -----
> 
>   team/schmidts/unleash-the-beast/channels/chan_sip.c 350974 
> 
> Diff: https://reviewboard.asterisk.org/r/1673/diff
> 
> 
> Testing
> -------
> 
> tested several different P-Asserted-Identity Headers with display name or without.
> 
> 
> Thanks,
> 
> schmidts
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120117/f7fa30cf/attachment-0001.htm>


More information about the asterisk-dev mailing list