[asterisk-commits] mmichelson: trunk r403605 - /trunk/res/res_pjsip_authenticator_digest.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 10 09:15:20 CST 2013


Author: mmichelson
Date: Tue Dec 10 09:15:13 2013
New Revision: 403605

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=403605
Log:
Fix correct authentication behavior for artificial endpoint.

When switching to using a vector for authentication, I initialized
the vector for the artificial endpoint to be of size 1. However, this
does not result in AST_VECTOR_SIZE() returning 1 since there isn't
actually anything in the vector.

Rather than trifle with the vector by putting unnecessary elements in,
I simply changed the callback in res_pjsip_authenticator_digest.c to
explicitly report that the artificial endpoint requires authentication.

Thanks to Joshua Colp for pointing this out.


Modified:
    trunk/res/res_pjsip_authenticator_digest.c

Modified: trunk/res/res_pjsip_authenticator_digest.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_authenticator_digest.c?view=diff&rev=403605&r1=403604&r2=403605
==============================================================================
--- trunk/res/res_pjsip_authenticator_digest.c (original)
+++ trunk/res/res_pjsip_authenticator_digest.c Tue Dec 10 09:15:13 2013
@@ -41,7 +41,9 @@
  */
 static int digest_requires_authentication(struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata)
 {
-	return AST_VECTOR_SIZE(&endpoint->inbound_auths) > 0;
+	RAII_VAR(struct ast_sip_endpoint *, artificial, ast_sip_get_artificial_endpoint(), ao2_cleanup);
+
+	return endpoint == artificial || AST_VECTOR_SIZE(&endpoint->inbound_auths) > 0;
 }
 
 static void auth_store_cleanup(void *data)




More information about the asterisk-commits mailing list