forbid nesting maildir Path under Inbox again
it was never documented, and i can't really think of a case where
someone would actually want it, as the MUA side of things would be just
weird. additionally, the case of Path being Inbox+'/' did not work
anyway. will reconsider and fix the latter case if someone complains.
reverts 98bd2b11
.
This commit is contained in:
parent
acd6b4b0b8
commit
3bfc3c5063
|
@ -365,7 +365,7 @@ maildir_list_maildirpp( maildir_store_t *ctx, int flags, const char *inbox )
|
||||||
|
|
||||||
static int
|
static int
|
||||||
maildir_list_recurse( maildir_store_t *ctx, int isBox, int flags,
|
maildir_list_recurse( maildir_store_t *ctx, int isBox, int flags,
|
||||||
const char *inbox, uint inboxLen, const char *basePath, uint basePathLen,
|
const char *inbox, uint inboxLen,
|
||||||
char *path, int pathLen, char *name, int nameLen )
|
char *path, int pathLen, char *name, int nameLen )
|
||||||
{
|
{
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
|
@ -402,8 +402,6 @@ maildir_list_recurse( maildir_store_t *ctx, int isBox, int flags,
|
||||||
pl += pathLen;
|
pl += pathLen;
|
||||||
if (inbox && equals( path, pl, inbox, inboxLen )) {
|
if (inbox && equals( path, pl, inbox, inboxLen )) {
|
||||||
// Inbox nested into Path.
|
// Inbox nested into Path.
|
||||||
} else if (basePath && equals( path, pl, basePath, basePathLen )) {
|
|
||||||
// Path nested into Inbox.
|
|
||||||
} else {
|
} else {
|
||||||
if (style == SUB_LEGACY) {
|
if (style == SUB_LEGACY) {
|
||||||
if (*ent == '.') {
|
if (*ent == '.') {
|
||||||
|
@ -431,7 +429,7 @@ maildir_list_recurse( maildir_store_t *ctx, int isBox, int flags,
|
||||||
add_string_list( &ctx->boxes, name );
|
add_string_list( &ctx->boxes, name );
|
||||||
path[pl] = 0;
|
path[pl] = 0;
|
||||||
name[nl++] = '/';
|
name[nl++] = '/';
|
||||||
if (maildir_list_recurse( ctx, isBox + 1, flags, inbox, inboxLen, basePath, basePathLen, path, pl, name, nl ) < 0) {
|
if (maildir_list_recurse( ctx, isBox + 1, flags, inbox, inboxLen, path, pl, name, nl ) < 0) {
|
||||||
closedir( dir );
|
closedir( dir );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -451,9 +449,8 @@ maildir_list_inbox( maildir_store_t *ctx, int flags )
|
||||||
ctx->listed |= LIST_INBOX;
|
ctx->listed |= LIST_INBOX;
|
||||||
|
|
||||||
add_string_list( &ctx->boxes, "INBOX" );
|
add_string_list( &ctx->boxes, "INBOX" );
|
||||||
const char *basePath = ctx->conf->path;
|
|
||||||
return maildir_list_recurse(
|
return maildir_list_recurse(
|
||||||
ctx, 1, flags, NULL, 0, basePath, basePath ? strlen( basePath ) - 1 : 0,
|
ctx, 1, flags, NULL, 0,
|
||||||
path, nfsnprintf( path, _POSIX_PATH_MAX, "%s/", ctx->conf->inbox ),
|
path, nfsnprintf( path, _POSIX_PATH_MAX, "%s/", ctx->conf->inbox ),
|
||||||
name, nfsnprintf( name, _POSIX_PATH_MAX, "INBOX/" ) );
|
name, nfsnprintf( name, _POSIX_PATH_MAX, "INBOX/" ) );
|
||||||
}
|
}
|
||||||
|
@ -471,7 +468,7 @@ maildir_list_path( maildir_store_t *ctx, int flags )
|
||||||
return -1;
|
return -1;
|
||||||
const char *inbox = ctx->conf->inbox;
|
const char *inbox = ctx->conf->inbox;
|
||||||
return maildir_list_recurse(
|
return maildir_list_recurse(
|
||||||
ctx, 0, flags, inbox, strlen( inbox ), NULL, 0,
|
ctx, 0, flags, inbox, strlen( inbox ),
|
||||||
path, nfsnprintf( path, _POSIX_PATH_MAX, "%s", ctx->conf->path ),
|
path, nfsnprintf( path, _POSIX_PATH_MAX, "%s", ctx->conf->path ),
|
||||||
name, 0 );
|
name, 0 );
|
||||||
}
|
}
|
||||||
|
@ -1908,9 +1905,17 @@ maildir_parse_store( conffile_t *cfg, store_conf_t **storep )
|
||||||
}
|
}
|
||||||
if (!store->inbox)
|
if (!store->inbox)
|
||||||
store->inbox = expand_strdup( "~/Maildir", NULL );
|
store->inbox = expand_strdup( "~/Maildir", NULL );
|
||||||
if (store->sub_style == SUB_MAILDIRPP && store->path) {
|
if (store->path) {
|
||||||
error( "Maildir store '%s': Setting Path is incompatible with 'SubFolders Maildir++'\n", store->name );
|
if (store->sub_style == SUB_MAILDIRPP) {
|
||||||
cfg->err = 1;
|
error( "Maildir store '%s': Setting Path is incompatible with 'SubFolders Maildir++'\n", store->name );
|
||||||
|
cfg->err = 1;
|
||||||
|
} else {
|
||||||
|
uint inboxLen = strlen( store->inbox );
|
||||||
|
if (starts_with( store->path, -1, store->inbox, inboxLen ) && store->path[inboxLen] == '/') {
|
||||||
|
error( "Maildir store '%s': Path cannot be nested under Inbox\n", store->name );
|
||||||
|
cfg->err = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
nfasprintf( &store->info_prefix, "%c2,", store->info_delimiter );
|
nfasprintf( &store->info_prefix, "%c2,", store->info_delimiter );
|
||||||
nfasprintf( &store->info_stop, "%c,", store->info_delimiter );
|
nfasprintf( &store->info_stop, "%c,", store->info_delimiter );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user