Merge branch '1.3' into 1.4
Conflicts: configure.ac src/drv_imap.c
This commit is contained in:
commit
4b185e35fe
|
@ -1378,7 +1378,7 @@ static int
|
||||||
parse_list_rsp_p2( imap_store_t *ctx, list_t *list, char *cmd ATTR_UNUSED )
|
parse_list_rsp_p2( imap_store_t *ctx, list_t *list, char *cmd ATTR_UNUSED )
|
||||||
{
|
{
|
||||||
string_list_t *narg;
|
string_list_t *narg;
|
||||||
char *arg;
|
char *arg, c;
|
||||||
int argl;
|
int argl;
|
||||||
uint l;
|
uint l;
|
||||||
|
|
||||||
|
@ -1422,6 +1422,34 @@ parse_list_rsp_p2( imap_store_t *ctx, list_t *list, char *cmd ATTR_UNUSED )
|
||||||
warn( "IMAP warning: ignoring mailbox %s (reserved character '/' in name)\n", arg );
|
warn( "IMAP warning: ignoring mailbox %s (reserved character '/' in name)\n", arg );
|
||||||
return LIST_OK;
|
return LIST_OK;
|
||||||
}
|
}
|
||||||
|
// Validate the normalized name. Technically speaking, we could tolerate
|
||||||
|
// '//' and '/./', and '/../' being forbidden is a limitation of the Maildir
|
||||||
|
// driver, but there isn't really a legitimate reason for these being present.
|
||||||
|
for (const char *p = narg->string, *sp = p;;) {
|
||||||
|
if (!(c = *p) || c == '/') {
|
||||||
|
uint pcl = (uint)(p - sp);
|
||||||
|
if (!pcl) {
|
||||||
|
error( "IMAP warning: ignoring mailbox '%s' due to empty name component\n", narg->string );
|
||||||
|
free( narg );
|
||||||
|
return LIST_OK;
|
||||||
|
}
|
||||||
|
if (pcl == 1 && sp[0] == '.') {
|
||||||
|
error( "IMAP warning: ignoring mailbox '%s' due to '.' component\n", narg->string );
|
||||||
|
free( narg );
|
||||||
|
return LIST_OK;
|
||||||
|
}
|
||||||
|
if (pcl == 2 && sp[0] == '.' && sp[1] == '.') {
|
||||||
|
error( "IMAP error: LIST'd mailbox name '%s' contains '..' component - THIS MIGHT BE AN ATTEMPT TO HACK YOU!\n", narg->string );
|
||||||
|
free( narg );
|
||||||
|
return LIST_BAD;
|
||||||
|
}
|
||||||
|
if (!c)
|
||||||
|
break;
|
||||||
|
sp = ++p;
|
||||||
|
} else {
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
}
|
||||||
narg->next = ctx->boxes;
|
narg->next = ctx->boxes;
|
||||||
ctx->boxes = narg;
|
ctx->boxes = narg;
|
||||||
return LIST_OK;
|
return LIST_OK;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user