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

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


Author: bweschke
Date: Wed Jan  2 22:27:49 2008
New Revision: 96172

URL: http://svn.digium.com/view/asterisk?view=rev&rev=96172
Log:
 Another progress commit. We seem to have check_user_full working the way we want it to now without re-doing another version of check_auth within chan_sip. This should hopefully reduce future merge conflicts on this branch which had been a source of problems with the previous ACD branch.


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=96172&r1=96171&r2=96172
==============================================================================
--- 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 22:27:49 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 *digestname);
+					 char *uri, enum xmittype reliable, int ignore);
 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 *digestname)
+					 char *uri, enum xmittype reliable, int ignore)
 {
 	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 (!digestname && strcmp(username, keys[K_USER].s)) {
+	if (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), NULL))) {
+			if (!(res = check_auth(p, req, peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri, XMIT_UNRELIABLE, ast_test_flag(req, SIP_PKT_IGNORE)))) {
 				sip_cancel_destroy(p);
 
 				/* We have a succesful registration attemp with proper authentication,
@@ -9249,10 +9249,10 @@
 	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);
+	int checkauthret = -1;
 
 	/* Terminate URI */
 	t = uri2;
@@ -9342,7 +9342,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), NULL))) {
+		if (!(res = check_auth(p, req, user->name, user->secret, user->md5secret, sipmethod, uri2, reliable, ast_test_flag(req, SIP_PKT_IGNORE)))) {
 			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);
@@ -9464,7 +9464,19 @@
 				ast_string_field_free(p, peersecret);
 				ast_string_field_free(p, peermd5secret);
 			}
-			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))) {
+
+
+			checkauthret = check_auth(p, req, peer->name, p->peersecret, p->peermd5secret, sipmethod, uri2, reliable, ast_test_flag(req, SIP_PKT_IGNORE));
+			if (checkauthret == AUTH_USERNAME_MISMATCH) {
+				checkauthret = check_auth(p, req, "12345", "12345", NULL, sipmethod, uri2, reliable, ast_test_flag(req, SIP_PKT_IGNORE));
+				if (!checkauthret)
+					ast_log(LOG_DEBUG, "auth'd correctly with 12345 on peer %s\n", peer->name);
+				else
+					ast_log(LOG_DEBUG, "not auth'd correctly with 12345 on peer %s\n", peer->name);
+			}
+			res = checkauthret;
+			if (checkauthret == AUTH_SUCCESSFUL) {
+
 				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 */
@@ -9527,7 +9539,6 @@
 				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