Fix erroneous behavior when sending auth rejection to artificial endpoint.
authorMark Michelson <mmichelson@digium.com>
Tue, 14 Jan 2014 16:43:33 +0000 (16:43 +0000)
committerMark Michelson <mmichelson@digium.com>
Tue, 14 Jan 2014 16:43:33 +0000 (16:43 +0000)
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

index e59305e..5cc645c 100644 (file)
@@ -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;
 }