void *params)
{
struct ldap_creds *cp = (struct ldap_creds *) params;
+ struct berval cred;
+ if (cp->pw) {
+ cred.bv_val=cp->pw;
+ cred.bv_len=strlen(cp->pw);
+ }
whop = whop;
credp = credp;
methodp = methodp;
freeit = freeit;
- return ldap_bind_s(ld, cp->dn, cp->pw, LDAP_AUTH_SIMPLE);
+ return ldap_sasl_bind_s(ld, cp->dn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL);
}
#elif HAVE_LDAP_REBIND_PROC
#if HAVE_SASL_H || HAVE_SASL_SASL_H || HAVE_SASL_DARWIN
void *params)
{
struct ldap_creds *cp = (struct ldap_creds *) params;
- return ldap_bind_s(ld, cp->dn, cp->pw, LDAP_AUTH_SIMPLE);
+ struct berval cred;
+ if (cp->pw) {
+ cred.bv_val=cp->pw;
+ cred.bv_len=strlen(cp->pw);
+ }
+ return ldap_sasl_bind_s(ld, cp->dn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL);
}
#elif HAVE_LDAP_REBIND_FUNCTION
void *params)
{
struct ldap_creds *cp = (struct ldap_creds *) params;
+ struct berval cred;
+ if (cp->pw) {
+ cred.bv_val=cp->pw;
+ cred.bv_len=strlen(cp->pw);
+ }
whop = whop;
credp = credp;
methodp = methodp;
freeit = freeit;
- return ldap_bind_s(ld, cp->dn, cp->pw, LDAP_AUTH_SIMPLE);
+ return ldap_sasl_bind_s(ld, cp->dn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL);
}
#else
#error "No rebind functione defined"
static LDAP_REBIND_PROC ldap_sasl_rebind;
static int
-ldap_sasl_rebind(LDAP *ld, LDAP_CONST char *, ber_tag_t, ber_int_t, void *params)
+ldap_sasl_rebind(LDAP *ld, LDAP_CONST char *, ber_tag_t request, ber_int_t msgid, void *params)
{
struct ldap_creds *cp = (struct ldap_creds *) params;
return tool_sasl_bind(ld, cp->dn, cp->pw);
static LDAP_REBIND_PROC ldap_simple_rebind;
static int
-ldap_simple_rebind(LDAP * ld, LDAP_CONST char *, ber_tag_t, ber_int_t, void *params)
+ldap_simple_rebind(LDAP *ld, LDAP_CONST char *, ber_tag_t request, ber_int_t msgid, void *params)
{
struct ldap_creds *cp = (struct ldap_creds *) params;
- return ldap_bind_s(ld, cp->dn, cp->pw, LDAP_AUTH_SIMPLE);
+ struct berval cred;
+ if (cp->pw) {
+ cred.bv_val=cp->pw;
+ cred.bv_len=strlen(cp->pw);
+ }
+ return ldap_sasl_bind_s(ld, cp->dn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL);
}
#endif
xfree(ldapuri);
if (rc != LDAP_SUCCESS) {
error((char *) "%s| %s: ERROR: Error while initialising connection to ldap server: %s\n", LogTime(), PROGRAM, ldap_err2string(rc));
- ldap_unbind(ld);
+ ldap_unbind_ext(ld,NULL,NULL);
ld = NULL;
return NULL;
}
rc = ldap_set_defaults(ld);
if (rc != LDAP_SUCCESS) {
error((char *) "%s| %s: ERROR: Error while setting default options for ldap server: %s\n", LogTime(), PROGRAM, ldap_err2string(rc));
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
return NULL;
}
rc = ldap_set_ssl_defaults(margs);
if (rc != LDAP_SUCCESS) {
error((char *) "%s| %s: ERROR: Error while setting SSL default options for ldap server: %s\n", LogTime(), PROGRAM, ldap_err2string(rc));
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
return NULL;
}
rc = ldap_start_tls_s(ld, NULL, NULL);
if (rc != LDAP_SUCCESS) {
error((char *) "%s| %s: ERROR: Error while setting start_tls for ldap server: %s\n", LogTime(), PROGRAM, ldap_err2string(rc));
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
url = (LDAPURLDesc *) xmalloc(sizeof(*url));
memset(url, 0, sizeof(*url));
xfree(ldapuri);
if (rc != LDAP_SUCCESS) {
error((char *) "%s| %s: ERROR: Error while initialising connection to ldap server: %s\n", LogTime(), PROGRAM, ldap_err2string(rc));
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
return NULL;
}
rc = ldap_set_defaults(ld);
if (rc != LDAP_SUCCESS) {
error((char *) "%s| %s: ERROR: Error while setting default options for ldap server: %s\n", LogTime(), PROGRAM, ldap_err2string(rc));
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
return NULL;
}
ld = ldapssl_init(host, port, 1);
if (!ld) {
error((char *) "%s| %s: ERROR: Error while setting SSL for ldap server: %s\n", LogTime(), PROGRAM, ldapssl_err2string(rc));
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
return NULL;
}
rc = ldap_set_defaults(ld);
if (rc != LDAP_SUCCESS) {
error((char *) "%s| %s: ERROR: Error while setting default options for ldap server: %s\n", LogTime(), PROGRAM, ldap_err2string(rc));
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
return NULL;
}
rc = tool_sasl_bind(ld, bindp, margs->ssl);
if (rc != LDAP_SUCCESS) {
error((char *) "%s| %s: ERROR: Error while binding to ldap server with SASL/GSSAPI: %s\n", LogTime(), PROGRAM, ldap_err2string(rc));
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
continue;
}
break;
}
#else
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
error((char *) "%s| %s: ERROR: SASL not supported on system\n", LogTime(), PROGRAM);
continue;
nhosts = get_hostname_list(&hlist, 0, host);
xfree(host);
for (size_t i = 0; i < nhosts; ++i) {
-
+ struct berval cred;
+ if (margs->lpass) {
+ cred.bv_val=margs->lpass;
+ cred.bv_len=strlen(margs->lpass);
+ }
ld = tool_ldap_open(margs, hlist[i].host, port, ssl);
if (!ld)
continue;
*/
debug((char *) "%s| %s: DEBUG: Bind to ldap server with Username/Password\n", LogTime(), PROGRAM);
- rc = ldap_simple_bind_s(ld, margs->luser, margs->lpass);
+ rc = ldap_sasl_bind_s(ld, margs->luser, LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL);
if (rc != LDAP_SUCCESS) {
error((char *) "%s| %s: ERROR: Error while binding to ldap server with Username/Password: %s\n", LogTime(), PROGRAM, ldap_err2string(rc));
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
continue;
}
rc = check_AD(margs, ld);
if (rc != LDAP_SUCCESS) {
error((char *) "%s| %s: ERROR: Error determining ldap server type: %s\n", LogTime(), PROGRAM, ldap_err2string(rc));
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
retval = 0;
goto cleanup;
if (rc != LDAP_SUCCESS) {
error((char *) "%s| %s: ERROR: Error searching ldap server: %s\n", LogTime(), PROGRAM, ldap_err2string(rc));
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
retval = 0;
goto cleanup;
ldap_msgfree(res);
} else if (ldap_count_entries(ld, res) == 0 && margs->AD) {
ldap_msgfree(res);
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
retval = 0;
goto cleanup;
safe_free(attr_value);
}
}
- rc = ldap_unbind(ld);
+ rc = ldap_unbind_ext(ld, NULL, NULL);
ld = NULL;
if (rc != LDAP_SUCCESS) {
error((char *) "%s| %s: ERROR: Error unbind ldap server: %s\n", LogTime(), PROGRAM, ldap_err2string(rc));