]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mail-crypt-acl: Fix logging while updating private keys for shared users
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 9 Jan 2023 16:33:12 +0000 (18:33 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:11 +0000 (12:34 +0200)
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.

src/plugins/mail-crypt/mail-crypt-acl-plugin.c

index 8068f45bd1590199b81914d7ab2eb3407f62a2e1..e0d33c5a068280e8062e1de7e6e6ae6f4849cd38 100644 (file)
@@ -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)