jeremycx / node-LDAP

LDAP binding for node.js
MIT License
221 stars 43 forks source link

LDAP search not working #79

Closed user0403 closed 8 years ago

user0403 commented 8 years ago

In the previous version of node-LDAP, the below code was working as expected but now its throwing error { [LDAPError: Timeout] name: 'LDAPError', message: 'Timeout' } when tested with new npm ldap-client.

var ldap = require('ldap-client'); var bind_options = { binddn: 'cn=admin,dc=nodomain', password: 'password' }; var ldapObj = new ldap({ uri: "ldap://IP", version: 3, connecttimeout: 1, reconnect: true }); ldapObj.open(function (err) {

}); ldapObj.simplebind(bind_options, function (err) { if (err) { console.log(err); } else { var search_options = { base: "dc=nodomain", scope: '', filter: '', attrs: '', pagesize: 2 }; ldapObj.search(search_options, function (err, data) { if (err) { console.log(err) } else { console.log("success") } }) } })

jeremycx commented 8 years ago

Unfortunately, there's been some API changes - and I'm still working on the reconnection logic - should be 100% complete by the end of this week.

For now, try removing the scope: '', filter: '', attrs: '', from the search options - if those values are undefined, then you get the defaults, but you have them as empty strings instead.

jeremycx commented 8 years ago

Closing.