]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: struct ldap_settings - Add auth_ prefixes
authorMarco Bettini <marco.bettini@open-xchange.com>
Fri, 5 Jul 2024 14:21:49 +0000 (14:21 +0000)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:13 +0000 (12:34 +0200)
src/auth/db-ldap-settings.c
src/auth/db-ldap-settings.h
src/auth/db-ldap.c

index 5773ea393e233eb5aa200abf31c92c342f43246b..e4eb3ebe55f8f81c6d185d8819078850ca0262c7 100644 (file)
@@ -20,15 +20,15 @@ static const struct setting_define ldap_setting_defines[] = {
        { .type = SET_FILTER_NAME, .key = "userdb_ldap", },
        DEF(STR, hosts),
        DEF(STR, uris),
-       DEF(STR, dn),
-       DEF(STR, dnpass),
+       DEF(STR, auth_dn),
+       DEF(STR, auth_dn_password),
        DEF(BOOL, auth_bind),
        DEF(STR, auth_bind_userdn),
+       DEF(BOOL, auth_sasl_bind),
+       DEF(STR, auth_sasl_mechanism),
+       DEF(STR, auth_sasl_realm),
+       DEF(STR, auth_sasl_authz_id),
        DEF(BOOL, starttls),
-       DEF(BOOL, sasl_bind),
-       DEF(STR, sasl_mech),
-       DEF(STR, sasl_realm),
-       DEF(STR, sasl_authz_id),
        DEF(STR, deref),
        DEF(STR, scope),
        DEF(STR, base),
@@ -46,15 +46,15 @@ static const struct setting_define ldap_setting_defines[] = {
 static const struct ldap_settings ldap_default_settings = {
        .hosts = "",
        .uris = "",
-       .dn = "",
-       .dnpass = "",
+       .auth_dn = "",
+       .auth_dn_password = "",
        .auth_bind = FALSE,
        .auth_bind_userdn = "",
+       .auth_sasl_bind = FALSE,
+       .auth_sasl_mechanism = "",
+       .auth_sasl_realm = "",
+       .auth_sasl_authz_id = "",
        .starttls = FALSE,
-       .sasl_bind = FALSE,
-       .sasl_mech = "",
-       .sasl_realm = "",
-       .sasl_authz_id = "",
        .deref = "never",
        .scope = "subtree",
        .base = "",
@@ -148,8 +148,8 @@ static bool ldap_setting_check(void *_set, pool_t pool ATTR_UNUSED,
 #endif
 
 #ifndef HAVE_LDAP_SASL
-       if (set->sasl_bind) {
-               *error_r = "ldap_sasl_bind=yes but no SASL support compiled in";
+       if (set->auth_sasl_bind) {
+               *error_r = "ldap_auth_sasl_bind=yes but no SASL support compiled in";
                return FALSE;
        }
 #endif
@@ -172,8 +172,8 @@ int ldap_setting_post_check(const struct ldap_settings *set, const char **error_
        }
 
        if (set->version < 3) {
-               if (set->sasl_bind) {
-                       *error_r = "ldap_sasl_bind=yes requires ldap_version=3";
+               if (set->auth_sasl_bind) {
+                       *error_r = "ldap_sauth_sasl_bind=yes requires ldap_version=3";
                        return -1;
                }
                if (set->starttls) {
index ff9e0421f9faa2b13c4e1d2cf85a91dce550c06d..be964164d18a0f25bcc820b16fa9da39df38c452 100644 (file)
@@ -6,13 +6,13 @@ struct ldap_settings {
 
        const char *hosts;
        const char *uris;
-       const char *dn;
-       const char *dnpass;
+       const char *auth_dn;
+       const char *auth_dn_password;
        const char *auth_bind_userdn;
 
-       const char *sasl_mech;
-       const char *sasl_realm;
-       const char *sasl_authz_id;
+       const char *auth_sasl_mechanism;
+       const char *auth_sasl_realm;
+       const char *auth_sasl_authz_id;
 
        const char *deref;
        const char *scope;
@@ -33,8 +33,8 @@ struct ldap_settings {
        gid_t gid;
 
        bool auth_bind;
+       bool auth_sasl_bind;
        bool starttls;
-       bool sasl_bind;
 
        /* parsed */
        int parsed_deref;
index f0cede3d7ca286119d53097601095b5dc6ff599d..1eac7b3f603e477f67cbe815049c44dea231dc02 100644 (file)
@@ -361,7 +361,7 @@ static int db_ldap_connect_finish(struct ldap_connection *conn, int ret)
        }
        if (ret != LDAP_SUCCESS) {
                e_error(conn->event, "binding failed (dn %s): %s",
-                       conn->set->dn == NULL ? "(none)" : conn->set->dn,
+                       conn->set->auth_dn == NULL ? "(none)" : conn->set->auth_dn,
                        ldap_get_error(conn));
                return -1;
        }
@@ -739,15 +739,15 @@ static int db_ldap_bind_sasl(struct ldap_connection *conn)
        int ret;
 
        i_zero(&context);
-       context.authcid = conn->set->dn;
-       context.passwd = conn->set->dnpass;
-       context.realm = conn->set->sasl_realm;
-       context.authzid = conn->set->sasl_authz_id;
+       context.authcid = conn->set->auth_dn;
+       context.passwd = conn->set->auth_dn_password;
+       context.realm = conn->set->auth_sasl_realm;
+       context.authzid = conn->set->auth_sasl_authz_id;
 
        /* There doesn't seem to be a way to do SASL binding
           asynchronously.. */
        ret = ldap_sasl_interactive_bind_s(conn->ld, NULL,
-                                          conn->set->sasl_mech,
+                                          conn->set->auth_sasl_mechanism,
                                           NULL, NULL, LDAP_SASL_QUIET,
                                           sasl_interact, &context);
        if (db_ldap_connect_finish(conn, ret) < 0)
@@ -774,8 +774,8 @@ static int db_ldap_bind_simple(struct ldap_connection *conn)
        i_assert(conn->default_bind_msgid == -1);
        i_assert(conn->pending_count == 0);
 
-       msgid = ldap_bind(conn->ld, conn->set->dn, conn->set->dnpass,
-                         LDAP_AUTH_SIMPLE);
+       msgid = ldap_bind(conn->ld, conn->set->auth_dn,
+                         conn->set->auth_dn_password, LDAP_AUTH_SIMPLE);
        if (msgid == -1) {
                i_assert(ldap_get_errno(conn) != LDAP_SUCCESS);
                if (db_ldap_connect_finish(conn, ldap_get_errno(conn)) < 0) {
@@ -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->sasl_bind) {
+       if (conn->set->auth_sasl_bind) {
                if (db_ldap_bind_sasl(conn) < 0)
                        return -1;
        } else {