[asterisk-commits] tilghman: branch 1.4 r94660 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Dec 22 19:21:04 CST 2007


Author: tilghman
Date: Sat Dec 22 19:21:03 2007
New Revision: 94660

URL: http://svn.digium.com/view/asterisk?view=rev&rev=94660
Log:
Argh... I suppose third time's the charm.

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=94660&r1=94659&r2=94660
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Sat Dec 22 19:21:03 2007
@@ -2500,33 +2500,34 @@
 	/* First check on peer name */
 	if (newpeername) {
 		var = ast_load_realtime("sippeers", "name", newpeername, "host", "dynamic", NULL);
-		if (!var && sin) {
+		if (!var && sin)
 			var = ast_load_realtime("sippeers", "name", newpeername, "host", ast_inet_ntoa(sin->sin_addr), NULL);
-			if (!var) {
-				var = ast_load_realtime("sippeers", "name", newpeername, NULL);
-				/*!\note
-				 * If this one loaded something, then we need to ensure that the host
-				 * field matched.  The only reason why we can't have this as a criteria
-				 * is because we only have the IP address and the host field might be
-				 * set as a name (and the reverse PTR might not match).
-				 */
-				if (var) {
-					for (tmp = var; tmp; tmp = tmp->next) {
-						if (!strcasecmp(var->name, "host")) {
-							struct in_addr sin2 = { 0, };
-							struct ast_dnsmgr_entry *dnsmgr = NULL;
-							if ((ast_dnsmgr_lookup(tmp->value, &sin2, &dnsmgr) < 0) || (memcmp(&sin2, &sin->sin_addr, sizeof(sin2)) != 0)) {
-								/* No match */
-								ast_variables_destroy(var);
-								var = NULL;
-							}
-							break;
+		if (!var) {
+			var = ast_load_realtime("sippeers", "name", newpeername, NULL);
+			/*!\note
+			 * If this one loaded something, then we need to ensure that the host
+			 * field matched.  The only reason why we can't have this as a criteria
+			 * is because we only have the IP address and the host field might be
+			 * set as a name (and the reverse PTR might not match).
+			 */
+			if (var) {
+				for (tmp = var; tmp; tmp = tmp->next) {
+					if (!strcasecmp(var->name, "host")) {
+						struct in_addr sin2 = { 0, };
+						struct ast_dnsmgr_entry *dnsmgr = NULL;
+						if ((ast_dnsmgr_lookup(tmp->value, &sin2, &dnsmgr) < 0) || (memcmp(&sin2, &sin->sin_addr, sizeof(sin2)) != 0)) {
+							/* No match */
+							ast_variables_destroy(var);
+							var = NULL;
 						}
+						break;
 					}
 				}
 			}
 		}
-	} else if (sin) {	/* Then check on IP address */
+	}
+
+	if (!var && sin) {	/* Then check on IP address */
 		iabuf = ast_inet_ntoa(sin->sin_addr);
 		portnum = ntohs(sin->sin_port);
 		sprintf(portstring, "%d", portnum);




More information about the asterisk-commits mailing list