[xmppd-dev] commit r1553 - in branches/RELEASE-1_6_1: . jabberd/base
mail at jabberd.org
mail at jabberd.org
Mon Mar 16 18:21:38 CET 2009
Author: mawis
Date: Mon Mar 16 18:21:38 2009
New Revision: 1553
Log:
Updates in the routing code:
- Do not forward default routing as a routing update
- Allow source addresses to be blocked from routing
Modified:
branches/RELEASE-1_6_1/ChangeLog
branches/RELEASE-1_6_1/configure.ac
branches/RELEASE-1_6_1/jabberd/base/base_accept.cc
branches/RELEASE-1_6_1/jabberd/base/base_connect.cc
Modified: branches/RELEASE-1_6_1/ChangeLog
==============================================================================
--- branches/RELEASE-1_6_1/ChangeLog Mon Mar 16 12:08:17 2009 (r1552)
+++ branches/RELEASE-1_6_1/ChangeLog Mon Mar 16 18:21:38 2009 (r1553)
@@ -1,3 +1,9 @@
+2009-03-16 Matthias Wimmer <m at tthias.eu>
+
+ * jabberd/deliver.cc: allow source addresses to be blocked
+ * jabberd/base/base_accept.cc: do not forward routing updates for default
+ * jabberd/base/base_connect.cc: same
+
2008-12-08 Matthias Wimmer <m at tthias.eu>
* jabberd/mio_xml.cc: implemented mini-HTTP-server and additional flash
Modified: branches/RELEASE-1_6_1/configure.ac
==============================================================================
--- branches/RELEASE-1_6_1/configure.ac Mon Mar 16 12:08:17 2009 (r1552)
+++ branches/RELEASE-1_6_1/configure.ac Mon Mar 16 18:21:38 2009 (r1553)
@@ -6,7 +6,7 @@
AC_INIT(jabberd/jabberd.h)
-AM_INIT_AUTOMAKE(jabberd14,1.6.1.2-pre4)
+AM_INIT_AUTOMAKE(jabberd14,1.6.1.2-pre5)
AM_CONFIG_HEADER(config.h)
AC_LANG(C++)
Modified: branches/RELEASE-1_6_1/jabberd/base/base_accept.cc
==============================================================================
--- branches/RELEASE-1_6_1/jabberd/base/base_accept.cc Mon Mar 16 12:08:17 2009 (r1552)
+++ branches/RELEASE-1_6_1/jabberd/base/base_accept.cc Mon Mar 16 18:21:38 2009 (r1553)
@@ -332,6 +332,16 @@
return r_DONE;
}
+static void base_accept_send_routingupdate(accept_instance inst, char const* destination, int is_register) {
+ xmlnode route_stanza = xmlnode_new_tag_ns("xdb", NULL, NS_SERVER);
+ xmlnode_put_attrib_ns(route_stanza, "ns", NULL, NULL, "");
+ xmlnode_put_attrib_ns(route_stanza, "from", NULL, NULL, inst->i->id);
+ jid magic_jid = jid_new(xmlnode_pool(route_stanza), is_register ? "host at -internal" : "unhost at -internal");
+ jid_set(magic_jid, destination, JID_RESOURCE);
+ xmlnode_put_attrib_ns(route_stanza, "to", NULL, NULL, jid_full(magic_jid));
+ mio_write(inst->m, route_stanza, NULL, 0);
+}
+
/**
* callback that gets notified if a new host is routed by this jabberd instance
*
@@ -343,29 +353,27 @@
static void base_accept_routingupdate(instance i, char const* destination, int is_register, void *arg) {
accept_instance inst = static_cast<accept_instance>(arg);
// sanity check
- if (!inst)
+ if (!inst || !destination)
return;
// we only care for routingupdates if we are configured to be the uplink
if (!deliver_is_uplink(inst->i))
return;
- // and we have to have an established connection
- if (!inst->m || inst->state != A_READY)
+ // we do not forward default routings
+ if (std::string("*") == destination)
return;
// do not route back updates if both sides feel being an uplink
if (inst->i == i)
return;
+ // and we have to have an established connection
+ if (!inst->m || inst->state != A_READY)
+ return;
+
log_debug2(ZONE, LOGT_DYNAMIC, "base_accept is uplink and has to forward %s", is_register ? "host-command" : "unhost-command");
- xmlnode route_stanza = xmlnode_new_tag_ns("xdb", NULL, NS_SERVER);
- xmlnode_put_attrib_ns(route_stanza, "ns", NULL, NULL, "");
- xmlnode_put_attrib_ns(route_stanza, "from", NULL, NULL, inst->i->id);
- jid magic_jid = jid_new(xmlnode_pool(route_stanza), is_register ? "host at -internal" : "unhost at -internal");
- jid_set(magic_jid, destination, JID_RESOURCE);
- xmlnode_put_attrib_ns(route_stanza, "to", NULL, NULL, jid_full(magic_jid));
- mio_write(inst->m, route_stanza, NULL, 0);
+ base_accept_send_routingupdate(inst, destination, is_register);
}
static void _base_accept_freeing_instance(void* arg) {
Modified: branches/RELEASE-1_6_1/jabberd/base/base_connect.cc
==============================================================================
--- branches/RELEASE-1_6_1/jabberd/base/base_connect.cc Mon Mar 16 12:08:17 2009 (r1552)
+++ branches/RELEASE-1_6_1/jabberd/base/base_connect.cc Mon Mar 16 18:21:38 2009 (r1553)
@@ -212,13 +212,17 @@
static void base_connect_routingupdate(instance i, char const* destination, int is_register, void *arg) {
conn_info ci = static_cast<conn_info>(arg);
// sanity check
- if (!ci)
+ if (!ci || !destination)
return;
// we only care for the routingupdates if we are configured to be the uplink
if (!deliver_is_uplink(ci->inst))
return;
+ // we do not forward default routings
+ if (std::string("*") == destination)
+ return;
+
// do not route back updates if both sides feel being an uplink
if (ci->inst == i)
return;
More information about the dev
mailing list