From: Timo Sirainen Date: Thu, 13 Apr 2023 21:07:28 +0000 (+0300) Subject: global: Replace master_service_settings_instance_get() calls with master_service_sett... X-Git-Tag: 2.4.0~2179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e62a9749f256b39b0bf92bed41ab3b1a487bb4ec;p=thirdparty%2Fdovecot%2Fcore.git global: Replace master_service_settings_instance_get() calls with master_service_settings_get() This is now possible because the lookup event has MASTER_SERVICE_SETTINGS_INSTANCE set. --- diff --git a/src/doveadm/doveadm-dsync.c b/src/doveadm/doveadm-dsync.c index 1c1bcbb45e..033154b1bd 100644 --- a/src/doveadm/doveadm-dsync.c +++ b/src/doveadm/doveadm-dsync.c @@ -1019,12 +1019,9 @@ get_default_replica_location(struct dsync_cmd_context *ctx, struct mail_storage_service_user *service_user, const char **error_r) { - struct master_service_settings_instance *set_instance = - mail_storage_service_user_get_settings_instance(service_user); const struct mail_storage_settings *mail_set; - if (master_service_settings_instance_get( + if (master_service_settings_get( mail_storage_service_user_get_event(service_user), - set_instance, &mail_storage_setting_parser_info, MASTER_SERVICE_SETTINGS_GET_FLAG_NO_CHECK | MASTER_SERVICE_SETTINGS_GET_FLAG_NO_EXPAND, diff --git a/src/imap-urlauth/imap-urlauth-worker.c b/src/imap-urlauth/imap-urlauth-worker.c index e322958ca1..f99d8f2a01 100644 --- a/src/imap-urlauth/imap-urlauth-worker.c +++ b/src/imap-urlauth/imap-urlauth-worker.c @@ -559,8 +559,7 @@ client_handle_user_command(struct client *client, const char *cmd, return 1; } - if (master_service_settings_instance_get(mail_user->event, - mail_user->set_instance, + if (master_service_settings_get(mail_user->event, &imap_urlauth_worker_setting_parser_info, 0, &set, &error) < 0) { e_error(client->event, "user %s: %s", input.username, error); diff --git a/src/imap/main.c b/src/imap/main.c index a7dd93d95a..141ba7e20c 100644 --- a/src/imap/main.c +++ b/src/imap/main.c @@ -281,13 +281,12 @@ int client_create_from_input(const struct mail_storage_service_input *input, restrict_access_allow_coredumps(TRUE); - if (master_service_settings_instance_get(mail_user->event, - mail_user->set_instance, - &smtp_submit_setting_parser_info, 0, - &smtp_set, error_r) < 0 || - master_service_settings_instance_get(mail_user->event, - mail_user->set_instance, &imap_setting_parser_info, 0, - &imap_set, error_r) < 0) { + if (master_service_settings_get(mail_user->event, + &smtp_submit_setting_parser_info, 0, + &smtp_set, error_r) < 0 || + master_service_settings_get(mail_user->event, + &imap_setting_parser_info, 0, + &imap_set, error_r) < 0) { master_service_settings_free(smtp_set); mail_user_deinit(&mail_user); event_unref(&event); diff --git a/src/lda/main.c b/src/lda/main.c index a22bc27f48..48d4f59dfe 100644 --- a/src/lda/main.c +++ b/src/lda/main.c @@ -290,14 +290,12 @@ lda_deliver(struct mail_deliver_input *dinput, const char *error; int ret; - if (master_service_settings_instance_get(dinput->rcpt_user->event, - dinput->rcpt_user->set_instance, - &lda_setting_parser_info, 0, - &dinput->set, &error) < 0 || - master_service_settings_instance_get(dinput->rcpt_user->event, - dinput->rcpt_user->set_instance, - &smtp_submit_setting_parser_info, 0, - &dinput->smtp_set, &error) < 0) + if (master_service_settings_get(dinput->rcpt_user->event, + &lda_setting_parser_info, 0, + &dinput->set, &error) < 0 || + master_service_settings_get(dinput->rcpt_user->event, + &smtp_submit_setting_parser_info, 0, + &dinput->smtp_set, &error) < 0) i_fatal("%s", error); dinput->src_mail = lda_raw_mail_open(dinput, path); diff --git a/src/lib-storage/index/dbox-multi/mdbox-storage.c b/src/lib-storage/index/dbox-multi/mdbox-storage.c index 76cf449bc2..bb92df42ea 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage.c +++ b/src/lib-storage/index/dbox-multi/mdbox-storage.c @@ -47,10 +47,9 @@ int mdbox_storage_create(struct mail_storage *_storage, struct mdbox_storage *storage = MDBOX_STORAGE(_storage); const char *dir; - if (master_service_settings_instance_get(_storage->event, - _storage->user->set_instance, - &mdbox_setting_parser_info, 0, - &storage->set, error_r) < 0) + if (master_service_settings_get(_storage->event, + &mdbox_setting_parser_info, 0, + &storage->set, error_r) < 0) return -1; storage->preallocate_space = storage->set->mdbox_preallocate_space; diff --git a/src/lib-storage/index/imapc/imapc-storage.c b/src/lib-storage/index/imapc/imapc-storage.c index f6c37cf252..2e1611a989 100644 --- a/src/lib-storage/index/imapc/imapc-storage.c +++ b/src/lib-storage/index/imapc/imapc-storage.c @@ -316,9 +316,9 @@ int imapc_storage_client_create(struct mail_namespace *ns, struct imapc_client_settings set; string_t *str; - if (master_service_settings_instance_get(ns->user->event, - ns->user->set_instance, &imapc_setting_parser_info, 0, - &imapc_set, error_r) < 0) + if (master_service_settings_get(ns->user->event, + &imapc_setting_parser_info, 0, + &imapc_set, error_r) < 0) return -1; i_zero(&set); diff --git a/src/lib-storage/index/maildir/maildir-storage.c b/src/lib-storage/index/maildir/maildir-storage.c index b6425f0519..f6b6955968 100644 --- a/src/lib-storage/index/maildir/maildir-storage.c +++ b/src/lib-storage/index/maildir/maildir-storage.c @@ -57,10 +57,9 @@ maildir_storage_create(struct mail_storage *_storage, struct mail_namespace *ns, struct mailbox_list *list = ns->list; const char *dir; - if (master_service_settings_instance_get(_storage->event, - _storage->user->set_instance, - &maildir_setting_parser_info, 0, - &storage->set, error_r) < 0) + if (master_service_settings_get(_storage->event, + &maildir_setting_parser_info, 0, + &storage->set, error_r) < 0) return -1; storage->temp_prefix = p_strdup(_storage->pool, diff --git a/src/lib-storage/index/mbox/mbox-storage.c b/src/lib-storage/index/mbox/mbox-storage.c index fb7d92b790..19863cc7f0 100644 --- a/src/lib-storage/index/mbox/mbox-storage.c +++ b/src/lib-storage/index/mbox/mbox-storage.c @@ -185,10 +185,9 @@ mbox_storage_create(struct mail_storage *_storage, struct mail_namespace *ns, return -1; } - if (master_service_settings_instance_get(_storage->event, - _storage->user->set_instance, - &mbox_setting_parser_info, 0, - &storage->set, error_r) < 0) + if (master_service_settings_get(_storage->event, + &mbox_setting_parser_info, 0, + &storage->set, error_r) < 0) return -1; if (mailbox_list_get_root_path(ns->list, MAILBOX_LIST_PATH_TYPE_INDEX, &dir)) { diff --git a/src/lib-storage/index/pop3c/pop3c-storage.c b/src/lib-storage/index/pop3c/pop3c-storage.c index d58803e703..b0cb91d622 100644 --- a/src/lib-storage/index/pop3c/pop3c-storage.c +++ b/src/lib-storage/index/pop3c/pop3c-storage.c @@ -42,10 +42,9 @@ pop3c_storage_create(struct mail_storage *_storage, { struct pop3c_storage *storage = POP3C_STORAGE(_storage); - if (master_service_settings_instance_get(_storage->event, - _storage->user->set_instance, - &pop3c_setting_parser_info, 0, - &storage->set, error_r) < 0) + if (master_service_settings_get(_storage->event, + &pop3c_setting_parser_info, 0, + &storage->set, error_r) < 0) return -1; if (storage->set->pop3c_host[0] == '\0') { diff --git a/src/lib-storage/mail-storage-service.c b/src/lib-storage/mail-storage-service.c index 7caa77fc41..a91dbf0b6f 100644 --- a/src/lib-storage/mail-storage-service.c +++ b/src/lib-storage/mail-storage-service.c @@ -1073,9 +1073,8 @@ mail_storage_service_lookup_real(struct mail_storage_service_ctx *ctx, mail_storage_service_var_expand_callback); event_set_ptr(event, MASTER_SERVICE_VAR_EXPAND_FUNC_CONTEXT, &var_expand_ctx); - if (master_service_settings_instance_get(event, set_instance, - &mail_user_setting_parser_info, - 0, &user_set, error_r) < 0) { + if (master_service_settings_get(event, &mail_user_setting_parser_info, + 0, &user_set, error_r) < 0) { event_unref(&event); master_service_settings_instance_free(&set_instance); return -1; @@ -1192,9 +1191,9 @@ mail_storage_service_lookup_real(struct mail_storage_service_ctx *ctx, if (ret > 0) { mail_storage_service_update_chroot(user); /* Settings may have changed in the parser */ - if (master_service_settings_instance_get(event, user->set_instance, - &mail_user_setting_parser_info, - 0, &user_set, &error) < 0) { + if (master_service_settings_get(event, + &mail_user_setting_parser_info, + 0, &user_set, &error) < 0) { *error_r = t_strdup_printf( "%s (probably caused by userdb)", error); ret = -2; @@ -1545,13 +1544,11 @@ int mail_storage_service_user_init_ssl_client_settings( struct mail_storage_service_user *user, pool_t pool, struct ssl_iostream_settings *ssl_set_r, const char **error_r) { - struct master_service_settings_instance *set_instance; const struct master_service_ssl_settings *ssl_set; - set_instance = mail_storage_service_user_get_settings_instance(user); - if (master_service_settings_instance_get(user->event, - set_instance, &master_service_ssl_setting_parser_info, - 0, &ssl_set, error_r) < 0) + if (master_service_settings_get(user->event, + &master_service_ssl_setting_parser_info, + 0, &ssl_set, error_r) < 0) return -1; master_service_ssl_client_settings_to_iostream_set(ssl_set, pool, ssl_set_r); diff --git a/src/lib-storage/mail-user.c b/src/lib-storage/mail-user.c index fe7fd9be38..0e3b556046 100644 --- a/src/lib-storage/mail-user.c +++ b/src/lib-storage/mail-user.c @@ -150,9 +150,9 @@ int mail_user_init(struct mail_user *user, const char **error_r) i_assert(!user->initialized); - if (master_service_settings_instance_get(user->event, user->set_instance, - &mail_storage_setting_parser_info, 0, - &user->_mail_set, &error) < 0) + if (master_service_settings_get(user->event, + &mail_storage_setting_parser_info, 0, + &user->_mail_set, &error) < 0) user->error = p_strdup(user->pool, error); else mail_user_expand_plugins_envs(user, user->_mail_set); diff --git a/src/lmtp/lmtp-client.c b/src/lmtp/lmtp-client.c index 884c414438..acb9dcdafa 100644 --- a/src/lmtp/lmtp-client.c +++ b/src/lmtp/lmtp-client.c @@ -122,12 +122,10 @@ static void client_read_settings(struct client *client, bool ssl) struct event *event = event_create(client->event); event_set_ptr(event, MASTER_SERVICE_VAR_EXPAND_TABLE, (void *)tab); - if (master_service_settings_instance_get(event, client->set_instance, - &lda_setting_parser_info, 0, - &client->lda_set, &error) < 0 || - master_service_settings_instance_get(event, client->set_instance, - &lmtp_setting_parser_info, 0, - &client->lmtp_set, &error) < 0) + if (master_service_settings_get(event, &lda_setting_parser_info, 0, + &client->lda_set, &error) < 0 || + master_service_settings_get(event, &lmtp_setting_parser_info, 0, + &client->lmtp_set, &error) < 0) i_fatal("%s", error); event_unref(&event); } diff --git a/src/lmtp/lmtp-local.c b/src/lmtp/lmtp-local.c index 3bfc281f95..7d37e7df42 100644 --- a/src/lmtp/lmtp-local.c +++ b/src/lmtp/lmtp-local.c @@ -344,11 +344,8 @@ int lmtp_local_rcpt(struct client *client, lrcpt->type = LMTP_RECIPIENT_TYPE_LOCAL; lrcpt->backend_context = llrcpt; - struct master_service_settings_instance *set_instance = - mail_storage_service_user_get_settings_instance(service_user); - if (master_service_settings_instance_get( + if (master_service_settings_get( mail_storage_service_user_get_event(service_user), - set_instance, &lda_setting_parser_info, 0, &llrcpt->lda_set, &error) < 0) { e_error(rcpt->event, "%s", error); @@ -439,17 +436,14 @@ lmtp_local_deliver(struct lmtp_local *local, const struct mail_storage_settings *mail_set; struct smtp_proxy_data proxy_data; struct mail_namespace *ns; - struct master_service_settings_instance *set_instance; const char *error, *username; int ret; input = mail_storage_service_user_get_input(service_user); username = t_strdup(input->username); - set_instance = mail_storage_service_user_get_settings_instance(service_user); - if (master_service_settings_instance_get( + if (master_service_settings_get( mail_storage_service_user_get_event(service_user), - set_instance, &mail_storage_setting_parser_info, MASTER_SERVICE_SETTINGS_GET_FLAG_NO_EXPAND, &mail_set, &error) < 0) { @@ -503,8 +497,7 @@ lmtp_local_deliver(struct lmtp_local *local, mail_storage_service_user_get_log_prefix(service_user)); lldctx.rcpt_user = rcpt_user; - if (master_service_settings_instance_get(rcpt_user->event, - rcpt_user->set_instance, + if (master_service_settings_get(rcpt_user->event, &smtp_submit_setting_parser_info, 0, &lldctx.smtp_set, &error) < 0) { e_error(rcpt->event, "%s", error); diff --git a/src/pop3/main.c b/src/pop3/main.c index d2cd382b52..27ffb0dcff 100644 --- a/src/pop3/main.c +++ b/src/pop3/main.c @@ -147,9 +147,9 @@ client_create_from_input(const struct mail_storage_service_input *input, } restrict_access_allow_coredumps(TRUE); - if (master_service_settings_instance_get(mail_user->event, - mail_user->set_instance, - &pop3_setting_parser_info, 0, &set, error_r) < 0) { + if (master_service_settings_get(mail_user->event, + &pop3_setting_parser_info, 0, + &set, error_r) < 0) { if (write(fd_out, lookup_error_str, strlen(lookup_error_str)) < 0) { /* ignored */ } diff --git a/src/submission/main.c b/src/submission/main.c index c72c133e1d..1fbeeb0a09 100644 --- a/src/submission/main.c +++ b/src/submission/main.c @@ -191,10 +191,9 @@ client_create_from_input(const struct mail_storage_service_input *input, restrict_access_allow_coredumps(TRUE); - if (master_service_settings_instance_get(mail_user->event, - mail_user->set_instance, - &submission_setting_parser_info, 0, - &set, error_r) < 0) { + if (master_service_settings_get(mail_user->event, + &submission_setting_parser_info, 0, + &set, error_r) < 0) { send_error(fd_out, event, my_hostname, "4.7.0", MAIL_ERRSTR_CRITICAL_MSG); mail_user_deinit(&mail_user);