[asterisk-dev] [Code Review] Add getnameinfo()	to	ast_sockaddr_resolve ()
    Simon Perreault 
    simon.perreault at viagenie.ca
       
    Fri May  6 08:19:18 CDT 2011
    
    
  
On 2011-05-05 16:57, Paul Belanger wrote:
> The original issue is, this worked in Asterisk 1.4, meaning
> Dial(SIP/1050) would return an error right away because 1050 was not a
> defined peer, but in Asterisk 1.8 it does not, we send a SIP INVITE to a
> bogus IP address.
I think it would be appropriate to add a SIP grammar check in chan_sip
before calling ast_sockaddr_resolve(). No matter whether we add new
syntax or not, this check is missing now.
There are two calls to ast_sockaddr_resolve() in chan_sip.c. I would
advise to create a wrapper function that would do, in pseudocode:
if (string does not match "host" production rule from SIP grammar) {
    return error;
}
return ast_sockaddr_resolve(string);
That's an easy and correct fix for the original reporter's issue.
Simon
-- 
DTN made easy, lean, and smart --> http://postellation.viagenie.ca
NAT64/DNS64 open-source        --> http://ecdysis.viagenie.ca
STUN/TURN server               --> http://numb.viagenie.ca
    
    
More information about the asterisk-dev
mailing list