[asterisk-commits] oej: trunk r47521 - /trunk/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Nov 12 13:47:26 MST 2006


Author: oej
Date: Sun Nov 12 14:47:25 2006
New Revision: 47521

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47521
Log:
Part of patch in #7403 to improve tag checking in pedantic mode (stephen_dredge)

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=47521&r1=47520&r2=47521
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sun Nov 12 14:47:25 2006
@@ -4373,6 +4373,19 @@
 
 		if (option_debug > 4 )
 			ast_log(LOG_DEBUG, "= Looking for  Call ID: %s (Checking %s) --From tag %s --To-tag %s  \n", callid, req->method==SIP_RESPONSE ? "To" : "From", fromtag, totag);
+
+		/* All messages must always have From: tag */
+		if (ast_strlen_zero(fromtag)) {
+			if (option_debug > 4 ) 
+				ast_log(LOG_DEBUG, "%s request has no from tag, dropping callid: %s from: %s\n", sip_methods[req->method].text , callid, from );
+			return NULL;
+		}
+		/* reject requests that must always have a To: tag */
+		if (ast_strlen_zero(totag) && (req->method == SIP_ACK || req->method == SIP_BYE || req->method == SIP_INFO )) {
+			if (option_debug > 4) 
+				ast_log(LOG_DEBUG, "%s must have a to tag. dropping callid: %s from: %s\n", sip_methods[req->method].text , callid, from );
+			return NULL;
+		}
 	}
 
 	dialoglist_lock();



More information about the asterisk-commits mailing list