[svn-commits] rizzo: trunk r45915 - /trunk/channels/chan_sip.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sun Oct 22 14:08:08 MST 2006


Author: rizzo
Date: Sun Oct 22 16:08:07 2006
New Revision: 45915

URL: http://svn.digium.com/view/asterisk?rev=45915&view=rev
Log:
more streamlining of check_user_full


Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=45915&r1=45914&r2=45915&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sun Oct 22 16:08:07 2006
@@ -8867,7 +8867,7 @@
 	char *of;
 	char rpid_num[50];
 	const char *rpid;
-	enum check_auth_result res = AUTH_SUCCESSFUL;
+	enum check_auth_result res;
 	char *t;
 	char calleridname[50];
 	int debug=sip_debug_test_addr(sin);
@@ -9033,7 +9033,11 @@
 			*/
 			peer = find_peer(NULL, &p->recv, 1);
 
-		if (peer) {
+		if (!peer) {
+			if (debug)
+				ast_verbose("Found no matching peer or user for '%s:%d'\n", ast_inet_ntoa(p->recv.sin_addr), ntohs(p->recv.sin_port));
+
+		} else {
 			/* Set Frame packetization */
 			if (p->rtp) {
 				ast_rtp_codec_setpref(p->rtp, &peer->prefs);
@@ -9133,18 +9137,16 @@
 					p->t38.jointcapability &= p->t38.peercapability;
 			}
 			ASTOBJ_UNREF(peer, sip_destroy_peer);
-		} else { 
-			if (debug)
-				ast_verbose("Found no matching peer or user for '%s:%d'\n", ast_inet_ntoa(p->recv.sin_addr), ntohs(p->recv.sin_port));
-
-			/* do we allow guests? */
-			if (!global_allowguest) {
-				if (global_alwaysauthreject)
-					res = AUTH_FAKE_AUTH; /* reject with fake authorization request */
-				else
-					res = AUTH_SECRET_FAILED; /* we don't want any guests, authentication will fail */
-			}
-		}
+			return res;
+		}
+
+	/* Finally, apply the guest policy */
+	if (global_allowguest)
+		res = AUTH_SUCCESSFUL;
+	else if (global_alwaysauthreject)
+		res = AUTH_FAKE_AUTH; /* reject with fake authorization request */
+	else
+		res = AUTH_SECRET_FAILED; /* we don't want any guests, authentication will fail */
 
 	return res;
 }



More information about the svn-commits mailing list