Check for empty caps values and not just for None. See #5399
This prevents our caps cache from getting filled with invalid caps values. Furtheremore, NullClientCaps has been saveguarded so that it won't fail for people with already tainted caches.
This commit is contained in:
parent
b2a4c92e7a
commit
c1cbc07645
|
@ -198,7 +198,7 @@ class NullClientCaps(AbstractClientCaps):
|
||||||
|
|
||||||
def _lookup_in_cache(self, caps_cache):
|
def _lookup_in_cache(self, caps_cache):
|
||||||
# lookup something which does not exist to get a new CacheItem created
|
# lookup something which does not exist to get a new CacheItem created
|
||||||
cache_item = caps_cache[('old', '')]
|
cache_item = caps_cache[('dummy', '')]
|
||||||
assert cache_item.queried == 0
|
assert cache_item.queried == 0
|
||||||
return cache_item
|
return cache_item
|
||||||
|
|
||||||
|
@ -359,10 +359,10 @@ class ConnectionCaps(object):
|
||||||
else:
|
else:
|
||||||
hash_method, node, caps_hash = caps_tag['hash'], caps_tag['node'], caps_tag['ver']
|
hash_method, node, caps_hash = caps_tag['hash'], caps_tag['node'], caps_tag['ver']
|
||||||
|
|
||||||
if node is None or caps_hash is None:
|
if not node or not caps_hash:
|
||||||
# improper caps in stanza, ignore client capabilities.
|
# improper caps in stanza, ignore client capabilities.
|
||||||
client_caps = NullClientCaps()
|
client_caps = NullClientCaps()
|
||||||
elif hash_method is None:
|
elif not hash_method:
|
||||||
client_caps = OldClientCaps(caps_hash, node)
|
client_caps = OldClientCaps(caps_hash, node)
|
||||||
else:
|
else:
|
||||||
client_caps = ClientCaps(caps_hash, node, hash_method)
|
client_caps = ClientCaps(caps_hash, node, hash_method)
|
||||||
|
|
Loading…
Reference in New Issue