I have some issues regarding searchEntry in LDAP repository using LDAPjs. I am not very familiar with LDAP and because of that I might be missing something in the client implementation. The problem is that after some period of time LDAP there is no response from LDAP server, just nothing none of the callbacks are invoked.
const ldapClient = ldap.createClient({
url: 'ldap://some.ldap.server',
timeout: 3000,
connectTimeout: 6000
});
ldapClient.search('c=XX', opts, (err, res) => {
if (err) {
ldapClient.unbind(function(err) {
if (err) {
console.log(err)
}
});
return next(null);
}
res.once('searchEntry', (entry) => {
ldapClient.unbind(function(err) {
if (err) {
console.log(err)
}
});
return next(entry);
});
res.on('error', (error) => {
ldapClient.unbind(function(err) {
if (err) {
console.log(err)
}
});
return next(null, new Error(error.message));
});
});