[Asterisk-code-review] res pjsip session: Prevent user=phone being added to anonimi... (asterisk[14])

Joshua Colp asteriskteam at digium.com
Thu Oct 12 12:39:06 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/6717 )

Change subject: res_pjsip_session: Prevent user=phone being added to anonimized URIs.
......................................................................

res_pjsip_session: Prevent user=phone being added to anonimized URIs.

Move ast_sip_add_usereqphone to be called after anonymization of URIs,
to prevent the user_eq_phone adding "user=phone" to URIs containing a
username that is not a phonenumber (RFC3261 19.1.1). An extra call to
ast_sip_add_usereqphone on the saved version before anonymization is
added to add user=phone" to the PAI.

ASTERISK-27047 #close

Change-Id: Ie5644bc66341b86dc08b1f7442210de2e6acdec6
---
M res/res_pjsip_session.c
1 file changed, 4 insertions(+), 3 deletions(-)

Approvals:
  Sean Bright: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index f84d60e..808477c 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -802,10 +802,9 @@
 		pj_strdup2(dlg_pool, &dlg_info_uri->host, session->endpoint->fromdomain);
 	}
 
-	ast_sip_add_usereqphone(session->endpoint, dlg_pool, dlg_info->uri);
-
 	/* We need to save off the non-anonymized From for RPID/PAI generation (for domain) */
 	session->saved_from_hdr = pjsip_hdr_clone(dlg_pool, dlg_info);
+	ast_sip_add_usereqphone(session->endpoint, dlg_pool, session->saved_from_hdr->uri);
 
 	/* In chan_sip, fromuser and fromdomain trump restricted so we only
 	 * anonymize if they're not set.
@@ -821,7 +820,9 @@
 		if (ast_strlen_zero(session->endpoint->fromdomain)) {
 			pj_strdup2(dlg_pool, &dlg_info_uri->host, "anonymous.invalid");
 		}
-	}
+	} else {
+		ast_sip_add_usereqphone(session->endpoint, dlg_pool, dlg_info->uri);
+    }
 }
 
 int ast_sip_session_refresh(struct ast_sip_session *session,

-- 
To view, visit https://gerrit.asterisk.org/6717
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie5644bc66341b86dc08b1f7442210de2e6acdec6
Gerrit-Change-Number: 6717
Gerrit-PatchSet: 2
Gerrit-Owner: dtryba <daniel at tryba.nl>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171012/b3340527/attachment-0001.html>


More information about the asterisk-code-review mailing list