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

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sun Oct 22 13:59:39 MST 2006


Author: rizzo
Date: Sun Oct 22 15:59:38 2006
New Revision: 45905

URL: http://svn.digium.com/view/asterisk?rev=45905&view=rev
Log:
simplify the flow of function check_user_full()

A large block needs reindentation now, but we don't do that because
it can be moved to a separate function.


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=45905&r1=45904&r2=45905&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sun Oct 22 15:59:38 2006
@@ -8928,7 +8928,13 @@
 		user = find_user(of, 1);
 
 	/* Find user based on user name in the from header */
-	if (user && ast_apply_ha(user->ha, sin)) {
+	if (user && !ast_apply_ha(user->ha, sin)) {
+		if (!authpeer && debug)
+			ast_verbose("Found user '%s', but fails host access\n", user->name);
+		ASTOBJ_UNREF(user,sip_destroy_user);
+		user = NULL;
+	}
+	if (user) {
 		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);
 		/* copy channel vars */
@@ -9010,16 +9016,12 @@
 		}
 		if (debug)
 			ast_verbose("Found user '%s'\n", user->name);
-	} else {
-		if (user) {
-			if (!authpeer && debug)
-				ast_verbose("Found user '%s', but fails host access\n", user->name);
-			ASTOBJ_UNREF(user,sip_destroy_user);
-		}
-		user = NULL;
-	}
-
-	if (!user) {
+		ASTOBJ_UNREF(user, sip_destroy_user);
+		return res;
+	}
+
+	/* XXX need to reindent the next block */
+
 		/* If we didn't find a user match, check for peers */
 		if (sipmethod == SIP_SUBSCRIBE)
 			/* For subscribes, match on peer name only */
@@ -9144,10 +9146,6 @@
 			}
 		}
 
-	}
-
-	if (user)
-		ASTOBJ_UNREF(user, sip_destroy_user);
 	return res;
 }
 



More information about the svn-commits mailing list