dovecot-2.2: "Mailbox doesn't exist" error mixed up using storag...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Apr 5 00:13:33 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/eece943c7521
changeset: 16182:eece943c7521
user: Timo Sirainen <tss at iki.fi>
date: Sun Mar 24 12:09:39 2013 +0200
description:
"Mailbox doesn't exist" error mixed up using storage and virtual mailbox names.
This could have allowed a user to figure out existence of a mailbox without
having lookup ACL.
diffstat:
src/lib-storage/index/cydir/cydir-storage.c | 2 +-
src/lib-storage/index/dbox-common/dbox-storage.c | 2 +-
src/lib-storage/index/maildir/maildir-storage.c | 2 +-
src/lib-storage/index/mbox/mbox-storage.c | 2 +-
src/lib-storage/index/pop3c/pop3c-storage.c | 2 +-
src/lib-storage/index/raw/raw-storage.c | 2 +-
src/lib-storage/list/mailbox-list-delete.c | 8 ++++----
src/lib-storage/list/mailbox-list-fs.c | 4 ++--
src/lib-storage/list/mailbox-list-maildir.c | 4 ++--
src/lib-storage/mailbox-list-private.h | 4 ++++
src/plugins/acl/acl-mailbox.c | 2 +-
src/plugins/virtual/virtual-config.c | 2 +-
12 files changed, 20 insertions(+), 16 deletions(-)
diffs (191 lines):
diff -r a588b743d695 -r eece943c7521 src/lib-storage/index/cydir/cydir-storage.c
--- a/src/lib-storage/index/cydir/cydir-storage.c Sun Oct 30 12:39:53 2011 +0100
+++ b/src/lib-storage/index/cydir/cydir-storage.c Sun Mar 24 12:09:39 2013 +0200
@@ -68,7 +68,7 @@
/* exists, open it */
} else if (errno == ENOENT) {
mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name));
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname));
return -1;
} else if (errno == EACCES) {
mail_storage_set_critical(box->storage, "%s",
diff -r a588b743d695 -r eece943c7521 src/lib-storage/index/dbox-common/dbox-storage.c
--- a/src/lib-storage/index/dbox-common/dbox-storage.c Sun Oct 30 12:39:53 2011 +0100
+++ b/src/lib-storage/index/dbox-common/dbox-storage.c Sun Mar 24 12:09:39 2013 +0200
@@ -184,7 +184,7 @@
;
else if (errno == ENOENT || errno == ENAMETOOLONG) {
mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name));
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname));
return -1;
} else if (errno == EACCES) {
mail_storage_set_critical(box->storage, "%s",
diff -r a588b743d695 -r eece943c7521 src/lib-storage/index/maildir/maildir-storage.c
--- a/src/lib-storage/index/maildir/maildir-storage.c Sun Oct 30 12:39:53 2011 +0100
+++ b/src/lib-storage/index/maildir/maildir-storage.c Sun Mar 24 12:09:39 2013 +0200
@@ -367,7 +367,7 @@
if (errno == ENOENT || errno == ENAMETOOLONG) {
mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name));
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname));
return -1;
} else {
mail_storage_set_critical(box->storage,
diff -r a588b743d695 -r eece943c7521 src/lib-storage/index/mbox/mbox-storage.c
--- a/src/lib-storage/index/mbox/mbox-storage.c Sun Oct 30 12:39:53 2011 +0100
+++ b/src/lib-storage/index/mbox/mbox-storage.c Sun Mar 24 12:09:39 2013 +0200
@@ -470,7 +470,7 @@
return -1;
} else if (ENOTFOUND(errno)) {
mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name));
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname));
return -1;
} else if (mail_storage_set_error_from_errno(box->storage)) {
return -1;
diff -r a588b743d695 -r eece943c7521 src/lib-storage/index/pop3c/pop3c-storage.c
--- a/src/lib-storage/index/pop3c/pop3c-storage.c Sun Oct 30 12:39:53 2011 +0100
+++ b/src/lib-storage/index/pop3c/pop3c-storage.c Sun Mar 24 12:09:39 2013 +0200
@@ -165,7 +165,7 @@
if (strcmp(box->name, "INBOX") != 0) {
mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name));
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname));
return -1;
}
diff -r a588b743d695 -r eece943c7521 src/lib-storage/index/raw/raw-storage.c
--- a/src/lib-storage/index/raw/raw-storage.c Sun Oct 30 12:39:53 2011 +0100
+++ b/src/lib-storage/index/raw/raw-storage.c Sun Mar 24 12:09:39 2013 +0200
@@ -151,7 +151,7 @@
if (ENOTFOUND(errno)) {
mail_storage_set_error(box->storage,
MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name));
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname));
} else if (!mail_storage_set_error_from_errno(box->storage)) {
mail_storage_set_critical(box->storage,
"open(%s) failed: %m", path);
diff -r a588b743d695 -r eece943c7521 src/lib-storage/list/mailbox-list-delete.c
--- a/src/lib-storage/list/mailbox-list-delete.c Sun Oct 30 12:39:53 2011 +0100
+++ b/src/lib-storage/list/mailbox-list-delete.c Sun Mar 24 12:09:39 2013 +0200
@@ -68,7 +68,7 @@
continue;
}
mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
+ T_MAILBOX_LIST_ERR_NOT_FOUND(list, name));
return -1;
}
if (errno == EXDEV) {
@@ -130,7 +130,7 @@
return 0;
else if (ENOTFOUND(errno)) {
mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
+ T_MAILBOX_LIST_ERR_NOT_FOUND(list, name));
return -1;
} else {
if (!mailbox_list_set_error_from_errno(list)) {
@@ -158,7 +158,7 @@
if (dir == NULL) {
if (errno == ENOENT) {
mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
+ T_MAILBOX_LIST_ERR_NOT_FOUND(list, name));
} else {
if (!mailbox_list_set_error_from_errno(list)) {
mailbox_list_set_critical(list,
@@ -340,7 +340,7 @@
if (errno == ENOENT) {
mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
+ T_MAILBOX_LIST_ERR_NOT_FOUND(list, name));
} else if (errno == EISDIR ||
errno == EPERM) { /* Solaris */
mailbox_list_set_error(list, MAIL_ERROR_NOTPOSSIBLE,
diff -r a588b743d695 -r eece943c7521 src/lib-storage/list/mailbox-list-fs.c
--- a/src/lib-storage/list/mailbox-list-fs.c Sun Oct 30 12:39:53 2011 +0100
+++ b/src/lib-storage/list/mailbox-list-fs.c Sun Mar 24 12:09:39 2013 +0200
@@ -393,7 +393,7 @@
if (errno == ENOENT || errno == ENOTDIR) {
mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
+ T_MAILBOX_LIST_ERR_NOT_FOUND(list, name));
} else if (errno == ENOTEMPTY || errno == EEXIST) {
/* mbox workaround: if only .imap/ directory is preventing the
deletion, remove it */
@@ -586,7 +586,7 @@
if (rename(oldpath, newpath) < 0) {
if (ENOTFOUND(errno)) {
mailbox_list_set_error(oldlist, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(oldname));
+ T_MAILBOX_LIST_ERR_NOT_FOUND(oldlist, oldname));
} else if (!mailbox_list_set_error_from_errno(oldlist)) {
mailbox_list_set_critical(oldlist,
"rename(%s, %s) failed: %m", oldpath, newpath);
diff -r a588b743d695 -r eece943c7521 src/lib-storage/list/mailbox-list-maildir.c
--- a/src/lib-storage/list/mailbox-list-maildir.c Sun Oct 30 12:39:53 2011 +0100
+++ b/src/lib-storage/list/mailbox-list-maildir.c Sun Mar 24 12:09:39 2013 +0200
@@ -428,7 +428,7 @@
"Mailbox exists");
} else if (errno == ENOENT || errno == ENOTDIR) {
mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
+ T_MAILBOX_LIST_ERR_NOT_FOUND(list, name));
} else {
mailbox_list_set_critical(list, "stat(%s) failed: %m", path);
}
@@ -613,7 +613,7 @@
return -1;
if (!found && ret == 0) {
mailbox_list_set_error(oldlist, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(oldname));
+ T_MAILBOX_LIST_ERR_NOT_FOUND(oldlist, oldname));
return -1;
}
diff -r a588b743d695 -r eece943c7521 src/lib-storage/mailbox-list-private.h
--- a/src/lib-storage/mailbox-list-private.h Sun Oct 30 12:39:53 2011 +0100
+++ b/src/lib-storage/mailbox-list-private.h Sun Mar 24 12:09:39 2013 +0200
@@ -11,6 +11,10 @@
#define MAILBOX_LOG_FILE_NAME "dovecot.mailbox.log"
+#define T_MAILBOX_LIST_ERR_NOT_FOUND(list, name) \
+ t_strdup_printf(MAIL_ERRSTR_MAILBOX_NOT_FOUND, \
+ mailbox_list_get_vname(list, name))
+
enum mailbox_log_record_type;
struct stat;
struct dirent;
diff -r a588b743d695 -r eece943c7521 src/plugins/acl/acl-mailbox.c
--- a/src/plugins/acl/acl-mailbox.c Sun Oct 30 12:39:53 2011 +0100
+++ b/src/plugins/acl/acl-mailbox.c Sun Mar 24 12:09:39 2013 +0200
@@ -159,7 +159,7 @@
MAIL_ERRSTR_NO_PERMISSION);
} else if (ret == 0) {
mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name));
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname));
}
}
diff -r a588b743d695 -r eece943c7521 src/plugins/virtual/virtual-config.c
--- a/src/plugins/virtual/virtual-config.c Sun Oct 30 12:39:53 2011 +0100
+++ b/src/plugins/virtual/virtual-config.c Sun Mar 24 12:09:39 2013 +0200
@@ -378,7 +378,7 @@
"Virtual mailbox missing configuration file");
} else if (errno == ENOENT) {
mail_storage_set_error(storage, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(mbox->box.name));
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(mbox->box.vname));
} else {
mail_storage_set_critical(storage,
"stat(%s) failed: %m", box_path);
More information about the dovecot-cvs
mailing list