diff --git a/freeradius/auth.py b/freeradius/auth.py index dd4135a6..1422ca80 100644 --- a/freeradius/auth.py +++ b/freeradius/auth.py @@ -209,8 +209,8 @@ def get_fresh_rid(machine): machine.conn.lockholder.purge(lockId) @use_ldap_admin -def register_mac(data, machine, conn): - """Enregistre la mac actuelle sur une machine donnée.""" +def register_machine(data, machine, conn): + """Enregistre la mac actuelle et/ou assigne le rid sur une machine donnée.""" # TODO lc_ldap devrait posséder une fonction pour passer en rw depuis un ro if 'w' not in machine.mode: machine = conn.search(dn=machine.dn, scope=ldap.SCOPE_BASE, mode='rw')[0] @@ -427,8 +427,8 @@ def decide_vlan(data, is_wifi, conn): proprio = machine.proprio() # Avant de continuer, on assigne la mac à la machine candidat - if '' in machine['macAddress']: - register_mac(data, machine) + if '' in machine['macAddress'] or not machine['rid']: + register_machine(data, machine) if not machine['ipHostNumber']: decision = 'v6only', u'No IPv4'