[asterisk-commits] mmichelson: branch group/CCSS r230963 - /team/group/CCSS/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 23 16:21:12 CST 2009


Author: mmichelson
Date: Mon Nov 23 16:21:10 2009
New Revision: 230963

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=230963
Log:
* Now we can authenticate if an ESC sends a 401 or 407 in response to a PUBLISH
* I moved the etag assignment to the 200 OK case since my re-reading of RFC 3903 makes it
seem that a new etag will only be present in a 200 OK response.


Modified:
    team/group/CCSS/channels/chan_sip.c

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=230963&r1=230962&r2=230963
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Mon Nov 23 16:21:10 2009
@@ -18874,11 +18874,22 @@
 
 	ast_assert(epa_entry != NULL);
 
-	if (!ast_strlen_zero(etag)) {
-		ast_copy_string(epa_entry->entity_tag, etag, sizeof(epa_entry->entity_tag));
+	if (resp == 401 || resp == 407) {
+		if (p->options) {
+			p->options->auth_type = (resp == 401 ? WWW_AUTH : PROXY_AUTH);
+		}
+		if ((p->authtries == MAX_AUTHTRIES) || do_proxy_auth(p, req, resp, SIP_PUBLISH, 1)) {
+			ast_log(LOG_NOTICE, "Failed to authenticate on PUBLISH to '%s'\n", get_header(&p->initreq, "From"));
+		}
 	}
 
 	if (resp == 200) {
+		/* If I've read section 6, item 6 of RFC 3903 correctly,
+		 * an ESC will only generate a new etag when it sends a 200 OK
+		 */
+		if (!ast_strlen_zero(etag)) {
+			ast_copy_string(epa_entry->entity_tag, etag, sizeof(epa_entry->entity_tag));
+		}
 		/* The nominal case. Everything went well. Everybody is happy.
 		 * Each EPA will have a specific action to take as a result of this
 		 * development, so ... callbacks!




More information about the asterisk-commits mailing list