From: Graham B. <gb...@po...> - 2000-07-03 16:14:13
|
It's OK I found it in the RFC, doh. The cookie returned in the controls will be empty. I think this just all shows that the API for controls is not yet optimal and needs some work. THis is something I would like to discuss at the perl conference. Graham. On Mon, Jul 03, 2000 at 10:26:53AM -0500, Mark Wilcox wrote: > > 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 :). > > 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). > > 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 ----- > > > > > > |