summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-07-23 03:10:04 -0700
committerLance Stout <lancestout@gmail.com>2012-07-24 01:43:20 -0700
commit78aa5c3dfa6432833877390f4bf48e3b5c442d2b (patch)
treeb7942c9594e9ec5abd161e670d95597d561fb63d /sleekxmpp
parent613323b5fb71dea6af7d2cdacfbadffc77a67ad9 (diff)
downloadslixmpp-78aa5c3dfa6432833877390f4bf48e3b5c442d2b.tar.gz
slixmpp-78aa5c3dfa6432833877390f4bf48e3b5c442d2b.tar.bz2
slixmpp-78aa5c3dfa6432833877390f4bf48e3b5c442d2b.tar.xz
slixmpp-78aa5c3dfa6432833877390f4bf48e3b5c442d2b.zip
Add more validation for 0 length JID components.
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/jid.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/sleekxmpp/jid.py b/sleekxmpp/jid.py
index 7597885a..f0b7423b 100644
--- a/sleekxmpp/jid.py
+++ b/sleekxmpp/jid.py
@@ -140,7 +140,13 @@ def _validate_node(node):
"""
try:
if node is not None:
+ if not node:
+ raise InvalidJID('Localpart must not be 0 bytes')
+
node = nodeprep(node)
+
+ if not node:
+ raise InvalidJID('Localpart must not be 0 bytes')
return node
except stringprep_profiles.StringPrepError:
raise InvalidJID('Invalid local part')
@@ -202,7 +208,7 @@ def _validate_domain(domain):
domain = '.'.join(domain_parts)
if not domain:
- raise InvalidJID('Missing domain')
+ raise InvalidJID('Domain must not be 0 bytes')
return domain
@@ -216,7 +222,13 @@ def _validate_resource(resource):
"""
try:
if resource is not None:
+ if not resource:
+ raise InvalidJID('Resource must not be 0 bytes')
+
resource = resourceprep(resource)
+
+ if not resource:
+ raise InvalidJID('Resource must not be 0 bytes')
return resource
except stringprep_profiles.StringPrepError:
raise InvalidJID('Invalid resource')