errno = ENOENT;
}
- if (!mailbox_list_is_valid_create_name(_list, name)) {
- *status = MAILBOX_NAME_INVALID;
- return 0;
- }
-
if (ENOTFOUND(errno) || errno == EACCES) {
- *status = MAILBOX_NAME_VALID;
- return 0;
- } else if (errno == ENOTDIR) {
- *status = MAILBOX_NAME_NOINFERIORS;
+ *status = MAILBOX_NAME_NONEXISTENT;
return 0;
} else {
mailbox_list_set_critical(_list, "stat(%s) failed: %m", path);
return 0;
}
- if (!mailbox_list_is_valid_create_name(_list, name)) {
- *status = MAILBOX_NAME_INVALID;
- return 0;
- }
-
if (ENOTFOUND(errno) || errno == EACCES) {
- *status = MAILBOX_NAME_VALID;
+ *status = MAILBOX_NAME_NONEXISTENT;
return 0;
} else {
mailbox_list_set_critical(_list, "stat(%s) failed: %m", path);
const char *name ATTR_UNUSED,
enum mailbox_name_status *status)
{
- *status = MAILBOX_NAME_VALID;
+ *status = MAILBOX_NAME_NONEXISTENT;
return 0;
}
enum mailbox_name_status *status)
{
if (!mailbox_list_is_valid_existing_name(list, name)) {
- *status = MAILBOX_NAME_INVALID;
- return 0;
+ mailbox_list_set_error(list, MAIL_ERROR_PARAMS,
+ "Invalid mailbox name");
+ return -1;
}
return list->v.get_mailbox_name_status(list, name, status);
}
};
enum mailbox_name_status {
+ MAILBOX_NAME_NONEXISTENT,
/* name points to a selectable mailbox */
MAILBOX_NAME_EXISTS_MAILBOX,
/* name points to non-selectable mailbox */
- MAILBOX_NAME_EXISTS_DIR,
- MAILBOX_NAME_VALID,
- MAILBOX_NAME_INVALID,
- MAILBOX_NAME_NOINFERIORS
+ MAILBOX_NAME_EXISTS_DIR
};
enum mailbox_list_iter_flags {
if (alist->module_ctx.super.get_mailbox_name_status(list, name,
status) < 0)
return -1;
- if (ret > 0)
- return 0;
-
- /* we shouldn't reveal this mailbox's existance */
- switch (*status) {
- case MAILBOX_NAME_EXISTS_MAILBOX:
- case MAILBOX_NAME_EXISTS_DIR:
- *status = MAILBOX_NAME_VALID;
- break;
- case MAILBOX_NAME_VALID:
- case MAILBOX_NAME_INVALID:
- break;
- case MAILBOX_NAME_NOINFERIORS:
- /* have to check if we are allowed to see the parent */
- T_BEGIN {
- ret = acl_mailbox_list_have_right(list, name,
- TRUE, ACL_STORAGE_RIGHT_LOOKUP, NULL);
- } T_END;
-
- if (ret < 0) {
- mailbox_list_set_internal_error(list);
- return -1;
- }
- if (ret == 0) {
- /* no permission to see the parent */
- *status = MAILBOX_NAME_VALID;
- }
- break;
+ if (ret == 0) {
+ /* we shouldn't reveal this mailbox's existance */
+ *status = MAILBOX_NAME_NONEXISTENT;
}
return 0;
}