[asterisk-dev] [Code Review] Parsing of reg->username containing @domain

David Vossel dvossel at digium.com
Thu May 20 11:47:12 CDT 2010


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


This is really close now.


trunk/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/628/#comment4330>

    This is not at all obvious. I don't think you should ever store the result from ast_inet_ntoa().  It uses some thread storage that could get overridden.  In this case it looks like it might work, but I'd rather just avoid this if at all possible.
    
    Example
    char *domain1 = ast_inet_ntoa(blah)
    char *domain2 = ast_inet_ntoa(blah2)
    
    domain1 and domain2 both point to the result of ast_inet_ntoa(blah2) afterwards.
    
    This is easy to fix. I think an ast_strdupa() will work.



trunk/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/628/#comment4331>

    What if there is a fromdomain without a fromdomainport and a regdomain with a regdomainport.  That would mean fromdomain would get matched with regdomain's port later.
    
    This is a crazy edge case, but it appears possible.  We just need to make sure the port matches up correctly with the domain.


- David


On 2010-05-20 04:37:10, Nick Lewis wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/628/
> -----------------------------------------------------------
> 
> (Updated 2010-05-20 04:37:10)
> 
> 
> Review request for Asterisk Developers and David Vossel.
> 
> 
> Summary
> -------
> 
> reg->username is parsed for each registration refresh rather than once on sip reload. A previously committed change that addressed this was reverted because it did not cater for registration strings that contained a peer name in the host field. This change does. 
> 
> 
> This addresses bug 14331.
>     https://issues.asterisk.org/view.php?id=14331
> 
> 
> Diffs
> -----
> 
>   trunk/channels/chan_sip.c 258227 
>   trunk/channels/sip/config_parser.c 258227 
>   trunk/channels/sip/include/sip.h 258228 
>   trunk/main/app.c 258227 
> 
> Diff: https://reviewboard.asterisk.org/r/628/diff
> 
> 
> Testing
> -------
> 
> Passes a new unit test for parsing usernames containing domains. Passes existing unit tests. Passes peername functional test with sip.conf snippet
> 
> [general]
> register=nick at quirk
> [quirk]
> fromdomain=10.10.235.48
> 
> 
> Thanks,
> 
> Nick
> 
>




More information about the asterisk-dev mailing list