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

SECURITY: normalize account names before checking network / oper filters

(cherry picked from commit a6c1beaad0)
This commit is contained in:
James Lu 2018-03-30 11:54:45 -07:00
parent 22efe1384c
commit 310ad345a3

View File

@ -15,12 +15,15 @@ from pylinkirc.log import log
def _login(irc, source, username):
"""Internal function to process logins."""
# Mangle case before we start checking for login data.
accounts = {k.lower(): v for k, v in conf.conf['login'].get('accounts', {}).items()}
if irc.is_internal_client(source):
irc.error("Cannot use 'identify' via a command proxy.")
return
logindata = conf.conf['login'].get('accounts', {}).get(username, {})
logindata = accounts.get(username.lower(), {})
network_filter = logindata.get('networks')
require_oper = logindata.get('require_oper', False)
hosts_filter = logindata.get('hosts', [])