fix nameprep for wrong jids. Fixes #6925

This commit is contained in:
Yann Leboulanger 2011-07-21 23:50:22 +02:00
parent 24d62c2591
commit cbecbd93a4
1 changed files with 3 additions and 1 deletions

View File

@ -2,7 +2,7 @@
## src/common/xmpp/stringprepare.py ## src/common/xmpp/stringprepare.py
## ##
## Copyright (C) 2001-2005 Twisted Matrix Laboratories ## Copyright (C) 2001-2005 Twisted Matrix Laboratories
## Copyright (C) 2005-2010 Yann Leboulanger <asterix AT lagaule.org> ## Copyright (C) 2005-2011 Yann Leboulanger <asterix AT lagaule.org>
## Copyright (C) 2006 Stefan Bethge <stefan AT lanpartei.de> ## Copyright (C) 2006 Stefan Bethge <stefan AT lanpartei.de>
## Copyright (C) 2007 Jean-Marie Traissard <jim AT lapin.org> ## Copyright (C) 2007 Jean-Marie Traissard <jim AT lapin.org>
## ##
@ -202,6 +202,8 @@ class NamePrep:
def nameprep(self, label): def nameprep(self, label):
label = idna.nameprep(label) label = idna.nameprep(label)
self.check_prohibiteds(label) self.check_prohibiteds(label)
if len(label) == 0:
raise UnicodeError, "Invalid empty name"
if label[0] == '-': if label[0] == '-':
raise UnicodeError, "Invalid leading hyphen-minus" raise UnicodeError, "Invalid leading hyphen-minus"
if label[-1] == '-': if label[-1] == '-':