diff --git a/mail/cyrus-imapd/Makefile b/mail/cyrus-imapd/Makefile index 705cbc4cad9..f3f5de696c0 100644 --- a/mail/cyrus-imapd/Makefile +++ b/mail/cyrus-imapd/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.75 2012/12/03 11:17:03 ajacoutot Exp $ +# $OpenBSD: Makefile,v 1.76 2012/12/10 15:25:06 ajacoutot Exp $ SHARED_ONLY= Yes @@ -6,6 +6,7 @@ COMMENT= Cyrus IMAP server V= 2.4.17 DISTNAME= cyrus-imapd-${V} +REVISION= 0 CATEGORIES= mail diff --git a/mail/cyrus-imapd/patches/patch-imap_statuscache_db_c b/mail/cyrus-imapd/patches/patch-imap_statuscache_db_c new file mode 100644 index 00000000000..6c55765dee2 --- /dev/null +++ b/mail/cyrus-imapd/patches/patch-imap_statuscache_db_c @@ -0,0 +1,36 @@ +$OpenBSD: patch-imap_statuscache_db_c,v 1.1 2012/12/10 15:25:06 ajacoutot Exp $ + +From 1661683d453ea444aae5832b4a2cb7fd54489672 Mon Sep 17 00:00:00 2001 +From: Bron Gondwana +Date: Sun, 09 Dec 2012 19:42:17 +0000 +Subject: Bug #3757 - don't segfault on mailbox close with no user + +--- imap/statuscache_db.c.orig Sat Dec 1 20:57:54 2012 ++++ imap/statuscache_db.c Mon Dec 10 16:20:33 2012 +@@ -150,9 +150,11 @@ static char *statuscache_buildkey(const char *mailboxn + + /* Build statuscache key */ + len = strlcpy(key, mailboxname, sizeof(key)); ++ /* double % is a safe separator, it can't exist in a mailboxname */ + key[len++] = '%'; + key[len++] = '%'; +- len += strlcpy(key + len, userid, sizeof(key) - len); ++ if (userid) ++ len += strlcpy(key + len, userid, sizeof(key) - len); + + *keylen = len; + +@@ -410,11 +412,9 @@ int statuscache_invalidate(const char *mboxname, struc + drock.db = statuscachedb; + drock.tid = NULL; + +- key = statuscache_buildkey(mboxname, "", &keylen); ++ key = statuscache_buildkey(mboxname, /*userid*/NULL, &keylen); + +- /* strip off the second NULL that buildkey added, so we match +- * the entires for all users */ +- r = DB->foreach(drock.db, key, keylen - 1, NULL, delete_cb, ++ r = DB->foreach(drock.db, key, keylen, NULL, delete_cb, + &drock, &drock.tid); + if (r != CYRUSDB_OK) { + syslog(LOG_ERR, "DBERROR: error invalidating: %s (%s)",