From: Allen, R. <ra...@ci...> - 2000-07-03 19:39:33
|
> From: Mark Wilcox [mailto:mew...@un...] > > sorry I don't. I couldn't find anything on the IETF site as > well. I wonder if it's buried in a MS document somewhere, hidden by an NDA :). As Graham mentioned, checking for the Paged cookie to be unset does the job. > But I did remember another argument for not including the > paged-control in the search method, it's a proprietary control > for Active Directory (this is perfectly legal LDAP, however ;). It will be > replaced by the Virtual List View control in future versions of AD, > because VLV provides everything Page control does, but it's > being agreed upon by Netscape, Microsoft and Novell, thus should be more > standardized across the board (I know Netscape already supports it, I think Novell > does). Ok, then replace Paged with VLV in my suggestion ;-) All I'm really asking is for the search method to return all entries that match the search criteria. To be safe, I need to use VLV in all of my searches, because one day the number of entries returned may exceed the server limit, or the server limit may one day be set lower, and the application may break because it does not get all the entries it thinks it should. This may not be an issue in some environments, but it is in mine. Coming from a database background where this limitation wasn't enforced, paging creates an additional hurdle. I'm not saying server limits are inherently a bad thing, I just wish it was easier to get around. Robbie Allen > Mark > > On Mon, 3 Jul 2000, Graham Barr wrote: > > > Does anyone know when a Paged search is complete ? > > > > ----- Forwarded message from "Allen, Robbie" > <ra...@ci...> ----- > > > > From: "Allen, Robbie" <ra...@ci...> > > To: "'Graham Barr'" <gb...@po...> > > Subject: RE: Page or VLV control > > Date: Sun, 2 Jul 2000 12:49:13 -0700 > > X-Mailer: Internet Mail Service (5.5.2650.21) > > > > Yep, that's better. So here is the finished product that > works for me: > > > > #----------------------------------------------------# > > use Net::LDAP; > > use Net::LDAP::Control; > > use Net::LDAP::Constant qw( LDAP_CONTROL_PAGED > LDAP_CONTROL_SORTREQUEST > > ); > > > > ... > > > > $page = Net::LDAP::Control->new( LDAP_CONTROL_PAGED, > size => 1000); > > $sort = Net::LDAP::Control->new( > LDAP_CONTROL_SORTREQUEST, order => > > 'cn'); > > @args = ( base => > "cn=subnets,cn=sites,cn=configuration,$BASE_DN", > > scope => "subtree", > > filter => "(objectClass=subnet)", > > control => [ $sort, $page ] ); > > while (($mesg = $LDAP->search( @args ))) { > > print_subnet($_) foreach $mesg->entries; > > last if $mesg->count < $page->size; > > ($resp) = $mesg->control( LDAP_CONTROL_PAGED ); > > $page->cookie($resp->cookie); > > } > > #----------------------------------------------------# > > > > The only question that still remains for me is the best way > to determine > > a Paged search is complete. Above I just check to see if > the mesg count > > is less than the page size, but seems like there should be a more > > intuitive approach. The search inside the while clause isn't a good > > check, because after the search completes, it starts over > again from 1 > > (and continues), so the only way to break out of the loop > is with the > > 'last' call. > > > > Thanks for working on this!!! This is the critical piece I > was missing > > to start automating a lot of our Active Directory processes. > > > > Robbie Allen > > > > > > > -----Original Message----- > > > From: Graham Barr [mailto:gb...@po...] > > > Sent: Sunday, July 02, 2000 12:01 AM > > > To: Allen, Robbie > > > Subject: Re: Page or VLV control > > > > > > > > > Ah, OK. Try this new patch > > > > > > Graham. > > > > > > On Sat, Jul 01, 2000 at 08:32:35PM -0700, Allen, Robbie wrote: > > > > Works! At least for Paged and Sort, haven't tried VLV yet. > > > For some > > > > reason, when I used both Paged and Sort together, I also > > > had to 'use' > > > > SortResult.pm or else it complained that it couldn't find init: > > > > > > > > Can't locate object method "init" via package > > > > "Net::LDAP::Control::SortResult" a > > > > t > /usr/SD/perl5.004_05/lib/site_perl/Net/LDAP/Control.pm line 78. > > > > > > > > Wasn't necessary though if I just used the Sort control > by itself. > > > > > > > ----- End forwarded message ----- > > > > > > > |
From: Graham B. <gb...@po...> - 2000-07-04 03:20:04
|
On Mon, Jul 03, 2000 at 12:33:44PM -0700, Allen, Robbie wrote: > All I'm really asking is for the search method to return all entries > that match the search criteria. To be safe, I need to use VLV in all of > my searches, because one day the number of entries returned may exceed > the server limit, or the server limit may one day be set lower, and the > application may break because it does not get all the entries it thinks > it should. This may not be an issue in some environments, but it is in > mine. Ah, it sounds like you want the LDAPiranah module someone wrote a while back. It will need so changes to work with the latest Net::LDAP though. In fact I have some changes planned for Net::LDAP which will make that kind of thing easier. Graham. |
From: Mark W. <mew...@un...> - 2000-07-04 17:28:59
|
Graham Barr wrote: > On Mon, Jul 03, 2000 at 12:33:44PM -0700, Allen, Robbie wrote: > > All I'm really asking is for the search method to return all entries > > that match the search criteria. To be safe, I need to use VLV in all of > > my searches, because one day the number of entries returned may exceed > > the server limit, or the server limit may one day be set lower, and the > > application may break because it does not get all the entries it thinks > > it should. This may not be an issue in some environments, but it is in > > mine. > If the LDAP server can return all of the entries it will during a search. If it doesn't then it will throw an error. That's what you want! If you suddenly bind yourself to a particular method and then one day it doesn't work (e.g. you suddenly start searching on an LDAP server that doesn't support controls & your search is still beyond the limit)& it's not documented, the developer won't know why. The simple answer is to always include the proper control in all of your searches and document why you are doing this. I don't know why that's so #!$@!$! difficult ;). You also always have the option of binding as the Directory Manager account. Insecure as hell, but that will work for most servers ;). > > Ah, it sounds like you want the LDAPiranah module someone wrote a while ?? I couldn't find it on CPAN. I'd be happy to help someone get this to work if that would make your life easier. I'll be out of town for most of the next 2 weeks but after that I'll help with what I can. > back. Itwill need so changes to work with the latest Net::LDAP though. In fact > I have some changes planned for Net::LDAP which will make that kind of > thing easier. Cool. Mark > > > Graham. |
From: Graham B. <gb...@po...> - 2000-07-04 20:25:40
|
On Tue, Jul 04, 2000 at 12:24:25PM -0500, Mark Wilcox wrote: > > Graham Barr wrote: > > > > Ah, it sounds like you want the LDAPiranah module someone wrote a while > > ?? I couldn't find it on CPAN. I'd be happy to help someone get this to work if that > would make your life easier. I'll be out of town for most of the next 2 weeks but > after that I'll help with what I can. It's mot on CPAN. It was written by Matthew Sisk. You can get a copy from http://www.mojotoad.com/sisk/projects/LDAPiranah/ Graham. |