From: Marco Bettini Date: Fri, 5 Jul 2024 14:21:49 +0000 (+0000) Subject: auth: struct ldap_settings - Add auth_ prefixes X-Git-Tag: 2.4.1~770 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92893976d2eb429b6ad8305020b4824683986c2c;p=thirdparty%2Fdovecot%2Fcore.git auth: struct ldap_settings - Add auth_ prefixes --- diff --git a/src/auth/db-ldap-settings.c b/src/auth/db-ldap-settings.c index 5773ea393e..e4eb3ebe55 100644 --- a/src/auth/db-ldap-settings.c +++ b/src/auth/db-ldap-settings.c @@ -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) { diff --git a/src/auth/db-ldap-settings.h b/src/auth/db-ldap-settings.h index ff9e0421f9..be964164d1 100644 --- a/src/auth/db-ldap-settings.h +++ b/src/auth/db-ldap-settings.h @@ -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; diff --git a/src/auth/db-ldap.c b/src/auth/db-ldap.c index f0cede3d7c..1eac7b3f60 100644 --- a/src/auth/db-ldap.c +++ b/src/auth/db-ldap.c @@ -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 {