static int shared_get_storage(struct mailbox_list **list, const char *vname, struct mail_storage **storage_r) { struct mail_namespace *ns = (*list)->ns; const char *name; name = mailbox_list_get_storage_name(*list, vname); if (*name == '\0' && (ns->flags & NAMESPACE_FLAG_AUTOCREATED) == 0) { /* trying to access the shared/ prefix itself */ *storage_r = ns->storage; return 0; } if (shared_storage_get_namespace(&ns, &name) < 0) return -1; *list = ns->list; return mailbox_list_get_storage(list, vname, storage_r); }
static const char * acl_backend_vfile_get_local_dir(struct acl_backend *backend, const char *name, const char *vname) { struct mail_namespace *ns = mailbox_list_get_namespace(backend->list); struct mailbox_list *list = ns->list; struct mail_storage *storage; enum mailbox_list_path_type type; const char *dir, *inbox; if (*name == '\0') name = NULL; /* ACL files are very important. try to keep them among the main mail files. that's not possible though with a) if the mailbox is a file or b) if the mailbox path doesn't point to filesystem. */ if (mailbox_list_get_storage(&list, vname, &storage) < 0) return NULL; i_assert(list == ns->list); type = mail_storage_is_mailbox_file(storage) || (storage->class_flags & MAIL_STORAGE_CLASS_FLAG_NO_ROOT) != 0 ? MAILBOX_LIST_PATH_TYPE_CONTROL : MAILBOX_LIST_PATH_TYPE_MAILBOX; if (name == NULL) { if (!mailbox_list_get_root_path(list, type, &dir)) return NULL; } else { if (mailbox_list_get_path(list, name, type, &dir) <= 0) return NULL; } /* verify that the directory isn't same as INBOX's directory. this is mainly for Maildir. */ if (name == NULL && mailbox_list_get_path(list, "INBOX", MAILBOX_LIST_PATH_TYPE_MAILBOX, &inbox) > 0 && strcmp(inbox, dir) == 0) { /* can't have default ACLs with this setup */ return NULL; } return dir; }