Comments (4)
Howdy,
Yeah, perfect - so if they're sending "compound" filters you kind of have to introspect the filter to see what type it is. Here's a complex example of doing it in the riak backend I wrote: https://github.com/mcavage/node-ldapjs-riak/blob/master/lib/search.js#L86
That said, if you're sure they're only going to send and and or filters, just do this:
var address = req.filter.filters && req.filter.filters.length ? req.filter.filters[0].value : req.filter.value;
Basically if it's an and|or filter, it will have a filters
property, which is an array, and judging by wat you sent they should be "simple" filters at that point.
You probably don't want to do a regex, in case the value has a whacky character in it. Let me know if that helps.
m
from node-ldapjs.
Hi,
actually, my example were incorrect, was xavier* instead of xavier (so that's in initial instead of value). And the one from outlook generated a filters[0].filters...
anyway, went for a regex at the end (yeap I know, now I have two problems ;)
var address = req.filter.toString().match(/(\w.?=(._?)_)/);
and address[1] is so far good enough.
To be continued...
from node-ldapjs.
Hey Xavier,
Well, if it's a substring filter - is it sending *xavier*
or xavier*
? Basically, you could look at ldapjs/lib/filters/substr_filter.js and grab one of the properties depending on how it's being set. Or just regex ;)
m
from node-ldapjs.
Well, if it's a substring filter - is it sending
*xavier*
orxavier*
?
For the autocomplete, it seems to be xavier*. ldap.js is super useful to
check out what the clients send. It seems to be a bit "creative".
Basically, you could look at ldapjs/lib/filters/substr_filter.js and grab
one of the properties depending on how it's being set. Or just regex ;)So, I'm having it running for a beta and tracking the queries for a while
seeing what I'm catching and what I'm missing... to be continued.
So far, the biggest issue seems to be that some version of thunderbird are
denial of servicing me (firering a ldap query at every keystroket). I'm not
sure if I should skip all queries of less than 2 chars or if I throttle
somehow (eg. queue the queries and don't run the old one if a new one comes
in less than x ms)
Testing...
from node-ldapjs.
Related Issues (20)
- Whitespace in (old) parseFilter causes `Uncaught Error: missing paren`
- Module build failed: UnhandledSchemeError: Reading from "node:util" is not handled by plugins (Unhandled scheme). HOT 4
- SASL / GSSAPI support HOT 3
- Open ssl issue with node 18 HOT 1
- Compatibility Issue Between ldapjs Library and FreeRADIUS HOT 1
- Edited: Ldapjs doesn't work after next.js build HOT 5
- Sharing unescape DN code for helper method
- (node:536) [LDAP_MESSAGE_DEP_001] LdapjsMessageWarning: messageID is deprecated. Use messageId instead. HOT 1
- Missing LDAP Result Codes in errors.js HOT 1
- AttributeFilter not implemented on Server? HOT 3
- What is Naming Violation Error HOT 1
- LDAPJS Server: when searching, I need to request in lowercase attributes in order to get mixed-case attributes HOT 1
- Assistance Needed with LDAPS Connection to Windows Server 2012 R2 AD HOT 2
- TLS 1.3 not supported
- Why does the bind method call fail without throwing exception information? HOT 1
- Parse Error
- Get IP of a request
- problems changing passwords HOT 2
- Problem binding to active directory special characters HOT 1
- res.on("searchEntry") in next.js after build does not return data. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-ldapjs.