Don't use deprecated ldap_bind_s

ldap_bind_s is marked as deprecated in new libldap releases.

Signed-off-by: Simo Sorce <ssorce@redhat.com>
This commit is contained in:
Jakub Hrozek
2010-11-04 19:41:12 +01:00
committed by Simo Sorce
parent 3b7a86024b
commit 110397f059

View File

@@ -58,6 +58,10 @@
#define KEYTAB_SET_OID "2.16.840.1.113730.3.8.3.1"
#define KEYTAB_RET_OID "2.16.840.1.113730.3.8.3.2"
#ifndef discard_const
#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
#endif
struct krb_key_salt {
krb5_enctype enctype;
krb5_int32 salttype;
@@ -576,7 +580,13 @@ static int ldap_set_keytab(krb5_context krbctx,
}
if (binddn) {
ret = ldap_bind_s(ld, binddn, bindpw, LDAP_AUTH_SIMPLE);
struct berval bv;
bv.bv_val = discard_const(bindpw);
bv.bv_len = strlen(bindpw);
ret = ldap_sasl_bind_s(ld, binddn, LDAP_SASL_SIMPLE, &bv,
NULL, NULL, NULL);
if (ret != LDAP_SUCCESS) {
fprintf(stderr, _("Simple bind failed\n"));
goto error_out;