]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix realm comparison for outbound auth
authorKinsey Moore <kmoore@digium.com>
Sat, 12 Oct 2013 16:49:00 +0000 (16:49 +0000)
committerKinsey Moore <kmoore@digium.com>
Sat, 12 Oct 2013 16:49:00 +0000 (16:49 +0000)
When generating the list of authentication credentials to pass to
PJSIP, Asterisk was using the raw pointer of a pj_str_t which is not
always NULL-terminated. This sometimes resulted in incorrect text for
the realm and a failure to match the realm for authentication purposes
which was causing the outbound nominal auth pjsip basic call test to
bounce. This now uses the pj_str_t that contains the realm instead of
generating a new one. Thanks to John Bigelow for helping to narrow this
down.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400863 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_pjsip_outbound_authenticator_digest.c

index 58eae5550503c241bf41cc33f54d1921dedfdc76..e7e77dbd5f83fbb2b0d1f1a8ccf3d4b123523f1d 100644 (file)
@@ -72,7 +72,7 @@ static int set_outbound_authentication_credentials(pjsip_auth_clt_sess *auth_ses
 
        for (i = 0; i < array->num; ++i) {
                if (ast_strlen_zero(auths[i]->realm)) {
-                       pj_cstr(&auth_creds[i].realm, auth_hdr->challenge.common.realm.ptr);
+                       auth_creds[i].realm = auth_hdr->challenge.common.realm;
                } else {
                        pj_cstr(&auth_creds[i].realm, auths[i]->realm);
                }