]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Remove imap_client.session_id
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 21 Nov 2019 13:30:38 +0000 (15:30 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 26 Nov 2019 09:56:35 +0000 (11:56 +0200)
Use mail_user.session_id instead. The imap_client.session_id was NULL for
command line sessions, which gets fixed by using mail_user.session_id.

src/imap/imap-client-hibernate.c
src/imap/imap-client.c
src/imap/imap-client.h
src/imap/main.c

index d85bad0d7817eaca0bc1ffa5d8e5012dc9f890f3..b8c2c32d0f8917b6bac7255931cf1c8aa995114e 100644 (file)
@@ -61,10 +61,8 @@ static void imap_hibernate_write_cmd(struct client *client, string_t *cmd,
                            (unsigned long long)peer_st.st_ino);
        }
 
-       if (client->session_id != NULL) {
-               str_append(cmd, "\tsession=");
-               str_append_tabescaped(cmd, client->session_id);
-       }
+       str_append(cmd, "\tsession=");
+       str_append_tabescaped(cmd, user->session_id);
        if (user->session_create_time != 0) {
                str_printfa(cmd, "\tsession_created=%s",
                            dec2str(user->session_create_time));
index 6dc784980bc52c34d3bd36f2259bda5947dcc15a..968da5e056bbd28087961cd06eb59fe2bb068ce5 100644 (file)
@@ -68,7 +68,7 @@ static void client_init_urlauth(struct client *client)
        config.url_port = client->set->imap_urlauth_port;
        config.socket_path = t_strconcat(client->user->set->base_dir,
                                         "/"IMAP_URLAUTH_SOCKET_NAME, NULL);
-       config.session_id = client->session_id;
+       config.session_id = client->user->session_id;
        config.access_user = client->user->username;
        config.access_service = "imap";
        config.access_anonymous = client->user->anonymous;
@@ -107,7 +107,7 @@ static bool user_has_special_use_mailboxes(struct mail_user *user)
        return FALSE;
 }
 
-struct client *client_create(int fd_in, int fd_out, const char *session_id,
+struct client *client_create(int fd_in, int fd_out,
                             struct event *event, struct mail_user *user,
                             struct mail_storage_service_user *service_user,
                             const struct imap_settings *set,
@@ -131,7 +131,6 @@ struct client *client_create(int fd_in, int fd_out, const char *session_id,
        client->set = set;
        client->smtp_set = smtp_set;
        client->service_user = service_user;
-       client->session_id = p_strdup(pool, session_id);
        client->fd_in = fd_in;
        client->fd_out = fd_out;
        client->input = i_stream_create_fd(fd_in,
@@ -279,7 +278,7 @@ const char *client_stats(struct client *client)
        const struct var_expand_table logout_tab[] = {
                { 'i', dec2str(i_stream_get_absolute_offset(client->input)), "input" },
                { 'o', dec2str(client->output->offset), "output" },
-               { '\0', client->session_id, "session" },
+               { '\0', client->user->session_id, "session" },
                { '\0', dec2str(client->fetch_hdr_count), "fetch_hdr_count" },
                { '\0', dec2str(client->fetch_hdr_bytes), "fetch_hdr_bytes" },
                { '\0', dec2str(client->fetch_body_count), "fetch_body_count" },
index 557d7d9f5876860b45d7ef7e7332c094b5244def..f2ffe0d7c9163baba56109eb9328a46b96afcd9d 100644 (file)
@@ -153,7 +153,6 @@ struct client {
 
        struct imap_client_vfuncs v;
        struct event *event;
-       const char *session_id;
        const char *const *userdb_fields; /* for internal session saving/restoring */
 
        int fd_in, fd_out;
@@ -262,7 +261,7 @@ extern unsigned int imap_feature_qresync;
 
 /* Create new client with specified input/output handles. socket specifies
    if the handle is a socket. */
-struct client *client_create(int fd_in, int fd_out, const char *session_id,
+struct client *client_create(int fd_in, int fd_out,
                             struct event *event, struct mail_user *user,
                             struct mail_storage_service_user *service_user,
                             const struct imap_settings *set,
index 7f6e98ab4419d71fd9307b559c74fb04c48a672c..dd0478991a963929246a77b1a5ce0bc6889539cb 100644 (file)
@@ -289,7 +289,7 @@ int client_create_from_input(const struct mail_storage_service_input *input,
                return -1;
        }
 
-       client = client_create(fd_in, fd_out, input->session_id,
+       client = client_create(fd_in, fd_out,
                               event, mail_user, user, imap_set, smtp_set);
        client->userdb_fields = input->userdb_fields == NULL ? NULL :
                p_strarray_dup(client->pool, input->userdb_fields);