[Asterisk-code-review] res pjsip pubsub: Check for Content-Type header in rx notif... (asterisk[15])

Jenkins2 asteriskteam at digium.com
Wed Sep 20 08:10:43 CDT 2017


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

Change subject: res_pjsip_pubsub:  Check for Content-Type header in rx_notify_request
......................................................................

res_pjsip_pubsub:  Check for Content-Type header in rx_notify_request

pubsub_on_rx_notify_request wasn't checking for a null
Content-Type header before checking that it was
application/simple-message-summary.

ASTERISK-27279
Reported by: Ross Beer

Change-Id: Iec2a6c4d2e74af37ff779ecc9fd35644c5c4ea52
---
M res/res_pjsip_pubsub.c
1 file changed, 6 insertions(+), 2 deletions(-)

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



diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index 81b25ac..b0365d9 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -3524,10 +3524,12 @@
 	return PJ_TRUE;
 }
 
+static pjsip_media_type simple_message_summary;
+
 static pj_bool_t pubsub_on_rx_notify_request(pjsip_rx_data *rdata)
 {
-	if (pj_stricmp2(&rdata->msg_info.msg->body->content_type.type, "application") == 0 &&
-		pj_stricmp2(&rdata->msg_info.msg->body->content_type.subtype, "simple-message-summary") == 0) {
+	if (rdata->msg_info.msg->body &&
+		pjsip_media_type_cmp(&rdata->msg_info.msg->body->content_type, &simple_message_summary, 0) == 0) {
 		return pubsub_on_rx_mwi_notify_request(rdata);
 	}
 	return PJ_FALSE;
@@ -5363,6 +5365,8 @@
 		return AST_MODULE_LOAD_DECLINE;
 	}
 
+	pjsip_media_type_init2(&simple_message_summary, "application", "simple-message-summary");
+
 	if (ast_sched_start_thread(sched)) {
 		ast_log(LOG_ERROR, "Could not start scheduler thread for publication expiration\n");
 		ast_sched_context_destroy(sched);

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

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: Iec2a6c4d2e74af37ff779ecc9fd35644c5c4ea52
Gerrit-Change-Number: 6540
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp 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/20170920/f2e85c2c/attachment.html>


More information about the asterisk-code-review mailing list