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

SECURITY: normalize account names before checking network / oper filters

This commit is contained in:
James Lu 2018-03-30 11:54:45 -07:00
parent 557f1578bc
commit a6c1beaad0

View File

@ -15,8 +15,10 @@ from pylinkirc.log import log
def _login(irc, source, username): def _login(irc, source, username):
"""Internal function to process logins.""" """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()}
logindata = conf.conf['login'].get('accounts', {}).get(username, {}) logindata = accounts.get(username.lower(), {})
network_filter = logindata.get('networks') network_filter = logindata.get('networks')
require_oper = logindata.get('require_oper', False) require_oper = logindata.get('require_oper', False)
hosts_filter = logindata.get('hosts', []) hosts_filter = logindata.get('hosts', [])