node-ldapjs
node-ldapjs copied to clipboard
Execution failing with error: Time Limit Exceeded while retrieving newly created objects
Connection Timeout Error while retreiving newly created computer object using date filter in Microsoft Active Directory.
Below is the code snippet for the execution:
var ldap = require('ldapjs');
var fs = require("fs");
var opts = {
key: fs.readFileSync("./abcd_key.pem"),
cert: fs.readFileSync("./abcd_cert.pem"),
ca: [fs.readFileSync('./AbcdCertCA.pem')],
rejectUnauthorized: false
};
var client = ldap.createClient({
url: 'ldaps://myldaphost:port',
tlsOptions: opts
});
client.bind('Admin DN', 'password', function(err) {
if(err){
console.log('error',err);
}else{
console.log('bind is success');
}
});
var opts = {
filter: '(&(objectClass=computer)(whenCreated>=20191226041710.0Z))',//I have created new computer object and it is avialble in LDAP server which satisfies this criteria.
scope: 'sub'
};
client.search('DC=abc,DC=xyz,DC=com', opts, function(err, res) {
if(err){
console.log('error',err);
}else{
res.on('searchEntry', function(entry) {
console.log('entry : ' + JSON.stringify(entry.object));
});
res.on('searchReference', function(referral) {
console.log('referral: ' + referral.uris.join());
});
res.on('error', function(err) {
console.error('error: ' + err.message);
});
res.on('end', function(result) {
console.log('end: ' + result);
});
}
});
Below is the error:
referral: ldap://ForestDnsZones.abc.xyz.com/DC=ForestDnsZones,DC=abc,DC=xyz,DC=com referral: ldap://DomainDnsZones.abc.xyz.com/DC=DomainDnsZones,DC=abc,DC=xyz,DC=com referral: ldap://abc.xyz.com/CN=Configuration,DC=abc,DC=xyz,DC=com error: Time Limit Exceeded
The same code is working if we change the date filter to retrieve records which has less entries in the system like 'contact' or increasing the time like retrieving last month/year records. The issue is only with newly created objects with date filter.
Please let me know in case any further information required. Thank you.
Can you reproduce this in our integration test suite?
Hi @jsumners, I have provided sample code for reproducing this issue. I will try to check for test suite. Thank you.
Your sample code targets an unspecified Active Directory server. I am asking if you can replicate this issue by adding a test to our test suite -- https://github.com/ldapjs/node-ldapjs/tree/8384a4736ff03bc6a09da5ee0e12d69eae02d277/test-integration/client
https://github.com/ldapjs/node-ldapjs/blob/8384a4736ff03bc6a09da5ee0e12d69eae02d277/package.json#L43
👋
On February 22, 2023, we released version 3 of this library. As a result, we are closing this issue/pull request.
Please see issue #839 for more information, including how to proceed if you feel this closure is in error.