acl-backend-vfile-acllist.c (dovecot-2.3.16) | : | acl-backend-vfile-acllist.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 53 | skipping to change at line 53 | |||
enum mailbox_list_path_type *type_r) | enum mailbox_list_path_type *type_r) | |||
{ | { | |||
struct mail_storage *storage; | struct mail_storage *storage; | |||
const char *rootdir, *maildir; | const char *rootdir, *maildir; | |||
enum mailbox_list_path_type type; | enum mailbox_list_path_type type; | |||
if (backend->backend.globals_only) | if (backend->backend.globals_only) | |||
return FALSE; | return FALSE; | |||
storage = mailbox_list_get_namespace(backend->backend.list)->storage; | storage = mailbox_list_get_namespace(backend->backend.list)->storage; | |||
type = (storage->class_flags & MAIL_STORAGE_CLASS_FLAG_NO_ROOT) != 0 ? | type = mail_storage_get_acl_list_path_type(storage); | |||
MAILBOX_LIST_PATH_TYPE_CONTROL : MAILBOX_LIST_PATH_TYPE_DIR; | ||||
if (!mailbox_list_get_root_path(backend->backend.list, type, &rootdir)) | if (!mailbox_list_get_root_path(backend->backend.list, type, &rootdir)) | |||
return FALSE; | return FALSE; | |||
*type_r = type; | *type_r = type; | |||
if (type == MAILBOX_LIST_PATH_TYPE_DIR && | if (type == MAILBOX_LIST_PATH_TYPE_DIR && | |||
mail_storage_is_mailbox_file(storage)) { | mail_storage_is_mailbox_file(storage)) { | |||
maildir = mailbox_list_get_root_forced(backend->backend.list, | maildir = mailbox_list_get_root_forced(backend->backend.list, | |||
MAILBOX_LIST_PATH_TYPE_MAI LBOX); | MAILBOX_LIST_PATH_TYPE_MAI LBOX); | |||
if (strcmp(maildir, rootdir) == 0) { | if (strcmp(maildir, rootdir) == 0) { | |||
/* dovecot-acl-list would show up as a mailbox if we | /* dovecot-acl-list would show up as a mailbox if we | |||
skipping to change at line 203 | skipping to change at line 202 | |||
} | } | |||
ret = acl_object_list_deinit(&iter); | ret = acl_object_list_deinit(&iter); | |||
if (acl_backend_vfile_object_get_mtime(aclobj, &acllist.mtime) < 0) | if (acl_backend_vfile_object_get_mtime(aclobj, &acllist.mtime) < 0) | |||
ret = -1; | ret = -1; | |||
if (ret > 0) { | if (ret > 0) { | |||
acllist.name = p_strdup(backend->acllist_pool, name); | acllist.name = p_strdup(backend->acllist_pool, name); | |||
array_push_back(&backend->acllist, &acllist); | array_push_back(&backend->acllist, &acllist); | |||
T_BEGIN { | o_stream_nsend_str(output, t_strdup_printf( | |||
const char *line; | "%s %s\n", dec2str(acllist.mtime), name)); | |||
line = t_strdup_printf("%s %s\n", | ||||
dec2str(acllist.mtime), name); | ||||
o_stream_nsend_str(output, line); | ||||
} T_END; | ||||
} | } | |||
acl_object_deinit(&aclobj); | acl_object_deinit(&aclobj); | |||
return ret < 0 ? -1 : 0; | return ret < 0 ? -1 : 0; | |||
} | } | |||
static int | static int | |||
acl_backend_vfile_acllist_try_rebuild(struct acl_backend_vfile *backend) | acl_backend_vfile_acllist_try_rebuild(struct acl_backend_vfile *backend) | |||
{ | { | |||
struct mailbox_list *list = backend->backend.list; | struct mailbox_list *list = backend->backend.list; | |||
struct mail_namespace *ns; | struct mail_namespace *ns; | |||
skipping to change at line 277 | skipping to change at line 272 | |||
output = o_stream_create_fd_file(fd, 0, FALSE); | output = o_stream_create_fd_file(fd, 0, FALSE); | |||
o_stream_cork(output); | o_stream_cork(output); | |||
ret = 0; | ret = 0; | |||
acllist_clear(backend, 0); | acllist_clear(backend, 0); | |||
backend->rebuilding_acllist = TRUE; | backend->rebuilding_acllist = TRUE; | |||
iter = mailbox_list_iter_init(list, "*", | iter = mailbox_list_iter_init(list, "*", | |||
MAILBOX_LIST_ITER_RAW_LIST | | MAILBOX_LIST_ITER_RAW_LIST | | |||
MAILBOX_LIST_ITER_RETURN_NO_FLAGS); | MAILBOX_LIST_ITER_RETURN_NO_FLAGS); | |||
while ((info = mailbox_list_iter_next(iter)) != NULL) { | while (ret == 0 && (info = mailbox_list_iter_next(iter)) != NULL) T_BEGIN | |||
if (acllist_append(backend, output, info->vname) < 0) { | { | |||
ret = -1; | ret = acllist_append(backend, output, info->vname); | |||
break; | } T_END; | |||
} | ||||
} | ||||
if (o_stream_finish(output) < 0) { | if (o_stream_finish(output) < 0) { | |||
i_error("write(%s) failed: %s", str_c(path), | i_error("write(%s) failed: %s", str_c(path), | |||
o_stream_get_error(output)); | o_stream_get_error(output)); | |||
ret = -1; | ret = -1; | |||
} | } | |||
if (mailbox_list_iter_deinit(&iter) < 0) | if (mailbox_list_iter_deinit(&iter) < 0) | |||
ret = -1; | ret = -1; | |||
o_stream_destroy(&output); | o_stream_destroy(&output); | |||
End of changes. 3 change blocks. | ||||
14 lines changed or deleted | 7 lines changed or added |