summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-31 20:03:17 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-31 20:03:17 +0000
commitebbad39834e94c644dea59afe865ac74aa14dee3 (patch)
tree6976930bdee4a4d637858fc516cefe5de84792e2
parent80a3bb4b660bbb4e323227f54de7f0d9071628d1 (diff)
downloadchromium_src-ebbad39834e94c644dea59afe865ac74aa14dee3.zip
chromium_src-ebbad39834e94c644dea59afe865ac74aa14dee3.tar.gz
chromium_src-ebbad39834e94c644dea59afe865ac74aa14dee3.tar.bz2
[Sync] Relax checks for received XMPP messages
Basically they caused more bugs than they fixed (see discussion in bug). BUG=71285 TEST= Review URL: http://codereview.chromium.org/6392014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73180 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sync/notifier/cache_invalidation_packet_handler.cc12
-rw-r--r--jingle/notifier/listener/listen_task.cc14
2 files changed, 10 insertions, 16 deletions
diff --git a/chrome/browser/sync/notifier/cache_invalidation_packet_handler.cc b/chrome/browser/sync/notifier/cache_invalidation_packet_handler.cc
index be46eca..7fec7f4 100644
--- a/chrome/browser/sync/notifier/cache_invalidation_packet_handler.cc
+++ b/chrome/browser/sync/notifier/cache_invalidation_packet_handler.cc
@@ -84,15 +84,9 @@ class CacheInvalidationListenTask : public buzz::XmppTask {
private:
bool IsValidCacheInvalidationIqPacket(const buzz::XmlElement* stanza) {
- // We make sure to compare jids (which are normalized) instead of
- // just strings -- server may use non-normalized jids in
- // attributes.
- //
- // TODO(akalin): Add unit tests for this.
- buzz::Jid to(stanza->Attr(buzz::QN_TO));
- return
- (MatchRequestIq(stanza, buzz::STR_SET, kQnData) &&
- (to == GetClient()->jid()));
+ // We deliberately minimize the verification we do here: see
+ // http://crbug.com/71285 .
+ return MatchRequestIq(stanza, buzz::STR_SET, kQnData);
}
bool GetCacheInvalidationIqPacketData(const buzz::XmlElement* stanza,
diff --git a/jingle/notifier/listener/listen_task.cc b/jingle/notifier/listener/listen_task.cc
index 8466c57..01fb26c 100644
--- a/jingle/notifier/listener/listen_task.cc
+++ b/jingle/notifier/listener/listen_task.cc
@@ -65,8 +65,9 @@ int ListenTask::ProcessResponse() {
// Note that there can be multiple "Result" elements, so we need to loop
// through all of them.
bool update_signaled = false;
+ const buzz::QName kQnNotifierGetAll(kNotifierNamespace, "getAll");
const buzz::XmlElement* get_all_element =
- stanza->FirstNamed(buzz::QName("google:notifier", "getAll"));
+ stanza->FirstNamed(kQnNotifierGetAll);
if (get_all_element) {
const buzz::XmlElement* result_element =
get_all_element->FirstNamed(
@@ -125,8 +126,6 @@ bool ListenTask::HandleStanza(const buzz::XmlElement* stanza) {
}
bool ListenTask::IsValidNotification(const buzz::XmlElement* stanza) {
- static const buzz::QName kQnNotifierGetAll(
- kNotifierNamespace, "getAll");
// An update notificaiton has the following form.
// <cli:iq from="{bare_jid}" to="{full_jid}"
// id="#" type="set" xmlns:cli="jabber:client">
@@ -134,10 +133,11 @@ bool ListenTask::IsValidNotification(const buzz::XmlElement* stanza) {
// <Timestamp long="#" xmlns=""/>
// </not:getAll>
// </cli:iq>
- return
- (MatchRequestIq(stanza, buzz::STR_SET, kQnNotifierGetAll) &&
- (stanza->Attr(buzz::QN_TO) == GetClient()->jid().Str()) &&
- (stanza->Attr(buzz::QN_FROM) == GetClient()->jid().BareJid().Str()));
+ //
+ // We deliberately minimize the verification we do here, though: see
+ // http://crbug.com/71285 .
+ const buzz::QName kQnNotifierGetAll(kNotifierNamespace, "getAll");
+ return MatchRequestIq(stanza, buzz::STR_SET, kQnNotifierGetAll);
}
} // namespace notifier