Use ssl_err2string() in message on ldap_ssl_client_init() failure.
Displaying SSL reason code directly is not user-friendly.
This commit is contained in:
@@ -466,6 +466,9 @@
|
|||||||
/* Define to 1 if you use LDAP for sudoers. */
|
/* Define to 1 if you use LDAP for sudoers. */
|
||||||
#undef HAVE_LDAP
|
#undef HAVE_LDAP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <ldapssl.h> header file. */
|
||||||
|
#undef HAVE_LDAPSSL_H
|
||||||
|
|
||||||
/* Define to 1 if you have the `ldapssl_init' function. */
|
/* Define to 1 if you have the `ldapssl_init' function. */
|
||||||
#undef HAVE_LDAPSSL_INIT
|
#undef HAVE_LDAPSSL_INIT
|
||||||
|
|
||||||
|
2
configure
vendored
2
configure
vendored
@@ -26259,7 +26259,7 @@ done
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
for ac_header in ldap_ssl.h mps/ldap_ssl.h
|
for ac_header in ldapssl.h ldap_ssl.h mps/ldap_ssl.h
|
||||||
do :
|
do :
|
||||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||||
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#include <ldap.h>
|
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#include <ldap.h>
|
||||||
|
@@ -4159,7 +4159,7 @@ if test ${with_ldap-'no'} != "no"; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
AC_CHECK_HEADERS([ldap_ssl.h] [mps/ldap_ssl.h], [break], [], [#include <ldap.h>])
|
AC_CHECK_HEADERS([ldapssl.h] [ldap_ssl.h] [mps/ldap_ssl.h], [break], [], [#include <ldap.h>])
|
||||||
AC_CHECK_FUNCS([ldap_initialize ldap_start_tls_s ldapssl_init ldapssl_set_strength ldap_unbind_ext_s ldap_str2dn ldap_create ldap_sasl_bind_s ldap_ssl_init ldap_ssl_client_init ldap_start_tls_s_np])
|
AC_CHECK_FUNCS([ldap_initialize ldap_start_tls_s ldapssl_init ldapssl_set_strength ldap_unbind_ext_s ldap_str2dn ldap_create ldap_sasl_bind_s ldap_ssl_init ldap_ssl_client_init ldap_start_tls_s_np])
|
||||||
AC_CHECK_FUNCS([ldap_search_ext_s ldap_search_st], [break])
|
AC_CHECK_FUNCS([ldap_search_ext_s ldap_search_st], [break])
|
||||||
|
|
||||||
|
@@ -46,7 +46,9 @@
|
|||||||
# include <lber.h>
|
# include <lber.h>
|
||||||
#endif
|
#endif
|
||||||
#include <ldap.h>
|
#include <ldap.h>
|
||||||
#if defined(HAVE_LDAP_SSL_H)
|
#if defined(HAVE_LDAPSSL_H)
|
||||||
|
# include <ldapssl.h>
|
||||||
|
#elif defined(HAVE_LDAP_SSL_H)
|
||||||
# include <ldap_ssl.h>
|
# include <ldap_ssl.h>
|
||||||
#elif defined(HAVE_MPS_LDAP_SSL_H)
|
#elif defined(HAVE_MPS_LDAP_SSL_H)
|
||||||
# include <mps/ldap_ssl.h>
|
# include <mps/ldap_ssl.h>
|
||||||
@@ -262,8 +264,8 @@ sudo_ldap_init(LDAP **ldp, const char *host, int port)
|
|||||||
ret = ldap_ssl_client_init(ldap_conf.tls_keyfile, ldap_conf.tls_keypw,
|
ret = ldap_ssl_client_init(ldap_conf.tls_keyfile, ldap_conf.tls_keypw,
|
||||||
0, &sslrc);
|
0, &sslrc);
|
||||||
if (ret != LDAP_SUCCESS) {
|
if (ret != LDAP_SUCCESS) {
|
||||||
sudo_warnx("ldap_ssl_client_init(): %s (SSL reason code %d)",
|
sudo_warnx("ldap_ssl_client_init(): %s: %s",
|
||||||
ldap_err2string(ret), sslrc);
|
ldap_err2string(ret), ssl_err2string(sslrc));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
DPRINTF2("ldap_ssl_init(%s, %d, NULL)", host, port);
|
DPRINTF2("ldap_ssl_init(%s, %d, NULL)", host, port);
|
||||||
@@ -1680,8 +1682,8 @@ sudo_ldap_open(struct sudo_nss *nss)
|
|||||||
rc = ldap_ssl_client_init(ldap_conf.tls_keyfile, ldap_conf.tls_keypw,
|
rc = ldap_ssl_client_init(ldap_conf.tls_keyfile, ldap_conf.tls_keypw,
|
||||||
0, &sslrc);
|
0, &sslrc);
|
||||||
if (rc != LDAP_SUCCESS) {
|
if (rc != LDAP_SUCCESS) {
|
||||||
sudo_warnx("ldap_ssl_client_init(): %s (SSL reason code %d)",
|
sudo_warnx("ldap_ssl_client_init(): %s: %s",
|
||||||
ldap_err2string(rc), sslrc);
|
ldap_err2string(rc), ssl_err2string(sslrc));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
rc = ldap_start_tls_s_np(ld, NULL);
|
rc = ldap_start_tls_s_np(ld, NULL);
|
||||||
|
Reference in New Issue
Block a user