From f62635accb9d53fe1a90c6b0fb84f56322e6530e Mon Sep 17 00:00:00 2001 From: Marco Bettini Date: Tue, 14 May 2024 14:15:58 +0000 Subject: [PATCH] auth: db-ldap - Drop auth_sasl_bind Now inferred by non-empty ldap_auth_sasl_mechanism. --- src/auth/db-ldap-settings.c | 10 ++++------ src/auth/db-ldap-settings.h | 1 - src/auth/db-ldap.c | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/auth/db-ldap-settings.c b/src/auth/db-ldap-settings.c index 0717198005..4dd895156d 100644 --- a/src/auth/db-ldap-settings.c +++ b/src/auth/db-ldap-settings.c @@ -26,7 +26,6 @@ static const struct setting_define ldap_setting_defines[] = { DEF(STR, auth_dn_password), DEFN(BOOL, passdb_ldap_bind, passdb_ldap_bind), DEFN(STR, passdb_ldap_bind_userdn, passdb_ldap_bind_userdn), - DEF(BOOL, auth_sasl_bind), DEF(STR, auth_sasl_mechanism), DEF(STR, auth_sasl_realm), DEF(STR, auth_sasl_authz_id), @@ -52,7 +51,6 @@ static const struct ldap_settings ldap_default_settings = { .auth_dn_password = "", .passdb_ldap_bind = FALSE, .passdb_ldap_bind_userdn = "", - .auth_sasl_bind = FALSE, .auth_sasl_mechanism = "", .auth_sasl_realm = "", .auth_sasl_authz_id = "", @@ -150,8 +148,8 @@ static bool ldap_setting_check(void *_set, pool_t pool ATTR_UNUSED, #endif #ifndef HAVE_LDAP_SASL - if (set->auth_sasl_bind) { - *error_r = "ldap_auth_sasl_bind=yes but no SASL support compiled in"; + if (*set->auth_sasl_mechanism != '\0') { + *error_r = "ldap_auth_sasl_mechanism set, but no SASL support compiled in"; return FALSE; } #endif @@ -174,8 +172,8 @@ int ldap_setting_post_check(const struct ldap_settings *set, const char **error_ } if (set->version < 3) { - if (set->auth_sasl_bind) { - *error_r = "ldap_sauth_sasl_bind=yes requires ldap_version=3"; + if (*set->auth_sasl_mechanism != '\0') { + *error_r = "ldap_auth_sasl_mechanism requires ldap_version=3"; return -1; } if (set->starttls) { diff --git a/src/auth/db-ldap-settings.h b/src/auth/db-ldap-settings.h index 9c5a8dabe1..25f9718295 100644 --- a/src/auth/db-ldap-settings.h +++ b/src/auth/db-ldap-settings.h @@ -33,7 +33,6 @@ struct ldap_settings { gid_t gid; bool passdb_ldap_bind; - bool auth_sasl_bind; bool starttls; /* parsed */ diff --git a/src/auth/db-ldap.c b/src/auth/db-ldap.c index 1eac7b3f60..17dde33380 100644 --- a/src/auth/db-ldap.c +++ b/src/auth/db-ldap.c @@ -796,7 +796,7 @@ static int db_ldap_bind_simple(struct ldap_connection *conn) static int db_ldap_bind(struct ldap_connection *conn) { - if (conn->set->auth_sasl_bind) { + if (*conn->set->auth_sasl_mechanism != '\0') { if (db_ldap_bind_sasl(conn) < 0) return -1; } else { -- 2.47.3