Alias: add hard-coded check that alias names are valid registry names

This commit is contained in:
jacksonmj 2015-08-22 13:18:19 +00:00
parent 4507771ce7
commit f5c66afe4f

View File

@ -319,10 +319,17 @@ class Alias(callbacks.Plugin):
group.unregister(name) group.unregister(name)
def setLocked(name, value): def setLocked(self, name, value):
self.aliases[name][1] = value self.aliases[name][1] = value
self.aliasRegistryNode(name).locked.setValue(value) self.aliasRegistryNode(name).locked.setValue(value)
def isValidName(self, name):
if not re.search(self.registryValue('validName'), name):
return False
if not registry.isValidRegistryName(name):
return False
return True
@internationalizeDocstring @internationalizeDocstring
def lock(self, irc, msg, args, name): def lock(self, irc, msg, args, name):
"""<alias> """<alias>
@ -350,7 +357,7 @@ class Alias(callbacks.Plugin):
unlock = wrap(unlock, [('checkCapability', 'admin'), 'commandName']) unlock = wrap(unlock, [('checkCapability', 'admin'), 'commandName'])
def addAlias(self, irc, name, alias, lock=False): def addAlias(self, irc, name, alias, lock=False):
if not re.search(self.registryValue('validName'), name): if not self.isValidName(name):
raise AliasError('Invalid alias name.') raise AliasError('Invalid alias name.')
realName = callbacks.canonicalName(name) realName = callbacks.canonicalName(name)
if name != realName: if name != realName: