Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/pynslcd/host.py
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2011-12-12 22:53:10 +0100
committerArthur de Jong <arthur@arthurdejong.org>2011-12-12 22:53:10 +0100
commit330a28040095fff67e9cb105019f3b4cb7cb5f0e (patch)
tree802d2a763f9210a3a1f581a9f758bdde301b96df /pynslcd/host.py
parentf4b3ad848987eb6ac2cf50d7ea99d1a7b579c70c (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/host.py')
-rw-r--r--pynslcd/host.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/pynslcd/host.py b/pynslcd/host.py
index 85e88a6..c2f8074 100644
--- a/pynslcd/host.py
+++ b/pynslcd/host.py
@@ -30,18 +30,14 @@ filter = '(objectClass=ipHost)'
class HostRequest(common.Request):
+ canonical_first = ('cn', )
+ required = ('cn', )
+
def write(self, dn, attributes, parameters):
- hostname = common.get_rdn_value(dn, attmap['cn'])
+ # get values
hostnames = attributes['cn']
- if not hostnames:
- print 'Error: entry %s does not contain %s value' % ( dn, attmap['cn'] )
- if not hostname:
- hostname = hostnames.pop(0)
- elif hostname in hostnames:
- hostnames.remove(hostname)
+ hostname = hostnames.pop(0)
addresses = attributes['ipHostNumber']
- if not addresses:
- print 'Error: entry %s does not contain %s value' % ( dn, attmap['ipHostNumber'] )
# write result
self.fp.write_int32(constants.NSLCD_RESULT_BEGIN)
self.fp.write_string(hostname)