[asterisk-scf-commits] asterisk-scf/integration/pjproject.git branch "remove-smartness" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Sep 21 12:46:27 CDT 2011


branch "remove-smartness" has been created
        at  9af2bb7fae4b82ba928b9492b25a40f753a9e85d (commit)

- Log -----------------------------------------------------------------
commit 9af2bb7fae4b82ba928b9492b25a40f753a9e85d
Author: Joshua Colp <jcolp at digium.com>
Date:   Wed Sep 21 14:52:47 2011 -0300

    Comment out logic which modifies the SDP to add missing media lines.

diff --git a/pjmedia/src/pjmedia/sdp_neg.c b/pjmedia/src/pjmedia/sdp_neg.c
index 6263f0c..45a3282 100644
--- a/pjmedia/src/pjmedia/sdp_neg.c
+++ b/pjmedia/src/pjmedia/sdp_neg.c
@@ -283,6 +283,7 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_modify_local_offer( pj_pool_t *pool,
      * the new offer by reordering and adding the missing media line with 
      * port number set to zero.
      */
+#if 0
     for (oi = 0; oi < old_offer->media_count; ++oi) {
 	pjmedia_sdp_media *om;
 	pjmedia_sdp_media *nm;
@@ -308,6 +309,7 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_modify_local_offer( pj_pool_t *pool,
 		break;
 	    }
 	}
+
 	if (!found) {
 	    pjmedia_sdp_media *m;
 
@@ -316,7 +318,9 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_modify_local_offer( pj_pool_t *pool,
 	    pj_array_insert(new_offer->media, sizeof(new_offer->media[0]),
 			    new_offer->media_count++, oi, &m);
 	}
+
     }
+#endif
 
     /* New_offer fixed */
     neg->initial_sdp = new_offer;

commit d0b00a22e2d840431e0bf82ae2980e65ebd36905
Author: Joshua Colp <jcolp at digium.com>
Date:   Tue Aug 30 14:48:04 2011 -0300

    Provide an easier method of attaching authentication information that does not require a callback.

diff --git a/pjsip/include/pjsip/sip_auth.h b/pjsip/include/pjsip/sip_auth.h
index 57db0e7..e5737fe 100644
--- a/pjsip/include/pjsip/sip_auth.h
+++ b/pjsip/include/pjsip/sip_auth.h
@@ -274,7 +274,7 @@ typedef struct pjsip_auth_srv
     pj_str_t		     realm;	/**< Realm to serve.		    */
     pj_bool_t		     is_proxy;	/**< Will issue 407 instead of 401  */
     pjsip_auth_lookup_cred  *lookup;	/**< Lookup function.		    */
-
+    pjsip_cred_info          cred_info; /**< Credentials                    */
 } pjsip_auth_srv;
 
 
diff --git a/pjsip/src/pjsip/sip_auth_server.c b/pjsip/src/pjsip/sip_auth_server.c
index 1a557d7..9dce9c9 100644
--- a/pjsip/src/pjsip/sip_auth_server.c
+++ b/pjsip/src/pjsip/sip_auth_server.c
@@ -38,7 +38,7 @@ PJ_DEF(pj_status_t) pjsip_auth_srv_init(  pj_pool_t *pool,
 					  pjsip_auth_lookup_cred *lookup,
 					  unsigned options )
 {
-    PJ_ASSERT_RETURN(pool && auth_srv && realm && lookup, PJ_EINVAL);
+    PJ_ASSERT_RETURN(pool && auth_srv && realm, PJ_EINVAL);
 
     pj_strdup( pool, &auth_srv->realm, realm);
     auth_srv->lookup = lookup;
@@ -60,14 +60,12 @@ static pj_status_t pjsip_auth_verify( const pjsip_authorization_hdr *hdr,
 	pj_str_t digest;
 	const pjsip_digest_credential *dig = &hdr->credential.digest;
 
-	/* Check that username and realm match. 
-	 * These checks should have been performed before entering this
-	 * function.
-	 */
-	PJ_ASSERT_RETURN(pj_strcmp(&dig->username, &cred_info->username) == 0,
-			 PJ_EINVALIDOP);
-	PJ_ASSERT_RETURN(pj_strcmp(&dig->realm, &cred_info->realm) == 0,
-			 PJ_EINVALIDOP);
+	/* Check that username and realm match.  */
+	if ((pj_strcmp(&dig->username, &cred_info->username) != 0) ||
+	    (pj_strcmp(&dig->realm, &cred_info->realm) != 0))
+	{
+            return PJ_EINVALIDOP;
+	}
 
 	/* Prepare for our digest calculation. */
 	digest.ptr = digest_buf;
@@ -107,7 +105,6 @@ PJ_DEF(pj_status_t) pjsip_auth_srv_verify( pjsip_auth_srv *auth_srv,
     pjsip_msg *msg = rdata->msg_info.msg;
     pjsip_hdr_e htype;
     pj_str_t acc_name;
-    pjsip_cred_info cred_info;
     pj_status_t status;
 
     PJ_ASSERT_RETURN(auth_srv && rdata, PJ_EINVAL);
@@ -147,17 +144,19 @@ PJ_DEF(pj_status_t) pjsip_auth_srv_verify( pjsip_auth_srv *auth_srv,
 	return PJSIP_EINVALIDAUTHSCHEME;
     }
 
-    /* Find the credential information for the account. */
-    status = (*auth_srv->lookup)(rdata->tp_info.pool, &auth_srv->realm,
-				 &acc_name, &cred_info);
-    if (status != PJ_SUCCESS) {
-	*status_code = PJSIP_SC_FORBIDDEN;
-	return status;
+    if (*auth_srv->lookup) {
+	/* Find the credential information for the account. */
+	status = (*auth_srv->lookup)(rdata->tp_info.pool, &auth_srv->realm,
+	    &acc_name, &auth_srv->cred_info);
+	if (status != PJ_SUCCESS) {
+	    *status_code = PJSIP_SC_FORBIDDEN;
+	    return status;
+	}
     }
 
     /* Authenticate with the specified credential. */
     status = pjsip_auth_verify(h_auth, &msg->line.req.method.name, 
-			       &cred_info);
+			       &auth_srv->cred_info);
     if (status != PJ_SUCCESS) {
 	*status_code = PJSIP_SC_FORBIDDEN;
     }

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


-- 
asterisk-scf/integration/pjproject.git



More information about the asterisk-scf-commits mailing list