From a7d3af3ca1d704af25bcc8601d4a2c6d9165ebe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Elliott=20B=C3=A9cue?= Date: Sun, 5 May 2013 05:41:36 +0200 Subject: [PATCH] =?UTF-8?q?[lc=5Fldap/attributs]=20ns1.crans.ens-cachan.fr?= =?UTF-8?q?=20n'=C3=A9tait=20pas=20un=20nom=20d'h=C3=B4te=20valide.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- attributs.py | 5 ++--- lc_ldap.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/attributs.py b/attributs.py index 5c1c4fb..3e2c439 100644 --- a/attributs.py +++ b/attributs.py @@ -503,9 +503,8 @@ class dnsAttr(Attr): category = 'dns' def parse_value(self, val): val = val.lower() - name, net = val.split('.', 1) - if (net not in ['adm.crans.org', 'crans.org', 'wifi.crans.org'] or - not re.match('[a-z][-_a-z0-9]+', name)): + name, _ = val.split('.', 1) + if not re.match('[a-z][-_a-z0-9]+', name): raise ValueError("Nom d'hote invalide %r" % val) self.value = val diff --git a/lc_ldap.py b/lc_ldap.py index 3ecccf4..d2f7d90 100644 --- a/lc_ldap.py +++ b/lc_ldap.py @@ -252,7 +252,7 @@ class lc_ldap(ldap.ldapobject.LDAPObject, object): uldif['ipsec'] = [u''.join( random.choice(filter(lambda x: x != 'l' and x != 'o', string.lowercase) + filter(lambda x: x != '1' and x != '0', string.digits)) for i in range(10))] assert isinstance(owner, adherent) or isinstance(owner, club) - elif realm in ["fil-adherents", "fil-v6", "personnel-ens"]: + elif realm in ["adherents", "fil-adherents", "fil-v6", "personnel-ens"]: uldif['objectClass'] = [u'machineFixe'] assert isinstance(owner, adherent) or isinstance(owner, club) @@ -824,7 +824,7 @@ class proprio(CransLdapObject): def machines(self): """Renvoie la liste des machines""" if not self._machines: - self._machines = self.conn.search('mid=*', dn = self.dn, scope = 1) + self._machines = self.conn.search('mid=*', dn = self.dn, scope = 1, mode=self.mode) for m in self._machines: m._proprio = self return self._machines