-+ |
-+
-+
- zephyr
- |
-
-diff -Naur cyrus-imapd-2.2.12.orig/lib/imapoptions cyrus-imapd-2.2.12/lib/imapoptions
---- cyrus-imapd-2.2.12.orig/lib/imapoptions 2004-07-21 21:07:45.000000000 +0200
-+++ cyrus-imapd-2.2.12/lib/imapoptions 2005-08-16 13:27:08.000000000 +0200
-@@ -721,6 +721,10 @@
- /* The pathname of the sendmail executable. Sieve invokes sendmail
- for sending rejections, redirects and vacation responses. */
-
-+{ "sendsms", "/usr/bin/sendsms", STRING }
-+/* The pathname of the sendsms executable. Sieve invokes sendsms
-+ for sending SMS notifications. */
-+
- { "servername", NULL, STRING }
- /* This is the hostname visible in the greeting messages of the POP,
- IMAP and LMTP daemons. If it is unset, then the result returned
-diff -Naur cyrus-imapd-2.2.12.orig/man/imapd.conf.5 cyrus-imapd-2.2.12/man/imapd.conf.5
---- cyrus-imapd-2.2.12.orig/man/imapd.conf.5 2005-02-14 19:02:16.000000000 +0100
-+++ cyrus-imapd-2.2.12/man/imapd.conf.5 2005-08-16 13:35:40.000000000 +0200
-@@ -590,6 +590,9 @@
- .IP "\fBsendmail:\fR /usr/lib/sendmail" 5
- The pathname of the sendmail executable. Sieve invokes sendmail
- for sending rejections, redirects and vacation responses.
-+.IP "\fBsendsms:\fR /usr/bin/sendsms" 5
-+The pathname of the sendsms executable. Sieve invokes sendsms
-+for sending SMS notifications.
- .IP "\fBservername:\fR " 5
- This is the hostname visible in the greeting messages of the POP,
- IMAP and LMTP daemons. If it is unset, then the result returned
-diff -Naur cyrus-imapd-2.2.12.orig/man/notifyd.8 cyrus-imapd-2.2.12/man/notifyd.8
---- cyrus-imapd-2.2.12.orig/man/notifyd.8 2003-08-10 01:43:14.000000000 +0200
-+++ cyrus-imapd-2.2.12/man/notifyd.8 2005-08-16 13:18:03.000000000 +0200
-@@ -110,6 +110,11 @@
- Sieve 'notify' action as it requires a \fImailto:\fR URL to be
- specified as an \fI:option\fR.
- .TP
-+.B sms
-+Send the notification as SMS. This method can ONLY be used in a
-+Sieve 'notify' action as it requires a \fIsms:\fR URL to be
-+specified as an \fI:option\fR.
-+.TP
- .B zephyr
- Send the notification as a zephyrgram. If used in a Sieve 'notify'
- action, additional recipients can be specified as \fI:options\fR.
-diff -Naur cyrus-imapd-2.2.12.orig/notifyd/Makefile.in cyrus-imapd-2.2.12/notifyd/Makefile.in
---- cyrus-imapd-2.2.12.orig/notifyd/Makefile.in 2004-05-28 20:03:06.000000000 +0200
-+++ cyrus-imapd-2.2.12/notifyd/Makefile.in 2005-08-16 15:18:45.000000000 +0200
-@@ -82,7 +82,7 @@
- install:
- $(INSTALL) -m 755 notifyd $(DESTDIR)$(service_path)
-
--OBJS= notifyd.o notify_null.o notify_log.o notify_mailto.o notify_zephyr.o
-+OBJS= notifyd.o notify_null.o notify_log.o notify_mailto.o notify_sms.o notify_zephyr.o
-
- notifytest: notifytest.o
- $(CC) $(LDFLAGS) -o notifytest \
-diff -Naur cyrus-imapd-2.2.12.orig/notifyd/notifyd.h cyrus-imapd-2.2.12/notifyd/notifyd.h
---- cyrus-imapd-2.2.12.orig/notifyd/notifyd.h 2003-02-13 21:15:48.000000000 +0100
-+++ cyrus-imapd-2.2.12/notifyd/notifyd.h 2005-08-16 12:58:17.000000000 +0200
-@@ -48,6 +48,7 @@
- #include "notify_null.h"
- #include "notify_log.h"
- #include "notify_mailto.h"
-+#include "notify_sms.h"
- #include "notify_zephyr.h"
-
- /* Notify method dispatch table definition */
-@@ -64,6 +65,7 @@
- { "null", notify_null }, /* do nothing */
- { "log", notify_log }, /* use syslog (for testing) */
- { "mailto", notify_mailto }, /* send an email */
-+ { "sms", notify_sms }, /* send an sms */
- #ifdef HAVE_ZEPHYR
- { "zephyr", notify_zephyr }, /* send a zephyrgram */
- #endif
-diff -Naur cyrus-imapd-2.2.12.orig/notifyd/notify_sms.c cyrus-imapd-2.2.12/notifyd/notify_sms.c
---- cyrus-imapd-2.2.12.orig/notifyd/notify_sms.c 1970-01-01 01:00:00.000000000 +0100
-+++ cyrus-imapd-2.2.12/notifyd/notify_sms.c 2005-08-16 18:43:56.000000000 +0200
-@@ -0,0 +1,111 @@
-+/* notify_sms.c -- SMS notification method
-+ * Simon Matter
-+ */
-+/*
-+ * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ *
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ *
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in
-+ * the documentation and/or other materials provided with the
-+ * distribution.
-+ *
-+ * 3. The name "Carnegie Mellon University" must not be used to
-+ * endorse or promote products derived from this software without
-+ * prior written permission. For permission or any other legal
-+ * details, please contact
-+ * Office of Technology Transfer
-+ * Carnegie Mellon University
-+ * 5000 Forbes Avenue
-+ * Pittsburgh, PA 15213-3890
-+ * (412) 268-4387, fax: (412) 268-7395
-+ * tech-transfer@andrew.cmu.edu
-+ *
-+ * 4. Redistributions of any form whatsoever must retain the following
-+ * acknowledgment:
-+ * "This product includes software developed by Computing Services
-+ * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
-+ *
-+ * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
-+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-+ * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
-+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
-+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
-+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-+ *
-+ * notify_sms is based on code from notify_mailto by Ken Murchison.
-+ * Copyright (c) 2005 Simon Matter, Invoca Systems.
-+ * Release 2005081600/2.2.12
-+*/
-+
-+#include
-+
-+#include "notify_sms.h"
-+
-+#include
-+#include
-+#include
-+#include
-+#include
-+
-+#include "global.h"
-+#include "libconfig.h"
-+#include "sieve_interface.h"
-+
-+static int global_outgoing_count = 0;
-+
-+char* notify_sms(const char *class __attribute__((unused)),
-+ const char *priority __attribute__((unused)),
-+ const char *user __attribute__((unused)),
-+ const char *mailbox __attribute__((unused)),
-+ int nopt, char **options,
-+ const char *message)
-+{
-+ FILE *sm;
-+ const char *smbuf[10];
-+ int sm_stat;
-+ pid_t sm_pid;
-+ int fds[2];
-+
-+ /* XXX check/parse options (sms URI) */
-+ if (nopt < 1)
-+ return strdup("NO sms URI not specified");
-+
-+ smbuf[0] = "sendsms";
-+ smbuf[1] = options[0];
-+ smbuf[2] = NULL;
-+
-+ pipe(fds);
-+ if ((sm_pid = fork()) == 0) {
-+ /* i'm the child! run sendsms! */
-+ close(fds[1]);
-+ /* make the pipe be stdin */
-+ dup2(fds[0], 0);
-+ execv(config_getstring(IMAPOPT_SENDSMS), (char **) smbuf);
-+
-+ /* if we're here we suck */
-+ return strdup("NO sms couldn't exec");
-+ }
-+ /* i'm the parent */
-+ close(fds[0]);
-+ sm = fdopen(fds[1], "w");
-+
-+ if (!sm)
-+ return strdup("NO sms could not spawn sendsms process");
-+
-+ fprintf(sm, message);
-+
-+ fclose(sm);
-+ while (waitpid(sm_pid, &sm_stat, 0) < 0);
-+
-+ /* XXX check for sendsms exit code */
-+
-+ return strdup("OK sms notification successful");
-+}
-diff -Naur cyrus-imapd-2.2.12.orig/notifyd/notify_sms.h cyrus-imapd-2.2.12/notifyd/notify_sms.h
---- cyrus-imapd-2.2.12.orig/notifyd/notify_sms.h 1970-01-01 01:00:00.000000000 +0100
-+++ cyrus-imapd-2.2.12/notifyd/notify_sms.h 2005-08-16 14:57:16.000000000 +0200
-@@ -0,0 +1,62 @@
-+/* notify_sms.h -- SMS notification method
-+ * Simon Matter
-+ */
-+/*
-+ * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ *
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ *
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in
-+ * the documentation and/or other materials provided with the
-+ * distribution.
-+ *
-+ * 3. The name "Carnegie Mellon University" must not be used to
-+ * endorse or promote products derived from this software without
-+ * prior written permission. For permission or any other legal
-+ * details, please contact
-+ * Office of Technology Transfer
-+ * Carnegie Mellon University
-+ * 5000 Forbes Avenue
-+ * Pittsburgh, PA 15213-3890
-+ * (412) 268-4387, fax: (412) 268-7395
-+ * tech-transfer@andrew.cmu.edu
-+ *
-+ * 4. Redistributions of any form whatsoever must retain the following
-+ * acknowledgment:
-+ * "This product includes software developed by Computing Services
-+ * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
-+ *
-+ * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
-+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-+ * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
-+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
-+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
-+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-+ *
-+ * notify_sms is based on code from notify_mailto by Ken Murchison.
-+ * Copyright (c) 2005 Simon Matter, Invoca Systems.
-+ * Release 2005081600/2.2.12
-+ *
-+ */
-+
-+#ifndef _NOTIFY_SMS_H_
-+#define _NOTIFY_SMS_H_
-+
-+#include
-+
-+/* the only option should be a sms URI */
-+char* notify_sms(const char *class __attribute__((unused)),
-+ const char *priority __attribute__((unused)),
-+ const char *user __attribute__((unused)),
-+ const char *mailbox __attribute__((unused)),
-+ int nopt, char **options,
-+ const char *message);
-+
-+#endif /* _NOTIFY_SMS_H_ */
diff --git a/src/patches/cyrus-imapd-2.2.12-rmquota+deletemailbox-0.2-1.diff b/src/patches/cyrus-imapd-2.2.12-rmquota+deletemailbox-0.2-1.diff
deleted file mode 100644
index ce2cce06c..000000000
--- a/src/patches/cyrus-imapd-2.2.12-rmquota+deletemailbox-0.2-1.diff
+++ /dev/null
@@ -1,491 +0,0 @@
-diff -Naur cyrus-imapd-2.2.12.orig/imap/ctl_cyrusdb.c cyrus-imapd-2.2.12/imap/ctl_cyrusdb.c
---- cyrus-imapd-2.2.12.orig/imap/ctl_cyrusdb.c Tue Jul 13 04:34:20 2004
-+++ cyrus-imapd-2.2.12/imap/ctl_cyrusdb.c Mon Mar 7 11:30:58 2005
-@@ -136,7 +136,7 @@
- /* if it is MBTYPE_RESERVED, unset it & call mboxlist_delete */
- if(!r && (mbtype & MBTYPE_RESERVE)) {
- if(!r) {
-- r = mboxlist_deletemailbox(name, 1, NULL, NULL, 0, 0, 1);
-+ r = mboxlist_deletemailbox(name, 1, NULL, NULL, 0, 0, 1, 1);
- if(r) {
- /* log the error */
- syslog(LOG_ERR,
-diff -Naur cyrus-imapd-2.2.12.orig/imap/ctl_mboxlist.c cyrus-imapd-2.2.12/imap/ctl_mboxlist.c
---- cyrus-imapd-2.2.12.orig/imap/ctl_mboxlist.c Sat May 22 05:45:48 2004
-+++ cyrus-imapd-2.2.12/imap/ctl_mboxlist.c Mon Mar 7 11:30:58 2005
-@@ -456,7 +456,7 @@
-
- wipe_head = wipe_head->next;
-
-- ret = mboxlist_deletemailbox(me->mailbox, 1, "", NULL, 0, 1, 1);
-+ ret = mboxlist_deletemailbox(me->mailbox, 1, "", NULL, 0, 1, 1, 1);
- if(ret) {
- fprintf(stderr, "couldn't delete defunct mailbox %s\n",
- me->mailbox);
-diff -Naur cyrus-imapd-2.2.12.orig/imap/imapd.c cyrus-imapd-2.2.12/imap/imapd.c
---- cyrus-imapd-2.2.12.orig/imap/imapd.c Mon Feb 14 07:39:55 2005
-+++ cyrus-imapd-2.2.12/imap/imapd.c Mon Mar 7 11:30:58 2005
-@@ -3724,7 +3724,7 @@
-
- r = mboxlist_deletemailbox(name, imapd_userisadmin,
- imapd_userid, imapd_authstate,
-- 0, 0, 0);
-+ 0, 0, 0, 1);
-
- if(r) {
- prot_printf(imapd_out, "* NO delete %s: %s\r\n",
-@@ -3743,6 +3743,12 @@
- char mailboxname[MAX_MAILBOX_NAME+1];
- char *p;
- int domainlen = 0;
-+ int keepQuota = 1;
-+
-+ if(name && *name == '+') {
-+ keepQuota = 0;
-+ name++;
-+ }
-
- r = (*imapd_namespace.mboxname_tointernal)(&imapd_namespace, name,
- imapd_userid, mailboxname);
-@@ -3753,7 +3759,7 @@
-
- r = mboxlist_deletemailbox(mailboxname, imapd_userisadmin,
- imapd_userid, imapd_authstate, 1,
-- localonly, 0);
-+ localonly, 0, keepQuota);
- }
-
- /* was it a top-level user mailbox? */
-@@ -4718,6 +4724,7 @@
- {
- int newquota = -1;
- int badresource = 0;
-+ int rmquota = 0;
- int c;
- int force = 0;
- static struct buf arg;
-@@ -4732,7 +4739,8 @@
- if (c != ')' || arg.s[0] != '\0') {
- for (;;) {
- if (c != ' ') goto badlist;
-- if (strcasecmp(arg.s, "storage") != 0) badresource = 1;
-+ if (strcasecmp(arg.s, "remove") == 0) rmquota = 1;
-+ else if (strcasecmp(arg.s, "storage") != 0) badresource = 1;
- c = getword(imapd_in, &arg);
- if (c != ' ' && c != ')') goto badlist;
- if (arg.s[0] == '\0') goto badlist;
-@@ -4769,7 +4777,10 @@
- imapd_userid, mailboxname);
-
- if (!r) {
-- r = mboxlist_setquota(mailboxname, newquota, force);
-+ if(!rmquota)
-+ r = mboxlist_setquota(mailboxname, newquota, force);
-+ else
-+ r = mboxlist_unsetquota(mailboxname);
- }
- }
-
-@@ -6416,7 +6427,7 @@
- /* note also that we need to remember to let proxyadmins do this */
- r = mboxlist_deletemailbox(mailboxname,
- imapd_userisadmin || imapd_userisproxyadmin,
-- imapd_userid, imapd_authstate, 0, 1, 0);
-+ imapd_userid, imapd_authstate, 0, 1, 0, 1);
- if(r) syslog(LOG_ERR,
- "Could not delete local mailbox during move of %s",
- mailboxname);
-diff -Naur cyrus-imapd-2.2.12.orig/imap/mailbox.c cyrus-imapd-2.2.12/imap/mailbox.c
---- cyrus-imapd-2.2.12.orig/imap/mailbox.c Mon Feb 14 07:39:57 2005
-+++ cyrus-imapd-2.2.12/imap/mailbox.c Mon Mar 7 11:30:58 2005
-@@ -2117,27 +2117,7 @@
-
- seen_delete_mailbox(mailbox);
-
-- if (delete_quota_root && !rquota) {
-- quota_delete(&mailbox->quota, &tid);
-- free(mailbox->quota.root);
-- mailbox->quota.root = NULL;
-- } else if (!rquota) {
-- /* Free any quota being used by this mailbox */
-- if (mailbox->quota.used >= mailbox->quota_mailbox_used) {
-- mailbox->quota.used -= mailbox->quota_mailbox_used;
-- }
-- else {
-- mailbox->quota.used = 0;
-- }
-- r = quota_write(&mailbox->quota, &tid);
-- if (r) {
-- syslog(LOG_ERR,
-- "LOSTQUOTA: unable to record free of %lu bytes in quota %s",
-- mailbox->quota_mailbox_used, mailbox->quota.root);
-- }
-- else
-- quota_commit(&tid);
-- }
-+ mailbox_updatequota(mailbox,NULL);
-
- /* remove all files in directory */
- strlcpy(buf, mailbox->path, sizeof(buf));
-@@ -2751,3 +2731,49 @@
- if (*p == '.') *p = '/';
- }
- }
-+
-+
-+/* This function is used to update the quota. Can be used to replace
-+ * identical parts of the code, and can be quite handy some times
-+ * The tid is used in order to make possible to make the quota update
-+ * being a part of a bigger transaction to the quota db */
-+int mailbox_updatequota(struct mailbox *mailbox, struct txn **tid)
-+{
-+ int r = 0, havetid = 0;
-+ struct txn **ltid = NULL;
-+
-+ if(tid) {
-+ ltid = tid;
-+ havetid = 1;
-+ }
-+ /* Ensure that we are locked */
-+ if(!mailbox->header_lock_count) return IMAP_INTERNAL;
-+
-+
-+ if(mailbox->quota.root) {
-+ r = quota_read(&mailbox->quota, ltid, 1);
-+ if( r == 0 ) {
-+ if (mailbox->quota.used >= mailbox->quota_mailbox_used) {
-+ mailbox->quota.used -= mailbox->quota_mailbox_used;
-+ }
-+ else {
-+ mailbox->quota.used = 0;
-+ }
-+ r = quota_write(&mailbox->quota, ltid);
-+ if (r) {
-+ syslog(LOG_ERR,
-+ "LOSTQUOTA: unable to record free of %lu bytes in quota %s",
-+ mailbox->quota_mailbox_used, mailbox->quota.root);
-+ }
-+ else if(!havetid)
-+ quota_commit(tid);
-+ }
-+ /* It is not a big mistake not to have quota .. just remove from the mailbox */
-+ else if ( r == IMAP_QUOTAROOT_NONEXISTENT) {
-+ free(mailbox->quota.root);
-+ r = 0;
-+ }
-+ }
-+ return r;
-+}
-+
-diff -Naur cyrus-imapd-2.2.12.orig/imap/mailbox.h cyrus-imapd-2.2.12/imap/mailbox.h
---- cyrus-imapd-2.2.12.orig/imap/mailbox.h Thu Jan 22 22:17:09 2004
-+++ cyrus-imapd-2.2.12/imap/mailbox.h Mon Mar 7 11:30:58 2005
-@@ -305,6 +305,8 @@
- struct mailbox *mailboxp);
- extern int mailbox_delete(struct mailbox *mailbox, int delete_quota_root);
-
-+extern int mailbox_updatequota(struct mailbox *mailbox, struct txn **tid);
-+
- extern int mailbox_rename_copy(struct mailbox *oldmailbox,
- const char *newname, char *newpath,
- bit32 *olduidvalidityp, bit32 *newuidvalidityp,
-diff -Naur cyrus-imapd-2.2.12.orig/imap/mboxlist.c cyrus-imapd-2.2.12/imap/mboxlist.c
---- cyrus-imapd-2.2.12.orig/imap/mboxlist.c Mon Jul 26 20:08:03 2004
-+++ cyrus-imapd-2.2.12/imap/mboxlist.c Mon Mar 7 11:30:58 2005
-@@ -93,6 +93,11 @@
- static int mboxlist_opensubs();
- static void mboxlist_closesubs();
-
-+static int child_cb(char *name,
-+ int matchlen __attribute__((unused)),
-+ int maycreate __attribute__((unused)),
-+ void *rock);
-+
- static int mboxlist_rmquota(const char *name, int matchlen, int maycreate,
- void *rock);
- static int mboxlist_changequota(const char *name, int matchlen, int maycreate,
-@@ -100,6 +105,7 @@
-
- struct change_rock {
- struct quota *quota;
-+ struct quota *oldquota;
- struct txn **tid;
- };
-
-@@ -893,9 +899,9 @@
- */
- int mboxlist_deletemailbox(const char *name, int isadmin, char *userid,
- struct auth_state *auth_state, int checkacl,
-- int local_only, int force)
-+ int local_only, int force, int keepQuota)
- {
-- int r;
-+ int r, has_children = 0;
- char *acl;
- long access;
- struct mailbox mailbox;
-@@ -907,6 +913,7 @@
- int deleteright = get_deleteright();
- const char *p;
- mupdate_handle *mupdate_h = NULL;
-+ char *quotaroot = NULL;
-
- if(!isadmin && force) return IMAP_PERMISSION_DENIED;
-
-@@ -1018,13 +1025,44 @@
-
- if ((r && !force) || isremote) goto done;
-
-- if (!r || force) r = mailbox_delete(&mailbox, deletequotaroot);
-+ if (!r || force) {
-+ /* first we have to keep the previous quota root in order to delete it */
-+ if(mailbox.quota.root)
-+ quotaroot = xstrdup(mailbox.quota.root);
-+ r = mailbox_delete(&mailbox, deletequotaroot);
-+ }
-
- /*
- * See if we have to remove mailbox's quota root
- */
-- if (!r && mailbox.quota.root != NULL) {
-+ if (!r && quotaroot != NULL) {
- /* xxx look for any other mailboxes in this quotaroot */
-+ /* If we have not asked to remove the quota (default behaviour), we check
-+ * whether there are any subfolders beneeth the quota root. If there aren't
-+ * any subfolders the reasonable thing is to delete the quota */
-+ if(keepQuota) {
-+ char pattern[MAX_MAILBOX_PATH+1];
-+ strlcpy(pattern, quotaroot, sizeof(pattern));
-+ if (config_virtdomains && name[strlen(name)-1] == '!') {
-+ strlcat(pattern, "*", sizeof(pattern));
-+ }
-+ else {
-+ strlcat(pattern, ".*", sizeof(pattern));
-+ }
-+ /* find if there are subfolders. Then we want to
-+ * keep the existing quota */
-+ mboxlist_findall(NULL, pattern, isadmin, userid,
-+ auth_state, child_cb, (void *) &has_children);
-+
-+ if(!has_children)
-+ if(!mboxlist_mylookup(quotaroot, NULL, NULL, NULL, NULL, NULL, 0 ))
-+ has_children = 1;
-+ }
-+ /* If we want to remove the quota explicitely or the quota root folder has no subfolders
-+ * we execute the rmquota patch */
-+ if(!keepQuota || !has_children )
-+ mboxlist_unsetquota(quotaroot);
-+ free(quotaroot);
- }
-
- done:
-@@ -2357,6 +2395,7 @@
- if (r) return r;
-
- crock.quota = "a;
-+ crock.oldquota = NULL;
- crock.tid = &tid;
- /* top level mailbox */
- if(have_mailbox)
-@@ -2375,17 +2414,21 @@
- */
- int mboxlist_unsetquota(const char *root)
- {
-+ char newquota[MAX_MAILBOX_PATH+1];
- char pattern[MAX_MAILBOX_PATH+1];
- struct quota quota;
-- int r=0;
-+ struct change_rock crock;
-+ int r=0, k=0;
-
- if (!root[0] || root[0] == '.' || strchr(root, '/')
- || strchr(root, '*') || strchr(root, '%') || strchr(root, '?')) {
- return IMAP_MAILBOX_BADNAME;
- }
-+
-+ crock.tid=NULL;
-
- quota.root = (char *) root;
-- r = quota_read("a, NULL, 0);
-+ r = quota_read("a, crock.tid, 0);
- if (r == IMAP_QUOTAROOT_NONEXISTENT) {
- /* already unset */
- return 0;
-@@ -2402,13 +2445,45 @@
- }
- else
- strlcat(pattern, ".*", sizeof(pattern));
--
-- /* top level mailbox */
-- mboxlist_rmquota(root, 0, 0, (void *)root);
-- /* submailboxes - we're using internal names here */
-- mboxlist_findall(NULL, pattern, 1, 0, 0, mboxlist_rmquota, (void *)root);
-
-- r = quota_delete("a, NULL);
-+ r = quota_delete("a, crock.tid);
-+
-+ /* If we cannot delete the quota then abort the operation */
-+ if(!r) {
-+ /* quota_findroot performs several checks that we can
-+ * assume that are already done, and don't have to perform
-+ * them again. One of them is that it returns 1 only if
-+ * quotaroot exists.
-+ */
-+ if(quota_findroot(newquota, sizeof(newquota), root)) {
-+ struct quota rootquota;
-+ rootquota.root = newquota;
-+ k = quota_read(&rootquota, crock.tid, 0);
-+ if (!k) {
-+ crock.quota = &rootquota;
-+ crock.oldquota = "a;
-+ /* top level mailbox */
-+ k = mboxlist_changequota(root, 0, 0, &crock);
-+ }
-+ /* submailboxes - we're using internal names here */
-+ if (!k)
-+ k = mboxlist_findall(NULL, pattern, 1, 0, 0, mboxlist_changequota, &crock);
-+ if(!k)
-+ k = quota_write(&rootquota, crock.tid);
-+
-+ }
-+ else {
-+ /* top level mailbox */
-+ mboxlist_rmquota(root, 0, 0, (void *)root);
-+ /* submailboxes - we're using internal names here */
-+ mboxlist_findall(NULL, pattern, 1, 0, 0, mboxlist_rmquota, (void *)root);
-+ }
-+ }
-+
-+ if(!r && !k)
-+ quota_commit(crock.tid);
-+ else
-+ quota_abort(crock.tid);
-
- return r;
- }
-@@ -2506,6 +2581,7 @@
- struct mailbox mailbox;
- struct change_rock *crock = (struct change_rock *) rock;
- struct quota *mboxlist_newquota = crock->quota;
-+ struct quota *mboxlist_oldquota = crock->oldquota;
- struct txn **tid = crock->tid;
-
- assert(rock != NULL);
-@@ -2523,27 +2599,24 @@
- if (r) goto error;
-
- if (mailbox.quota.root) {
-- if (strlen(mailbox.quota.root) >= strlen(mboxlist_newquota->root)) {
-- /* Part of a child quota root */
-- mailbox_close(&mailbox);
-- return 0;
-- }
--
-- r = quota_read(&mailbox.quota, tid, 1);
-- if (r) goto error;
-- if (mailbox.quota.used >= mailbox.quota_mailbox_used) {
-- mailbox.quota.used -= mailbox.quota_mailbox_used;
-- }
-- else {
-- mailbox.quota.used = 0;
-- }
-- r = quota_write(&mailbox.quota, tid);
-- if (r) {
-- syslog(LOG_ERR,
-- "LOSTQUOTA: unable to record free of %lu bytes in quota %s",
-- mailbox.quota_mailbox_used, mailbox.quota.root);
-- }
-- free(mailbox.quota.root);
-+ if(mboxlist_oldquota) {
-+ if (strlen(mailbox.quota.root) > strlen(mboxlist_oldquota->root)) {
-+ /* Part of a child quota root */
-+ mailbox_close(&mailbox);
-+ return 0;
-+ }
-+ }
-+ else {
-+ if (strlen(mailbox.quota.root) >= strlen(mboxlist_newquota->root)) {
-+ /* Part of a child quota root */
-+ mailbox_close(&mailbox);
-+ return 0;
-+ }
-+ }
-+
-+ r = mailbox_updatequota(&mailbox,tid);
-+ if (r)
-+ goto error;
- }
-
- mailbox.quota.root = xstrdup(mboxlist_newquota->root);
-@@ -2553,18 +2626,24 @@
- mboxlist_newquota->used += mailbox.quota_mailbox_used;
- mailbox_close(&mailbox);
- return 0;
--
-+
- error:
- mailbox_close(&mailbox);
-+ syslog(LOG_ERR, "LOSTQUOTA: unable to change quota root for %s to %s: %s. \
-+ Command aborted. Run reconstruct to make sure mailboxes \
-+ are in consistent state",
-+ name, mboxlist_newquota->root, error_message(r));
-+ return 1;
- error_noclose:
- syslog(LOG_ERR, "LOSTQUOTA: unable to change quota root for %s to %s: %s",
-- name, mboxlist_newquota->root, error_message(r));
-+ name, mboxlist_newquota->root, error_message(r));
-
- /* Note, we're a callback, and it's not a huge tragedy if we
- * fail, so we don't ever return a failure */
- return 0;
- }
-
-+
- /* must be called after cyrus_init */
- void mboxlist_init(int myflags)
- {
-diff -Naur cyrus-imapd-2.2.12.orig/imap/mboxlist.h cyrus-imapd-2.2.12/imap/mboxlist.h
---- cyrus-imapd-2.2.12.orig/imap/mboxlist.h Wed Mar 17 19:07:49 2004
-+++ cyrus-imapd-2.2.12/imap/mboxlist.h Mon Mar 7 11:30:58 2005
-@@ -122,7 +122,7 @@
- * the planet */
- int mboxlist_deletemailbox(const char *name, int isadmin, char *userid,
- struct auth_state *auth_state, int checkacl,
-- int local_only, int force);
-+ int local_only, int force, int keepQuota);
-
- /* Rename/move a mailbox (hierarchical) */
- int mboxlist_renamemailbox(char *oldname, char *newname, char *partition,
-diff -Naur cyrus-imapd-2.2.12.orig/imap/mupdate.c cyrus-imapd-2.2.12/imap/mupdate.c
---- cyrus-imapd-2.2.12.orig/imap/mupdate.c Fri Dec 17 17:32:16 2004
-+++ cyrus-imapd-2.2.12/imap/mupdate.c Mon Mar 7 11:30:58 2005
-@@ -2190,7 +2190,7 @@
- remote_boxes.head = r->next;
- } else if (ret < 0) {
- /* Local without corresponding remote, delete it */
-- mboxlist_deletemailbox(l->mailbox, 1, "", NULL, 0, 0, 0);
-+ mboxlist_deletemailbox(l->mailbox, 1, "", NULL, 0, 0, 0, 1);
- local_boxes.head = l->next;
- } else /* (ret > 0) */ {
- /* Remote without corresponding local, insert it */
-@@ -2205,7 +2205,7 @@
- if(l && !r) {
- /* we have more deletes to do */
- while(l) {
-- mboxlist_deletemailbox(l->mailbox, 1, "", NULL, 0, 0, 0);
-+ mboxlist_deletemailbox(l->mailbox, 1, "", NULL, 0, 0, 0, 1);
- local_boxes.head = l->next;
- l = local_boxes.head;
- }
-diff -Naur cyrus-imapd-2.2.12.orig/imap/nntpd.c cyrus-imapd-2.2.12/imap/nntpd.c
---- cyrus-imapd-2.2.12.orig/imap/nntpd.c Fri Jan 7 21:59:04 2005
-+++ cyrus-imapd-2.2.12/imap/nntpd.c Mon Mar 7 11:30:58 2005
-@@ -3298,7 +3298,7 @@
- /* XXX should we delete right away, or wait until empty? */
-
- r = mboxlist_deletemailbox(mailboxname, 0,
-- newsmaster, newsmaster_authstate, 1, 0, 0);
-+ newsmaster, newsmaster_authstate, 1, 0, 0, 1);
-
- return r;
- }
diff --git a/src/patches/cyrus-imapd-2.2.12-seenstate.patch b/src/patches/cyrus-imapd-2.2.12-seenstate.patch
deleted file mode 100644
index 1de1d8f8a..000000000
--- a/src/patches/cyrus-imapd-2.2.12-seenstate.patch
+++ /dev/null
@@ -1,163 +0,0 @@
-# Small patch to Cyrus IMAP 2.2.12 which modifies \Seen state handling to
-# make it compatible with Outlook Express. OE makes two connections to a
-# given mailfolder: one generates indexes while the other fetches messages.
-# Unfortunately it gets confused if \Seen updates caused by the message
-# stream aren't immediately flushed and picked up by the index stream.
-#
-# Apparently Mozilla Thunderbird has the same problem.
-#
-# This patch is a 2.2.12 port from the patch found here:
-# http://www-uxsup.csx.cam.ac.uk/~dpc22/cyrus/patches/2.1.16/seenstate.patch
-#
-diff -Naur cyrus-imapd-2.2.12.orig/imap/imapd.c cyrus-imapd-2.2.12/imap/imapd.c
---- cyrus-imapd-2.2.12.orig/imap/imapd.c 2005-02-14 07:39:55.000000000 +0100
-+++ cyrus-imapd-2.2.12/imap/imapd.c 2006-01-04 07:41:45.000000000 +0100
-@@ -3095,6 +3095,10 @@
- snprintf(mytime, sizeof(mytime), "%2.3f",
- (clock() - start) / (double) CLOCKS_PER_SEC);
-
-+ /* Checkpoint \Seen immediately after each FETCH completes. Checks for
-+ * changes from other processes at the same time */
-+ index_check_existing(imapd_mailbox, usinguid, 1);
-+
- if (r) {
- prot_printf(imapd_out, "%s NO %s (%s sec)\r\n", tag,
- error_message(r), mytime);
-@@ -3219,7 +3223,8 @@
-
- index_fetch(imapd_mailbox, msgno, 0, &fetchargs, &fetchedsomething);
-
-- index_check(imapd_mailbox, 0, 0);
-+ /* Vanilla index_check() can generate illegal EXPUNGE events */
-+ index_check_existing(imapd_mailbox, 0, 1);
-
- if (fetchedsomething) {
- prot_printf(imapd_out, "%s OK %s\r\n", tag,
-@@ -3352,7 +3357,9 @@
- flag, nflags);
-
- if (usinguid) {
-- index_check(imapd_mailbox, 1, 0);
-+ index_check(imapd_mailbox, 1, 1); /* Check \Seen too */
-+ } else {
-+ index_check_existing(imapd_mailbox, 0, 1);
- }
-
- if (r) {
-diff -Naur cyrus-imapd-2.2.12.orig/imap/imapd.h cyrus-imapd-2.2.12/imap/imapd.h
---- cyrus-imapd-2.2.12.orig/imap/imapd.h 2004-06-22 23:36:18.000000000 +0200
-+++ cyrus-imapd-2.2.12/imap/imapd.h 2006-01-04 07:41:45.000000000 +0100
-@@ -232,6 +232,8 @@
- extern void index_operatemailbox(struct mailbox *mailbox);
- extern void index_check(struct mailbox *mailbox, int usinguid,
- int checkseen);
-+extern void
-+index_check_existing(struct mailbox *mailbox, int usinguid, int checkseen);
- extern void index_checkseen(struct mailbox *mailbox, int quiet,
- int usinguid, int oldexists);
-
-diff -Naur cyrus-imapd-2.2.12.orig/imap/index.c cyrus-imapd-2.2.12/imap/index.c
---- cyrus-imapd-2.2.12.orig/imap/index.c 2005-02-14 17:42:08.000000000 +0100
-+++ cyrus-imapd-2.2.12/imap/index.c 2006-01-04 08:08:51.000000000 +0100
-@@ -425,6 +425,53 @@
- }
- }
-
-+/* Nasty hack to report system + user flags updates without checking for
-+ * new mail or expunge (relies on index atomic rewrite+rename for expunge).
-+ *
-+ * Needed to keep Outlook Express happy without breaking IMAP concurrent
-+ * access regime which (quite correctly) prohibits unsolicited EXPUNGE and
-+ * EXIST responses for non-UID versions of FETCH and STORE. Otherwise you
-+ * can end up with hilarous situations such as:
-+ *
-+ * . FETCH 2 fast
-+ * * EXPUNGE 1 <-- from concurrent session.
-+ * . FETCH (data relating to previous message _3_, if it exists)
-+ *
-+ */
-+
-+void
-+index_check_existing(struct mailbox *mailbox, int usinguid, int checkseen)
-+{
-+ struct stat sbuf;
-+ int msgno, i;
-+ bit32 user_flags[MAX_USER_FLAGS/32];
-+
-+ if (imapd_exists == -1)
-+ return;
-+
-+ /* Bail out if the mailbox was rotated under our feet */
-+ if ((index_len > 0) &&
-+ ((stat(FNAME_INDEX+1, &sbuf) != 0) ||
-+ (sbuf.st_ino != mailbox->index_ino) ||
-+ (index_ino != mailbox->index_ino)))
-+ return;
-+
-+ if (checkseen)
-+ index_checkseen(mailbox, 0, usinguid, imapd_exists);
-+
-+ for (msgno = 1; msgno <= imapd_exists; msgno++) {
-+ if (flagreport[msgno] < LAST_UPDATED(msgno)) {
-+ for (i = 0; i < VECTOR_SIZE(user_flags); i++) {
-+ user_flags[i] = USER_FLAGS(msgno, i);
-+ }
-+ index_fetchflags(mailbox, msgno, SYSTEM_FLAGS(msgno), user_flags,
-+ LAST_UPDATED(msgno));
-+ if (usinguid) prot_printf(imapd_out, " UID %u", UID(msgno));
-+ prot_printf(imapd_out, ")\r\n");
-+ }
-+ }
-+}
-+
- /*
- * Checkpoint the user's \Seen state
- *
-@@ -458,6 +505,7 @@
- char *saveseenuids, *save;
- int savealloced;
- unsigned start, newallseen, inrange, usecomma;
-+ mailbox_notifyproc_t *updatenotifier;
-
- if (!keepingseen || !seendb) return;
- if (imapd_exists == 0) {
-@@ -731,6 +779,9 @@
-
- free(newseenuids);
- seenuids = saveseenuids;
-+
-+ updatenotifier = mailbox_get_updatenotifier();
-+ if (updatenotifier) updatenotifier(mailbox);
- }
-
-
-diff -Naur cyrus-imapd-2.2.12.orig/imap/mailbox.c cyrus-imapd-2.2.12/imap/mailbox.c
---- cyrus-imapd-2.2.12.orig/imap/mailbox.c 2005-02-14 07:39:57.000000000 +0100
-+++ cyrus-imapd-2.2.12/imap/mailbox.c 2006-01-04 07:41:45.000000000 +0100
-@@ -230,6 +230,14 @@
- }
-
- /*
-+ * Get the updatenotifier function
-+ */
-+mailbox_notifyproc_t *mailbox_get_updatenotifier(void)
-+{
-+ return updatenotifier;
-+}
-+
-+/*
- * Create connection to acappush (obsolete)
- */
- int mailbox_initialize(void)
-diff -Naur cyrus-imapd-2.2.12.orig/imap/mailbox.h cyrus-imapd-2.2.12/imap/mailbox.h
---- cyrus-imapd-2.2.12.orig/imap/mailbox.h 2004-01-22 22:17:09.000000000 +0100
-+++ cyrus-imapd-2.2.12/imap/mailbox.h 2006-01-04 07:41:45.000000000 +0100
-@@ -224,6 +224,8 @@
-
- extern void mailbox_set_updatenotifier(mailbox_notifyproc_t *notifyproc);
-
-+extern mailbox_notifyproc_t *mailbox_get_updatenotifier(void);
-+
- extern int mailbox_initialize(void);
-
- extern char *mailbox_message_fname(struct mailbox *mailbox,
diff --git a/src/patches/cyrus-imapd-2.2.12-singleinstancestore.patch b/src/patches/cyrus-imapd-2.2.12-singleinstancestore.patch
deleted file mode 100644
index 525155231..000000000
--- a/src/patches/cyrus-imapd-2.2.12-singleinstancestore.patch
+++ /dev/null
@@ -1,144 +0,0 @@
-diff -Naur cyrus-imapd-2.2.12/imap/append.c cyrus-imapd-2.2.12.cvs/imap/append.c
---- cyrus-imapd-2.2.12/imap/append.c 2004-05-22 05:45:48.000000000 +0200
-+++ cyrus-imapd-2.2.12.cvs/imap/append.c 2005-06-03 07:10:24.000000000 +0200
-@@ -1,5 +1,5 @@
- /* append.c -- Routines for appending messages to a mailbox
-- * $Id: append.c,v 1.107 2004/05/22 03:45:48 rjs3 Exp $
-+ * $Id: append.c,v 1.108 2005/06/02 15:47:50 ken3 Exp $
- *
- * Copyright (c)1998, 2000 Carnegie Mellon University. All rights reserved.
- *
-@@ -801,7 +801,8 @@
- int append_copy(struct mailbox *mailbox,
- struct appendstate *as,
- int nummsg,
-- struct copymsg *copymsg)
-+ struct copymsg *copymsg,
-+ int nolink)
- {
- struct mailbox *append_mailbox = &as->m;
- int msg;
-@@ -845,7 +846,7 @@
- mailbox_message_get_fname(mailbox, copymsg[msg].uid, fnamebuf,
- sizeof(fnamebuf));
- /* Link/copy message file */
-- r = mailbox_copyfile(fnamebuf, fname, 0);
-+ r = mailbox_copyfile(fnamebuf, fname, nolink);
- if (r) goto fail;
-
- /* Write out cache info, copy other info */
-diff -Naur cyrus-imapd-2.2.12/imap/append.h cyrus-imapd-2.2.12.cvs/imap/append.h
---- cyrus-imapd-2.2.12/imap/append.h 2004-01-22 22:17:07.000000000 +0100
-+++ cyrus-imapd-2.2.12.cvs/imap/append.h 2005-06-03 07:10:24.000000000 +0200
-@@ -1,5 +1,5 @@
- /* append.h -- Description of messages to be copied
-- * $Id: append.h,v 1.26 2004/01/22 21:17:07 ken3 Exp $
-+ * $Id: append.h,v 1.27 2005/06/02 15:47:51 ken3 Exp $
- *
- * Copyright (c) 1998, 2000 Carnegie Mellon University. All rights reserved.
- *
-@@ -137,7 +137,7 @@
-
- extern int append_copy(struct mailbox *mailbox,
- struct appendstate *append_mailbox,
-- int nummsg, struct copymsg *copymsg);
-+ int nummsg, struct copymsg *copymsg, int nolink);
-
- extern int append_collectnews(struct appendstate *mailbox,
- const char *group, unsigned long feeduid);
-diff -Naur cyrus-imapd-2.2.12/imap/imapd.c cyrus-imapd-2.2.12.cvs/imap/imapd.c
---- cyrus-imapd-2.2.12/imap/imapd.c 2005-02-14 07:39:55.000000000 +0100
-+++ cyrus-imapd-2.2.12.cvs/imap/imapd.c 2005-06-03 07:11:52.000000000 +0200
-@@ -38,7 +38,7 @@
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
--/* $Id: imapd.c,v 1.490 2005/02/14 06:39:55 shadow Exp $ */
-+/* $Id: imapd.c,v 1.493 2005/06/02 15:47:51 ken3 Exp $ */
-
- #include
-
-@@ -3593,7 +3593,7 @@
- imapd_userid, mailboxname);
- if (!r) {
- r = index_copy(imapd_mailbox, sequence, usinguid, mailboxname,
-- ©uid);
-+ ©uid, !config_getswitch(IMAPOPT_SINGLEINSTANCESTORE));
- }
-
- index_check(imapd_mailbox, usinguid, 0);
-diff -Naur cyrus-imapd-2.2.12/imap/imapd.h cyrus-imapd-2.2.12.cvs/imap/imapd.h
---- cyrus-imapd-2.2.12/imap/imapd.h 2004-06-22 23:36:18.000000000 +0200
-+++ cyrus-imapd-2.2.12.cvs/imap/imapd.h 2005-06-03 07:10:24.000000000 +0200
-@@ -1,5 +1,5 @@
- /* imapd.h -- Common state for IMAP daemon
-- * $Id: imapd.h,v 1.61 2004/06/22 21:36:18 rjs3 Exp $
-+ * $Id: imapd.h,v 1.62 2005/06/02 15:47:57 ken3 Exp $
- *
- * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
- *
-@@ -249,7 +249,7 @@
- extern int index_thread(struct mailbox *mailbox, int algorithm,
- struct searchargs *searchargs, int usinguid);
- extern int index_copy(struct mailbox *mailbox, char *sequence,
-- int usinguid, char *name, char **copyuidp);
-+ int usinguid, char *name, char **copyuidp, int nolink);
- extern int index_status(struct mailbox *mailbox, char *name,
- int statusitems);
-
-diff -Naur cyrus-imapd-2.2.12/imap/index.c cyrus-imapd-2.2.12.cvs/imap/index.c
---- cyrus-imapd-2.2.12/imap/index.c 2005-02-14 17:42:08.000000000 +0100
-+++ cyrus-imapd-2.2.12.cvs/imap/index.c 2005-06-03 07:13:04.000000000 +0200
-@@ -41,7 +41,7 @@
- *
- */
- /*
-- * $Id: index.c,v 1.213 2005/02/14 16:42:08 shadow Exp $
-+ * $Id: index.c,v 1.218 2005/06/02 15:47:58 ken3 Exp $
- */
- #include
-
-@@ -1145,7 +1145,8 @@
- char *sequence,
- int usinguid,
- char *name,
-- char **copyuidp)
-+ char **copyuidp,
-+ int nolink)
- {
- static struct copyargs copyargs;
- int i;
-@@ -1176,7 +1177,7 @@
- if (r) return r;
-
- r = append_copy(mailbox, &append_mailbox, copyargs.nummsg,
-- copyargs.copymsg);
-+ copyargs.copymsg, nolink);
- if (!r) append_commit(&append_mailbox, totalsize,
- &uidvalidity, &startuid, &num);
- if (!r) {
-diff -Naur cyrus-imapd-2.2.12/lib/imapoptions cyrus-imapd-2.2.12.cvs/lib/imapoptions
---- cyrus-imapd-2.2.12/lib/imapoptions 2004-07-21 21:07:45.000000000 +0200
-+++ cyrus-imapd-2.2.12.cvs/lib/imapoptions 2005-06-03 07:14:07.000000000 +0200
-@@ -42,7 +42,7 @@
- .\" AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- .\"
--.\" $Id: imapoptions,v 1.30 2004/07/21 19:07:45 rjs3 Exp $
-+.\" $Id: imapoptions,v 1.33 2005/06/02 15:47:59 ken3 Exp $
- .SH NAME
- imapd.conf \- IMAP configuration file
- .SH DESCRIPTION
-@@ -753,9 +753,9 @@
- directories: ~user/.sieve. */
-
- { "singleinstancestore", 1, SWITCH }
--/* If enabled, lmtpd and nntpd attempt to only write one copy of a message per
-- partition and create hard links, resulting in a potentially large
-- disk savings. */
-+/* If enabled, imapd, lmtpd and nntpd attempt to only write one copy
-+ of a message per partition and create hard links, resulting in a
-+ potentially large disk savings. */
-
- { "skiplist_unsafe", 0, SWITCH }
- /* If enabled, this option forces the skiplist cyrusdb backend to
diff --git a/src/patches/cyrus-imapd-2.2.12-spool.patch b/src/patches/cyrus-imapd-2.2.12-spool.patch
deleted file mode 100644
index 4171a5ed3..000000000
--- a/src/patches/cyrus-imapd-2.2.12-spool.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -Naur cyrus-imapd-2.2.12.orig/imap/spool.c cyrus-imapd-2.2.12/imap/spool.c
---- cyrus-imapd-2.2.12.orig/imap/spool.c 2004-10-27 22:40:50.000000000 +0200
-+++ cyrus-imapd-2.2.12/imap/spool.c 2005-10-24 15:08:37.000000000 +0200
-@@ -451,7 +451,7 @@
- p[1] = '\n';
- p[2] = '\0';
- }
-- else if (p[0] != '\n' && (strlen(buf) < sizeof(buf)-2)) {
-+ else if (p[0] != '\n' && (strlen(buf) < sizeof(buf)-3)) {
- /* line contained a \0 not at the end */
- r = IMAP_MESSAGE_CONTAINSNULL;
- continue;
diff --git a/src/patches/cyrus-imapd-2.3.3-deleteacl_invalid_identifier_fix.patch b/src/patches/cyrus-imapd-2.3.3-deleteacl_invalid_identifier_fix.patch
deleted file mode 100644
index a21c18635..000000000
--- a/src/patches/cyrus-imapd-2.3.3-deleteacl_invalid_identifier_fix.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-diff -Naur cyrus-imapd-2.3.3.orig/lib/acl_afs.c cyrus-imapd-2.3.3/lib/acl_afs.c
---- cyrus-imapd-2.3.3.orig/lib/acl_afs.c 2005-12-13 20:36:11.000000000 +0100
-+++ cyrus-imapd-2.3.3/lib/acl_afs.c 2006-04-12 07:28:50.000000000 +0200
-@@ -114,6 +114,7 @@
- cyrus_acl_canonproc_t *canonproc;
- void *canonrock;
- {
-+ const char *canonid;
- char *newidentifier = 0;
- char *newacl;
- char *thisid, *nextid;
-@@ -122,9 +123,14 @@
-
- /* Convert 'identifier' into canonical form */
- if (*identifier == '-') {
-- char *canonid = auth_canonifyid(identifier+1, 0);
-+ canonid = auth_canonifyid(identifier+1, 0);
- if (!canonid) {
-- return -1;
-+ if (access != 0L) {
-+ return -1;
-+ } else {
-+ /* trying to delete invalid/non-existent identifier */
-+ canonid = identifier+1;
-+ }
- }
- newidentifier = xmalloc(strlen(canonid)+2);
- newidentifier[0] = '-';
-@@ -135,9 +141,13 @@
- }
- }
- else {
-- identifier = auth_canonifyid(identifier, 0);
-- if (!identifier) {
-+ canonid = auth_canonifyid(identifier, 0);
-+ if (canonid) {
-+ identifier = canonid;
-+ } else if (access != 0L) {
- return -1;
-+ } else {
-+ /* trying to delete invalid/non-existent identifier */
- }
- if (canonproc) {
- access = canonproc(canonrock, identifier, access);
diff --git a/src/patches/cyrus-imapd-acceptinvalidfrom.patch b/src/patches/cyrus-imapd-acceptinvalidfrom.patch
deleted file mode 100644
index b44ab5929..000000000
--- a/src/patches/cyrus-imapd-acceptinvalidfrom.patch
+++ /dev/null
@@ -1,34 +0,0 @@
---- cyrus-imapd-2.2.6/imap/message.c.acceptinvalidfrom 2004-10-30 15:03:02.220642392 -0700
-+++ cyrus-imapd-2.2.6/imap/message.c 2004-10-30 15:06:01.838336352 -0700
-@@ -229,6 +229,8 @@
- int reject8bit = config_getswitch(IMAPOPT_REJECT8BIT);
- int munge8bit = config_getswitch(IMAPOPT_MUNGE8BIT);
- int inheader = 1, blankline = 1;
-+ char is_from;
-+ static const char * from_header = "From ";
-
- while (size) {
- n = prot_read(from, buf, size > 4096 ? 4096 : size);
-@@ -294,8 +296,20 @@
- /* Check for valid header name */
- if (sawnl && buf[0] != ' ' && buf[0] != '\t') {
- if (buf[0] == ':') return IMAP_MESSAGE_BADHEADER;
-- for (p = (unsigned char *)buf; *p != ':'; p++) {
-- if (*p <= ' ') return IMAP_MESSAGE_BADHEADER;
-+ p = (unsigned char *) buf;
-+ if (*p == '>')
-+ p++;
-+ if (*p == from_header[0])
-+ is_from = 0;
-+ else
-+ is_from = -1;
-+ for (; *p != ':' && is_from < 5; p++) {
-+ if (is_from > 0 && *p != from_header[is_from])
-+ is_from = -1;
-+ if (is_from >= 0)
-+ is_from++;
-+ else
-+ if (*p <= ' ') return IMAP_MESSAGE_BADHEADER;
- }
- }
-
diff --git a/src/patches/timsieved_reset_sasl_conn.patch b/src/patches/timsieved_reset_sasl_conn.patch
deleted file mode 100644
index af08f578e..000000000
--- a/src/patches/timsieved_reset_sasl_conn.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- timsieved/parser.c
-+++ timsieved/parser.c 2005/08/24 09:14:42
-@@ -664,8 +664,14 @@
-
- if(r) {
- /* mboxlist_detail error */
-- *errmsg = "mailbox unknown";
-- return FALSE;
-+ syslog(LOG_ERR, error_message(r));
-+
-+ if(reset_saslconn(&sieved_saslconn, ssf, authid) != SASL_OK)
-+ fatal("could not reset the sasl_conn_t after failure",
-+ EC_TEMPFAIL);
-+
-+ ret = FALSE;
-+ goto cleanup;
- }
-
- if(type & MBTYPE_REMOTE) {
|