summaryrefslogtreecommitdiff
path: root/pynslcd/ether.py
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2011-12-12 22:59:00 +0000
committerArthur de Jong <arthur@arthurdejong.org>2011-12-12 22:59:00 +0000
commit8c480f86c83b45d8922ae2b7353874ed499f3df1 (patch)
treeff609b39a803cf74d59f1a53fda272e73f1c0097 /pynslcd/ether.py
parent330a28040095fff67e9cb105019f3b4cb7cb5f0e (diff)
define the search separately from the request
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1571 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'pynslcd/ether.py')
-rw-r--r--pynslcd/ether.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/pynslcd/ether.py b/pynslcd/ether.py
index 05dea72..b26dcc7 100644
--- a/pynslcd/ether.py
+++ b/pynslcd/ether.py
@@ -38,23 +38,19 @@ attmap = common.Attributes(cn='cn', macAddress='macAddress')
filter = '(objectClass=ieee802Device)'
-class EtherRequest(common.Request):
+class Search(common.Search):
case_insensitive = ('cn', )
limit_attributes = ('cn', 'macAddress')
required = ('cn', 'macAddress')
+
+class EtherRequest(common.Request):
+
def write(self, dn, attributes, parameters):
- # get names
+ # get values
names = attributes['cn']
- # get addresses and convert to binary form
addresses = [ether_aton(x) for x in attributes['macAddress']]
- if 'macAddress' in parameters:
- address = ether_aton(parameters['macAddress'])
- if address not in addresses:
- print 'value %r for attribute %s not found in %s' % (parameters['macAddress'], attmap['macAddress'], dn)
- return
- addresses = ( address, )
# write results
for name in names:
for ether in addresses: