From: Timo Sirainen Date: Mon, 9 Jan 2023 16:33:12 +0000 (+0200) Subject: mail-crypt-acl: Fix logging while updating private keys for shared users X-Git-Tag: 2.4.1~1176 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20955e7e4aa254a3a6833785954c52b1c26c514c;p=thirdparty%2Fdovecot%2Fcore.git mail-crypt-acl: Fix logging while updating private keys for shared users During userdb lookup the log prefix contained only the user being looked up with no mention of the originating user. This was because mail_storage_service_lookup() didn't see that there was any IO loop context active, so it created a new log prefix. Fixed by simply removing the explicit IO loop context [de]activate calls. The logging seems to work just fine even without them. --- diff --git a/src/plugins/mail-crypt/mail-crypt-acl-plugin.c b/src/plugins/mail-crypt/mail-crypt-acl-plugin.c index 8068f45bd1..e0d33c5a06 100644 --- a/src/plugins/mail-crypt/mail-crypt-acl-plugin.c +++ b/src/plugins/mail-crypt/mail-crypt-acl-plugin.c @@ -147,16 +147,12 @@ mail_crypt_acl_user_create(struct mail_user *user, const char *dest_username, const struct mail_storage_service_input *old_input; struct mail_storage_service_input input; struct mail_storage_service_ctx *service_ctx; - struct ioloop_context *cur_ioloop_ctx; int ret; service_ctx = mail_storage_service_user_get_service_ctx(user->service_user); old_input = mail_storage_service_user_get_input(user->service_user); - if ((cur_ioloop_ctx = io_loop_get_current_context(current_ioloop)) != NULL) - io_loop_context_deactivate(cur_ioloop_ctx); - i_zero(&input); input.service = old_input->service; input.protocol = old_input->protocol; @@ -284,13 +280,6 @@ static int mail_crypt_acl_object_update(struct acl_object *aclobj, ret = mail_crypt_acl_user_create(aclobj->backend->list->ns->user, username, &dest_user, &error); - /* to make sure we get correct logging context */ - if (ret > 0) - mail_storage_service_io_deactivate_user(dest_user->service_user); - mail_storage_service_io_activate_user( - aclobj->backend->list->ns->user->service_user - ); - if (ret <= 0) { e_error(event, "mail-crypt-acl-plugin: Cannot initialize destination user %s: %s", @@ -315,12 +304,6 @@ static int mail_crypt_acl_object_update(struct acl_object *aclobj, } } - /* logging context swap again */ - mail_storage_service_io_deactivate_user( - aclobj->backend->list->ns->user->service_user - ); - mail_storage_service_io_activate_user(dest_user->service_user); - mail_user_deinit(&dest_user); if ((cur_ioloop_ctx = io_loop_get_current_context(current_ioloop)) != NULL)