[asterisk-commits] bweschke: branch bweschke/polycom_acd_on_1.4 r95940 - /team/bweschke/polycom_...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 2 13:50:52 CST 2008


Author: bweschke
Date: Wed Jan  2 13:50:51 2008
New Revision: 95940

URL: http://svn.digium.com/view/asterisk?view=rev&rev=95940
Log:
 Progress commit - so I can work on another machine with this one as well. 


Modified:
    team/bweschke/polycom_acd_on_1.4/channels/chan_sip.c

Modified: team/bweschke/polycom_acd_on_1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_on_1.4/channels/chan_sip.c?view=diff&rev=95940&r1=95939&r2=95940
==============================================================================
--- team/bweschke/polycom_acd_on_1.4/channels/chan_sip.c (original)
+++ team/bweschke/polycom_acd_on_1.4/channels/chan_sip.c Wed Jan  2 13:50:51 2008
@@ -1309,7 +1309,7 @@
 static int build_reply_digest(struct sip_pvt *p, int method, char *digest, int digest_len);
 static enum check_auth_result check_auth(struct sip_pvt *p, struct sip_request *req, const char *username,
 					 const char *secret, const char *md5secret, int sipmethod,
-					 char *uri, enum xmittype reliable, int ignore);
+					 char *uri, enum xmittype reliable, int ignore, char *digestname);
 static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_request *req,
 					      int sipmethod, char *uri, enum xmittype reliable,
 					      struct sockaddr_in *sin, struct sip_peer **authpeer);
@@ -8279,7 +8279,7 @@
 */
 static enum check_auth_result check_auth(struct sip_pvt *p, struct sip_request *req, const char *username,
 					 const char *secret, const char *md5secret, int sipmethod,
-					 char *uri, enum xmittype reliable, int ignore)
+					 char *uri, enum xmittype reliable, int ignore, char *digestname)
 {
 	const char *response = "407 Proxy Authentication Required";
 	const char *reqheader = "Proxy-Authorization";
@@ -8369,7 +8369,7 @@
 	}
 
 	/* Verify that digest username matches  the username we auth as */
-	if (strcmp(username, keys[K_USER].s)) {
+	if (!digestname && strcmp(username, keys[K_USER].s)) {
 		ast_log(LOG_WARNING, "username mismatch, have <%s>, digest has <%s>\n",
 			username, keys[K_USER].s);
 		/* Oops, we're trying something here */
@@ -8573,7 +8573,7 @@
 		} else {
 			ast_copy_flags(&p->flags[0], &peer->flags[0], SIP_NAT);
 			transmit_response(p, "100 Trying", req);
-			if (!(res = check_auth(p, req, peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri, XMIT_UNRELIABLE, ast_test_flag(req, SIP_PKT_IGNORE)))) {
+			if (!(res = check_auth(p, req, peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri, XMIT_UNRELIABLE, ast_test_flag(req, SIP_PKT_IGNORE), NULL))) {
 				sip_cancel_destroy(p);
 
 				/* We have a succesful registration attemp with proper authentication,
@@ -9244,6 +9244,7 @@
 	enum check_auth_result res = AUTH_SUCCESSFUL;
 	char *t;
 	char calleridname[50];
+	char *digestname = NULL;
 	int debug=sip_debug_test_addr(sin);
 	struct ast_variable *tmpvar = NULL, *v = NULL;
 	char *uri2 = ast_strdupa(uri);
@@ -9336,7 +9337,7 @@
 		
 		do_setnat(p, ast_test_flag(&p->flags[0], SIP_NAT_ROUTE) );
 
-		if (!(res = check_auth(p, req, user->name, user->secret, user->md5secret, sipmethod, uri2, reliable, ast_test_flag(req, SIP_PKT_IGNORE)))) {
+		if (!(res = check_auth(p, req, user->name, user->secret, user->md5secret, sipmethod, uri2, reliable, ast_test_flag(req, SIP_PKT_IGNORE), NULL))) {
 			sip_cancel_destroy(p);
 			ast_copy_flags(&p->flags[0], &user->flags[0], SIP_FLAGS_TO_COPY);
 			ast_copy_flags(&p->flags[1], &user->flags[1], SIP_PAGE2_FLAGS_TO_COPY);
@@ -9458,7 +9459,7 @@
 				ast_string_field_free(p, peersecret);
 				ast_string_field_free(p, peermd5secret);
 			}
-			if (!(res = check_auth(p, req, peer->name, p->peersecret, p->peermd5secret, sipmethod, uri2, reliable, ast_test_flag(req, SIP_PKT_IGNORE)))) {
+			if ((check_auth(p, req, peer->name, p->peersecret, p->peermd5secret, sipmethod, uri2, reliable, ast_test_flag(req, SIP_PKT_IGNORE), NULL) == AUTH_USERNAME_MISMATCH) || !(res = check_auth(p, req, peer->name, p->peersecret, p->peermd5secret, sipmethod, uri2, reliable, ast_test_flag(req, SIP_PKT_IGNORE), NULL))) {
 				ast_copy_flags(&p->flags[0], &peer->flags[0], SIP_FLAGS_TO_COPY);
 				ast_copy_flags(&p->flags[1], &peer->flags[1], SIP_PAGE2_FLAGS_TO_COPY);
 				/* If we have a call limit, set flag */
@@ -9521,6 +9522,7 @@
 				if (p->t38.peercapability)
 					p->t38.jointcapability &= p->t38.peercapability;
 			}
+			ast_free(digestname);
 			ASTOBJ_UNREF(peer, sip_destroy_peer);
 		} else { 
 			if (debug)




More information about the asterisk-commits mailing list