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

Re: "Protocol error" on ldap_simple_bind_s



Pupeno wrote:

On Sunday 11 September 2005 16:05, Pupeno wrote:


Hello,
I am making an LDAP client using OpenLDAP's libldap[1], I run ldap_open,
which returns a pointer and when I run ldap_simple_bind_s, I get that
error: "Protocol error".
I remember reading somewhere that the API defaulted to LDAPv2 while the
server is running LDAPv3, but I can't find that anymore.
Any help as to what is going wrong is appretiated.


Yes, it is that:
Sep 11 16:31:08 movlab slapd[9702]: conn=6 fd=13 ACCEPT from IP=127.0.0.1:40821 (IP=0.0.0.0:389)
Sep 11 16:31:08 movlab slapd[29552]: conn=6 op=0 BIND dn="cn=Manager,dc=movlab,dc=pupeno,dc=com" method=128
Sep 11 16:31:08 movlab slapd[29552]: conn=6 op=0 RESULT tag=97 err=2 text=historical protocol version requested, use LDAPv3 instead


consulting man ldap I see: "A session handle is created using ldap_initialize(3) and set the protocol version to 3 by calling ldap_set_option(3)"
ldap_initialize is now replaced by ldap_init or the better ldap_open, but I can't find what replaces ldap_set_option, does anybody know that ?


Nothing. You need to use ldap_set_option(3) to select the protocol version. I suggest you look into the code of ldap tools (clients/tools/*.c) and significantly in clients/tools/common.c to see how they deal with setting the requested protocol version. The protocol can either be explicitly selected by using the "-P" switch, or implicitly selected by selecting features that are LDAPv3 only, like SASL bind or LDAP controls.

p.


SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax: +390382476497