static int action_setacl(struct transaction_t *txn, int rights)
{
    struct strlist *share;
    char acl[100];
    int r, ret;

    /* Check rights */
    if (!(rights & DACL_ADMIN)) {
	/* DAV:need-privileges */
	txn->error.precond = DAV_NEED_PRIVS;
	txn->error.resource = txn->req_tgt.path;
	txn->error.rights = DACL_ADMIN;
	return HTTP_NO_PRIVS;
    }

    share = hash_lookup("share", &txn->req_qparams);
    if (!share || share->next || !*share->s) {
	txn->error.desc = "Multiple/missing/empty share parameter(s)";
	return HTTP_BAD_REQUEST;
    }

    acl[0] = !strcasecmp(share->s, "true") ? '+' : '-';
    cyrus_acl_masktostr(DACL_READ, acl+1);

    r = mboxlist_setacl(&httpd_namespace, txn->req_tgt.mboxname, "anyone", acl, 0,
			httpd_userid, httpd_authstate);

    switch (r) {
    case 0:
	ret = HTTP_NO_CONTENT;
	break;

    case IMAP_MAILBOX_NONEXISTENT:
	ret = HTTP_NOT_FOUND;
	break;

    case IMAP_PERMISSION_DENIED:
	ret = HTTP_FORBIDDEN;
	break;

    default:
	ret = HTTP_SERVER_ERROR;
	break;
    }

    return ret;
}
static int action_setacl(struct transaction_t *txn, int rights)
{
    struct strlist *share;
    char acl[100];
    int r, ret;

     
    if (!(rights & DACL_ADMIN)) {
	 
	txn->error.precond = DAV_NEED_PRIVS;
	txn->error.resource = txn->req_tgt.path;
	txn->error.rights = DACL_ADMIN;
	return HTTP_NO_PRIVS;
    }

    share = hash_lookup("share", &txn->req_qparams);
    if (!share || share->next || !*share->s) {
	txn->error.desc = "Multiple/missing/empty share parameter(s)";
	return HTTP_BAD_REQUEST;
    }

    acl[0] = !strcasecmp(share->s, "true") ? '+' : '-';
    cyrus_acl_masktostr(DACL_READ, acl+1);

    r = mboxlist_setacl(&httpd_namespace, txn->req_tgt.mboxname, "anyone", acl, 0,
			httpd_userid, httpd_authstate);

    switch (r) {
    case 0:
	ret = HTTP_NO_CONTENT;
	break;

    case IMAP_MAILBOX_NONEXISTENT:
	ret = HTTP_NOT_FOUND;
	break;

    case IMAP_PERMISSION_DENIED:
	ret = HTTP_FORBIDDEN;
	break;

    default:
	ret = HTTP_SERVER_ERROR;
	break;
    }

    return ret;
}