Mercurial > dovecot > core-2.2
changeset 22866:e8bb571b38b4
imap: Add client_create_finish() to finish namespace creation.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 15 Feb 2018 18:15:16 +0200 |
parents | 700827777c0b |
children | 334fc7c1e9ee |
files | src/imap/imap-client.c src/imap/imap-client.h src/imap/imap-master-client.c src/imap/main.c |
diffstat | 4 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/imap-client.c Thu Feb 15 18:13:20 2018 +0200 +++ b/src/imap/imap-client.c Thu Feb 15 18:15:16 2018 +0200 @@ -216,6 +216,13 @@ return client; } +int client_create_finish(struct client *client, const char **error_r) +{ + if (mail_namespaces_init(client->user, error_r) < 0) + return -1; + return 0; +} + void client_command_cancel(struct client_command_context **_cmd) { struct client_command_context *cmd = *_cmd;
--- a/src/imap/imap-client.h Thu Feb 15 18:13:20 2018 +0200 +++ b/src/imap/imap-client.h Thu Feb 15 18:15:16 2018 +0200 @@ -255,6 +255,7 @@ struct mail_storage_service_user *service_user, const struct imap_settings *set, const struct lda_settings *lda_set); +int client_create_finish(struct client *client, const char **error_r); void client_destroy(struct client *client, const char *reason) ATTR_NULL(2); /* Disconnect client connection */
--- a/src/imap/imap-master-client.c Thu Feb 15 18:13:20 2018 +0200 +++ b/src/imap/imap-master-client.c Thu Feb 15 18:15:16 2018 +0200 @@ -231,9 +231,8 @@ } client->imap_client_created = TRUE; - if (mail_namespaces_init(imap_client->user, &error) < 0) { - i_error("imap-master(%s): mail_namespaces_init() failed: %s", - input.username, error); + if (client_create_finish(imap_client, &error) < 0) { + i_error("imap-master(%s): %s", input.username, error); client_destroy(imap_client, error); return -1; }
--- a/src/imap/main.c Thu Feb 15 18:13:20 2018 +0200 +++ b/src/imap/main.c Thu Feb 15 18:15:16 2018 +0200 @@ -292,7 +292,7 @@ client_add_input_capability(client, input_buf->data, input_buf->used); } - if (mail_namespaces_init(client->user, &error) < 0) + if (client_create_finish(client, &error) < 0) i_fatal("%s", error); client_add_input_finalize(client); /* client may be destroyed now */ @@ -337,7 +337,7 @@ login_client->auth_req.data_size); /* finish initializing the user (see comment in main()) */ - if (mail_namespaces_init(client->user, &error) < 0) { + if (client_create_finish(client, &error) < 0) { if (write_full(login_client->fd, MSG_BYE_INTERNAL_ERROR, strlen(MSG_BYE_INTERNAL_ERROR)) < 0) if (errno != EAGAIN && errno != EPIPE)