From 7b474d0d1cf1a5c7a7b59e55b29a9778d5925742 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Wed, 21 Aug 2013 21:52:41 +0200 Subject: Have pynslcd handle mapped userPassword This fixes an error that could occur when the userPassword was retrieved from LDAP and insufficient privileges were available for reading the attribute. --- pynslcd/shadow.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pynslcd/shadow.py') diff --git a/pynslcd/shadow.py b/pynslcd/shadow.py index 5fd0aa9..89dbbfa 100644 --- a/pynslcd/shadow.py +++ b/pynslcd/shadow.py @@ -76,7 +76,10 @@ class ShadowRequest(common.Request): def convert(self, dn, attributes, parameters): names = attributes['uid'] - passwd = attributes['userPassword'][0] + try: + passwd = attributes['userPassword'][0] + except IndexError: + passwd = None if not passwd or self.calleruid != 0: passwd = '*' # function for making an int -- cgit v1.2.3