3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-29 14:12:39 +01:00

exttargets.account: fix extraneous lowercasing of the network name

(cherry picked from commit b45fe4c121)
This commit is contained in:
James Lu 2019-12-25 15:57:48 -08:00
parent a178a92d6a
commit 4d24aa236b

View File

@ -44,7 +44,7 @@ def account(irc, host, uid):
slogin = irc.to_lower(userobj.services_account) slogin = irc.to_lower(userobj.services_account)
# Split the given exttarget host into parts, so we know how many to look for. # 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) log.debug('(%s) exttargets.account: groups to match: %s', irc.name, groups)
if len(groups) == 1: if len(groups) == 1:
@ -52,12 +52,12 @@ def account(irc, host, uid):
return bool(slogin) return bool(slogin)
elif len(groups) == 2: elif len(groups) == 2:
# Second scenario. Return True if the user's account matches the one given. # 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: else:
# Third or fourth scenario. If there are more than 3 groups, the rest are ignored. # 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 # 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. # 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 @bind
def ircop(irc, host, uid): def ircop(irc, host, uid):