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

Re: Protocol Error with ldap_bind_s





On Fri, 11 Mar 2005 Christophe.Senzot@steria.be wrote:

Hi,

I'm trying to use the C API to connect to  LDAP but I always get a
"protocol error" (return code = 2) when executing the ldap_simple_bind_s
function.
Here is the source, can anyone help me ?

m_LDAP = ldap_init( HOST_IP , LDAP_PORT );
if( m_LDAP == NULL )
{
    printf("ldap_init error\n");
    return 1;
}

This is kinda OT and you should post this question on a general ldap list, but this may help:


You need

int version = LDAP_VERSION3;
ldap_set_option( m_LDAP, LDAP_OPT_PROTOCOL_VERSION, &version );

or allow v2 protocol on your ldap server.

ulRet = ldap_simple_bind_s( m_LDAP, NULL, NULL) ;
if( ulRet != LDAP_SUCCESS )
{
    printf("ldap_simple_bind_s <%s> (%d)\n", ldap_err2string(ulRet),
ulRet);
    ldap_unbind( m_LDAP);
    return ulRet;
}

-> the error message I have is "ldap_simple_bind_s <Protocol Error> (2)"

Any advice would be appreciate, thanks in advance.

Christophe.



-- Igor