From: Markus Valentin Date: Fri, 1 Mar 2024 16:41:49 +0000 (+0100) Subject: auth: Add auth_static_settings for static userdb and passdb X-Git-Tag: 2.4.1~894 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fc78b10fe7a03044a671180efaac926a4136b80;p=thirdparty%2Fdovecot%2Fcore.git auth: Add auth_static_settings for static userdb and passdb --- diff --git a/src/auth/auth-settings.c b/src/auth/auth-settings.c index 1ef3239c15..a45d861d35 100644 --- a/src/auth/auth-settings.c +++ b/src/auth/auth-settings.c @@ -298,6 +298,33 @@ const struct setting_parser_info auth_userdb_post_setting_parser_info = { .pool_offset1 = 1 + offsetof(struct auth_userdb_post_settings, pool), }; +#undef DEF +#define DEF(type, name) \ + SETTING_DEFINE_STRUCT_##type(#name, name, struct auth_static_settings) + +static const struct setting_define auth_static_setting_defines[] = { + { .type = SET_FILTER_NAME, .key = "passdb_static", }, + { .type = SET_FILTER_NAME, .key = "userdb_static", }, + DEF(STR, passdb_static_password), + DEF(BOOL, userdb_static_allow_all_users), + + SETTING_DEFINE_LIST_END +}; + +static const struct auth_static_settings auth_static_default_settings = { + .passdb_static_password = "", + .userdb_static_allow_all_users = FALSE, +}; + +const struct setting_parser_info auth_static_setting_parser_info = { + .name = "auth_static", + + .defines = auth_static_setting_defines, + .defaults = &auth_static_default_settings, + + .struct_size = sizeof(struct auth_static_settings), + .pool_offset1 = 1 + offsetof(struct auth_static_settings, pool), +}; /* we're kind of kludging here to avoid "auth_" prefix in the struct fields */ #undef DEF diff --git a/src/auth/auth-settings.h b/src/auth/auth-settings.h index b848854511..f9cd52ce69 100644 --- a/src/auth/auth-settings.h +++ b/src/auth/auth-settings.h @@ -125,8 +125,15 @@ struct auth_settings { const struct ip_addr *proxy_self_ips; }; +struct auth_static_settings { + pool_t pool; + const char *passdb_static_password; + bool userdb_static_allow_all_users; +}; + extern const struct setting_parser_info auth_setting_parser_info; extern const struct setting_parser_info auth_passdb_setting_parser_info; +extern const struct setting_parser_info auth_static_setting_parser_info; extern const struct setting_parser_info auth_passdb_pre_setting_parser_info; extern const struct setting_parser_info auth_passdb_post_setting_parser_info; extern const struct setting_parser_info auth_userdb_setting_parser_info;