3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 20:22:45 +01:00

exttargets.account: fix extraneous lowercasing of the network name

This commit is contained in:
James Lu 2019-12-25 15:57:48 -08:00
parent ae01c5e418
commit b45fe4c121

View File

@ -45,7 +45,7 @@ def account(irc, host, uid):
slogin = irc.to_lower(str(userobj.services_account))
# Split the given exttarget host into parts, so we know how many to look for.
groups = list(map(irc.to_lower, host.split(':')))
groups = host.split(':')
log.debug('(%s) exttargets.account: groups to match: %s', irc.name, groups)
if len(groups) == 1:
@ -53,12 +53,12 @@ def account(irc, host, uid):
return bool(slogin)
elif len(groups) == 2:
# Second scenario. Return True if the user's account matches the one given.
return slogin == groups[1] and homenet == irc.name
return slogin == irc.to_lower(groups[1]) and homenet == irc.name
else:
# Third or fourth scenario. If there are more than 3 groups, the rest are ignored.
# In other words: Return True if the user is logged in, the query matches either '*' or the
# user's login, and the user is connected on the network requested.
return slogin and (groups[1] in ('*', slogin)) and (homenet == groups[2])
return slogin and (irc.to_lower(groups[1]) in ('*', slogin)) and (homenet == groups[2])
@bind
def ircop(irc, host, uid):