From 48c09ef517816b94a4054aa3f0636e3f17126d65 Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Fri, 28 Jul 2006 18:53:43 +0000 Subject: [PATCH] Merged revisions 38420 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r38420 | file | 2006-07-28 14:49:00 -0400 (Fri, 28 Jul 2006) | 2 lines Make a copy of the request URI in check_user_full instead of modifying the one on the structure, and also strip params properly from the user portion of the SIP URI so as to preserve the domain (issue #7552 reported by dan42) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@38421 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 087e1090bb..3a712fa182 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -8535,9 +8535,10 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ int debug=sip_debug_test_addr(sin); struct ast_variable *tmpvar = NULL, *v = NULL; int usenatroute; + char *uri2 = ast_strdupa(uri); /* Terminate URI */ - t = uri; + t = uri2; while (*t && *t > 32 && *t != ';') t++; *t = '\0'; @@ -8557,7 +8558,7 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ of = get_in_brackets(from); if (ast_strlen_zero(p->exten)) { - t = uri; + t = uri2; if (!strncmp(t, "sip:", 4)) t+= 4; ast_string_field_set(p, exten, t); @@ -8630,7 +8631,7 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ ast_log(LOG_DEBUG, "Setting NAT on UDPTL to %s\n", usenatroute ? "On" : "Off"); ast_udptl_setnat(p->udptl, usenatroute); } - if (!(res = check_auth(p, req, user->name, user->secret, user->md5secret, sipmethod, uri, reliable, ast_test_flag(req, SIP_PKT_IGNORE)))) { + if (!(res = check_auth(p, req, user->name, user->secret, user->md5secret, sipmethod, uri2, reliable, ast_test_flag(req, SIP_PKT_IGNORE)))) { sip_cancel_destroy(p); ast_copy_flags(&p->flags[0], &user->flags[0], SIP_FLAGS_TO_COPY); ast_copy_flags(&p->flags[1], &user->flags[1], SIP_PAGE2_FLAGS_TO_COPY); @@ -8757,7 +8758,7 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ ast_string_field_free(p, peersecret); ast_string_field_free(p, peermd5secret); } - if (!(res = check_auth(p, req, peer->name, p->peersecret, p->peermd5secret, sipmethod, uri, reliable, ast_test_flag(req, SIP_PKT_IGNORE)))) { + if (!(res = check_auth(p, req, peer->name, p->peersecret, p->peermd5secret, sipmethod, uri2, reliable, ast_test_flag(req, SIP_PKT_IGNORE)))) { ast_copy_flags(&p->flags[0], &peer->flags[0], SIP_FLAGS_TO_COPY); ast_copy_flags(&p->flags[1], &peer->flags[1], SIP_PAGE2_FLAGS_TO_COPY); /* If we have a call limit, set flag */