aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2021-06-19 08:39:13 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2021-06-19 08:48:06 +0000
commit2d1887b68b126bf7cec16962f807ac266dc4c4df (patch)
tree31bc7cec8d36d4aee54a47128b31f12b36a8c982
parentcbccc77e92185b5ac7f412e37de2354e79bb2c6a (diff)
downloadports-2d1887b68b126bf7cec16962f807ac266dc4c4df.tar.gz
ports-2d1887b68b126bf7cec16962f807ac266dc4c4df.zip
mail/cyrus-imapd3[24]: NOTIFY(EVENT): datagram too large when using notifyd.
PR: 256478 Reported by: jsm
-rw-r--r--mail/cyrus-imapd32/Makefile2
-rw-r--r--mail/cyrus-imapd32/files/patch-imap__notify.c45
-rw-r--r--mail/cyrus-imapd32/files/patch-notifyd__notifyd.c44
-rw-r--r--mail/cyrus-imapd34/Makefile2
-rw-r--r--mail/cyrus-imapd34/files/patch-imap__notify.c48
-rw-r--r--mail/cyrus-imapd34/files/patch-notifyd__notifyd.c44
6 files changed, 183 insertions, 2 deletions
diff --git a/mail/cyrus-imapd32/Makefile b/mail/cyrus-imapd32/Makefile
index a5bce0236cfd..465c680cf5a0 100644
--- a/mail/cyrus-imapd32/Makefile
+++ b/mail/cyrus-imapd32/Makefile
@@ -1,6 +1,6 @@
PORTNAME= cyrus-imapd
PORTVERSION= 3.2.7
-PORTREVISION= 0
+PORTREVISION= 1
CATEGORIES= mail
MASTER_SITES= https://github.com/cyrusimap/cyrus-imapd/releases/download/${PORTNAME}-${PORTVERSION}/
PKGNAMESUFFIX= 32
diff --git a/mail/cyrus-imapd32/files/patch-imap__notify.c b/mail/cyrus-imapd32/files/patch-imap__notify.c
new file mode 100644
index 000000000000..17908c1c9f2f
--- /dev/null
+++ b/mail/cyrus-imapd32/files/patch-imap__notify.c
@@ -0,0 +1,45 @@
+--- imap/notify.c.orig 2021-05-10 04:16:13 UTC
++++ imap/notify.c
+@@ -49,6 +49,9 @@
+ #include <syslog.h>
+ #include <sys/mman.h>
+ #include <sys/types.h>
++#if defined(__FreeBSD__)
++#include <sys/sysctl.h>
++#endif
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <sys/un.h>
+@@ -191,6 +194,24 @@ EXPORTED void notify(const char *method,
+ FNAME_NOTIFY_SOCK, sizeof(sun_data.sun_path));
+ }
+
++#if defined(__FreeBSD__)
++ size_t maxsockbuf;
++ size_t len = sizeof(maxsockbuf);
++ r = sysctlbyname("kern.ipc.maxsockbuf", &maxsockbuf, &len, NULL, 0);
++ if (r == 0) {
++ bufsiz = MIN(maxsockbuf, NOTIFY_MAXSIZE);
++ } else {
++ syslog(LOG_WARNING, "unable to sysctlbyname(kern.ipc.maxsockbuf): %m");
++ bufsiz = NOTIFY_MAXSIZE;
++ }
++
++ optlen = sizeof(bufsiz);
++ r = setsockopt(soc, SOL_SOCKET, SO_SNDBUF, &bufsiz, optlen);
++ if (r == -1) {
++ syslog(LOG_WARNING,
++ "unable to setsockopt(SO_SNDBUF) on notify socket: %m");
++ }
++#else
+ /* Get send buffer size */
+ optlen = sizeof(bufsiz);
+ r = getsockopt(soc, SOL_SOCKET, SO_SNDBUF, &bufsiz, &optlen);
+@@ -201,6 +222,7 @@ EXPORTED void notify(const char *method,
+
+ /* Use minimum of 1/10 of send buffer size (-overhead) NOTIFY_MAXSIZE */
+ bufsiz = MIN(bufsiz / 10 - 32, NOTIFY_MAXSIZE);
++#endif
+
+ /*
+ * build request of the form:
diff --git a/mail/cyrus-imapd32/files/patch-notifyd__notifyd.c b/mail/cyrus-imapd32/files/patch-notifyd__notifyd.c
new file mode 100644
index 000000000000..0719b98c13f6
--- /dev/null
+++ b/mail/cyrus-imapd32/files/patch-notifyd__notifyd.c
@@ -0,0 +1,44 @@
+--- notifyd/notifyd.c.orig 2021-05-05 03:21:59 UTC
++++ notifyd/notifyd.c
+@@ -50,6 +50,9 @@
+ #include <sysexits.h>
+ #include <syslog.h>
+ #include <sys/types.h>
++#if defined(__FreeBSD__)
++#include <sys/sysctl.h>
++#endif
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <sys/un.h>
+@@ -111,6 +114,23 @@ static int do_notify(void)
+ unsigned bufsiz;
+ socklen_t optlen;
+
++#if defined(__FreeBSD__)
++ size_t maxsockbuf;
++ size_t len = sizeof(maxsockbuf);
++ r = sysctlbyname("kern.ipc.maxsockbuf", &maxsockbuf, &len, NULL, 0);
++ if (r == 0) {
++ bufsiz = MIN(maxsockbuf, NOTIFY_MAXSIZE);
++ } else {
++ syslog(LOG_WARNING, "unable to sysctlbyname(kern.ipc.maxsockbuf): %m");
++ bufsiz = NOTIFY_MAXSIZE;
++ }
++
++ optlen = sizeof(bufsiz);
++ r = setsockopt(soc, SOL_SOCKET, SO_RCVBUF, &bufsiz, optlen);
++ if (r == -1) {
++ syslog(LOG_WARNING, "unable to setsockopt(SO_RCVBUF) on notify socket: %m");
++ }
++#else
+ /* Get receive buffer size */
+ optlen = sizeof(bufsiz);
+ r = getsockopt(soc, SOL_SOCKET, SO_RCVBUF, &bufsiz, &optlen);
+@@ -121,6 +141,7 @@ static int do_notify(void)
+
+ /* Use minimum of 1/10 of receive buffer size (-overhead) NOTIFY_MAXSIZE */
+ bufsiz = MIN(bufsiz / 10 - 32, NOTIFY_MAXSIZE);
++#endif
+
+ while (1) {
+ method = class = priority = user = mailbox = message = reply = NULL;
diff --git a/mail/cyrus-imapd34/Makefile b/mail/cyrus-imapd34/Makefile
index bd34281568e4..a8ccaa44d76a 100644
--- a/mail/cyrus-imapd34/Makefile
+++ b/mail/cyrus-imapd34/Makefile
@@ -1,6 +1,6 @@
PORTNAME= cyrus-imapd
PORTVERSION= 3.4.1
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= mail
MASTER_SITES= https://github.com/cyrusimap/cyrus-imapd/releases/download/${PORTNAME}-${PORTVERSION}/
PKGNAMESUFFIX= ${CYRUS_IMAPD_VER}
diff --git a/mail/cyrus-imapd34/files/patch-imap__notify.c b/mail/cyrus-imapd34/files/patch-imap__notify.c
new file mode 100644
index 000000000000..e093378fc10d
--- /dev/null
+++ b/mail/cyrus-imapd34/files/patch-imap__notify.c
@@ -0,0 +1,48 @@
+--- imap/notify.c.orig 2021-05-10 04:34:24 UTC
++++ imap/notify.c
+@@ -49,6 +49,9 @@
+ #include <syslog.h>
+ #include <sys/mman.h>
+ #include <sys/types.h>
++#if defined(__FreeBSD__)
++#include <sys/sysctl.h>
++#endif
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <sys/un.h>
+@@ -209,6 +212,27 @@ EXPORTED void notify(const char *method,
+ FNAME_NOTIFY_SOCK, sizeof(sun_data.sun_path));
+ }
+
++#if defined(__FreeBSD__)
++ size_t maxsockbuf;
++ size_t len = sizeof(maxsockbuf);
++ r = sysctlbyname("kern.ipc.maxsockbuf", &maxsockbuf, &len, NULL, 0);
++ if (r == 0) {
++ bufsiz = MIN(maxsockbuf, NOTIFY_MAXSIZE);
++ } else {
++ syslog(LOG_WARNING,
++ "NOTIFY(%s): unable to sysctlbyname(kern.ipc.maxsockbuf): %m",
++ loginfo);
++ bufsiz = NOTIFY_MAXSIZE;
++ }
++
++ optlen = sizeof(bufsiz);
++ r = setsockopt(soc, SOL_SOCKET, SO_SNDBUF, &bufsiz, optlen);
++ if (r == -1) {
++ syslog(LOG_WARNING,
++ "NOTIFY(%s): unable to setsockopt(SO_SNDBUF) on socket: %m",
++ loginfo);
++ }
++#else
+ /* Get send buffer size */
+ optlen = sizeof(bufsiz);
+ r = getsockopt(soc, SOL_SOCKET, SO_SNDBUF, &bufsiz, &optlen);
+@@ -221,6 +245,7 @@ EXPORTED void notify(const char *method,
+
+ /* Use minimum of 1/10 of send buffer size (-overhead) NOTIFY_MAXSIZE */
+ bufsiz = MIN(bufsiz / 10 - 32, NOTIFY_MAXSIZE);
++#endif
+
+ /*
+ * build request of the form:
diff --git a/mail/cyrus-imapd34/files/patch-notifyd__notifyd.c b/mail/cyrus-imapd34/files/patch-notifyd__notifyd.c
new file mode 100644
index 000000000000..0719b98c13f6
--- /dev/null
+++ b/mail/cyrus-imapd34/files/patch-notifyd__notifyd.c
@@ -0,0 +1,44 @@
+--- notifyd/notifyd.c.orig 2021-05-05 03:21:59 UTC
++++ notifyd/notifyd.c
+@@ -50,6 +50,9 @@
+ #include <sysexits.h>
+ #include <syslog.h>
+ #include <sys/types.h>
++#if defined(__FreeBSD__)
++#include <sys/sysctl.h>
++#endif
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <sys/un.h>
+@@ -111,6 +114,23 @@ static int do_notify(void)
+ unsigned bufsiz;
+ socklen_t optlen;
+
++#if defined(__FreeBSD__)
++ size_t maxsockbuf;
++ size_t len = sizeof(maxsockbuf);
++ r = sysctlbyname("kern.ipc.maxsockbuf", &maxsockbuf, &len, NULL, 0);
++ if (r == 0) {
++ bufsiz = MIN(maxsockbuf, NOTIFY_MAXSIZE);
++ } else {
++ syslog(LOG_WARNING, "unable to sysctlbyname(kern.ipc.maxsockbuf): %m");
++ bufsiz = NOTIFY_MAXSIZE;
++ }
++
++ optlen = sizeof(bufsiz);
++ r = setsockopt(soc, SOL_SOCKET, SO_RCVBUF, &bufsiz, optlen);
++ if (r == -1) {
++ syslog(LOG_WARNING, "unable to setsockopt(SO_RCVBUF) on notify socket: %m");
++ }
++#else
+ /* Get receive buffer size */
+ optlen = sizeof(bufsiz);
+ r = getsockopt(soc, SOL_SOCKET, SO_RCVBUF, &bufsiz, &optlen);
+@@ -121,6 +141,7 @@ static int do_notify(void)
+
+ /* Use minimum of 1/10 of receive buffer size (-overhead) NOTIFY_MAXSIZE */
+ bufsiz = MIN(bufsiz / 10 - 32, NOTIFY_MAXSIZE);
++#endif
+
+ while (1) {
+ method = class = priority = user = mailbox = message = reply = NULL;