55 LDAP *ld = ldap_init(config->hostname, config->port); |
55 LDAP *ld = ldap_init(config->hostname, config->port); |
56 if (ld == NULL) { |
56 if (ld == NULL) { |
57 fprintf(stderr, "ldap_init failed\n"); |
57 fprintf(stderr, "ldap_init failed\n"); |
58 return NULL; |
58 return NULL; |
59 } |
59 } |
|
60 int ldapv = 3; |
|
61 ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &ldapv); |
60 |
62 |
61 int r = ldap_simple_bind_s(ld, config->binddn, config->bindpw); |
63 int r = ldap_simple_bind_s(ld, config->binddn, config->bindpw); |
62 if (r != LDAP_SUCCESS) { |
64 if (r != LDAP_SUCCESS) { |
63 ldap_unbind(ld); |
65 ldap_unbind(ld); |
64 fprintf(stderr, "ldap_simple_bind_s failed: %s\n", ldap_err2string(r)); |
66 fprintf(stderr, "ldap_simple_bind_s failed: %s\n", ldap_err2string(r)); |