8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-30 08:32:26 +00:00

Fix bug, empèche le crash de freeradius si login non ascii

This commit is contained in:
Gabriel Detraz 2017-11-11 18:06:50 +00:00 committed by root
parent cd7fab5edf
commit 70f5d55667

View file

@ -154,11 +154,12 @@ def authorize(data):
else: else:
nas_type = None nas_type = None
if not nas_type or nas_type.port_access_mode == '802.1X': if not nas_type or nas_type.port_access_mode == '802.1X':
user = data.get('User-Name', '') user = data.get('User-Name', '').decode('utf-8', errors='replace')
user = user.split('@', 1)[0] user = user.split('@', 1)[0]
mac = data.get('Calling-Station-Id', '') mac = data.get('Calling-Station-Id', '')
result, log, password = check_user_machine_and_register(nas_type, user, mac) result, log, password = check_user_machine_and_register(nas_type, user, mac)
logger.info(log.encode('utf-8')) logger.info(log.encode('utf-8'))
logger.info(user.encode('utf-8'))
if not result: if not result:
return radiusd.RLM_MODULE_REJECT return radiusd.RLM_MODULE_REJECT