ldap_set_option() should set option for "tldap" other than "ldap".
The current code will lead to "Protocol error" as the ldap version
of tldap is not set.
Signed-off-by: Weibing Zhang <zhangweibing@unitedstack.com>
(cherry picked from commit
96cf7fa06a1192293b24c823ad9d08456f81ac8a)
int ret = ldap_initialize(&tldap, uri.c_str());
if (ret == LDAP_SUCCESS) {
unsigned long ldap_ver = LDAP_VERSION3;
- ret = ldap_set_option(ldap, LDAP_OPT_PROTOCOL_VERSION,
+ ret = ldap_set_option(tldap, LDAP_OPT_PROTOCOL_VERSION,
(void*) &ldap_ver);
if (ret == LDAP_SUCCESS) {
ret = ldap_simple_bind_s(tldap, dn, pwd.c_str());