pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

cyrus-imapd30: integrated patch to enable CalDAV/CardDAV auto-discovery for shared resources



Module Name:	pkgsrc-wip
Committed By:	Matthias Petermann <mp%petermann-it.de@localhost>
Pushed By:	mp
Date:		Wed Mar 18 22:44:10 2020 +0100
Changeset:	deb96029de089fe7157e84b4a244cbdf34f23044

Modified Files:
	cyrus-imapd30/Makefile
	cyrus-imapd30/TODO
	cyrus-imapd30/distinfo
Added Files:
	cyrus-imapd30/patches/patch-imap_http__dav.c

Log Message:
cyrus-imapd30: integrated patch to enable CalDAV/CardDAV auto-discovery for shared resources

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=deb96029de089fe7157e84b4a244cbdf34f23044

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 cyrus-imapd30/Makefile                       |  2 +-
 cyrus-imapd30/TODO                           | 18 +++++-
 cyrus-imapd30/distinfo                       |  1 +
 cyrus-imapd30/patches/patch-imap_http__dav.c | 82 ++++++++++++++++++++++++++++
 4 files changed, 99 insertions(+), 4 deletions(-)

diffs:
diff --git a/cyrus-imapd30/Makefile b/cyrus-imapd30/Makefile
index 1e7fb60792..f989372ea8 100644
--- a/cyrus-imapd30/Makefile
+++ b/cyrus-imapd30/Makefile
@@ -1,7 +1,7 @@
 # $NetBSD: $
 
 DISTNAME=	cyrus-imapd-3.0.13
-REVISION=	1
+REVISION=	2
 CATEGORIES=	mail
 MASTER_SITES=	${MASTER_SITE_GITHUB:=cyrusimap/}
 GITHUB_RELEASE=	${PKGNAME_NOREV}
diff --git a/cyrus-imapd30/TODO b/cyrus-imapd30/TODO
index 6ffd069447..70a8ec6490 100644
--- a/cyrus-imapd30/TODO
+++ b/cyrus-imapd30/TODO
@@ -23,15 +23,27 @@ Done:
 
 - Integrated documentation from source package into the package
 
+- Possibly create further patches for cyrus-imap 3 (especially with
+  regard to the newly added functions CalDAV / CardDAV), if necessary
+
 Next steps:
 
 - regenerate documentation at build time using Sphinx
 
-- Possibly create further patches for cyrus-imap 3 (especially with
-  regard to the newly added functions CalDAV / CardDAV), if necessary
-
 Bugs:
 
+- The way how the Dav-Patch is integrated. It is not a security patch
+  nor a patch that would be necessary to ensure the build.
+  In principle, it eliminates a functional deficiency, which may
+  not be a deficiency at all, but simply an implementation gap.
+  pkgsrc is therefore not the right place to deal with this problem,
+  I'm almost sure of that. Without this patch, the CalDAV / CardDAV
+  functionality cannot be used meaningfully for me, and in my
+  experience it will also be for most other users who want to
+  maintain a shared calendar, for example. I will definitely keep
+  an eye on what is going on upstream. In the meantime, I would like
+  to keep the patch here if there are no important reasons why.
+
 - Kerberos support, PostgreSQL and MySQL are currently not tested
 
 For questions, tips or offers of help you can contact me at mp%petermann-it.de@localhost
diff --git a/cyrus-imapd30/distinfo b/cyrus-imapd30/distinfo
index 0e2d1ace3f..5a34cf7fca 100644
--- a/cyrus-imapd30/distinfo
+++ b/cyrus-imapd30/distinfo
@@ -4,3 +4,4 @@ SHA1 (cyrus-imapd-3.0.13.tar.gz) = 69d29e09ae4e4f3c8ae0c49a1024b7ec4dffbf57
 RMD160 (cyrus-imapd-3.0.13.tar.gz) = b789c903620e83160fce4de3e06bbe0c842f7957
 SHA512 (cyrus-imapd-3.0.13.tar.gz) = 5cd066916797efb975cdb97720f65edc72d3fe82afbd78a26aa8369d95ae4ca09c0593dd4bec5521156c64ea38af7a13065f3b35447a76267dec93feb0ac6ac6
 Size (cyrus-imapd-3.0.13.tar.gz) = 10840005 bytes
+SHA1 (patch-imap_http__dav.c) = dfbac5c379dce8977b28376692b8de7621caeca3
diff --git a/cyrus-imapd30/patches/patch-imap_http__dav.c b/cyrus-imapd30/patches/patch-imap_http__dav.c
new file mode 100644
index 0000000000..e77248cd3d
--- /dev/null
+++ b/cyrus-imapd30/patches/patch-imap_http__dav.c
@@ -0,0 +1,82 @@
+$NetBSD$
+
+The CalDAV / CardDAV functionality of Cyrus IMAP supports the
+auto-discovery mechanism, which is used by many clients to find out
+the calendars and address books available for the respective user.
+At the moment this does not work for shared calendars and address
+books from other users.
+
+There was a discussion on this topic on Github:
+
+    https://github.com/cyrusimap/cyrus-imapd/issues/2373
+
+As part of the discussion, Дилян Палаузов provided a patch that
+solves this problem. Unfortunately, it has not yet been included
+in an official release because it may not yet be the complete solution
+that covers all scenarios.
+
+Anyway - the patch is included here because, in my opinion, sharing
+calendars and address books is an essential functionality of a
+groupware. Without this patch, this will not work on clients that only
+offer auto-discovery - i.e. most mobile devices.
+
+--- imap/http_dav.c.orig	2020-03-18 20:29:25.102243914 +0000
++++ imap/http_dav.c
+@@ -5455,7 +5455,7 @@ int propfind_by_collection(const mbentry
+
+     if (!fctx->req_tgt->resource) {
+         len = make_collection_url(&writebuf, fctx->req_tgt->namespace->prefix,
+-                                  mboxname, fctx->req_tgt->userid, NULL);
++                                  mboxname, mbname_userid(mbname_from_intname(mboxname)), NULL);
+
+         /* copy it all back into place... in theory we should check against
+          * 'last' and make sure it doesn't change from the original request.
+@@ -5483,6 +5483,12 @@ int propfind_by_collection(const mbentry
+     return r;
+ }
+
++static int wrapper_propfind_by_collection(struct findall_data *data, void* rock) {
++    if (!data || !data->mbentry) return 0;
++    struct propfind_ctx *fctx = (struct propfind_ctx *) rock;
++    if ((httpd_myrights(httpd_authstate, data->mbentry) & DACL_READ != DACL_READ)) return 0;
++    return propfind_by_collection(data->mbentry, fctx);
++}
+
+ /* Perform a PROPFIND request */
+ EXPORTED int meth_propfind(struct transaction_t *txn, void *params)
+@@ -5746,12 +5752,13 @@ EXPORTED int meth_propfind(struct transa
+             else if (txn->req_tgt.mbentry) {
+                 /* Add responses for all contained collections */
+                 fctx.prefer &= ~PREFER_NOROOT;
+-                mboxlist_mboxtree(txn->req_tgt.mbentry->name,
+-                                  propfind_by_collection, &fctx,
+-                                  MBOXTREE_SKIP_ROOT);
+
+                 switch (txn->req_tgt.namespace->id) {
+                 case URL_NS_DRIVE:
++                    mboxlist_mboxtree(txn->req_tgt.mbentry->name,
++                                  propfind_by_collection, &fctx,
++                                  MBOXTREE_SKIP_ROOT);
++
+                     if (txn->req_tgt.flags == TGT_DRIVE_ROOT) {
+                         /* Add a response for 'user' hierarchy */
+                         buf_setcstr(&fctx.buf, txn->req_tgt.namespace->prefix);
+@@ -5772,11 +5779,16 @@ EXPORTED int meth_propfind(struct transa
+                     /* Fall through */
+
+                 case URL_NS_ADDRESSBOOK:
++                    {
+                     /* Add responses for shared collections */
+-                    mboxlist_usersubs(txn->req_tgt.userid,
+-                                      propfind_by_collection, &fctx,
+-                                      MBOXTREE_SKIP_PERSONAL);
++                    const char *conf_str = txn->req_tgt.namespace->id == URL_NS_CALENDAR ?
++                        config_getstring(IMAPOPT_CALENDARPREFIX) : config_getstring(IMAPOPT_ADDRESSBOOKPREFIX);
++                    char *pat = malloc(5 + strlen(conf_str));
++                    sprintf(pat, "*%s%c*", conf_str, httpd_namespace.hier_sep);
++                    mboxlist_findall(&httpd_namespace, pat, httpd_userisadmin, txn->req_tgt.userid, httpd_authstate, wrapper_propfind_by_collection, &fctx);
++                    free(pat);
+                     break;
++                    }
+                 }
+             }


Home | Main Index | Thread Index | Old Index