[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "auth" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Aug 2 18:41:39 CDT 2011


branch "auth" has been created
        at  495836a1a62f961160d46cde236e57a1f7a5bf39 (commit)

- Log -----------------------------------------------------------------
commit 495836a1a62f961160d46cde236e57a1f7a5bf39
Author: Joshua Colp <jcolp at digium.com>
Date:   Tue Aug 2 20:41:53 2011 -0300

    Populate credential information and let pjsip take care of the rest.

diff --git a/src/AuthManager.cpp b/src/AuthManager.cpp
index f91994e..075a909 100644
--- a/src/AuthManager.cpp
+++ b/src/AuthManager.cpp
@@ -143,13 +143,6 @@ std::vector<AuthHookPrx> AuthInstance::getHooks()
     return mImpl->hooks;
 }
 
-static pj_status_t lookup_cred(pj_pool_t *, const pj_str_t *,
-        const pj_str_t *, pjsip_cred_info *)
-{
-    // Return non-success for now just so it doesn't seem like authentication is actually succeeding.
-    return !PJ_SUCCESS;
-}
-
 bool AuthInstance::authenticate(pjsip_rx_data *rdata)
 {
     //For each server auth, we need to call pjsip_auth_srv_verify(), which will then
@@ -195,7 +188,12 @@ void AuthInstance::addDigests(pjsip_tx_data *tdata, const DigestChallengeSeq &di
         pjsip_auth_srv *authServer = PJ_POOL_ZALLOC_T(mImpl->mPool, pjsip_auth_srv);
         pj_str_t realm;
         pj_cstr(&realm, (*digest)->realm.c_str());
-        pjsip_auth_srv_init(mImpl->mPool, authServer, &realm, lookup_cred, 0);
+        pjsip_auth_srv_init(mImpl->mPool, authServer, &realm, NULL, 0);
+
+        pj_strdup2(mImpl->mPool, &authServer->cred_info.username, (*digest)->username.c_str());
+        authServer->cred_info.data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
+        pj_strdup2(mImpl->mPool, &authServer->cred_info.data, (*digest)->password.c_str());
+
         pj_str_t nonce, opaque, *noncePtr = NULL, *opaquePtr = NULL;
         if (!(*digest)->opaque.empty())
         {

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list