Browse Source

fix IMAP INBOX case normalization

while is_INBOX() was adjusted to work with not null-terminated strings,
is_inbox() wasn't.

amends 3aead33.
master
Oswald Buddenhagen 3 months ago
parent
commit
d54c22d20e
  1. 4
      src/drv_imap.c

4
src/drv_imap.c

@ -1530,7 +1530,7 @@ is_inbox( imap_store_t *ctx, const char *arg, int argl )
{ {
if (!starts_with_upper( arg, argl, "INBOX", 5 )) if (!starts_with_upper( arg, argl, "INBOX", 5 ))
return 0; return 0;
if (arg[5] && arg[5] != ctx->delimiter[0]) if (argl > 5 && arg[5] != ctx->delimiter[0])
return 0; return 0;
return 1; return 1;
} }
@ -3602,7 +3602,7 @@ imap_list_store( store_t *gctx, int flags,
// path | P [i] | i [P] | P // path | P [i] | i [P] | P
// //
int pfx_is_empty = !*ctx->prefix; int pfx_is_empty = !*ctx->prefix;
int pfx_is_inbox = !pfx_is_empty && is_inbox( ctx, ctx->prefix, -1 ); int pfx_is_inbox = !pfx_is_empty && is_inbox( ctx, ctx->prefix, strlen( ctx->prefix ) );
if (((flags & (LIST_PATH | LIST_PATH_MAYBE)) || pfx_is_empty) && !pfx_is_inbox && !(ctx->listed & LIST_PATH)) { if (((flags & (LIST_PATH | LIST_PATH_MAYBE)) || pfx_is_empty) && !pfx_is_inbox && !(ctx->listed & LIST_PATH)) {
ctx->listed |= LIST_PATH; ctx->listed |= LIST_PATH;
if (pfx_is_empty) if (pfx_is_empty)

Loading…
Cancel
Save