[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: content sync control with perl search

Most likely due to a bug in OpenLDAP 2.2, turn off the Critical flag for the control.
See this email thread for the background info:

Lee Jensen wrote:

I've been trying for a day or two now to figure out how to use a
refreshAndPersist search in a perl client. I've made some progress but
feel I'm missing something that perhaps someone on this list could
clarify... I used the following RFC as a guide to building the control

I'll post my test code below:

use Net::LDAP;
use Net::LDAP::Control::PersistentSearch;
use Convert::ASN1;

$asn = new Convert::ASN1;
reloadHint BOOLEAN

) || die;

$buf = $asn->encode(
   mode => 1,
   cookie => undef,
   reloadHint => true
) or die;

$ctrl = Net::LDAP::Control->new(
       type => '',
       value => $buf,
       critical => 1

$ldap = Net::LDAP->new('critter');

$ret = $ldap->bind('cn=slave_search,dc=directory,dc=sento,dc=com',
                   password => 'M@iLy!!l3s3cr3t'

print $ret->error(), "\n";

$s = $ldap->search( base => 'dc=directory,dc=sento,dc=com',
               scope => 'sub',
               filter => '(objectclass=*)',
               attrs => [ '*' ],
               control => [ $ctrl ]

print $s->error(), "\n";
print $s->count(),"\n";
print $s->control(),"\n";

Success                               (bind)
control unavailable in context        (search)
0                                     (search count)
                                     (search control print)

If I change the mode to say 5 the server fails with the error: Sync control : unknown update mode As rightly it should...

So I figure the ASN1 encoding is working alright. I can't for the life
of me figure out what the problem is. I have master slave replication
set up using syncrepl so I know that the refreshAndPersist controls are
compiled in and working.

Any help would be very much appreciated.


 -- Howard Chu
 Chief Architect, Symas Corp.       Director, Highland Sun
 http://www.symas.com               http://highlandsun.com/hyc
 Symas: Premier OpenSource Development and Support