]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Fix setting imap client event's "session" field for CLI sessions
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 21 Nov 2019 13:31:40 +0000 (15:31 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 26 Nov 2019 09:56:35 +0000 (11:56 +0200)
src/imap/main.c

index dd0478991a963929246a77b1a5ce0bc6889539cb..58157a40dafe462210c418f6c0fba77c5b76dbe4 100644 (file)
@@ -250,7 +250,6 @@ int client_create_from_input(const struct mail_storage_service_input *input,
        event_add_category(event, &event_category_imap);
        event_add_fields(event, (const struct event_add_field []){
                { .key = "user", .value = input->username },
-               { .key = "session", .value = input->session_id },
                { .key = NULL }
        });
        if (input->local_ip.family != 0)
@@ -269,6 +268,10 @@ int client_create_from_input(const struct mail_storage_service_input *input,
                event_unref(&event);
                return -1;
        }
+       /* Add the session only after creating the user, because
+          input->session_id may be NULL */
+       event_add_str(event, "session", mail_user->session_id);
+
        restrict_access_allow_coredumps(TRUE);
 
        smtp_set = mail_storage_service_user_get_set(user)[1];