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

CardDAV: remove DELETE from supported-method-set for Default address book #5062

Merged
Merged
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
11 changes: 10 additions & 1 deletion imap/http_carddav.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ static void my_carddav_init(struct buf *serverinfo);
static int my_carddav_auth(const char *userid);
static void my_carddav_reset(void);
static void my_carddav_shutdown(void);
static unsigned long carddav_allow_cb(struct request_target_t*);

static int carddav_parse_path(const char *path, struct request_target_t *tgt,
const char **resultstr);
Expand Down Expand Up @@ -257,7 +258,7 @@ static const struct prop_entry carddav_props[] = {
propfind_reportset, NULL, (void *) carddav_reports },
{ "supported-method-set", NS_DAV,
PROP_COLLECTION | PROP_RESOURCE,
propfind_methodset, NULL, (void *) &calcarddav_allow_cb },
propfind_methodset, NULL, (void *) carddav_allow_cb },

/* WebDAV ACL (RFC 3744) properties */
{ "owner", NS_DAV,
Expand Down Expand Up @@ -582,6 +583,14 @@ static void my_carddav_shutdown(void)
carddav_done();
}

/* Determine allowed methods in CardDAV namespace */
static unsigned long carddav_allow_cb(struct request_target_t *tgt) {
unsigned long allow = calcarddav_allow_cb(tgt);
if (tgt->collection && !tgt->resource && !strcmp(tgt->collection, DEFAULT_ADDRBOOK "/"))
allow &= ~ALLOW_DELETE;

return allow;
}

/* Parse request-target path in CardDAV namespace */
static int carddav_parse_path(const char *path, struct request_target_t *tgt,
Expand Down