[attributs] test de shells valides ?

This commit is contained in:
Antoine Durand-Gasselin 2010-10-17 16:31:13 +02:00
parent 049f1b5460
commit 39bc969e22

View file

@ -453,8 +453,8 @@ class loginShell(Attr):
def parse_value(self, shell, ldif):
with open('/etc/shells') as f:
shells = f.readlines()
if (shell not in shells) or shell.startswith('#'):
shells = [ l.strip() for l in f.readlines() if not l.startswith('#') ]
if (shell not in shells)
raise ValueError("Shell %s invalide" % shell)
self.value = shell