From aced8bdd2e5d210f024be602bf5a1e70555ecec4 Mon Sep 17 00:00:00 2001
From: Mark Michelson <mmichelson@digium.com>
Date: Tue, 14 Jan 2014 16:43:33 +0000
Subject: [PATCH] Fix erroneous behavior when sending auth rejection to
 artificial endpoint.

We were not including an authentication challenge when sending a 401 response
to unmatched endpoints. This was due to the conversion to use a vector for
authentication section names on an endpoint. The vector for artificial endpoints
was empty, resulting in the challenge being sent back containing no challenges.

This is worked around by placing a bogus value in the artificial endpoint's auth
vector. This value is never looked up by anything, since they instead will directly
call ast_sip_get_artificial_auth().



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405420 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 res/res_pjsip/pjsip_distributor.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/res/res_pjsip/pjsip_distributor.c b/res/res_pjsip/pjsip_distributor.c
index e59305ec57..5cc645cc3d 100644
--- a/res/res_pjsip/pjsip_distributor.c
+++ b/res/res_pjsip/pjsip_distributor.c
@@ -228,6 +228,11 @@ static int create_artificial_endpoint(void)
 	}
 
 	AST_VECTOR_INIT(&artificial_endpoint->inbound_auths, 1);
+	/* Pushing a bogus value into the vector will ensure that
+	 * the proper size of the vector is returned. This value is
+	 * not actually used anywhere
+	 */
+	AST_VECTOR_APPEND(&artificial_endpoint->inbound_auths, "artificial-auth");
 	return 0;
 }
 
-- 
GitLab