[svn-commits] mmichelson: branch mmichelson/pool_shark2 r381578 - /team/mmichelson/pool_sha...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Feb 15 13:28:29 CST 2013


Author: mmichelson
Date: Fri Feb 15 13:28:26 2013
New Revision: 381578

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381578
Log:
Change to only authenticating dialog-creating methods.

This helps us not to try to authenticate things like BYE and INFO, but
it doesn't really help with other in-dialog requests like reinvites. We'll
still challenge those.

We unfortunately cannot detect if a request is in-dialog since the request
has not reached the dialog layer before it reaches us.


Modified:
    team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c

Modified: team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c?view=diff&rev=381578&r1=381577&r2=381578
==============================================================================
--- team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c (original)
+++ team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c Fri Feb 15 13:28:26 2013
@@ -49,8 +49,8 @@
 	pj_bool_t handled;
 	pjsip_rx_data *rdata = data;
 	int is_request = rdata->msg_info.msg->type == PJSIP_REQUEST_MSG;
-	int is_ack = is_request ? rdata->msg_info.msg->line.req.method.id == PJSIP_ACK_METHOD : 0;
-	int is_cancel = is_request ? rdata->msg_info.msg->line.req.method.id == PJSIP_CANCEL_METHOD : 0;
+	pjsip_method *req_method = is_request ? &rdata->msg_info.msg->line.req.method : NULL;
+	int is_ack = req_method ? req_method->id == PJSIP_ACK_METHOD : 0;
 	struct ast_sip_endpoint *endpoint;
 
 	endpoint = ast_sip_identify_endpoint(rdata);
@@ -66,7 +66,7 @@
 	}
 	rdata->endpt_info.mod_data[cloner_mod.id] = endpoint;
 
-	if (is_request && !is_ack && !is_cancel) {
+	if (is_request && pjsip_method_creates_dialog(req_method)) {
 		if (ast_sip_requires_authentication(endpoint, rdata)) {
 			pjsip_tx_data *tdata;
 			pjsip_endpt_create_response(ast_sip_get_pjsip_endpoint(), rdata, 401, NULL, &tdata);




More information about the svn-commits mailing list