node-activedirectory icon indicating copy to clipboard operation
node-activedirectory copied to clipboard

sizeLimit don't working

Open Damassk opened this issue 9 years ago • 6 comments

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
}

Damassk avatar Feb 19 '16 13:02 Damassk

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 avatar Feb 19 '16 13:02 Damassk

@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

jsumners avatar Mar 02 '16 13:03 jsumners

Is this bug fixed? I am seeing the same issue. Only getting 1000 records when the AD server is set to 5000 limit..

fjuarez67 avatar Mar 18 '16 19:03 fjuarez67

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.

gheeres avatar Mar 18 '16 20:03 gheeres

Tried both:

  1. set the defaulPageSize to 5000. That worked..
  2. applied the patch from Damassk ( code above) that also worked.

Regards.

fjuarez67 avatar Mar 20 '16 13:03 fjuarez67

I'm also seeing this bug.

oceddi avatar Jun 22 '16 17:06 oceddi