sizeLimit don't working
On my ActiveDirectory server set MaxPageLimit to 2500 and command 'ldapsearch' confirmed this value. I have 2433 user in AD. But when I'm trying to get all users from AD, the most get only 1,000. I'm tried use paging, sizeLimit and pageSize param, but I have no changes. My code:
var ad = new ActiveDirectory(config);
var query = {
filter: '(&(!(sAMAccountName=*_envtest))(objectClass=User))',
//paging: true,
//sizeLimit: 2500,
paging: {
pageSize: 2500
}
};
ad.findUsers(query, false, function(err, users) {
// TODO
}
I fix this problem add sizeLimit params to lib/activedirectory.js My fix:
var sizeLimit = opts.sizeLimit || defaultPageSize;
// Add paging results control by default if not already added.
if (!_.any(controls, function(control) { return(control instanceof ldap.PagedResultsControl); })) {
log.debug('Adding PagedResultControl to search (%s) with filter "%s" for %j',
baseDN, truncateLogOutput(opts.filter), _.any(opts.attributes) ? opts.attributes : '[*]');
controls.push(new ldap.PagedResultsControl({ value: { size: sizeLimit } }));
}
@Damassk would you be up for testing this against my es2015 branch? I'd like to know if the bug still persists as you understand it.
https://github.com/jsumners/node-activedirectory/tree/es2015
Is this bug fixed? I am seeing the same issue. Only getting 1000 records when the AD server is set to 5000 limit..
Please apply the patch / change that Damassk specified and get back to us on your results. If confirmed, I can merge those changes and publish and updated version.
Tried both:
- set the defaulPageSize to 5000. That worked..
- applied the patch from Damassk ( code above) that also worked.
Regards.
I'm also seeing this bug.