Hi
I'm getting an len() of unsized object error in LDAPUserFolder 2.7, but the problem code seems to be in 2.9.beta as well, so I'd like to bring it to your attention.
In LDAPUserFolder.getUserByAttr(), Line 694ff, login_name is defaulted to None by the .get(), but a few lines later on, a len() is done on it, which fails if it is None.
I have no idea why not user_attrs.has_key(self._login), but the default handling is certainly wrong.
>>> login_name = user_attrs.get(self._login_attr)
uid = user_attrs.get(self._uid_attr)
>>> if self._login_attr != 'dn' and len(login_name) > 0:
if name == self._login_attr:
logins = [x for x in login_name if value.lower() == x.lower()]
login_name = logins[0]
else:
login_name = login_name[0]
>>> elif len(login_name) == 0:
msg = 'getUserByAttr: "%s" has no "%s" (Login) value!' % (
user_dn, self._login_attr
)
logger.debug(msg)
self._cache('negative').set(value, NonexistingUser())
return None
I'd like to take the opportunity and thank you for a very useful product!
Best regards,
Martin Gfeller
|