Re: ruby-ldap and paged results on windows




On 8/21/07, Dave King <dave / davewking.com> wrote:

Hi-
I'm trying to get paged results to work with ruby-ldap against
Active Directory in Windows. I compiled ruby-ldap 0.9.7 following the
directions on
http://www.turnofthecrank.com/2006/09/11/ruby-ldap-and-win32/

Then I tried to run this code I found. The error I get is that ruby
can't find the constant LDAP_CONTROL_PAGEDRESULTS and if I put
LDAP.constants it's not listed. Any ideas?



The literal value of the control is "1.2.840.113556.1.4.319"
You might try defining that in your code and see if it works. (If you have
sharp eyes you'll notice that the enterprise number in the OID belongs to
Microsoft. Paged controls started life as a hack to make Active Directory
performance slightly less horrible.)

If you're still having trouble, try the Net::LDAP library. It supports
paged
results transparently.


Thanks for the tip. I tried setting the value of the control, then I got
an error that said
uninitialized constant LDAP_OPT_SERVER_CONTROLS (NameError)
Somewhere I found that this should be 0x12 (which may be wrong) so I set
it to that and got this error
`set_option': the set_option() function is unimplemented on this machine
(NotImplementedError)

So it looks like my problems may be bigger than undefined constants. I've
also been looking at Net::LDAP as well, the only problem I've found there
is that it doesn't parse my ldap filters right so I have to rewrite them
in the Net::LDAP way. For example this filter works fine in ruby-ldap
(&(samaccounttype=805306368)(|(lastLogonTimestamp<=128231111837280000)(&(!(lastLogonTimestamp=*)(whenCreated<=20070522000000.0Z)))))

but in Net::LDAP it gives me this error

c:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:302:in
`initialize': invalid filter syntax (Net::LDAP::LdapError)

when i run it like this

filter =
Net::LDAP::Filter.construct("(&(samaccounttype=805306368)(|(lastLogonTimestamp<=128231111837280000)(&(!(lastLogonTimestamp=*)(whenCreated<=20070522000000.0Z)))))")

I can rewrite my stuff to use the Net::LDAP filters, but it would be nice
to just use the ldap filter string.



.



Relevant Pages

  • Re: [Current User] filter problem
    ... from a Microsoft resource. ... filter to be on you need to change the ParameterBinding ... >> security group in Active Directory. ... >> Stefan Nilsson ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: [Current User] filter problem
    ... >>filter to the web part. ... >>security group in Active Directory. ... >>Best regards, ... >>Stefan Nilsson ...
    (microsoft.public.sharepoint.windowsservices)
  • Import Active Dicrectorys Mail Enabled Contacts?
    ... when I am importing accounts from Active Directory for the "People" search. ... This query plus the one from the link worked well in Active Directory Users ... However, when I put this filter into SPS, I got the following error when it ...
    (microsoft.public.sharepoint.portalserver.development)
  • [Current User] filter problem
    ... filter to the web part. ... security group in Active Directory. ... Active Directory, and yes, I have created actual users as well. ... Stefan Nilsson ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Listing only added users from Active Directory
    ... It would probably help if you specified the filter you are using. ... The description is still a bit nebulous, there is no DHCP user that I am aware of that comes with the system. ... Author of O'Reilly Active Directory Third Edition ... When i am exporting users from ActiveDirectory with ldifde command ...
    (microsoft.public.windows.server.active_directory)