freeradius/auth.py: reason is utf-8
This commit is contained in:
parent
08595c52ce
commit
4984b11021
1 changed files with 9 additions and 9 deletions
|
@ -264,7 +264,7 @@ def post_auth_wifi(data):
|
|||
mac = data.get('Calling-Station-Id', None)
|
||||
|
||||
log_message = '(wifi) %s -> %s [%s%s]' % \
|
||||
(port, mac, vlan_name, (reason and u': ' + reason).encode(u'utf-8'))
|
||||
(port, mac, vlan_name, (reason and u': ' + reason).encode('utf-8'))
|
||||
logger.info(log_message)
|
||||
radiusd.radlog(radiusd.L_AUTH, log_message)
|
||||
|
||||
|
@ -284,7 +284,7 @@ def post_auth_fil(data):
|
|||
mac = data.get('Calling-Station-Id', None)
|
||||
|
||||
log_message = '(fil) %s -> %s [%s%s]' % \
|
||||
(port, mac, vlan_name, (reason and u': ' + reason).encode(u'utf-8'))
|
||||
(port, mac, vlan_name, (reason and u': ' + reason).encode('utf-8'))
|
||||
logger.info(log_message)
|
||||
radiusd.radlog(radiusd.L_AUTH, log_message)
|
||||
|
||||
|
@ -311,10 +311,10 @@ def decide_vlan(data, is_wifi, conn):
|
|||
"""
|
||||
|
||||
if is_wifi:
|
||||
decision = 'wifi',''
|
||||
decision = 'wifi', u''
|
||||
port = data.get('Called-Station-Id', '?')
|
||||
else:
|
||||
decision = 'adherent',''
|
||||
decision = 'adherent', u''
|
||||
prise, chbre = get_prise_chbre(data)
|
||||
port = "%s/%s" % (prise, chbre)
|
||||
|
||||
|
@ -326,12 +326,12 @@ def decide_vlan(data, is_wifi, conn):
|
|||
proprio = machine.proprio()
|
||||
|
||||
if not machine['ipHostNumber']:
|
||||
decision = 'v6only', 'No IPv4'
|
||||
decision = 'v6only', u'No IPv4'
|
||||
elif unicode(machine['macAddress'][0]) in test_v6:
|
||||
decision = 'v6only', 'Test machine v6'
|
||||
decision = 'v6only', u'Test machine v6'
|
||||
elif machine['ipHostNumber'][0].value in netaddr.IPNetwork('10.2.9.0/24'):
|
||||
# Cas des personnels logés dans les appartements de l'ENS
|
||||
decision = 'appts', 'Personnel ENS'
|
||||
decision = 'appts', u'Personnel ENS'
|
||||
|
||||
# Application des blacklists
|
||||
for bl in machine.blacklist_actif():
|
||||
|
@ -346,7 +346,7 @@ def decide_vlan(data, is_wifi, conn):
|
|||
# prise d'un autre adhérent à jour de cotisation
|
||||
force_ma = False
|
||||
if chbre is None and not proprio['droits']:
|
||||
decision = "accueil", "Chambre inconnue"
|
||||
decision = "accueil", u"Chambre inconnue"
|
||||
elif chbre is not None:
|
||||
chbre = escape_ldap(chbre)
|
||||
hebergeurs = conn.search(u'(&(chambre=%s)(cid=*)(aid=*))' % chbre)
|
||||
|
@ -363,7 +363,7 @@ def decide_vlan(data, is_wifi, conn):
|
|||
else:
|
||||
force_ma = True
|
||||
if force_ma:
|
||||
decision = decision[0], decision[1] + ' (force MA)'
|
||||
decision = decision[0], decision[1] + u' (force MA)'
|
||||
|
||||
return (port,) + decision
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue