From: Timo Sirainen Date: Sat, 26 Feb 2022 22:36:11 +0000 (+0100) Subject: lib-storage, global: Add root parameter to mail_storage_service_user_get_set() X-Git-Tag: 2.4.0~3352 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9500c85b7ae4fe1d631d3274e5ddc16ee35e5283;p=thirdparty%2Fdovecot%2Fcore.git lib-storage, global: Add root parameter to mail_storage_service_user_get_set() --- diff --git a/src/doveadm/doveadm-dsync.c b/src/doveadm/doveadm-dsync.c index acc6b597a8..f029406800 100644 --- a/src/doveadm/doveadm-dsync.c +++ b/src/doveadm/doveadm-dsync.c @@ -1079,7 +1079,8 @@ static int cmd_dsync_prerun(struct doveadm_mail_cmd_context *_ctx, const struct master_service_ssl_settings *ssl_set; const char *username = ""; - user_set = mail_storage_service_user_get_set(service_user)[0]; + user_set = mail_storage_service_user_get_set(service_user, + &mail_user_setting_parser_info); ssl_set = mail_storage_service_user_get_ssl_settings(service_user); ctx->fd_in = -1; diff --git a/src/imap-urlauth/imap-urlauth-worker.c b/src/imap-urlauth/imap-urlauth-worker.c index 096a3a854e..701cefd78a 100644 --- a/src/imap-urlauth/imap-urlauth-worker.c +++ b/src/imap-urlauth/imap-urlauth-worker.c @@ -588,7 +588,8 @@ client_handle_user_command(struct client *client, const char *cmd, /* drop privileges */ restrict_access_allow_coredumps(TRUE); - set = mail_storage_service_user_get_set(user)[1]; + set = mail_storage_service_user_get_set(user, + &imap_urlauth_worker_setting_parser_info); if (mail_user_var_expand(mail_user, &imap_urlauth_worker_setting_parser_info, set, &error) <= 0) { client_send_line(client, "NO"); diff --git a/src/imap/main.c b/src/imap/main.c index 14473e4619..da50d7db0d 100644 --- a/src/imap/main.c +++ b/src/imap/main.c @@ -278,8 +278,10 @@ int client_create_from_input(const struct mail_storage_service_input *input, restrict_access_allow_coredumps(TRUE); - smtp_set = mail_storage_service_user_get_set(user)[1]; - imap_set = mail_storage_service_user_get_set(user)[2]; + smtp_set = mail_storage_service_user_get_set(user, + &smtp_submit_setting_parser_info); + imap_set = mail_storage_service_user_get_set(user, + &imap_setting_parser_info); if (imap_set->verbose_proctitle) verbose_proctitle = TRUE; diff --git a/src/lda/main.c b/src/lda/main.c index 6b17fa42b9..e76d7fc284 100644 --- a/src/lda/main.c +++ b/src/lda/main.c @@ -293,8 +293,10 @@ lda_deliver(struct mail_deliver_input *dinput, const char *errstr; int ret; - smtp_set = mail_storage_service_user_get_set(service_user)[1]; - lda_set = mail_storage_service_user_get_set(service_user)[2]; + smtp_set = mail_storage_service_user_get_set(service_user, + &smtp_submit_setting_parser_info); + lda_set = mail_storage_service_user_get_set(service_user, + &lda_setting_parser_info); ret = mail_user_var_expand(dinput->rcpt_user, &lda_setting_parser_info, lda_set, &errstr); if (ret > 0) { diff --git a/src/lib-storage/mail-storage-service.c b/src/lib-storage/mail-storage-service.c index 84a7963aaf..c0bdf0e897 100644 --- a/src/lib-storage/mail-storage-service.c +++ b/src/lib-storage/mail-storage-service.c @@ -1756,10 +1756,10 @@ struct mail_storage_service_ctx *mail_storage_service_get_global(void) return storage_service_global; } -void **mail_storage_service_user_get_set(struct mail_storage_service_user *user) +void *mail_storage_service_user_get_set(struct mail_storage_service_user *user, + const struct setting_parser_info *root) { - return master_service_settings_parser_get_others(master_service, - user->set_parser); + return settings_parser_get_root_set(user->set_parser, root); } const struct mail_storage_settings * diff --git a/src/lib-storage/mail-storage-service.h b/src/lib-storage/mail-storage-service.h index 713a58f127..95e5b44be1 100644 --- a/src/lib-storage/mail-storage-service.h +++ b/src/lib-storage/mail-storage-service.h @@ -151,9 +151,10 @@ void mail_storage_service_io_activate_user(struct mail_storage_service_user *use log prefix. */ void mail_storage_service_io_deactivate_user(struct mail_storage_service_user *user); -/* Return the settings pointed to by set_root parameter in _init(). - The settings contain all the changes done by userdb lookups. */ -void **mail_storage_service_user_get_set(struct mail_storage_service_user *user); +/* Return settings struct for the given root. The settings contain all the + changes done by userdb lookups. */ +void *mail_storage_service_user_get_set(struct mail_storage_service_user *user, + const struct setting_parser_info *root); const struct mail_storage_settings * mail_storage_service_user_get_mail_set(struct mail_storage_service_user *user); const struct mail_storage_service_input * diff --git a/src/lmtp/lmtp-local.c b/src/lmtp/lmtp-local.c index 1c4eb47b51..d2d0c8bc88 100644 --- a/src/lmtp/lmtp-local.c +++ b/src/lmtp/lmtp-local.c @@ -122,7 +122,8 @@ lmtp_local_rcpt_reply_overquota(struct lmtp_local_recipient *llrcpt, { struct smtp_server_recipient *rcpt = llrcpt->rcpt->rcpt; struct lda_settings *lda_set = - mail_storage_service_user_get_set(llrcpt->service_user)[2]; + mail_storage_service_user_get_set(llrcpt->service_user, + &lda_setting_parser_info); if (lda_set->quota_full_tempfail) smtp_server_recipient_reply(rcpt, 452, "4.2.2", "%s", error); @@ -423,7 +424,6 @@ lmtp_local_deliver(struct lmtp_local *local, struct lda_settings *lda_set; struct mail_namespace *ns; struct setting_parser_context *set_parser; - void **sets; const char *line, *error, *username; int ret; @@ -468,9 +468,10 @@ lmtp_local_deliver(struct lmtp_local *local, } local->rcpt_user = rcpt_user; - sets = mail_storage_service_user_get_set(service_user); - smtp_set = sets[1]; - lda_set = sets[2]; + smtp_set = mail_storage_service_user_get_set(service_user, + &smtp_submit_setting_parser_info); + lda_set = mail_storage_service_user_get_set(service_user, + &lda_setting_parser_info); ret = mail_user_var_expand(rcpt_user, &smtp_submit_setting_parser_info, smtp_set, &error); if (ret > 0) { diff --git a/src/pop3/main.c b/src/pop3/main.c index c665a10ff1..8592fd3ed8 100644 --- a/src/pop3/main.c +++ b/src/pop3/main.c @@ -148,7 +148,8 @@ client_create_from_input(const struct mail_storage_service_input *input, } restrict_access_allow_coredumps(TRUE); - set = mail_storage_service_user_get_set(user)[1]; + set = mail_storage_service_user_get_set(user, + &pop3_setting_parser_info); if (set->verbose_proctitle) verbose_proctitle = TRUE; diff --git a/src/submission/main.c b/src/submission/main.c index 8fa41f06ed..54f4b6f5d1 100644 --- a/src/submission/main.c +++ b/src/submission/main.c @@ -192,7 +192,8 @@ client_create_from_input(const struct mail_storage_service_input *input, restrict_access_allow_coredumps(TRUE); - set = mail_storage_service_user_get_set(user)[1]; + set = mail_storage_service_user_get_set(user, + &submission_setting_parser_info); if (set->verbose_proctitle) verbose_proctitle = TRUE;