[svn-commits] kpfleming: trunk r150052 - /trunk/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Oct 16 10:02:10 CDT 2008


Author: kpfleming
Date: Thu Oct 16 10:02:10 2008
New Revision: 150052

URL: http://svn.digium.com/view/asterisk?view=rev&rev=150052
Log:
ensure that type=peer entries are only matched on IP/port, not on name (after oej audits all the calls to find_peer() to make sure that forcenamematch is set correctly in each case)

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=150052&r1=150051&r2=150052
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Oct 16 10:02:10 2008
@@ -4177,9 +4177,25 @@
 	struct sip_peer *p = NULL;
 	struct sip_peer tmp_peer;
 	
+	auto int find_by_name(void *obj, void *arg, int flags);
+	int find_by_name(void *obj, void *arg, int flags)
+	{
+		struct sip_peer *search = obj, *match = arg;
+
+		if (strcasecmp(search->name, match->name)) {
+			return 0;
+		}
+
+		if (forcenamematch && search->onlymatchonip) {
+			return 0;
+		}
+
+		return CMP_MATCH | CMP_STOP;
+	}
+
 	if (peer) {
 		ast_copy_string(tmp_peer.name, peer, sizeof(tmp_peer.name));
-		p = ao2_t_find(peers, &tmp_peer, OBJ_POINTER, "ao2_find in peers table");
+		p = ao2_t_callback(peers, OBJ_POINTER, find_by_name, &tmp_peer, "ao2_find in peers table");
 	} else if (sin) { /* search by addr? */
 		tmp_peer.addr.sin_addr.s_addr = sin->sin_addr.s_addr;
 		tmp_peer.addr.sin_port = sin->sin_port;




More information about the svn-commits mailing list