[asterisk-commits] rizzo: trunk r76390 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jul 22 15:44:07 CDT 2007


Author: rizzo
Date: Sun Jul 22 15:44:06 2007
New Revision: 76390

URL: http://svn.digium.com/view/asterisk?view=rev&rev=76390
Log:
add two comment blocks, one on reusing nonces, and one on the handling
of an 'authpeer' local variable.

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=76390&r1=76389&r2=76390
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sun Jul 22 15:44:06 2007
@@ -8056,7 +8056,11 @@
 	else if (!ast_strlen_zero(r->nonce)) {
 		char digest[1024];
 
-		/* We have auth data to reuse, build a digest header! */
+		/* We have auth data to reuse, build a digest header.
+		 * Note, this is not always useful because some parties do not
+		 * like nonces to be reused (for good reasons!) so they will
+		 * challenge us anyways.
+		 */
 		if (sipdebug)
 			ast_debug(1, "   >>> Re-using Auth data for %s@%s\n", r->username, r->hostname);
 		ast_string_field_set(p, realm, r->realm);
@@ -15377,7 +15381,7 @@
 	/* Handle authentication */
 	res = check_user_full(p, req, SIP_SUBSCRIBE, e, 0, sin, &authpeer);
 	/* if an authentication response was sent, we are done here */
-	if (res == AUTH_CHALLENGE_SENT)
+	if (res == AUTH_CHALLENGE_SENT)	/* authpeer = NULL here */
 		return 0;
 	if (res < 0) {
 		if (res == AUTH_FAKE_AUTH) {
@@ -15390,6 +15394,11 @@
 		p->needdestroy = 1;
 		return 0;
 	}
+
+	/* At this point, authpeer cannot be NULL. Remember we hold a reference,
+	 * so we must release it when done.
+	 * XXX must remove all the checks for authpeer == NULL.
+	 */
 
 	/* Check if this user/peer is allowed to subscribe at all */
 	if (!ast_test_flag(&p->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)) {




More information about the asterisk-commits mailing list