I am doing passthrough authentication against a Novell eDirectory server. Currently I perform the following request:
results = server.search_s(
self.basedn,
ldap.SCOPE_SUBTREE,
'(objectClass=user)',
attrlist=['uid', 'networkAddress'])
(This is in python, let me know if you want me to explain it.)
The problem with this method is that each query returns every single user on the server, which I then have to loop through to find the user I'm interested in. I cache it, but what I'd really like to do is something like this:
results = server.search_s(
self.basedn,
ldap.SCOPE_SUBTREE,
'(&(objectClass=user)(networkAddress=#9#\x00\x00\xc0\xa8\n\x1e))')
(That wacky #9#
stuff is how the IP is stored - it's actually 192.168.10.30)
When I do a query for networkAddress
I get an 'Invalid Syntax'
error (even if I do something like networkAddress=blah
, without all the \
's).
Is there a way to do an LDAP query for a specific IP?