with_mit_krb5=yes
esac
])
+AH_TEMPLATE(USE_APPLE_KRB5,[Apple Kerberos support is available])
AH_TEMPLATE(USE_MIT_KRB5,[MIT Kerberos support is available])
AH_TEMPLATE(USE_SOLARIS_KRB5,[Solaris Kerberos support is available])
krb5confpath="`dirname $ac_cv_path_krb5_config`"
ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
ac_solaris="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i solaris`"
+ ac_apple="`$ac_cv_path_krb5_config --vendor 2>/dev/null | grep -c -i apple`"
if test $ac_heimdal -gt 0 ; then
with_heimdal_krb5=yes
ac_with_krb5_count=1
with_solaris_krb5=yes
ac_with_krb5_count=1
fi
- if test $ac_heimdal -eq 0 && test $ac_solaris -eq 0 ; then
+ if test $ac_apple -gt 0 ; then
+ with_apple_krb5=yes
+ ac_with_krb5_count=1
+ fi
+ if test $ac_heimdal -eq 0 && test $ac_solaris -eq 0 && test $ac_apple -eq 0; then
with_mit_krb5=yes
ac_with_krb5_count=1
fi
fi
fi
-if test "x$with_mit_krb5" = "xyes"; then
+if test "x$with_mit_krb5" = "xyes" || test "x$with_apple_krb5" = "xyes" ; then
SQUID_STATE_SAVE([squid_krb5_save])
LIBS="$LIBS $LIB_KRB5_PATH"
])
if test "x$LIB_KRB5_LIBS" != "x"; then
+ if test "x$with_apple_krb5" = "xyes" ; then
+ AC_DEFINE(USE_APPLE_KRB5,1,[Apple Kerberos support is available])
+ KRB5_FLAVOUR="Apple"
+ else
+ AC_DEFINE(USE_MIT_KRB5,1,[MIT Kerberos support is available])
+ KRB5_FLAVOUR="MIT"
+ fi
KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
KRB5INCS="$LIB_KRB5_CFLAGS"
- AC_DEFINE(USE_MIT_KRB5,1,[MIT Kerberos support is available])
- KRB5_FLAVOUR="MIT"
# check for other specific broken implementations
CXXFLAGS="$CXXFLAGS $KRB5INCS"
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 *url,
- ber_tag_t request,
- ber_int_t msgid,
- 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 *url,
- ber_tag_t request,
- ber_int_t msgid,
- 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));