Hi all
I am using cpan Net::LDAP module to access LDAP entries. I want to search LDAP entries using Net::LDAP search method. When I do search, I want some limited number of entries from search result, for this(searching) process I am using Net::LDAP::Control::VLV module. But I get error on VLV response control. Please, any one have idea about this error. * Error:* Died at vlv.pl line 50,
This is my example. I changed the font style of line 50
#!/usr/bin/perl -w
use Net::LDAP; use Net::LDAP::Control::VLV; use Net::LDAP::Constant qw( LDAP_CONTROL_VLVRESPONSE ); use Net::LDAP::Control::Sort;
sub procentry { my ( $mesg, $entry) = @_; # Return if there is no entry to process if ( !defined($entry) ) { return; } print "dn: " . $entry->dn() . "\n"; @attrs = $entry->attributes(); foreach $attr (@attrs) { #printf("\t%s: %s\n", $attr, $entry->get_value($attr)); $attrvalue = $entry->get_value($attr,asref=>1); #print $attr.":". $entry->get_value($attr)."\n"; foreach $value(@$attrvalue) { print "$attr: $value\n"; } } $mesg->pop_entry; print "\n"; }
$ldap = Net::LDAP->new( "localhost" );
# Get the first 20 entries $vlv = Net::LDAP::Control::VLV->new( before => 0, # No entries from before target entry after => 19, # 19 entries after target entry content => 0, # List size unknown offset => 1, # Target entry is the first ); my $sort = Net::LDAP::Control::Sort->new( order => 'cn' );
@args = ( base => "dc=example,dc=co,dc=in", scope => "subtree", filter => "(objectClass=inetOrgPerson)", callback => &procentry, # Call this sub for each entry control => [ $sort, $vlv ], );
$mesg = $ldap->search( @args );
# Get VLV response control *($resp) = $mesg->control( LDAP_CONTROL_VLVRESPONSE ) or die;* $vlv->response( $resp );
# Set the control to get the last 20 entries $vlv->end;
$mesg = $ldap->search( @args );
# Get VLV response control ($resp) = $mesg->control( LDAP_CONTROL_VLVRESPONSE ) or die; $vlv->response( $resp );
# Now get the previous page $vlv->scroll_page( -1 );
$mesg = $ldap->search( @args );
# Get VLV response control ($resp) = $mes # Now page with first entry starting with "B" in the middle $vlv->before(9); # Change page to show 9 before $vlv->after(10); # Change page to show 10 after $vlv->assert("B"); # assert "B"
$mesg = $ldap->search( @args );g->control( LDAP_CONTROL_VLVRESPONSE ) or die; $vlv->response( $resp );
Venish Khant venish@deeproot.co.in writes:
Hi all
I am using cpan Net::LDAP module to access LDAP entries. I want to search LDAP entries using Net::LDAP search method. When I do search, I want some limited number of entries from search result, for this(searching) process I am using Net::LDAP::Control::VLV module. But I get error on VLV response control. Please, any one have idea about this error.
Error:* Died at vlv.pl line 50,
[...]
Have you ever checked wether your directory supports virtual list control at all?
-Dieter
Dieter Kluenter wrote:
Venish Khant venish@deeproot.co.in writes:
Hi all
I am using cpan Net::LDAP module to access LDAP entries. I want to search LDAP entries using Net::LDAP search method. When I do search, I want some limited number of entries from search result, for this(searching) process I am using Net::LDAP::Control::VLV module. But I get error on VLV response control. Please, any one have idea about this error.
Error:* Died at vlv.pl line 50,
[...]
Have you ever checked wether your directory supports virtual list control at all?
-Dieter
No I didn't check it. How can I check virtual view control support or not. I have openldap version 2.4
Venish Khant venish@deeproot.co.in writes:
Venish Khant wrote:
Dieter Kluenter wrote:
[...]
Have you ever checked wether your directory supports virtual list control at all?
Yes, my directory server support virtual view control.
this is rather strange, mine doesn't. % ./slapd -V @(#) $OpenLDAP: slapd 2.4.X (Aug 17 2009 11:26:57) $
ldapsearch -x -H ldap://localhost:9004 -b "" -s base + | grep '113730' supportedControl: 2.16.840.1.113730.3.4.18 supportedControl: 2.16.840.1.113730.3.4.2
there is no 'supportedControl: 2.16.840.1.113730.3.4.9'
-Dieter
Dieter Kluenter wrote:
this is rather strange, mine doesn't. % ./slapd -V @(#) $OpenLDAP: slapd 2.4.X (Aug 17 2009 11:26:57) $
ldapsearch -x -H ldap://localhost:9004 -b "" -s base + | grep '113730' supportedControl: 2.16.840.1.113730.3.4.18 supportedControl: 2.16.840.1.113730.3.4.2
there is no 'supportedControl: 2.16.840.1.113730.3.4.9'
Yes, it not supported. I used given ldapsearch string but it didn't return anything. If I want to use virtual list view, for that what should I do.
Venish Khant wrote:
Dieter Kluenter wrote:
this is rather strange, mine doesn't. % ./slapd -V @(#) $OpenLDAP: slapd 2.4.X (Aug 17 2009 11:26:57) $
ldapsearch -x -H ldap://localhost:9004 -b "" -s base + | grep '113730' supportedControl: 2.16.840.1.113730.3.4.18 supportedControl: 2.16.840.1.113730.3.4.2
there is no 'supportedControl: 2.16.840.1.113730.3.4.9'
Yes, it not supported. I used given ldapsearch string but it didn't return anything. If I want to use virtual list view, for that what should I do.
AFAIK slapo-sssvlv was added recently in latest release 2.4.18. I'm pretty sure the OpenLDAP developers appreciate it if you test it thoroughly. Also make sure you read and understand the hints in this overlay's man-page.
I really wonder what you want to achieve with VLV. Maybe using the "Simple Paged Results" control would be sufficient in your case either?
Ciao, Michael.
Michael Ströder wrote:
Yes, it not supported. I used given ldapsearch string but it didn't return anything. If I want to use virtual list view, for that what should I do.
AFAIK slapo-sssvlv was added recently in latest release 2.4.18. I'm pretty sure the OpenLDAP developers appreciate it if you test it thoroughly. Also make sure you read and understand the hints in this overlay's man-page.
I really wonder what you want to achieve with VLV. Maybe using the "Simple Paged Results" control would be sufficient in your case either?
Yes definitely I will tested thoroughly. You have any idea about how to upgrade openldap. Because, my openldap version 2.4.15 so, I want upgrade.
I want like this, first time when I search entries, it'll show some limited search result entries after that when ever I click on next or previous buttons search result entries should be listed.
Venish Khant wrote:
You have any idea about how to upgrade openldap. Because, my openldap version 2.4.15 so, I want upgrade.
Simply compile the stuff.
I want like this, first time when I search entries, it'll show some limited search result entries after that when ever I click on next or previous buttons search result entries should be listed.
This does not make much sense in a UI without server-side sorting but without it "Simple Paged Results" control would be sufficient (see RFC 2696).
Ciao, Michael.
Michael Ströder wrote:
Venish Khant wrote:
You have any idea about how to upgrade openldap. Because, my openldap version 2.4.15 so, I want upgrade.
Simply compile the stuff.
I ll compile and do it.
I want like this, first time when I search entries, it'll show some limited search result entries after that when ever I click on next or previous buttons search result entries should be listed.
This does not make much sense in a UI without server-side sorting but without it "Simple Paged Results" control would be sufficient (see RFC 2696).
Thanx
On 8 September 2009 at 13:30, Venish Khant venish@deeproot.co.in wrote:
Michael Ströder wrote:
Venish Khant wrote:
You have any idea about how to upgrade openldap. Because, my openldap version 2.4.15 so, I want upgrade.
Old one, but I'm just using this code too:
http://search.cpan.org/dist/perl-ldap-0.55/lib/Net/LDAP/Control/VLV.pm
even with the overlay loaded, the error is no match type set:
use Net::LDAP; use Net::LDAP::Control::VLV; use Net::LDAP::Constant qw( LDAP_CONTROL_VLVRESPONSE );
$ldap = Net::LDAP->new( "ldap.mydomain.eg" );
# Get the first 20 entries $vlv = Net::LDAP::Control::VLV->new( before => 0, # No entries from before target entry after => 19, # 19 entries after target entry content => 0, # List size unknown offset => 1, # Target entry is the first ); $sort = Net::LDAP::Control::Sort->new( order => 'cn' );
should be:
my $sort = Net::LDAP::Control::Sort->new( order => 'sn:caseIgnoreIA5Match' );
The ldapsearch syntax would be something like:
/opt/symas/bin/ldapsearch -x -b dc=suretec,dc=co,dc=uk -D uid=xxx,ou=users,dc=suretec,dc=co,dc=uk -E !sss=mail:caseIgnoreIA5Match -E !vlv=0/10/0/10 -W
I'll also note we don't have this overlay in the overlay section of the OpenLDAP Admin Guide.
Thanks, Gavin.
Venish Khant venish@deeproot.co.in writes:
Dieter Kluenter wrote:
Venish Khant venish@deeproot.co.in writes:
[...]
Error:* Died at vlv.pl line 50,
[...]
Have you ever checked whether your directory supports virtual list control at all?
No I didn't check it. How can I check virtual view control support or not. I have openldap version 2.4
Draft-ietf-ldapext-ldapv3-vlv-xx, section 6, ldapsearch -x -H ldap://<host> -b "" -s base + | grep '113730.3.4.9'
-Dieter
openldap-technical@openldap.org