fix nameprep for wrong jids. Fixes #6925
This commit is contained in:
parent
24d62c2591
commit
cbecbd93a4
|
@ -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] == '-':
|
||||||
|
|
Loading…
Reference in New Issue