From 330a28040095fff67e9cb105019f3b4cb7cb5f0e Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Mon, 12 Dec 2011 21:53:10 +0000 Subject: move check of required attributes and other common tests to the Request.handle_entry() method git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1570 ef36b2f9-881f-0410-afb5-c4e39611909c --- pynslcd/passwd.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'pynslcd/passwd.py') diff --git a/pynslcd/passwd.py b/pynslcd/passwd.py index cab2022..f575fac 100644 --- a/pynslcd/passwd.py +++ b/pynslcd/passwd.py @@ -39,22 +39,19 @@ bases = ( 'ou=people,dc=test,dc=tld', ) class PasswdRequest(common.Request): + case_sensitive = ('uid', 'uidNumber', ) + limit_attributes = ('uid', 'uidNumber', ) + required = ('uid', 'uidNumber', 'gidNumber', 'gecos', 'homeDirectory', + 'loginShell') + def write(self, dn, attributes, parameters): - # get uid attribute and check against requested user name + # get values names = attributes['uid'] - if 'uid' in parameters: - if parameters['uid'] not in names: - return - names = ( parameters['uid'], ) - # get user password entry if 'shadowAccount' in attributes['objectClass']: passwd = 'x' else: passwd = attributes['userPassword'][0] - # get numeric user and group ids - uids = ( parameters['uidNumber'], ) if 'uidNumber' in parameters else attributes['uidNumber'] - uids = [ int(x) for x in uids ] - # get other passwd properties + uids = [ int(x) for x in attributes['uidNumber'] ] gid = int(attributes['gidNumber'][0]) gecos = attributes['gecos'][0] home = attributes['homeDirectory'][0] -- cgit v1.2.3