diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2011-12-12 22:53:10 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2011-12-12 22:53:10 +0100 |
commit | 330a28040095fff67e9cb105019f3b4cb7cb5f0e (patch) | |
tree | 802d2a763f9210a3a1f581a9f758bdde301b96df /pynslcd/passwd.py | |
parent | f4b3ad848987eb6ac2cf50d7ea99d1a7b579c70c (diff) |
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
Diffstat (limited to 'pynslcd/passwd.py')
-rw-r--r-- | pynslcd/passwd.py | 17 |
1 files changed, 7 insertions, 10 deletions
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] |