Mercurial > dovecot > core-2.2
changeset 19541:af2ddcf54f92
pop3: Make sure pop3_lock_session=yes creates the lock's directory if it's missing.
This happened at least with mbox if the root .imap/ didn't exist yet.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Tue, 05 Jan 2016 11:17:26 -0500 |
parents | f8d2dded6aa0 |
children | 76aa68b2b265 |
files | src/pop3/pop3-client.c |
diffstat | 1 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pop3/pop3-client.c Tue Jan 05 11:08:01 2016 -0500 +++ b/src/pop3/pop3-client.c Tue Jan 05 11:17:26 2016 -0500 @@ -335,17 +335,26 @@ const struct mail_storage_settings *mail_set = mail_storage_service_user_get_mail_set(client->service_user); struct dotlock_settings dotlock_set; + enum mailbox_list_path_type type; const char *dir, *path; int ret; - if (!mailbox_list_get_root_path(client->inbox_ns->list, - MAILBOX_LIST_PATH_TYPE_INDEX, &dir) && - !mailbox_list_get_root_path(client->inbox_ns->list, - MAILBOX_LIST_PATH_TYPE_DIR, &dir)) { + if (mailbox_list_get_root_path(client->inbox_ns->list, + MAILBOX_LIST_PATH_TYPE_INDEX, &dir)) { + type = MAILBOX_LIST_PATH_TYPE_INDEX; + } else if (mailbox_list_get_root_path(client->inbox_ns->list, + MAILBOX_LIST_PATH_TYPE_DIR, &dir)) { + type = MAILBOX_LIST_PATH_TYPE_DIR; + } else { i_error("pop3_lock_session: Storage has no root/index directory, " "can't create a POP3 session lock file"); return -1; } + if (mailbox_list_mkdir_root(client->inbox_ns->list, dir, type) < 0) { + i_error("pop3_lock_session: Couldn't create root directory %s: %s", + dir, mailbox_list_get_last_error(client->inbox_ns->list, NULL)); + return -1; + } path = t_strdup_printf("%s/"POP3_LOCK_FNAME, dir); dotlock_set = session_dotlock_set;