Lines 236-244
Link Here
|
236 |
pr_ldap_connect(void) |
236 |
pr_ldap_connect(void) |
237 |
{ |
237 |
{ |
238 |
int ret; |
238 |
int ret; |
239 |
#ifdef USE_LDAPV3_TLS |
|
|
240 |
int version = LDAP_VERSION3; |
239 |
int version = LDAP_VERSION3; |
241 |
#endif |
|
|
242 |
|
240 |
|
243 |
if ((ld = ldap_init(ldap_server, LDAP_PORT)) == NULL) { |
241 |
if ((ld = ldap_init(ldap_server, LDAP_PORT)) == NULL) { |
244 |
pr_log_pri(PR_LOG_ERR, "mod_ldap: pr_ldap_connect(): ldap_init() to %s failed: %s", ldap_server, strerror(errno)); |
242 |
pr_log_pri(PR_LOG_ERR, "mod_ldap: pr_ldap_connect(): ldap_init() to %s failed: %s", ldap_server, strerror(errno)); |
Lines 262-267
Link Here
|
262 |
} |
260 |
} |
263 |
#endif /* USE_LDAPV3_TLS */ |
261 |
#endif /* USE_LDAPV3_TLS */ |
264 |
|
262 |
|
|
|
263 |
if ((ret = ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version)) != LDAP_OPT_SUCCESS) { |
264 |
pr_log_pri(PR_LOG_ERR, "mod_ldap: pr_ldap_connect(): Setting LDAP version option failed: %s", ldap_err2string(ret)); |
265 |
pr_ldap_unbind(); |
266 |
return -1; |
267 |
} |
265 |
if ((ret = ldap_simple_bind_s(ld, ldap_dn, ldap_dnpass) != LDAP_SUCCESS)) { |
268 |
if ((ret = ldap_simple_bind_s(ld, ldap_dn, ldap_dnpass) != LDAP_SUCCESS)) { |
266 |
pr_log_pri(PR_LOG_ERR, "mod_ldap: pr_ldap_connect(): ldap_simple_bind() as %s failed: %s", ldap_dn, ldap_err2string(ret)); |
269 |
pr_log_pri(PR_LOG_ERR, "mod_ldap: pr_ldap_connect(): ldap_simple_bind() as %s failed: %s", ldap_dn, ldap_err2string(ret)); |
267 |
return -1; |
270 |
return -1; |
Lines 1204-1212
Link Here
|
1204 |
char *pass, *cryptpass, *hash_method; |
1207 |
char *pass, *cryptpass, *hash_method; |
1205 |
int encname_len; |
1208 |
int encname_len; |
1206 |
LDAP *ld_auth; |
1209 |
LDAP *ld_auth; |
1207 |
#ifdef USE_LDAPV3_TLS |
|
|
1208 |
int ret, version = LDAP_VERSION3; |
1210 |
int ret, version = LDAP_VERSION3; |
1209 |
#endif |
|
|
1210 |
|
1211 |
|
1211 |
#ifdef HAVE_OPENSSL |
1212 |
#ifdef HAVE_OPENSSL |
1212 |
EVP_MD_CTX EVP_Context; |
1213 |
EVP_MD_CTX EVP_Context; |
Lines 1252-1257
Link Here
|
1252 |
} |
1253 |
} |
1253 |
#endif /* USE_LDAPV3_TLS */ |
1254 |
#endif /* USE_LDAPV3_TLS */ |
1254 |
|
1255 |
|
|
|
1256 |
if ((ret = ldap_set_option(ld_auth, LDAP_OPT_PROTOCOL_VERSION, &version)) != LDAP_OPT_SUCCESS) { |
1257 |
pr_log_pri(PR_LOG_ERR, "mod_ldap: pr_ldap_connect(): Setting LDAP version option on rebind failed: %s", ldap_err2string(ret)); |
1258 |
pr_ldap_unbind(); |
1259 |
return ERROR(cmd); |
1260 |
} |
1261 |
|
1255 |
if (ldap_simple_bind_s(ld_auth, ldap_authbind_dn, cmd->argv[2]) != LDAP_SUCCESS) { |
1262 |
if (ldap_simple_bind_s(ld_auth, ldap_authbind_dn, cmd->argv[2]) != LDAP_SUCCESS) { |
1256 |
ldap_unbind(ld_auth); |
1263 |
ldap_unbind(ld_auth); |
1257 |
return ERROR(cmd); |
1264 |
return ERROR(cmd); |