mirror of
https://github.com/ceph/ceph
synced 2025-01-01 08:32:24 +00:00
Merge pull request #10593 from linuxbox2/ldap-bindv3-again
rgw ldap: enforce simple_bind w/LDAPv3 Reviewed-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
commit
e0e25dd99d
@ -70,14 +70,22 @@ namespace rgw {
|
||||
(void) init();
|
||||
return bind();
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
int simple_bind(const char *dn, const std::string& pwd) {
|
||||
LDAP* tldap;
|
||||
int ret = ldap_initialize(&tldap, uri.c_str());
|
||||
ret = ldap_simple_bind_s(tldap, dn, pwd.c_str());
|
||||
if (ret == LDAP_SUCCESS) {
|
||||
(void) ldap_unbind(tldap);
|
||||
unsigned long ldap_ver = LDAP_VERSION3;
|
||||
ret = ldap_set_option(ldap, LDAP_OPT_PROTOCOL_VERSION,
|
||||
(void*) &ldap_ver);
|
||||
if (ret == LDAP_SUCCESS) {
|
||||
ret = ldap_simple_bind_s(tldap, dn, pwd.c_str());
|
||||
if (ret == LDAP_SUCCESS) {
|
||||
(void) ldap_unbind(tldap);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret; // OpenLDAP client error space
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user