From 72dcd51cc8e6790fa9509536f9eb02a3cbef236f Mon Sep 17 00:00:00 2001 From: David Vossel Date: Fri, 12 Feb 2010 17:59:39 +0000 Subject: [PATCH] fixes areas where port should be removed from domain during parsing A patch was committed recently that converted duplicate uri parsing code to use the parse_uri function. There were two instances where this conversion did not mimic previous behavior exactly because the port was not being parsed off the end of the domain. In order to do this, a dummy pointer argument needs to be passed into parse_uri so it will know it must parse out the port from the domain. If a port output paramenter is not present, the domain is returned with the port still attached. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246420 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index dd918de596..acad725360 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -11904,7 +11904,7 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct sockaddr enum check_auth_result res = AUTH_NOT_FOUND; struct sip_peer *peer; char tmp[256]; - char *name = NULL, *c, *domain = NULL; + char *name = NULL, *c, *domain = NULL, *dummy = NULL; char *uri2 = ast_strdupa(uri); terminate_uri(uri2); @@ -11914,7 +11914,7 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct sockaddr c = get_in_brackets(tmp); c = remove_uri_parameters(c); - if (parse_uri(c, "sip:,sips:", &name, NULL, &domain, NULL, NULL)) { + if (parse_uri(c, "sip:,sips:", &name, &dummy, &domain, &dummy, NULL)) { ast_log(LOG_NOTICE, "Invalid to address: '%s' from %s (missing sip:) trying to use anyway...\n", c, ast_inet_ntoa(sin->sin_addr)); return -1; } @@ -12407,7 +12407,7 @@ static int get_rdnis(struct sip_pvt *p, struct sip_request *oreq, char **name, c */ static int get_destination(struct sip_pvt *p, struct sip_request *oreq) { - char tmp[256] = "", *uri, *domain; + char tmp[256] = "", *uri, *domain, *dummy = NULL; char tmpf[256] = "", *from = NULL; struct sip_request *req; char *decoded_uri; @@ -12422,7 +12422,7 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq) uri = get_in_brackets(tmp); - if (parse_uri(uri, "sip:,sips:", &uri, NULL, &domain, NULL, NULL)) { + if (parse_uri(uri, "sip:,sips:", &uri, &dummy, &domain, &dummy, NULL)) { ast_log(LOG_WARNING, "Not a SIP header (%s)?\n", uri); return -1; }