summaryrefslogtreecommitdiff
path: root/pynslcd/ether.py
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2013-02-23 22:31:04 +0100
committerArthur de Jong <arthur@arthurdejong.org>2013-02-23 22:31:04 +0100
commit61a3fce57df6e3fed01506765a0401be7c04af0f (patch)
tree12ab5509ba81f47e361cee402e7517686a629c5f /pynslcd/ether.py
parenta9aea20f136026d6553295727350c88fe2431e0c (diff)
also search for alternative macAddress representation in pynslcd
Diffstat (limited to 'pynslcd/ether.py')
-rw-r--r--pynslcd/ether.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/pynslcd/ether.py b/pynslcd/ether.py
index a26ac3b..e6975d5 100644
--- a/pynslcd/ether.py
+++ b/pynslcd/ether.py
@@ -1,7 +1,7 @@
# ether.py - lookup functions for ethernet addresses
#
-# Copyright (C) 2010, 2011, 2012 Arthur de Jong
+# Copyright (C) 2010, 2011, 2012, 2013 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -46,6 +46,16 @@ class Search(common.Search):
limit_attributes = ('cn', 'macAddress')
required = ('cn', 'macAddress')
+ def mk_filter(self):
+ # we need a custom mk_filter because this is an | query
+ if 'macAddress' in self.parameters:
+ ether = self.parameters['macAddress']
+ alt_ether = ':'.join('%02x' % int(x, 16) for x in ether.split(':'))
+ return '(&%s(|(%s=%s)(%s=%s)))' % (self.filter,
+ attmap['macAddress'], ether,
+ attmap['macAddress'], alt_ether)
+ return super(Search, self).mk_filter()
+
class Cache(cache.Cache):
pass