[Asterisk-code-review] res pjsip pubsub: Ensure remote URI contains URI only. (asterisk[15])

Jenkins2 asteriskteam at digium.com
Mon Nov 13 06:43:04 CST 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/7011 )

Change subject: res_pjsip_pubsub: Ensure remote URI contains URI only.
......................................................................

res_pjsip_pubsub: Ensure remote URI contains URI only.

This change makes it so that any user of the pubsub
API that requests the remote URI receives only the URI.
Previously the entire string was returned, which could
contain a display name.

ASTERISK-27290

Change-Id: If1d0cd6630f0a264856d31d2a67933109187a017
---
M res/res_pjsip_pubsub.c
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Sean Bright: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index 62b1879..274b038 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -2441,9 +2441,14 @@
 void ast_sip_subscription_get_remote_uri(struct ast_sip_subscription *sub, char *buf, size_t size)
 {
 	pjsip_dialog *dlg;
+	pjsip_sip_uri *uri;
 
 	dlg = sub->tree->dlg;
-	ast_copy_pj_str(buf, &dlg->remote.info_str, size);
+	uri = pjsip_uri_get_uri(dlg->remote.info->uri);
+
+	if (pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, uri, buf, size) < 0) {
+		*buf = '\0';
+	}
 }
 
 const char *ast_sip_subscription_get_resource_name(struct ast_sip_subscription *sub)

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

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: If1d0cd6630f0a264856d31d2a67933109187a017
Gerrit-Change-Number: 7011
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
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/20171113/4e59fcbc/attachment.html>


More information about the asterisk-code-review mailing list