This version restores interop with Thunderbird lightning, which is
currently unable to create new events in calendars managed by kcaldav.

And logging is now configurable at run-time which should make sending
bug reports to upstream much easier.

I am talking to kristaps about the local patches applied here to
fix startup issues I saw when trying to run the new version.
Hopefully these patches can be dropped again with future releases.

Ok?

-----------------------------------------------
commit 0c7c35f4caf4e52286099accc0188ce6a351a29a (kcaldav)
from: Stefan Sperling <s...@stsp.name>
date: Mon Nov 13 09:53:54 2023 UTC
 
 update kcaldav to 0.2.4
 
diff 0bbcf3a7ba0d1aae957b279ffa92c4372f1b3e28 
0c7c35f4caf4e52286099accc0188ce6a351a29a
commit - 0bbcf3a7ba0d1aae957b279ffa92c4372f1b3e28
commit + 0c7c35f4caf4e52286099accc0188ce6a351a29a
blob - 31ab63f4165a760bb10ec5ef0e6f967d9a898ce3
blob + 696d8d0c0c2380c9cc1d6841617b28688a5421e3
--- www/kcaldav/Makefile
+++ www/kcaldav/Makefile
@@ -1,7 +1,6 @@
 COMMENT =              a simple, safe, and minimal CalDAV server
 
-DISTNAME =             kcaldav-0.2.0
-REVISION =             0
+DISTNAME =             kcaldav-0.2.4
 CATEGORIES =           www
 
 HOMEPAGE =             https://kristaps.bsd.lv/kcaldav/
blob - f81557a9316972839dbd736b7798614e87b8e6ba
blob + c2516fdb03f4b0a60d9255416cdc62a11a2ff75c
--- www/kcaldav/distinfo
+++ www/kcaldav/distinfo
@@ -1,2 +1,2 @@
-SHA256 (kcaldav-0.2.0.tgz) = ajCsg1iuhu33r7YG1dXXKFzVsQYxTbtz8zqLmChTyvQ=
-SIZE (kcaldav-0.2.0.tgz) = 291932
+SHA256 (kcaldav-0.2.4.tgz) = zuP4UsBT5zk03Q7z04eZKVEjpcvsst0EygkRVNhjRN0=
+SIZE (kcaldav-0.2.4.tgz) = 300373
blob - 9bd5fc048ca8edcbcec8901dc1fc6e53fec831b9 (mode 644)
blob + /dev/null
--- www/kcaldav/patches/patch-Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-Index: Makefile
---- Makefile.orig
-+++ Makefile
-@@ -144,7 +144,7 @@ VERSION             = 0.2.0
- CFLAGS                += -DCALDIR=\"$(CALDIR)\"
- CFLAGS                += -DCALPREFIX=\"$(CALPREFIX)\"
- CFLAGS                += -DVERSION=\"$(VERSION)\"
--CFLAGS                += -DLOGFILE=\"$(LOGFILE)\"
-+#CFLAGS               += -DLOGFILE=\"$(LOGFILE)\"
- BHTMLS                 = collection.html \
-                  home.html
- 
blob - /dev/null
blob + 3b175d553fcd9d896bed83c936ba71dea9ede0a8 (mode 644)
--- /dev/null
+++ www/kcaldav/patches/patch-kcaldav_c
@@ -0,0 +1,52 @@
+Fix NULL-pointer deref on startup with bad config file.
+Ignore unveil ENOENT errors from optional directories in chroot.
+Index: kcaldav.c
+--- kcaldav.c.orig
++++ kcaldav.c
+@@ -19,6 +19,7 @@
+ 
+ #include <assert.h>
+ #include <ctype.h>
++#include <errno.h>
+ #include <limits.h>
+ #if HAVE_MD5
+ # include <md5.h>
+@@ -422,7 +423,7 @@ main(void)
+               { kvalid_hash, valids[VALID_PASS] },
+               { kvalid_path, valids[VALID_PATH] } }; 
+       struct state    *st = NULL;
+-      char            *np, *logfile = NULL;
++      char            *np;
+       struct conf      conf;
+       const char      *cfgfile = NULL;
+       size_t           i, sz;
+@@ -460,7 +461,7 @@ main(void)
+       verbose = conf.verbose;
+       if (conf.logfile != NULL && *conf.logfile != '\0')
+               if (!kutil_openlog(conf.logfile))
+-                      kutil_err(NULL, NULL, "%s", logfile);
++                      kutil_err(NULL, NULL, "%s", conf.logfile);
+ 
+       free(conf.logfile);
+       memset(&conf, 0, sizeof(struct conf));
+@@ -494,13 +495,13 @@ main(void)
+        * Directories required by sqlite3.
+        */
+       if (unveil(CALDIR, "rwxc") == -1)
+-              kutil_err(NULL, NULL, "unveil");
+-      if (unveil("/tmp", "rwxc") == -1)
+-              kutil_err(NULL, NULL, "unveil");
+-      if (unveil("/var/tmp", "rwxc") == -1)
+-              kutil_err(NULL, NULL, "unveil");
+-      if (unveil("/dev", "rwx") == -1)
+-              kutil_err(NULL, NULL, "unveil");
++              kutil_err(NULL, NULL, "unveil " CALDIR);
++      if (unveil("/tmp", "rwxc") == -1 && errno != ENOENT)
++              kutil_err(NULL, NULL, "unveil /tmp");
++      if (unveil("/var/tmp", "rwxc") == -1 && errno != ENOENT)
++              kutil_err(NULL, NULL, "unveil /var/tmp");
++      if (unveil("/dev", "rwx") == -1 && errno != ENOENT)
++              kutil_err(NULL, NULL, "unveil /dev");
+       if (pledge("stdio rpath cpath wpath flock fattr", NULL) == -1)
+               kutil_err(NULL, NULL, "pledge");
+ #endif
blob - 613439adcb12c8d000bf796b4298b7e79942099e
blob + c4e6e1cd5c3f7e25ed280f197ca69f3accd96c2c
--- www/kcaldav/pkg/PLIST
+++ www/kcaldav/pkg/PLIST
@@ -7,8 +7,11 @@ include/libkcaldav.h
 @man man/man3/ical_free.3
 @man man/man3/ical_parse.3
 @man man/man3/ical_print.3
+@man man/man5/kcaldav.conf.5
 @man man/man8/kcaldav.8
 share/doc/pkg-readmes/${PKGSTEM}
+share/kcaldav/
+share/kcaldav/kcaldav.example.conf
 @cwd /var/www
 @mode 775
 @owner www
blob - ce2a384a1cdc42794ba08790735f3f33c63ad195
blob + 9ca596203de51eec3438ebcb52d95e71e3d6831d
--- www/kcaldav/pkg/README
+++ www/kcaldav/pkg/README
@@ -92,23 +92,22 @@ Porting Notes: Write Ahead Logging
 Porting Notes: Debug and Logging
 ================================
 
-  Logging in kcaldav is controlled by the LOGFILE and DEBUG
-  variables in the Makefile. LOGFILE sets the name and location
-  of the file to write to, DEBUG controls the amount of logging.
+  Logging in kcaldav is controlled by the kcaldav.conf(5) configuration
+  file. The configuration file's location is set at compile-time:
 
-  The DEBUG level can only be set at build time. There are four
-  DEBUG levels in ascending order of verbosity: 0 - 3, where 0
-  disables all debugging. This port disables logging by commenting
-  out the Makefile line:
+    /var/www/conf/kcaldav.conf
 
-    CFLAGS     += -DLOGFILE=\"$(LOGFILE)\".
+  When sending error reports upstream, set debug=3 in kcaldav.conf(5).
 
-  When sending error reports upstream, re-enable the line above,
-  set DEBUG=3, and rebuild.
+  By default, kcaldav logs to stderr. Logging to a dedicated file can
+  be enabled by setting the logfile variable in kcaldav.conf(5).
+  For example:
 
-  LOGFILE defaults to /var/www/logs/kcaldav-system.log. This file
-  must be created by the user and permissions set:
+    logfile=/logs/kcaldav.log
 
-    touch /var/www/logs/kcaldav-system.log
-    chown www:www /var/www/logs/kcaldav-system.log
-    chmod 644 /var/www/logs/kcaldav-system.log
+  kcaldav will then use the log file /var/www/logs/kcaldav.log.
+  This file must be created by the user and permissions set:
+
+    touch /var/www/logs/kcaldav.log
+    chown www:www /var/www/logs/kcaldav.log
+    chmod 644 /var/www/logs/kcaldav.log

Reply via email to