[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Restrict nicknames to nice identifiers, as specified in...
Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv22730/lib/mixminion
Modified Files:
Config.py
Log Message:
Restrict nicknames to nice identifiers, as specified in dir-spec.txt
Index: Config.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Config.py,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- Config.py 19 Nov 2003 09:48:09 -0000 1.66
+++ Config.py 20 Nov 2003 08:48:33 -0000 1.67
@@ -403,12 +403,16 @@
_NICKNAME_CHARS = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"+
"abcdefghijklmnopqrstuvwxyz"+
- "0123456789_.@-")
+ "0123456789-")
+_NICKNAME_INITIAL_CHARS = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"+
+ "abcdefghijklmnopqrstuvwxyz")
+
MAX_NICKNAME = 128
def _parseNickname(s):
"""Validation function. Returns true iff s contains a valid
server nickname -- that is, a string of 1..128 characters,
- containing only the characters [A-Za-z0-9_@], '.' or '-'.
+ containing only the characters [A-Za-z0-9], or '-'. It must
+ not begin with a digit or a '-'.
"""
s = s.strip()
bad = s.translate(mixminion.Common._ALLCHARS, _NICKNAME_CHARS)
@@ -418,6 +422,8 @@
raise ConfigError("Nickname is too long")
elif len(s) == 0:
raise ConfigError("Nickname is too short")
+ elif s[0] not in _NICKNAME_INITIAL_CHARS:
+ raise ConfigError("Nickname begins with invalid character %r" %s[0])
return s
def _parseFilename(s):