Mercurial > dovecot > original-hg > dovecot-1.2
changeset 3498:910620d1e19e HEAD
Give error message if mailbox listing fails. Don't crash with mbox if
.subscriptions file couldn't be opened.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 21 Jul 2005 22:16:30 +0300 |
parents | 872218271484 |
children | 35be29ba348d |
files | src/lib-storage/index/maildir/maildir-list.c src/lib-storage/index/mbox/mbox-list.c |
diffstat | 2 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-list.c Thu Jul 21 22:07:37 2005 +0300 +++ b/src/lib-storage/index/maildir/maildir-list.c Thu Jul 21 22:16:30 2005 +0300 @@ -66,8 +66,9 @@ if (errno != ENOENT) { mail_storage_set_critical(ctx->mailbox_ctx.storage, "opendir(%s) failed: %m", ctx->dir); + return FALSE; } - return FALSE; + return TRUE; } stat_dirs = getenv("MAILDIR_STAT_DIRS") != NULL; @@ -286,8 +287,10 @@ ctx->prefix = ""; if ((flags & MAILBOX_LIST_SUBSCRIBED) != 0) { - if (!maildir_fill_subscribed(ctx, glob)) + if (!maildir_fill_subscribed(ctx, glob)) { + ctx->failed = TRUE; return &ctx->mailbox_ctx; + } } else if ((storage->flags & MAIL_STORAGE_FLAG_FULL_FS_ACCESS) != 0 && (p = strrchr(mask, '/')) != NULL) { dir = t_strdup_until(mask, p); @@ -301,8 +304,10 @@ if ((flags & MAILBOX_LIST_SUBSCRIBED) == 0 || (ctx->flags & MAILBOX_LIST_FAST_FLAGS) == 0) { int update_only = (flags & MAILBOX_LIST_SUBSCRIBED) != 0; - if (!maildir_fill_readdir(ctx, glob, update_only)) + if (!maildir_fill_readdir(ctx, glob, update_only)) { + ctx->failed = TRUE; return &ctx->mailbox_ctx; + } } ctx->node_path = str_new(pool, 256); @@ -314,10 +319,11 @@ int maildir_mailbox_list_deinit(struct mailbox_list_context *_ctx) { struct maildir_list_context *ctx = (struct maildir_list_context *)_ctx; + int ret = ctx->failed ? -1 : 0; mailbox_tree_deinit(ctx->tree_ctx); pool_unref(ctx->pool); - return TRUE; + return ret; } static struct mailbox_node *find_next(struct mailbox_node **node,
--- a/src/lib-storage/index/mbox/mbox-list.c Thu Jul 21 22:07:37 2005 +0300 +++ b/src/lib-storage/index/mbox/mbox-list.c Thu Jul 21 22:16:30 2005 +0300 @@ -144,6 +144,7 @@ subsfile_list_init(storage, path); if (ctx->subsfile_ctx == NULL) { ctx->next = mbox_list_next; + ctx->failed = TRUE; return &ctx->mailbox_ctx; } ctx->glob = imap_match_init(default_pool, mask, TRUE, '/'); @@ -423,7 +424,7 @@ } if (!ctx->inbox_found && (ctx->flags & MAILBOX_LIST_INBOX) != 0 && - imap_match(ctx->glob, "INBOX") > 0) { + ctx->glob != NULL && imap_match(ctx->glob, "INBOX") > 0) { /* show inbox */ ctx->inbox_found = TRUE; return mbox_list_inbox(ctx);