3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-23 19:19:31 +01:00

match_host: implicitly convert string masks such as "user1" to "$pylinkacc:user1"

This keeps it in line with other services packages and is way nicer to read.
This commit is contained in:
James Lu 2017-08-07 16:31:17 -07:00
parent 8059f3f7fc
commit e0e929492e
2 changed files with 12 additions and 1 deletions

View File

@ -1016,6 +1016,17 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
# Prepare a list of hosts to check against.
if target in self.users:
if not utils.isHostmask(glob):
for specialchar in '$:()':
# XXX: we should probably add proper rules on what's a valid account name
if specialchar in glob:
break
else:
# Implicitly convert matches for *sane* account names to "$pylinkacc:accountname".
log.debug('(%s) Using target $pylinkacc:%s instead of raw string %r', self.name, glob, glob)
glob = '$pylinkacc:' + glob
if glob.startswith('$'):
# Exttargets start with $. Skip regular ban matching and find the matching ban handler.
glob = glob.lstrip('$')

View File

@ -101,7 +101,7 @@ permissions:
# Replace ABC123 with your PyLink account name (configured above)
# in order to give yourself admin access.
"$pylinkacc:ABC123":
"ABC123":
- "*"
servers: