Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong paged result from search #36

Open
cfbrobak opened this issue Apr 10, 2012 · 11 comments
Open

Wrong paged result from search #36

cfbrobak opened this issue Apr 10, 2012 · 11 comments

Comments

@cfbrobak
Copy link

Environment: Windows XP, Java 1.6.0_29, JRuby 1.6.7 and net-ldap 0.3.1. JRuby is running in Ruby 1.9 mode.

Scenario: Searching for computers in our Windows Active Directory.

As I understand it, if the search result contains more than 126 (hardcoded page size in net/ldap.rb) entries, which it always does in my case, the server returns a cookie indicating a paged result (RFC 2696). The cookie should be sent back by the client when requesting more entries from the result. This does not seem to work. The result is always 126 bigger than it should be and those 126 seem to be duplicates of some already in the result.

Another problem: If the result contains more than 1000 entries a "Size Limit Exceeded" error is returned.

My guess is that net-ldap somehow changes the cookie before sending it back to the server.

If I switch to net-ldap 0.2.2, it seems to work as it should.

@GirlBossRush
Copy link

I've also experienced this issue. an encoding exception occurs on the 127th request.

@normelton
Copy link

I had similar problems, the paging cookie got corrupted by the UTF-8 encoding. The master branch seems to behave better than 0.3.1.

@blackpoplar
Copy link

I'm seeing something similar to this (duplicate results, but not all are duplicated) querying AD (Server 2008). Ruby 1.9.3p125 (2012-02-16) [i386-mingw32] with 0.3.1 exhibits the problem (windows 7). Ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-linux] with 0.3.1 does not.

@chy168
Copy link

chy168 commented Mar 15, 2013

I had similar problems, too. My case might have over 5000 entity in AD server. I alway fetch '1126' entries from AD on 0.3.1. (Even I manual patched net-ldap by #44 ). If I switch to 0.2.2, the problem had gone.

@GirlBossRush
Copy link

It's best to abandon this gem. The project is not being maintained. I ended up using Python's LDAP libraries to solve the issue. Not ideal, but it gets the job done.

On Mar 15, 2013, at 3:08 AM, Hung-Yen notifications@github.com wrote:

I had similar problems, too. My case might have over 5000 entity in AD server. I alway fetch '1126' entries from AD on 0.3.1. (Even I manual patched net-ldap by #44 ). If I switch to 0.2.2, the problem had gone.


Reply to this email directly or view it on GitHub.

@saimonmoore
Copy link

this is still an issue for me. Even though the page size is set to 126 and the possible result set is generally much larger than 1000 entries (I set the size to a very large number as I want the whole result set) the behaviour I'm seeing with AD is:

  • a first page containing 126 results
  • a 2nd page up until 1126 results
  • then Size Limit exceeded error

as if it was not actually doing any paging (126 results at a time).

In ruby there doesn't seem to be any other project as active as this one but this is a real blocker for us.

@jch can you please comment on this? I'm using master (8a18267) branch and seeing this behaviour...

@saimonmoore
Copy link

And I have just confirmed that 0.2.2 works fine (at least with paging)

@jch
Copy link
Member

jch commented Nov 12, 2015

@saimonmoore thanks for bumping this thread and the helpful reproduction list. I wasn't a maintainer back around 0.2.2, so I'll need to take some time to dig into the differences. There's been a lot of changes since then, so it may be worth revisiting this from scratch as well.

It sounds like you have a good environment for reproducing this. Would you be interested in opening a PR to attempt to fix this? I'm not very familiar with AD and don't have a local setup, so it would speed up development if you got something started. I'm happy to code review and follow up.

cc @meastman also in case you're looking for something to hack on during downtime

@saimonmoore
Copy link

@jch basically it all started to break with the introduction of utf8 encoding...

I will try and see if I have more time to track down the exact change...

@jch
Copy link
Member

jch commented Nov 12, 2015

Arrrgh, UTF8! 👍 to digging in.

@arindam2
Copy link

arindam2 commented May 3, 2017

Encountering this issue described on StackOverflow. Weird behaviour because the problem is only seen when I invoke the code from Rails, not while I run it through a regular script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants