Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proppatch_todb(): do not mask the annotations for admins user #3403

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions imap/http_caldav.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ static int proppatch_scheddefault(xmlNodePtr prop, unsigned set,

const strarray_t *boxes = mbname_boxes(mbname);
buf_setcstr(&pctx->buf, strarray_nth(boxes, strarray_size(boxes)-1));
r = annotate_state_writemask(astate, annotname, httpd_userid, &pctx->buf);
r = annotate_state_writemask(astate, annotname, httpd_userisadmin ? "" : httpd_userid, &pctx->buf);
}
}
mailbox_close(&mailbox);
Expand Down Expand Up @@ -6444,7 +6444,7 @@ static int proppatch_timezone(xmlNodePtr prop, unsigned set,
buf_reset(&pctx->buf);
r = mailbox_get_annotate_state(pctx->mailbox, 0, &astate);
if (!r) r = annotate_state_writemask(astate, prop_annot,
httpd_userid, &pctx->buf);
httpd_userisadmin ? "" : httpd_userid, &pctx->buf);
if (!r) {
/* Set CALDAV:calendar-timezone */
proppatch_todb(prop, set, pctx, propstat, (void *) tz);
Expand Down Expand Up @@ -6746,7 +6746,7 @@ static int proppatch_tzid(xmlNodePtr prop, unsigned set,
buf_reset(&pctx->buf);
r = mailbox_get_annotate_state(pctx->mailbox, 0, &astate);
if (!r) r = annotate_state_writemask(astate, prop_annot,
httpd_userid, &pctx->buf);
httpd_userisadmin ? "": httpd_userid, &pctx->buf);

if (r) {
xml_add_prop(HTTP_SERVER_ERROR, pctx->ns[NS_DAV],
Expand Down
6 changes: 3 additions & 3 deletions imap/http_dav.c
Original file line number Diff line number Diff line change
Expand Up @@ -3222,7 +3222,7 @@ static int proppatch_toresource(xmlNodePtr prop, unsigned set,

r = mailbox_get_annotate_state(pctx->mailbox, pctx->record->uid, &astate);
if (!r) r = annotate_state_writemask(astate, buf_cstring(&pctx->buf),
httpd_userid, &value);
httpd_userisadmin ? "" : httpd_userid, &value);
/* we need to rewrite the record to update the modseq because the layering
* of annotations and mailboxes is broken */
if (!r) r = mailbox_rewrite_index_record(pctx->mailbox, pctx->record);
Expand Down Expand Up @@ -3378,7 +3378,7 @@ static int proppatch_todb_internal(xmlNodePtr prop, unsigned set,
r = mailbox_get_annotate_state(pctx->mailbox, 0, &astate);
if (!r) r = mask ?
annotate_state_writemask(astate, buf_cstring(&pctx->buf),
httpd_userid, &value) :
httpd_userisadmin ? "" : httpd_userid, &value) :
annotate_state_write(astate, buf_cstring(&pctx->buf),
httpd_userid, &value);

Expand Down Expand Up @@ -3712,7 +3712,7 @@ static int do_proppatch(struct proppatch_ctx *pctx, xmlNodePtr instr)
DAV_PROT_PROP);
*pctx->ret = HTTP_FORBIDDEN;
}
else if ((pctx->txn->meth == METH_PROPPATCH) &&
else if ((pctx->txn->meth == METH_PROPPATCH) && !httpd_userisadmin &&
!(rights & ((entry->flags & PROP_PERUSER) ?
DACL_READ : DACL_PROPCOL))) {
/* DAV:need-privileges */
Expand Down
4 changes: 2 additions & 2 deletions imap/http_dav_sharing.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,15 +1145,15 @@ HIDDEN int notify_post(struct transaction_t *txn)

buf_init_ro_cstr(&value, (char *) resp->name);
r = annotate_state_writemask(astate, annot,
txn->req_tgt.userid, &value);
httpd_userisadmin ? "" : txn->req_tgt.userid, &value);

if (mbtype_isa(mailbox_mbtype(shared)) == MBTYPE_CALENDAR) {
/* Sharee's copy of calendar SHOULD default to transparent */
annot =
DAV_ANNOT_NS "<" XML_NS_CALDAV ">schedule-calendar-transp";
buf_init_ro_cstr(&value, "transparent");
r = annotate_state_writemask(astate, annot,
txn->req_tgt.userid, &value);
httpd_userisadmin ? "" : txn->req_tgt.userid, &value);
}
}

Expand Down