<sect1>Other changes<label id="otherchanges">
<p>
<descrip>
+ <tag>digest_edirectory_auth</tag>
+ <p>LDAPS activation and referrals were broken, and memory could leak.
+ LDAPS may now negotiate correctly, referrals honor configuration
+ (use <em>-R</em> to disable), and memory is now properly freed.
+
<tag>Adjusted configuration and format of ext_time_quota_acl helper debugging</tag>
<p>The <em>-l</em> option that enables <em>ext_time_quota_acl</em> to log debug messages
to a custom logfile has been removed, and their format has been
#endif
}
+static void
+squid_ldap_memfree(char *p)
+{
+ ldap_memfree(p);
+}
+
#else
static int
squid_ldap_errno(LDAP * ld)
squid_ldap_set_referrals(int referrals)
{
if (referrals)
- ld->ld_options |= ~LDAP_OPT_REFERRALS;
+ ld->ld_options |= LDAP_OPT_REFERRALS;
else
ld->ld_options &= ~LDAP_OPT_REFERRALS;
}
if (rc == LDAP_SUCCESS) {
entry = ldap_first_entry(ld, res);
if (entry) {
- debug("ldap dn: %s\n", ldap_get_dn(ld, entry));
+ const auto dn = ldap_get_dn(ld, entry);
+ if (!dn) {
+ fprintf(stderr, PROGRAM_NAME ": ERROR, could not get user DN for '%s'\n", login);
+ ldap_msgfree(res);
+ return nullptr;
+ }
+ debug("ldap dn: %s\n", dn);
if (edir_universal_passwd) {
/* allocate some memory for the universal password returned by NMAS */
values = (char**)calloc(2, sizeof(char *));
/* actually talk to NMAS to get a password */
- nmas_res = nds_get_password(ld, ldap_get_dn(ld, entry), &universal_password_len, universal_password);
+ nmas_res = nds_get_password(ld, dn, &universal_password_len, universal_password);
if (nmas_res == LDAP_SUCCESS && universal_password) {
debug("NMAS returned value %s\n", universal_password);
values[0] = universal_password;
} else {
values = ldap_get_values(ld, entry, passattr);
}
+ squid_ldap_memfree(dn);
} else {
ldap_msgfree(res);
return nullptr;
}
if (use_tls) {
#ifdef LDAP_OPT_X_TLS
- if ((version == LDAP_VERSION3) && (ldap_start_tls_s(ld, nullptr, nullptr) == LDAP_SUCCESS)) {
+ if ((version == LDAP_VERSION3) && (ldap_start_tls_s(ld, nullptr, nullptr) != LDAP_SUCCESS)) {
fprintf(stderr, "Could not Activate TLS connection\n");
ldap_unbind(ld);
ld = nullptr;