Skip to content

Commit

Permalink
imapd.c: GETMETADATA shouldn't show DAV mailboxes (unless auth with +…
Browse files Browse the repository at this point in the history
…DAV)
  • Loading branch information
ksmurchison committed Nov 10, 2023
1 parent c89f215 commit 9e7ffac
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions imap/imapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -10799,6 +10799,7 @@ struct apply_rock {
void *data;
char lastname[MAX_MAILBOX_PATH+1];
unsigned int nseen;
unsigned want_dav : 1;
};

static int apply_cb(struct findall_data *data, void* rock)
Expand All @@ -10810,6 +10811,10 @@ static int apply_cb(struct findall_data *data, void* rock)
annotate_state_t *state = arock->state;
int r;

if (!arock->want_dav && mbtype_isa(data->mbentry->mbtype) != MBTYPE_EMAIL) {
return 0;
}

strlcpy(arock->lastname, mbname_intname(data->mbname), sizeof(arock->lastname));

// malloc extra-long to have room for pattern shenanigans later
Expand Down Expand Up @@ -10841,6 +10846,7 @@ static int apply_mailbox_pattern(annotate_state_t *state,
arock.state = state;
arock.proc = proc;
arock.data = data;
arock.want_dav = !strcasecmpsafe(imapd_magicplus, "+dav");

r = mboxlist_findall(&imapd_namespace,
pattern,
Expand Down

0 comments on commit 9e7ffac

Please sign in to comment.