bring up to Simon Matter's 2.3.1-2 version

This commit is contained in:
John Dennis 2006-02-28 20:04:01 +00:00
parent c332f8040b
commit 9e566a4d52
31 changed files with 2324 additions and 936 deletions

View File

@ -1,3 +1,2 @@
cyrus-imapd-2.2.12.tar.gz cyrus-imapd-2.3.1.tar.gz
cyrus-imapd-README.HOWTO-recover-mailboxes.db
cyrus_sharedbackup-0.1.tar.gz cyrus_sharedbackup-0.1.tar.gz

View File

@ -2,19 +2,20 @@ Cyrus IMAP autocreate Inbox patch
---------------------------------- ----------------------------------
NOTE : This patch has been created at the University of Athens. For more info, as well NOTE : This patch has been created at the University of Athens. For more info, as well
as more patches on Cyrus IMAPD server, please visit http://email.uoa.gr as more patches on Cyrus IMAPD server, please visit http://email.uoa.gr/
The design of Cyrus IMAP server does not predict the automatic creation of users' The design of Cyrus IMAP server does not predict the automatic creation of users'
INBOX folders. The creation of a user's INBOX is considered to be an external task, INBOX folders. The creation of a user's INBOX is considered to be an external task,
that has to be completed as part of the user e-mail account creation procedure. that has to be completed as part of the user email account creation procedure.
Hence, to create a new e-mail account the site administrator has to Hence, to create a new email account the site administrator has to:
a) Include the new account in the user database for the authentication procedure
(e.g. sasldb, shadow, mysql, ldap). a) Include the new account in the user database for the authentication procedure
b) Create the corresponding INBOX folder. (e.g. sasldb, shadow, mysql, ldap).
b) Create the corresponding INBOX folder.
Alternatively, the user, if succesfully authenticated, may create his own INBOX folder, Alternatively, the user, if succesfully authenticated, may create his own INBOX folder,
as long as the configuration of the site allows it (see "autocreatequota" in imapd.conf). as long as the configuration of the site allows it (see "autocreatequota" in imapd.conf).
Unlike what uncareful readers may think, enabling the "autocreatequota" option, doesn't Unlike what not careful readers may think, enabling the "autocreatequota" option, doesn't
lead to the automatic INBOX folder creation by Cyrus IMAP server. lead to the automatic INBOX folder creation by Cyrus IMAP server.
In fact, "autocreate" means that the IMAP clients are allowed to automatically create In fact, "autocreate" means that the IMAP clients are allowed to automatically create
the user INBOX. the user INBOX.
@ -32,18 +33,18 @@ following requirements are met:
i) The user has succesfully passed the authentication procedure. i) The user has succesfully passed the authentication procedure.
ii) The user's authorization ID (typically the same as the user's ii) The user's authorisation ID (typically the same as the user's
authentication ID) doesn't belong to the imap_admins or admins authentication ID) doesn't belong to the imap_admins or admins
accounts (see imapd.conf). accounts (see imapd.conf).
iii) The "autocreatequota" option in the imap configuration file iii) The "autocreatequota" option in the imap configuration file
has been set to a non zero value. has been set to a non zero value.
iv) The corresponding to the user's authorizationID INBOX folder iv) The corresponding to the user's authorisation ID INBOX folder
does not exist. does not exist.
The user's first login is the most typical case when all four requirements are met. The user's first login is the most typical case when all four requirements are met.
Note that if the authenticatedID is allowed to proxy to another account for which Note that if the authenticated ID is allowed to proxy to another account for which
all of the above requirements are met, the corresponding INBOX folder for that account all of the above requirements are met, the corresponding INBOX folder for that account
will be created. will be created.
@ -54,10 +55,10 @@ Create on post
This feauture provides automatic creation of a user's INBOX folder when all of the This feauture provides automatic creation of a user's INBOX folder when all of the
following requirements are met. following requirements are met.
i) An e-mail message addressed to the user has been received. i) An email message addressed to the user has been received.
ii) The recipient is not any of the imap_admins or admins accounts. ii) The recipient is not any of the imap_admins or admins accounts.
Note that passing e-mails to admins or imap_admins accounts from Note that passing emails to admins or imap_admins accounts from
the MTA to LMTP should be avoided in any case. the MTA to LMTP should be avoided in any case.
iii) The recipient's INBOX does not exist. iii) The recipient's INBOX does not exist.
@ -72,26 +73,26 @@ has been switched on.
Besides the automatic creation of INBOX folder, additional functionalities are Besides the automatic creation of INBOX folder, additional functionalities are
provided: provided:
A) Automatic creation of INBOX subfolders controlled by "autocreateinboxfolders" (A) Automatic creation of INBOX subfolders controlled by "autocreateinboxfolders"
configuration option. eg configuration option. eg
autocreateinboxfolders: sent|drafts|spam|templates autocreateinboxfolders: sent|drafts|spam|templates
B) Automatic subscription of INBOX subfolders controlled by "autosubscribeinboxfolders" (B) Automatic subscription of INBOX subfolders controlled by "autosubscribeinboxfolders"
configuration option. eg configuration option. eg
autosubscribeinboxfolders: sent|spam autosubscribeinboxfolders: sent|spam
Obviously, only subscription to subfolders included in the "autocreateinboxfolder" Obviously, only subscription to subfolders included in the "autocreateinboxfolder"
list is meaningfull. list is meaningful.
C) Automatic subscription to shared folders (bulletin boards). The user gets (C) Automatic subscription to shared folders (bulletin boards). The user gets
automatically subscribed to the shared folders declared in the "autosubscribesharedfolders" automatically subscribed to the shared folders declared in the "autosubscribesharedfolders"
configuration option in imapd.conf. configuration option in imapd.conf.
eg autosubscribesharedfolders: public_folder | public_folder.subfolder eg autosubscribesharedfolders: public_folder | public_folder.subfolder
In order the above action to succeed, the shared folder has to pre-exist the INBOX creation In order the above action to succeed, the shared folder has to pre-exist the INBOX creation
and the user must have the apropriate permissions in order to be able to subscribe to the and the user must have the appropriate permissions in order to be able to subscribe to the
shared folder. shared folder.
* A new config option has been added. 'autosubscribe_all_sharedfolders' is a yes/no * A new config option has been added. 'autosubscribe_all_sharedfolders' is a yes/no
@ -99,7 +100,7 @@ option. When set to yes, the user is automatically subscribed to all shared fold
has permission to subscribe to. Please, note that when this option is set to yes, then has permission to subscribe to. Please, note that when this option is set to yes, then
'autosubscribesharedfolders' option is overriden. 'autosubscribesharedfolders' option is overriden.
D) Automatic creation of a predefined default sieve script. (D) Automatic creation of a predefined default sieve script.
This is very useful when a default sieve script is used for every user. Usually, a This is very useful when a default sieve script is used for every user. Usually, a
default anti-spam script may me be written in a file and copied to each user default anti-spam script may me be written in a file and copied to each user
@ -142,15 +143,39 @@ NOTES :
script as well as the compiled script is updated every time the source script changes. script as well as the compiled script is updated every time the source script changes.
(E) The administrator may control for which users and/or groups may the INBOXes
automatically be created. The autocreate_users option restricts the groups
for which the patch will create the mailboxes.
The default value of autocreate_users is anyone. So, if not set at all, the patch will
work for all users. However, one may set:
autocreate_users: user1 user2 group:group1 group:group2
In that case, the INBOX will be created only for user1, user2 and the users that belong
to group1 and group2.
More refined control per service is provided by the options imap_autocreate_users,
pop3_autocreate_users and lmtp_autocreate_users. These options override the
autocreate_users option and offer per service control.
Example:
One may want to restrict the create on post functionality only for a specific group
of users. To achieve this, the following lines must be added in the imapd.conf file:
createonpost: yes
lmtp_autocreate_users: group:groupname
Issues to be considered Issues to be considered
======================= =======================
I) In order to use the create on post feauture one should be absolutely sure that: I) In order to use the create on post feauture one should be absolutely sure that:
a) The MTA checks the validity of the e-mail recipient before sending the e-mail to a) The MTA checks the validity of the email recipient before sending the email to
LMTP. This is an RFC821 requirement. This usually expands to "the mta should be LMTP. This is an RFC821 requirement. This usually expands to "the mta should be
able to use the account database as user mailbox database". able to use the account database as user mailbox database".
b) Only authorized accounts/services can talk to LMTP. b) Only authorised accounts/services can talk to LMTP.
II) Especially in the case of imap logins, the current patch implementation checks II) Especially in the case of imap logins, the current patch implementation checks
for the INBOX folder existence upon login, causing an extra mailbox lookup in most for the INBOX folder existence upon login, causing an extra mailbox lookup in most
@ -158,7 +183,7 @@ of the cases.
A better approach would be to chase the "IMAP_MAILBOX_NONEXISTENT" error code and A better approach would be to chase the "IMAP_MAILBOX_NONEXISTENT" error code and
check if the error is associated with an INBOX folder. However, this would mess up check if the error is associated with an INBOX folder. However, this would mess up
Cyrus code. The way it was implemented may not have been the most performance Cyrus code. The way it was implemented may not have been the most performance
optimized, but it produces a much cleaner and simple patch. optimised, but it produces a much cleaner and simple patch.
@ -174,8 +199,13 @@ shared folders to be subscribed to for every domain.
Things to be done Things to be done
================= =================
1. Support MURDER architecture. 1. Support MUPDATE
It is within the developers' intentions to support the mupdate protocol, but serious
design issues on future cyrus releases have to resolved first.
For more information and updates please visit http://email.uoa.gr/autocreate 2. Select different attributes (quota, partition, sieve filter, etc) depending on the group
a user belongs to.
For more information and updates please visit http://email.uoa.gr/projects/cyrus/autocreate

View File

@ -0,0 +1,28 @@
--- imap/imapd.c
+++ imap/imapd.c 2004/01/16 12:25:51
@@ -578,8 +578,11 @@
fatal("SASL failed initializing: sasl_server_new()", EC_TEMPFAIL);
}
- /* never allow plaintext, since IMAP has the LOGIN command */
- secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT);
+ if( (config_getswitch(IMAPOPT_ALLOWPLAINWITHOUTTLS) == 0) ) {
+ secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT);
+ } else {
+ secprops = mysasl_secprops(0);
+ }
sasl_setprop(imapd_saslconn, SASL_SEC_PROPS, secprops);
sasl_setprop(imapd_saslconn, SASL_SSF_EXTERNAL, &extprops_ssf);
--- lib/imapoptions
+++ lib/imapoptions 2004/01/16 12:27:52
@@ -684,6 +684,9 @@
to set this to yes, especially if OpenLDAP is used as authentication
source. */
+{ "allowplainwithouttls", 0, SWITCH }
+/* Allow plain login mechanism without an encrypted connection. */
+
/*
.SH SEE ALSO
.PP

View File

@ -1,14 +0,0 @@
--- lib/cyrusdb_skiplist.c.orig Tue Apr 23 20:25:48 2002
+++ lib/cyrusdb_skiplist.c Wed May 8 13:49:23 2002
@@ -69,6 +69,11 @@
#define PROB (0.5)
+#ifdef __FreeBSD__
+/* #define fdatasync(fd) fsync(fd) */
+#define O_DSYNC 0
+#endif
+
/*
*
* disk format; all numbers in network byte order

View File

@ -0,0 +1,62 @@
--- cyrus-imapd-2.2.12/lib/acl_afs.c.orig 2005-07-14 17:12:53 +0300
+++ cyrus-imapd-2.2.12/lib/acl_afs.c 2005-07-14 17:17:44 +0300
@@ -119,12 +119,17 @@
char *thisid, *nextid;
int oldaccess = 0;
char *rights;
+ int identifier_found = 0;
+ int identifier_overridden = 0;
/* Convert 'identifier' into canonical form */
if (*identifier == '-') {
char *canonid = auth_canonifyid(identifier+1, 0);
- if (!canonid) {
+ if (!canonid && access != 0L) {
return -1;
+ } else if (!canonid && access == 0L) {
+ canonid = identifier+1;
+ identifier_overridden = 1;
}
newidentifier = xmalloc(strlen(canonid)+2);
newidentifier[0] = '-';
@@ -135,9 +140,15 @@
}
}
else {
+ newidentifier = xmalloc(strlen(identifier)+1);
+ strlcpy(newidentifier, identifier, strlen(identifier)+1);
+
identifier = auth_canonifyid(identifier, 0);
- if (!identifier) {
+ if (!identifier && access != 0L) {
return -1;
+ } else if(!identifier && access == 0L) {
+ identifier = newidentifier;
+ identifier_overridden = 1;
}
if (canonproc) {
access = canonproc(canonrock, identifier, access);
@@ -165,6 +176,7 @@
*nextid++ = '\0';
if (strcmp(identifier, thisid) == 0) {
+ identifier_found = 1;
oldaccess = cyrus_acl_strtomask(rights);
break;
}
@@ -172,6 +184,15 @@
nextid[-1] = '\t';
}
+ /*
+ * In case we have overridden the canonification of the
+ * identifier, but still the identifier does not exist in
+ * the mailboxdb, then return error as normally expected.
+ */
+ if(identifier_overridden && !identifier_found) {
+ return -1;
+ }
+
switch (mode) {
case ACL_MODE_SET:
break;

View File

@ -1,7 +1,7 @@
diff -Naur cyrus-imapd-2.2.4.orig/doc/man/deliver.8.html cyrus-imapd-2.2.4/doc/man/deliver.8.html diff -Naur cyrus-imapd-2.2.12/doc/man/deliver.8.html cyrus-imapd-2.2.12.munge8bit/doc/man/deliver.8.html
--- cyrus-imapd-2.2.4.orig/doc/man/deliver.8.html Sun May 16 23:05:05 2004 --- cyrus-imapd-2.2.12/doc/man/deliver.8.html 2005-02-14 19:02:17.000000000 +0100
+++ cyrus-imapd-2.2.4/doc/man/deliver.8.html Thu May 20 19:21:15 2004 +++ cyrus-imapd-2.2.12.munge8bit/doc/man/deliver.8.html 2005-06-18 19:02:39.000000000 +0200
@@ -221,13 +221,15 @@ @@ -223,13 +223,15 @@
<td width="10%"></td> <td width="10%"></td>
<td width="89%"> <td width="89%">
<p>Depending on the setting of <b>reject8bit</b> in <p>Depending on the setting of <b>reject8bit</b> in
@ -16,7 +16,7 @@ diff -Naur cyrus-imapd-2.2.4.orig/doc/man/deliver.8.html cyrus-imapd-2.2.4/doc/m
+messages with 8-bit-set characters in the headers. If we +messages with 8-bit-set characters in the headers. If we
+accept messages with 8-bit-set characters in the headers, +accept messages with 8-bit-set characters in the headers,
+then depending on the setting of <b>munge8bit</b>, these +then depending on the setting of <b>munge8bit</b>, these
+characters are either left un-touched or changed to . This +characters are either left un-touched or changed to &lsquo;X&rsquo;. This
+is because such characters can&rsquo;t be interpreted since +is because such characters can&rsquo;t be interpreted since
+the character set is not known, although some communities +the character set is not known, although some communities
+not well-served by US-ASCII assume that those characters can +not well-served by US-ASCII assume that those characters can
@ -24,9 +24,21 @@ diff -Naur cyrus-imapd-2.2.4.orig/doc/man/deliver.8.html cyrus-imapd-2.2.4/doc/m
<!-- INDENTATION --> <!-- INDENTATION -->
<p>A method for encoding 8-bit-set characters is provided by <p>A method for encoding 8-bit-set characters is provided by
RFC 2047.</p> RFC 2047.</p>
diff -Naur cyrus-imapd-2.2.4.orig/imap/message.c cyrus-imapd-2.2.4/imap/message.c diff -Naur cyrus-imapd-2.2.12/doc/man/imapd.conf.5.html cyrus-imapd-2.2.12.munge8bit/doc/man/imapd.conf.5.html
--- cyrus-imapd-2.2.4.orig/imap/message.c Fri Feb 27 18:44:55 2004 --- cyrus-imapd-2.2.12/doc/man/imapd.conf.5.html 2005-02-14 19:02:18.000000000 +0100
+++ cyrus-imapd-2.2.4/imap/message.c Thu May 20 19:15:23 2004 +++ cyrus-imapd-2.2.12.munge8bit/doc/man/imapd.conf.5.html 2005-06-18 18:59:46.000000000 +0200
@@ -2562,7 +2562,7 @@
<td width="80%">
<p>If enabled, lmtpd rejects messages with 8-bit characters
in the headers. Otherwise, 8-bit characters are changed to
-&lsquo;X&rsquo;. (A proper soultion to non-ASCII characters
+&lsquo;X&rsquo;. (A proper solution to non-ASCII characters
in headers is offered by RFC 2047 and its predecessors.)</p>
</td>
</table>
diff -Naur cyrus-imapd-2.2.12/imap/message.c cyrus-imapd-2.2.12.munge8bit/imap/message.c
--- cyrus-imapd-2.2.12/imap/message.c 2004-09-16 19:58:54.000000000 +0200
+++ cyrus-imapd-2.2.12.munge8bit/imap/message.c 2005-06-18 18:58:33.000000000 +0200
@@ -227,6 +227,7 @@ @@ -227,6 +227,7 @@
int n; int n;
int sawcr = 0, sawnl; int sawcr = 0, sawnl;
@ -44,9 +56,9 @@ diff -Naur cyrus-imapd-2.2.4.orig/imap/message.c cyrus-imapd-2.2.4/imap/message.
/* We have been configured to munge all mail of this /* We have been configured to munge all mail of this
form. */ form. */
*p = 'X'; *p = 'X';
diff -Naur cyrus-imapd-2.2.4.orig/imap/spool.c cyrus-imapd-2.2.4/imap/spool.c diff -Naur cyrus-imapd-2.2.12/imap/spool.c cyrus-imapd-2.2.12.munge8bit/imap/spool.c
--- cyrus-imapd-2.2.4.orig/imap/spool.c Thu Mar 4 17:09:34 2004 --- cyrus-imapd-2.2.12/imap/spool.c 2004-10-27 22:40:50.000000000 +0200
+++ cyrus-imapd-2.2.4/imap/spool.c Thu May 20 19:16:52 2004 +++ cyrus-imapd-2.2.12.munge8bit/imap/spool.c 2005-06-18 18:58:33.000000000 +0200
@@ -140,6 +140,7 @@ @@ -140,6 +140,7 @@
state s = NAME_START; state s = NAME_START;
int r = 0; int r = 0;
@ -64,23 +76,23 @@ diff -Naur cyrus-imapd-2.2.4.orig/imap/spool.c cyrus-imapd-2.2.4/imap/spool.c
/* We have been configured to munge all mail of this /* We have been configured to munge all mail of this
form. */ form. */
c = 'X'; c = 'X';
diff -Naur cyrus-imapd-2.2.4.orig/lib/imapoptions cyrus-imapd-2.2.4/lib/imapoptions diff -Naur cyrus-imapd-2.2.12/lib/imapoptions cyrus-imapd-2.2.12.munge8bit/lib/imapoptions
--- cyrus-imapd-2.2.4.orig/lib/imapoptions Wed May 5 20:53:09 2004 --- cyrus-imapd-2.2.12/lib/imapoptions 2004-07-21 21:07:45.000000000 +0200
+++ cyrus-imapd-2.2.4/lib/imapoptions Thu May 20 19:15:23 2004 +++ cyrus-imapd-2.2.12.munge8bit/lib/imapoptions 2005-06-18 18:58:33.000000000 +0200
@@ -454,6 +454,12 @@ @@ -458,6 +458,12 @@
{ "mboxlist_db", "skiplist", STRINGLIST("flat", "berkeley", "skiplist")} { "mboxlist_db", "skiplist", STRINGLIST("flat", "berkeley", "skiplist")}
/* The cyrusdb backend to use for the mailbox list. */ /* The cyrusdb backend to use for the mailbox list. */
+{ "munge8bit", 1, SWITCH } +{ "munge8bit", 1, SWITCH }
+/* If enabled, lmtpd munges messages with 8-bit characters. These characters +/* If enabled, lmtpd munges messages with 8-bit characters. These characters
+ are changed to . If \fBreject8bit\fR is enabled, setting \fBmunge8bit\fR + are changed to `X'. If \fBreject8bit\fR is enabled, setting \fBmunge8bit\fR
+ has no effect. (A proper soultion to non-ASCII characters in headers is + has no effect. (A proper solution to non-ASCII characters in headers is
+ offered by RFC 2047 and its predecessors.) */ + offered by RFC 2047 and its predecessors.) */
+ +
# xxx badly worded # xxx badly worded
{ "mupdate_connections_max", 128, INT } { "mupdate_connections_max", 128, INT }
/* The max number of connections that a mupdate process will allow, this /* The max number of connections that a mupdate process will allow, this
@@ -654,9 +660,7 @@ @@ -670,9 +676,7 @@
{ "reject8bit", 0, SWITCH } { "reject8bit", 0, SWITCH }
/* If enabled, lmtpd rejects messages with 8-bit characters in the /* If enabled, lmtpd rejects messages with 8-bit characters in the
@ -91,9 +103,9 @@ diff -Naur cyrus-imapd-2.2.4.orig/lib/imapoptions cyrus-imapd-2.2.4/lib/imapopti
{ "rfc2046_strict", 0, SWITCH } { "rfc2046_strict", 0, SWITCH }
/* If enabled, imapd will be strict (per RFC 2046) when matching MIME /* If enabled, imapd will be strict (per RFC 2046) when matching MIME
diff -Naur cyrus-imapd-2.2.4.orig/man/deliver.8 cyrus-imapd-2.2.4/man/deliver.8 diff -Naur cyrus-imapd-2.2.12/man/deliver.8 cyrus-imapd-2.2.12.munge8bit/man/deliver.8
--- cyrus-imapd-2.2.4.orig/man/deliver.8 Sat May 25 21:57:47 2002 --- cyrus-imapd-2.2.12/man/deliver.8 2004-06-21 20:40:10.000000000 +0200
+++ cyrus-imapd-2.2.4/man/deliver.8 Thu May 20 19:15:23 2004 +++ cyrus-imapd-2.2.12.munge8bit/man/deliver.8 2005-06-18 18:58:33.000000000 +0200
@@ -147,8 +147,10 @@ @@ -147,8 +147,10 @@
Accept messages using the LMTP protocol. Accept messages using the LMTP protocol.
.SH NOTES .SH NOTES
@ -107,3 +119,15 @@ diff -Naur cyrus-imapd-2.2.4.orig/man/deliver.8 cyrus-imapd-2.2.4/man/deliver.8
This is because such characters can't be interpreted since the This is because such characters can't be interpreted since the
character set is not known, although some communities not well-served by character set is not known, although some communities not well-served by
US-ASCII assume that those characters can be used to represent characters not US-ASCII assume that those characters can be used to represent characters not
diff -Naur cyrus-imapd-2.2.12/man/imapd.conf.5 cyrus-imapd-2.2.12.munge8bit/man/imapd.conf.5
--- cyrus-imapd-2.2.12/man/imapd.conf.5 2005-02-14 19:02:16.000000000 +0100
+++ cyrus-imapd-2.2.12.munge8bit/man/imapd.conf.5 2005-06-18 18:59:08.000000000 +0200
@@ -551,7 +551,7 @@
.IP "\fBreject8bit:\fR 0" 5
If enabled, lmtpd rejects messages with 8-bit characters in the
headers. Otherwise, 8-bit characters are changed to `X'. (A
-proper soultion to non-ASCII characters in headers is offered by
+proper solution to non-ASCII characters in headers is offered by
RFC 2047 and its predecessors.)
.IP "\fBrfc2046_strict:\fR 0" 5
If enabled, imapd will be strict (per RFC 2046) when matching MIME

View File

@ -0,0 +1,13 @@
diff -Naur cyrus-imapd-2.2.12.orig/doc/Makefile.dist cyrus-imapd-2.2.12/doc/Makefile.dist
--- cyrus-imapd-2.2.12.orig/doc/Makefile.dist Wed Oct 22 20:50:04 2003
+++ cyrus-imapd-2.2.12/doc/Makefile.dist Wed Nov 9 13:23:58 2005
@@ -13,7 +13,7 @@
rm -f groff-html-*.png pod2htm*
- fig2dev -L png murder.fig murder.png
- fig2dev -L png netnews.fig netnews.png
+# fig2dev -L png murder.fig murder.png
+# fig2dev -L png netnews.fig netnews.png
(cd text; make)

View File

@ -0,0 +1,304 @@
diff -Naur cyrus-imapd-2.2.12.orig/doc/man/imapd.conf.5.html cyrus-imapd-2.2.12/doc/man/imapd.conf.5.html
--- cyrus-imapd-2.2.12.orig/doc/man/imapd.conf.5.html 2005-02-14 19:02:18.000000000 +0100
+++ cyrus-imapd-2.2.12/doc/man/imapd.conf.5.html 2005-08-16 13:32:36.000000000 +0200
@@ -2751,6 +2751,24 @@
<tr valign="top" align="left">
<td width="10%"></td>
<td width="89%">
+<p><b>sendsms:</b> /usr/bin/sendsms</p></td>
+</table></p>
+<!-- INDENTATION -->
+<table width="100%" border=0 rules="none" frame="void"
+ cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="19%"></td>
+<td width="80%">
+<p>The pathname of the sendsms executable. Sieve invokes
+sendsms for sending SMS notifications.</p>
+</td>
+</table>
+<!-- INDENTATION -->
+<p><table width="100%" border=0 rules="none" frame="void"
+ cols="2" cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="89%">
<p><b>servername:</b> &lt;none&gt;</p></td>
</table></p>
<!-- INDENTATION -->
diff -Naur cyrus-imapd-2.2.12.orig/doc/man/notifyd.8.html cyrus-imapd-2.2.12/doc/man/notifyd.8.html
--- cyrus-imapd-2.2.12.orig/doc/man/notifyd.8.html 2005-02-14 19:02:19.000000000 +0100
+++ cyrus-imapd-2.2.12/doc/man/notifyd.8.html 2005-08-16 13:17:33.000000000 +0200
@@ -181,6 +181,18 @@
<td width="11%"></td>
<td width="10%">
+<p><b>sms</b></p>
+</td>
+<td width="77%">
+
+<p>Send the notification as SMS. This method can ONLY be used in
+a Sieve &rsquo;notify&rsquo; action as it requires a
+<i>sms:</i> URL to be specified as an <i>:option</i>.</p>
+</td>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="10%">
+
<p><b>zephyr</b></p>
</td>
<td width="77%">
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 <none>" 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 <config.h>
+
+#include "notify_sms.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#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 <config.h>
+
+/* 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_ */

Binary file not shown.

View File

@ -1,104 +0,0 @@
# Small patch to Cyrus IMAP 2.2.4 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.
#
# This patch is a 2.2.4 port from the patch found here:
# http://www-uxsup.csx.cam.ac.uk/~dpc22/cyrus/patches/2.1.16/OutLookExpress-seenstate.patch
#
diff -Naur cyrus-imapd-2.2.4.orig/imap/imapd.c cyrus-imapd-2.2.4/imap/imapd.c
--- cyrus-imapd-2.2.4.orig/imap/imapd.c Thu May 6 20:46:21 2004
+++ cyrus-imapd-2.2.4/imap/imapd.c Fri May 21 02:10:25 2004
@@ -3063,6 +3063,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);
@@ -3184,7 +3188,7 @@
index_fetch(imapd_mailbox, msgno, 0, &fetchargs, &fetchedsomething);
- index_check(imapd_mailbox, 0, 0);
+ index_check_existing(imapd_mailbox, 0, 1);
if (fetchedsomething) {
prot_printf(imapd_out, "%s OK %s\r\n", tag,
@@ -3321,7 +3325,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.4.orig/imap/imapd.h cyrus-imapd-2.2.4/imap/imapd.h
--- cyrus-imapd-2.2.4.orig/imap/imapd.h Wed Oct 22 20:50:07 2003
+++ cyrus-imapd-2.2.4/imap/imapd.h Fri May 21 02:06:02 2004
@@ -233,6 +233,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.4.orig/imap/index.c cyrus-imapd-2.2.4/imap/index.c
--- cyrus-imapd-2.2.4.orig/imap/index.c Wed Apr 21 19:40:48 2004
+++ cyrus-imapd-2.2.4/imap/index.c Fri May 21 02:06:02 2004
@@ -425,6 +425,45 @@
}
}
+/* 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)
+{
+ int msgno, i;
+ bit32 user_flags[MAX_USER_FLAGS/32];
+
+ if (imapd_exists == -1)
+ 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
*

View File

@ -0,0 +1,81 @@
diff -Naur cyrus-imapd-2.3.1.orig/lib/auth_unix.c cyrus-imapd-2.3.1/lib/auth_unix.c
--- cyrus-imapd-2.3.1.orig/lib/auth_unix.c Wed Feb 16 22:06:50 2005
+++ cyrus-imapd-2.3.1/lib/auth_unix.c Wed Dec 21 13:50:05 2005
@@ -157,10 +157,12 @@
size_t len;
{
static char retbuf[81];
+ char backup[81];
struct group *grp;
char sawalpha;
char *p;
int username_tolower = 0;
+ int ic,rbc;
if(!len) len = strlen(identifier);
if(len >= sizeof(retbuf)) return NULL;
@@ -210,6 +212,22 @@
/* now we don't */
/* if (!sawalpha) return NULL; */
+ if( (libcyrus_config_getswitch(CYRUSOPT_NORMALIZEUID) == 1) ) {
+ strcpy(backup,retbuf);
+ /* remove leading blanks */
+ for(ic=0; isblank(backup[ic]); ic++);
+ for(rbc=0; backup[ic]; ic++) {
+ retbuf[rbc] = ( isalpha(backup[ic]) ?
+ tolower(backup[ic]) : backup[ic] );
+ rbc++;
+ }
+ retbuf[rbc] = '\0';
+ /* remove trailing blanks */
+ for(--rbc; isblank(retbuf[rbc]); rbc--) {
+ retbuf[rbc] = '\0';
+ }
+ }
+
return retbuf;
}
diff -Naur cyrus-imapd-2.3.1.orig/lib/imapoptions cyrus-imapd-2.3.1/lib/imapoptions
--- cyrus-imapd-2.3.1.orig/lib/imapoptions Tue Dec 13 20:36:11 2005
+++ cyrus-imapd-2.3.1/lib/imapoptions Wed Dec 21 13:50:05 2005
@@ -990,6 +990,11 @@
interface, otherwise the user is assumed to be in the default
domain (if set). */
+{ "normalizeuid", 0, SWITCH }
+/* Lowercase uid and strip leading and trailing blanks. It is recommended
+ to set this to yes, especially if OpenLDAP is used as authentication
+ source. */
+
/*
.SH SEE ALSO
.PP
diff -Naur cyrus-imapd-2.3.1.orig/lib/libcyr_cfg.c cyrus-imapd-2.3.1/lib/libcyr_cfg.c
--- cyrus-imapd-2.3.1.orig/lib/libcyr_cfg.c Tue Dec 13 20:36:12 2005
+++ cyrus-imapd-2.3.1/lib/libcyr_cfg.c Wed Dec 21 13:50:05 2005
@@ -127,6 +127,11 @@
CFGVAL(const char *, "c"),
CYRUS_OPT_STRING },
+ { CYRUSOPT_NORMALIZEUID,
+ CFGVAL(long, 1),
+ CYRUS_OPT_SWITCH },
+
+
{ CYRUSOPT_LAST, { NULL }, CYRUS_OPT_NOTOPT }
};
diff -Naur cyrus-imapd-2.3.1.orig/lib/libcyr_cfg.h cyrus-imapd-2.3.1/lib/libcyr_cfg.h
--- cyrus-imapd-2.3.1.orig/lib/libcyr_cfg.h Tue Dec 13 20:36:12 2005
+++ cyrus-imapd-2.3.1/lib/libcyr_cfg.h Wed Dec 21 13:51:37 2005
@@ -101,6 +101,8 @@
CYRUSOPT_BERKELEY_TXNS_MAX,
/* RFC 2086 right which allows DELETE ("c") */
CYRUSOPT_DELETERIGHT,
+ /* Lowercase uid and strip leading and trailing blanks (OFF) */
+ CYRUSOPT_NORMALIZEUID,
CYRUSOPT_LAST

View File

@ -1,6 +1,6 @@
diff -Naur cyrus-imapd-2.2.12/README.autosievefolder cyrus-imapd-2.2.12-autosieve.uncompiled/README.autosievefolder diff -Naur cyrus-imapd-2.3.1/README.autosievefolder cyrus-imapd-2.3.1-autosieve/README.autosievefolder
--- cyrus-imapd-2.2.12/README.autosievefolder 1970-01-01 02:00:00 +0200 --- cyrus-imapd-2.3.1/README.autosievefolder 1970-01-01 02:00:00 +0200
+++ cyrus-imapd-2.2.12-autosieve.uncompiled/README.autosievefolder 2005-02-15 13:59:51 +0200 +++ cyrus-imapd-2.3.1-autosieve/README.autosievefolder 2006-01-19 03:29:08 +0200
@@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
+Cyrus IMAP autosievefolder patch +Cyrus IMAP autosievefolder patch
+---------------------------------- +----------------------------------
@ -44,21 +44,12 @@ diff -Naur cyrus-imapd-2.2.12/README.autosievefolder cyrus-imapd-2.2.12-autosiev
+ +
+For more information and updates please visit http://email.uoa.gr/projects/cyrus/autosievefolder +For more information and updates please visit http://email.uoa.gr/projects/cyrus/autosievefolder
+ +
diff -Naur cyrus-imapd-2.2.12/imap/lmtp_sieve.c cyrus-imapd-2.2.12-autosieve.uncompiled/imap/lmtp_sieve.c diff -Naur cyrus-imapd-2.3.1/imap/lmtp_sieve.c cyrus-imapd-2.3.1-autosieve/imap/lmtp_sieve.c
--- cyrus-imapd-2.2.12/imap/lmtp_sieve.c 2004-06-01 16:47:16 +0300 --- cyrus-imapd-2.3.1/imap/lmtp_sieve.c 2005-11-21 18:26:54 +0200
+++ cyrus-imapd-2.2.12-autosieve.uncompiled/imap/lmtp_sieve.c 2005-02-15 13:59:51 +0200 +++ cyrus-imapd-2.3.1-autosieve/imap/lmtp_sieve.c 2006-01-19 03:29:13 +0200
@@ -72,6 +72,8 @@ @@ -86,6 +86,9 @@
#include "util.h" struct auth_state *authstate;
#include "version.h" } script_data_t;
#include "xmalloc.h"
+#include "imap_err.h"
+
static int sieve_usehomedir = 0;
static const char *sieve_dir = NULL;
@@ -98,6 +100,9 @@
int quotaoverride,
int acloverride);
+static int autosieve_subfolder(char *userid, struct auth_state *auth_state, +static int autosieve_subfolder(char *userid, struct auth_state *auth_state,
+ char *subfolder, struct namespace *namespace); + char *subfolder, struct namespace *namespace);
@ -66,36 +57,30 @@ diff -Naur cyrus-imapd-2.2.12/imap/lmtp_sieve.c cyrus-imapd-2.2.12-autosieve.unc
static char *make_sieve_db(const char *user) static char *make_sieve_db(const char *user)
{ {
static char buf[MAX_MAILBOX_PATH+1]; static char buf[MAX_MAILBOX_PATH+1];
@@ -312,6 +317,7 @@ @@ -487,7 +490,20 @@
}
+
static int sieve_redirect(void *ac,
void *ic __attribute__((unused)),
void *sc, void *mc, const char **errmsg)
@@ -444,7 +450,18 @@
sd->username, mdata->notifyheader, sd->username, mdata->notifyheader,
namebuf, quotaoverride, 0); namebuf, quotaoverride, 0);
} }
- -
+
+ if (ret == IMAP_MAILBOX_NONEXISTENT) { + if (ret == IMAP_MAILBOX_NONEXISTENT) {
+ /* if "plus" folder under INBOX, then try to create it */ + /* if "plus" folder under INBOX, then try to create it */
+ syslog(LOG_DEBUG, "calling autosieve folder for : %s", namebuf);
+ ret = autosieve_subfolder((char *) sd->username, sd->authstate, namebuf, mdata->namespace); + ret = autosieve_subfolder((char *) sd->username, sd->authstate, namebuf, mdata->namespace);
+ +
+ /* Try to deliver the mail again. */
+ if (!ret) + if (!ret)
+ ret = deliver_mailbox(md->data, mdata->stage, md->size, + ret = deliver_mailbox(md->f, mdata->content, mdata->stage, md->size,
+ fc->imapflags->flag, fc->imapflags->nflags, + fc->imapflags->flag, fc->imapflags->nflags,
+ (char *) sd->username, sd->authstate, md->id, + (char *) sd->username, sd->authstate, md->id,
+ sd->username, mdata->notifyheader, + sd->username, mdata->notifyheader,
+ namebuf, quotaoverride, 0); + namebuf, quotaoverride, 0);
+ } + }
+
if (!ret) { if (!ret) {
snmp_increment(SIEVE_FILEINTO, 1); snmp_increment(SIEVE_FILEINTO, 1);
return SIEVE_OK; return SIEVE_OK;
@@ -882,3 +899,77 @@ @@ -939,3 +955,80 @@
we'll do normal delivery */
return r; return r;
} }
+ +
@ -113,12 +98,15 @@ diff -Naur cyrus-imapd-2.2.12/imap/lmtp_sieve.c cyrus-imapd-2.2.12-autosieve.unc
+ int createsievefolder = 0; + int createsievefolder = 0;
+ +
+ /* Check if subfolder or userid are NULL */ + /* Check if subfolder or userid are NULL */
+ if(subfolder == NULL || userid == NULL) + if(userid == NULL || subfolder == NULL)
+ return IMAP_MAILBOX_NONEXISTENT; + return IMAP_MAILBOX_NONEXISTENT;
+ +
+ if (config_getswitch(IMAPOPT_ANYSIEVEFOLDER)) + syslog(LOG_DEBUG, "autosievefolder: autosieve_subfolder() was called for user %s, folder %s",
+ userid, subfolder);
+
+ if (config_getswitch(IMAPOPT_ANYSIEVEFOLDER)) {
+ createsievefolder = 1; + createsievefolder = 1;
+ else if ((subf = config_getstring(IMAPOPT_AUTOSIEVEFOLDERS)) != NULL) { + } else if ((subf = config_getstring(IMAPOPT_AUTOSIEVEFOLDERS)) != NULL) {
+ /* Roll through subf */ + /* Roll through subf */
+ next_subf = (char *) subf; + next_subf = (char *) subf;
+ while (*next_subf) { + while (*next_subf) {
@ -160,7 +148,7 @@ diff -Naur cyrus-imapd-2.2.12/imap/lmtp_sieve.c cyrus-imapd-2.2.12-autosieve.unc
+ 1, userid, auth_state, 0, 0, 0); + 1, userid, auth_state, 0, 0, 0);
+ if (!r) { + if (!r) {
+ mboxlist_changesub(subfolder, userid, auth_state, 1, 1); + mboxlist_changesub(subfolder, userid, auth_state, 1, 1);
+ syslog(LOG_DEBUG, "autosievefolder: User %s, folder %s creation succeeded.", + syslog(LOG_DEBUG, "autosievefolder: User %s, folder %s creation succeeded",
+ userid, subfolder); + userid, subfolder);
+ return 0; + return 0;
+ } else { + } else {
@ -172,10 +160,10 @@ diff -Naur cyrus-imapd-2.2.12/imap/lmtp_sieve.c cyrus-imapd-2.2.12-autosieve.unc
+ return IMAP_MAILBOX_NONEXISTENT; + return IMAP_MAILBOX_NONEXISTENT;
+} +}
+ +
diff -Naur cyrus-imapd-2.2.12/lib/imapoptions cyrus-imapd-2.2.12-autosieve.uncompiled/lib/imapoptions diff -Naur cyrus-imapd-2.3.1/lib/imapoptions cyrus-imapd-2.3.1-autosieve/lib/imapoptions
--- cyrus-imapd-2.2.12/lib/imapoptions 2004-07-21 22:07:45 +0300 --- cyrus-imapd-2.3.1/lib/imapoptions 2005-12-13 21:36:11 +0200
+++ cyrus-imapd-2.2.12-autosieve.uncompiled/lib/imapoptions 2005-02-15 13:59:51 +0200 +++ cyrus-imapd-2.3.1-autosieve/lib/imapoptions 2006-01-19 03:29:15 +0200
@@ -752,6 +752,15 @@ @@ -856,6 +856,15 @@
/* If enabled, lmtpd will look for Sieve scripts in user's home /* If enabled, lmtpd will look for Sieve scripts in user's home
directories: ~user/.sieve. */ directories: ~user/.sieve. */
@ -189,5 +177,5 @@ diff -Naur cyrus-imapd-2.2.12/lib/imapoptions cyrus-imapd-2.2.12-autosieve.uncom
+ i.e. autosievefolders: Junk | Spam */ + i.e. autosievefolders: Junk | Spam */
+ +
{ "singleinstancestore", 1, SWITCH } { "singleinstancestore", 1, SWITCH }
/* If enabled, lmtpd and nntpd attempt to only write one copy of a message per /* If enabled, imapd, lmtpd and nntpd attempt to only write one copy
partition and create hard links, resulting in a potentially large of a message per partition and create hard links, resulting in a

View File

@ -0,0 +1,12 @@
diff -Naur cyrus-imapd-2.3.1.orig/imap/backend.c cyrus-imapd-2.3.1/imap/backend.c
--- cyrus-imapd-2.3.1.orig/imap/backend.c 2005-02-25 07:46:14.000000000 +0100
+++ cyrus-imapd-2.3.1/imap/backend.c 2006-01-25 08:10:20.000000000 +0100
@@ -274,7 +274,7 @@
/* need to (re)establish connection to server or create one */
int sock = -1;
int r;
- int err;
+ int err = -1;
struct addrinfo hints, *res0 = NULL, *res1 = NULL, *res;
struct sockaddr_un sunsock;
char buf[2048], *mechlist = NULL;

View File

@ -0,0 +1,94 @@
diff -Naur cyrus-imapd-2.3.1.orig/lib/imapoptions cyrus-imapd-2.3.1/lib/imapoptions
--- cyrus-imapd-2.3.1.orig/lib/imapoptions 2005-12-13 20:36:11.000000000 +0100
+++ cyrus-imapd-2.3.1/lib/imapoptions 2006-01-13 10:17:26.000000000 +0100
@@ -198,9 +198,12 @@
grant the user the ability to delete a mailbox. If a user has this
right, they will automatically be given the new 'x' right. */
-{ "duplicate_db", "berkeley-nosync", STRINGLIST("berkeley", "berkeley-nosync", "skiplist") }
+{ "duplicate_db", "skiplist", STRINGLIST("berkeley", "berkeley-nosync", "skiplist") }
/* The cyrusdb backend to use for the duplicate delivery suppression
- and sieve. */
+ and sieve.
+.PP
+ Note: This Invoca RPM build uses \fIskiplist\fR by default instead of
+ \fIberkeley-nosync\fR for \fBduplicate_db\fR. */
{ "duplicatesuppression", 1, SWITCH }
/* If enabled, lmtpd will suppress delivery of a message to a mailbox if
@@ -220,12 +223,15 @@
result in greater responsiveness for the client, especially when
expunging a large number of messages. */
-{ "flushseenstate", 0, SWITCH }
+{ "flushseenstate", 1, SWITCH }
/* If enabled, changes to the seen state will be flushed to disk
immediately, otherwise changes will be cached and flushed when the
mailbox is closed. This option may be used to fix the problem of
previously read messages being marked as unread in Microsoft
- Outlook, at the expense of a loss of performance/scalability. */
+ Outlook, at the expense of a loss of performance/scalability.
+.PP
+ Note: This Invoca RPM build uses \fI1\fR by default instead of
+ \fI0\fR for \fBflushseenstate\fR. */
{ "foolstupidclients", 0, SWITCH }
/* If enabled, only list the personal namespace when a LIST "*" is performed.
@@ -735,8 +741,11 @@
/* Unix domain socket that ptloader listens on.
(defaults to configdir/ptclient/ptsock) */
-{ "ptscache_db", "berkeley", STRINGLIST("berkeley", "skiplist") }
-/* The cyrusdb backend to use for the pts cache. */
+{ "ptscache_db", "skiplist", STRINGLIST("berkeley", "skiplist") }
+/* The cyrusdb backend to use for the pts cache.
+.PP
+ Note: This Invoca RPM build uses \fIskiplist\fR by default instead of
+ \fIberkeley\fR for \fBptscache_db\fR. */
{ "ptscache_timeout", 10800, INT }
/* The timeout (in seconds) for the PTS cache database when using the
@@ -813,9 +822,12 @@
{ "seenstate_db", "skiplist", STRINGLIST("flat", "berkeley", "skiplist") }
/* The cyrusdb backend to use for the seen state. */
-{ "sendmail", "/usr/lib/sendmail", STRING }
+{ "sendmail", "/usr/sbin/sendmail", STRING }
/* The pathname of the sendmail executable. Sieve invokes sendmail
- for sending rejections, redirects and vacation responses. */
+ for sending rejections, redirects and vacation responses.
+.PP
+ Note: This Invoca RPM build uses \fI/usr/sbin/sendmail\fR by default
+ instead of \fI/usr/lib/sendmail\fR for \fBsendmail\fR. */
{ "servername", NULL, STRING }
/* This is the hostname visible in the greeting messages of the POP,
@@ -842,9 +854,12 @@
/* Maximum number of sieve scripts any user may have, enforced at
submission by timsieved(8). */
-{ "sievedir", "/usr/sieve", STRING }
+{ "sievedir", "/var/lib/imap/sieve", STRING }
/* If sieveusehomedir is false, this directory is searched for Sieve
- scripts. */
+ scripts.
+.PP
+ Note: This Invoca RPM build uses \fI/var/lib/imap/sieve\fR by default
+ instead of \fI/usr/sieve\fR for \fBsievedir\fR. */
{ "sievenotifier", NULL, STRING }
/* Notifyd(8) method to use for "SIEVE" notifications. If not set, "SIEVE"
@@ -934,8 +949,11 @@
have filenames with the hashed value of the certificate (see
openssl(XXX)). */
-{ "tlscache_db", "berkeley-nosync", STRINGLIST("berkeley", "berkeley-nosync", "skiplist") }
-/* The cyrusdb backend to use for the TLS cache. */
+{ "tlscache_db", "skiplist", STRINGLIST("berkeley", "berkeley-nosync", "skiplist") }
+/* The cyrusdb backend to use for the TLS cache.
+.PP
+ Note: This Invoca RPM build uses \fIskiplist\fR by default instead of
+ \fIberkeley-nosync\fR for \fBtlscache_db\fR. */
{ "tls_cert_file", NULL, STRING }
/* File containing the certificate presented for server authentication

View File

@ -0,0 +1,18 @@
diff -Naur cyrus-imapd-2.3.1.orig/imap/make_md5.c cyrus-imapd-2.3.1/imap/make_md5.c
--- cyrus-imapd-2.3.1.orig/imap/make_md5.c 2005-12-13 16:31:08.000000000 +0100
+++ cyrus-imapd-2.3.1/imap/make_md5.c 2006-01-18 20:21:14.000000000 +0100
@@ -391,7 +391,13 @@
FILE *file;
int i;
- if ((file=fopen(name, "w")) == NULL)
+ file = fopen(name, "w");
+ if (file == NULL && errno == ENOENT) {
+ if (cyrus_mkdir(name, 0750) == 0) {
+ file = fopen(name, "w");
+ }
+ }
+ if (file == NULL)
return(IMAP_IOERROR);
for (mailbox = list->head ; mailbox ; mailbox = mailbox->next) {

View File

@ -0,0 +1,32 @@
diff -Naur cyrus-imapd-2.3.1.orig/imap/make_md5.c cyrus-imapd-2.3.1/imap/make_md5.c
--- cyrus-imapd-2.3.1.orig/imap/make_md5.c 2005-12-13 16:31:08.000000000 +0100
+++ cyrus-imapd-2.3.1/imap/make_md5.c 2006-01-16 11:27:29.000000000 +0100
@@ -811,7 +811,7 @@
if (!md5_dir) md5_dir = config_getstring(IMAPOPT_MD5_DIR);
if (!md5_dir)
- md5_dir = xstrdup("/var/imap/md5");
+ md5_dir = xstrdup("/var/lib/imap/md5");
if (((uid_file = config_getstring(IMAPOPT_MD5_USER_MAP)) != NULL) &&
((uid_fd=open(uid_file, O_RDONLY)) < 0)) {
diff -Naur cyrus-imapd-2.3.1.orig/lib/imapoptions cyrus-imapd-2.3.1/lib/imapoptions
--- cyrus-imapd-2.3.1.orig/lib/imapoptions 2005-12-13 20:36:11.000000000 +0100
+++ cyrus-imapd-2.3.1/lib/imapoptions 2006-01-16 11:26:54.000000000 +0100
@@ -527,10 +527,14 @@
mailspool, but each have their own "replicated" copy of
mailboxes.db. */
-{ "md5_dir", NULL, STRING }
+{ "md5_dir", "/var/lib/imap/md5", STRING }
/* Top level directory for MD5 store manipulated by make_md5. File
structure within this directory is one file for each user on the system,
- hashed on the first letter of the userid (e.g: /var/imap/md5/d/dpc22). */
+ hashed on the first letter of the
+ userid (e.g: /var/lib/imap/md5/d/dpc22).
+.PP
+ Note: This Invoca RPM build uses \fI/var/lib/imap/md5\fR by default
+ instead of \fI/var/imap/md5\fR for \fBmd5_dir\fR. */
{ "md5_user_map", NULL, STRING }
/* Map file (cdb) to allow partial make_md5 runs. Maps username to UID */

View File

@ -0,0 +1,20 @@
diff -Naur cyrus-imapd-2.3.1.orig/imap/sync_commit.c cyrus-imapd-2.3.1/imap/sync_commit.c
--- cyrus-imapd-2.3.1.orig/imap/sync_commit.c 2005-12-13 16:31:10.000000000 +0100
+++ cyrus-imapd-2.3.1/imap/sync_commit.c 2006-01-25 10:18:50.000000000 +0100
@@ -834,9 +834,15 @@
/* Must be atleast MAX_PARTITION_LEN + 30 for partition, need
* MAX_PARTITION_LEN + HOSTNAME_SIZE + 2 for mupdate location */
char buf[MAX_PARTITION_LEN + HOSTNAME_SIZE + 2];
+ char *mbox = name;
+ char *p;
/* Need an extra sanity check here as normal ACL logic is bypassed */
- r = mboxname_policycheck(name);
+ if (config_virtdomains && (p = strchr(name, '!'))) {
+ /* pointer to mailbox w/o domain prefix */
+ mbox = p + 1;
+ }
+ r = mboxname_policycheck(mbox);
if (r) return r;
if (!uniqueid) {

View File

@ -1,7 +1,7 @@
diff -Naur cyrus-imapd-2.2.10/imap/ctl_cyrusdb.c cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/ctl_cyrusdb.c diff -Naur cyrus-imapd-2.3.1.orig/imap/ctl_cyrusdb.c cyrus-imapd-2.3.1/imap/ctl_cyrusdb.c
--- cyrus-imapd-2.2.10/imap/ctl_cyrusdb.c 2004-07-13 05:34:20.000000000 +0300 --- cyrus-imapd-2.3.1.orig/imap/ctl_cyrusdb.c 2005-02-16 22:06:18.000000000 +0100
+++ cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/ctl_cyrusdb.c 2004-11-24 13:30:54.000000000 +0200 +++ cyrus-imapd-2.3.1/imap/ctl_cyrusdb.c 2006-01-16 11:10:56.000000000 +0100
@@ -136,7 +136,7 @@ @@ -133,7 +133,7 @@
/* if it is MBTYPE_RESERVED, unset it & call mboxlist_delete */ /* if it is MBTYPE_RESERVED, unset it & call mboxlist_delete */
if(!r && (mbtype & MBTYPE_RESERVE)) { if(!r && (mbtype & MBTYPE_RESERVE)) {
if(!r) { if(!r) {
@ -10,10 +10,10 @@ diff -Naur cyrus-imapd-2.2.10/imap/ctl_cyrusdb.c cyrus-imapd-2.2.10.rmquota+dele
if(r) { if(r) {
/* log the error */ /* log the error */
syslog(LOG_ERR, syslog(LOG_ERR,
diff -Naur cyrus-imapd-2.2.10/imap/ctl_mboxlist.c cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/ctl_mboxlist.c diff -Naur cyrus-imapd-2.3.1.orig/imap/ctl_mboxlist.c cyrus-imapd-2.3.1/imap/ctl_mboxlist.c
--- cyrus-imapd-2.2.10/imap/ctl_mboxlist.c 2004-05-22 06:45:48.000000000 +0300 --- cyrus-imapd-2.3.1.orig/imap/ctl_mboxlist.c 2005-11-23 14:41:24.000000000 +0100
+++ cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/ctl_mboxlist.c 2004-11-24 13:30:54.000000000 +0200 +++ cyrus-imapd-2.3.1/imap/ctl_mboxlist.c 2006-01-16 11:10:56.000000000 +0100
@@ -456,7 +456,7 @@ @@ -457,7 +457,7 @@
wipe_head = wipe_head->next; wipe_head = wipe_head->next;
@ -22,41 +22,41 @@ diff -Naur cyrus-imapd-2.2.10/imap/ctl_mboxlist.c cyrus-imapd-2.2.10.rmquota+del
if(ret) { if(ret) {
fprintf(stderr, "couldn't delete defunct mailbox %s\n", fprintf(stderr, "couldn't delete defunct mailbox %s\n",
me->mailbox); me->mailbox);
diff -Naur cyrus-imapd-2.2.10/imap/imapd.c cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/imapd.c diff -Naur cyrus-imapd-2.3.1.orig/imap/imapd.c cyrus-imapd-2.3.1/imap/imapd.c
--- cyrus-imapd-2.2.10/imap/imapd.c 2004-11-18 00:29:03.000000000 +0200 --- cyrus-imapd-2.3.1.orig/imap/imapd.c 2005-12-13 20:35:50.000000000 +0100
+++ cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/imapd.c 2004-11-24 13:30:54.000000000 +0200 +++ cyrus-imapd-2.3.1/imap/imapd.c 2006-01-16 11:10:56.000000000 +0100
@@ -3725,7 +3725,7 @@ @@ -4707,7 +4707,7 @@
r = mboxlist_deletemailbox(name, imapd_userisadmin, r = mboxlist_deletemailbox(name, imapd_userisadmin,
imapd_userid, imapd_authstate, imapd_userid, imapd_authstate,
- 0, 0, 0); - 0, 0, 0);
+ 0, 0, 0, 1); + 0, 0, 0, 1);
if(r) { if (!r) sync_log_mailbox(name);
prot_printf(imapd_out, "* NO delete %s: %s\r\n",
@@ -3744,6 +3744,12 @@ @@ -4731,6 +4731,12 @@
char mailboxname[MAX_MAILBOX_NAME+1];
char *p; char *p;
int domainlen = 0; int domainlen = 0;
int sync_lockfd = (-1);
+ int keepQuota = 1; + int keepQuota = 1;
+ +
+ if(name && *name == '+') { + if(name && *name == '+') {
+ keepQuota = 0; + keepQuota = 0;
+ name++; + name++;
+ } + }
r = (*imapd_namespace.mboxname_tointernal)(&imapd_namespace, name, r = (*imapd_namespace.mboxname_tointernal)(&imapd_namespace, name,
imapd_userid, mailboxname); imapd_userid, mailboxname);
@@ -3754,7 +3760,7 @@ @@ -4789,7 +4795,7 @@
r = mboxlist_deletemailbox(mailboxname, imapd_userisadmin, r = mboxlist_deletemailbox(mailboxname, imapd_userisadmin,
imapd_userid, imapd_authstate, 1, imapd_userid, imapd_authstate, 1-force,
- localonly, 0); - localonly, 0);
+ localonly, 0, keepQuota); + localonly, 0, keepQuota);
} }
/* was it a top-level user mailbox? */ /* was it a top-level user mailbox? */
@@ -4715,6 +4721,7 @@ @@ -6149,6 +6155,7 @@
{ {
int newquota = -1; int newquota = -1;
int badresource = 0; int badresource = 0;
@ -64,7 +64,7 @@ diff -Naur cyrus-imapd-2.2.10/imap/imapd.c cyrus-imapd-2.2.10.rmquota+deletemail
int c; int c;
int force = 0; int force = 0;
static struct buf arg; static struct buf arg;
@@ -4729,7 +4736,8 @@ @@ -6165,7 +6172,8 @@
if (c != ')' || arg.s[0] != '\0') { if (c != ')' || arg.s[0] != '\0') {
for (;;) { for (;;) {
if (c != ' ') goto badlist; if (c != ' ') goto badlist;
@ -74,19 +74,19 @@ diff -Naur cyrus-imapd-2.2.10/imap/imapd.c cyrus-imapd-2.2.10.rmquota+deletemail
c = getword(imapd_in, &arg); c = getword(imapd_in, &arg);
if (c != ' ' && c != ')') goto badlist; if (c != ' ' && c != ')') goto badlist;
if (arg.s[0] == '\0') goto badlist; if (arg.s[0] == '\0') goto badlist;
@@ -4766,7 +4774,10 @@ @@ -6234,7 +6242,10 @@
imapd_userid, mailboxname); quotaroot++;
if (!r) {
- r = mboxlist_setquota(mailboxname, newquota, force);
+ if(!rmquota)
+ r = mboxlist_setquota(mailboxname, newquota, force);
+ else
+ r = mboxlist_unsetquota(mailboxname);
} }
- r = mboxlist_setquota(mailboxname, newquota, force);
+ if(!rmquota)
+ r = mboxlist_setquota(mailboxname, newquota, force);
+ else
+ r = mboxlist_unsetquota(mailboxname);
} }
@@ -6413,7 +6424,7 @@ imapd_check(NULL, 0, 0);
@@ -7931,7 +7942,7 @@
/* note also that we need to remember to let proxyadmins do this */ /* note also that we need to remember to let proxyadmins do this */
r = mboxlist_deletemailbox(mailboxname, r = mboxlist_deletemailbox(mailboxname,
imapd_userisadmin || imapd_userisproxyadmin, imapd_userisadmin || imapd_userisproxyadmin,
@ -95,10 +95,10 @@ diff -Naur cyrus-imapd-2.2.10/imap/imapd.c cyrus-imapd-2.2.10.rmquota+deletemail
if(r) syslog(LOG_ERR, if(r) syslog(LOG_ERR,
"Could not delete local mailbox during move of %s", "Could not delete local mailbox during move of %s",
mailboxname); mailboxname);
diff -Naur cyrus-imapd-2.2.10/imap/mailbox.c cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/mailbox.c diff -Naur cyrus-imapd-2.3.1.orig/imap/mailbox.c cyrus-imapd-2.3.1/imap/mailbox.c
--- cyrus-imapd-2.2.10/imap/mailbox.c 2004-05-22 06:45:51.000000000 +0300 --- cyrus-imapd-2.3.1.orig/imap/mailbox.c 2005-11-10 07:04:55.000000000 +0100
+++ cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/mailbox.c 2004-11-24 13:30:54.000000000 +0200 +++ cyrus-imapd-2.3.1/imap/mailbox.c 2006-01-16 11:10:56.000000000 +0100
@@ -2117,27 +2117,7 @@ @@ -2622,27 +2622,7 @@
seen_delete_mailbox(mailbox); seen_delete_mailbox(mailbox);
@ -117,7 +117,7 @@ diff -Naur cyrus-imapd-2.2.10/imap/mailbox.c cyrus-imapd-2.2.10.rmquota+deletema
- r = quota_write(&mailbox->quota, &tid); - r = quota_write(&mailbox->quota, &tid);
- if (r) { - if (r) {
- syslog(LOG_ERR, - syslog(LOG_ERR,
- "LOSTQUOTA: unable to record free of %lu bytes in quota %s", - "LOSTQUOTA: unable to record free of " UQUOTA_T_FMT " bytes in quota %s",
- mailbox->quota_mailbox_used, mailbox->quota.root); - mailbox->quota_mailbox_used, mailbox->quota.root);
- } - }
- else - else
@ -125,9 +125,9 @@ diff -Naur cyrus-imapd-2.2.10/imap/mailbox.c cyrus-imapd-2.2.10.rmquota+deletema
- } - }
+ mailbox_updatequota(mailbox,NULL); + mailbox_updatequota(mailbox,NULL);
/* remove all files in directory */ /* remove data (message file) directory */
strlcpy(buf, mailbox->path, sizeof(buf)); path = mailbox->path;
@@ -2751,3 +2731,49 @@ @@ -3263,3 +3243,49 @@
if (*p == '.') *p = '/'; if (*p == '.') *p = '/';
} }
} }
@ -166,7 +166,7 @@ diff -Naur cyrus-imapd-2.2.10/imap/mailbox.c cyrus-imapd-2.2.10.rmquota+deletema
+ mailbox->quota_mailbox_used, mailbox->quota.root); + mailbox->quota_mailbox_used, mailbox->quota.root);
+ } + }
+ else if(!havetid) + else if(!havetid)
+ quota_commit(&tid); + quota_commit(tid);
+ } + }
+ /* It is not a big mistake not to have quota .. just remove from the mailbox */ + /* It is not a big mistake not to have quota .. just remove from the mailbox */
+ else if ( r == IMAP_QUOTAROOT_NONEXISTENT) { + else if ( r == IMAP_QUOTAROOT_NONEXISTENT) {
@ -177,21 +177,21 @@ diff -Naur cyrus-imapd-2.2.10/imap/mailbox.c cyrus-imapd-2.2.10.rmquota+deletema
+ return r; + return r;
+} +}
+ +
diff -Naur cyrus-imapd-2.2.10/imap/mailbox.h cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/mailbox.h diff -Naur cyrus-imapd-2.3.1.orig/imap/mailbox.h cyrus-imapd-2.3.1/imap/mailbox.h
--- cyrus-imapd-2.2.10/imap/mailbox.h 2004-01-22 23:17:09.000000000 +0200 --- cyrus-imapd-2.3.1.orig/imap/mailbox.h 2005-05-27 19:40:54.000000000 +0200
+++ cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/mailbox.h 2004-11-24 13:30:54.000000000 +0200 +++ cyrus-imapd-2.3.1/imap/mailbox.h 2006-01-16 11:10:56.000000000 +0100
@@ -305,6 +305,8 @@ @@ -329,6 +329,8 @@
struct mailbox *mailboxp); struct mailbox *mailboxp);
extern int mailbox_delete(struct mailbox *mailbox, int delete_quota_root); extern int mailbox_delete(struct mailbox *mailbox, int delete_quota_root);
+extern int mailbox_updatequota(struct mailbox *mailbox, struct txn **tid); +extern int mailbox_updatequota(struct mailbox *mailbox, struct txn **tid);
+ +
extern int mailbox_rename_copy(struct mailbox *oldmailbox, extern int mailbox_rename_copy(struct mailbox *oldmailbox,
const char *newname, char *newpath, const char *newname, char *newpartition,
bit32 *olduidvalidityp, bit32 *newuidvalidityp, bit32 *olduidvalidityp, bit32 *newuidvalidityp,
diff -Naur cyrus-imapd-2.2.10/imap/mboxlist.c cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/mboxlist.c diff -Naur cyrus-imapd-2.3.1.orig/imap/mboxlist.c cyrus-imapd-2.3.1/imap/mboxlist.c
--- cyrus-imapd-2.2.10/imap/mboxlist.c 2004-07-26 21:08:03.000000000 +0300 --- cyrus-imapd-2.3.1.orig/imap/mboxlist.c 2005-12-13 20:36:03.000000000 +0100
+++ cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/mboxlist.c 2004-11-24 13:30:54.000000000 +0200 +++ cyrus-imapd-2.3.1/imap/mboxlist.c 2006-01-16 11:10:56.000000000 +0100
@@ -93,6 +93,11 @@ @@ -93,6 +93,11 @@
static int mboxlist_opensubs(); static int mboxlist_opensubs();
static void mboxlist_closesubs(); static void mboxlist_closesubs();
@ -212,7 +212,7 @@ diff -Naur cyrus-imapd-2.2.10/imap/mboxlist.c cyrus-imapd-2.2.10.rmquota+deletem
struct txn **tid; struct txn **tid;
}; };
@@ -893,9 +899,9 @@ @@ -891,9 +897,9 @@
*/ */
int mboxlist_deletemailbox(const char *name, int isadmin, char *userid, int mboxlist_deletemailbox(const char *name, int isadmin, char *userid,
struct auth_state *auth_state, int checkacl, struct auth_state *auth_state, int checkacl,
@ -224,15 +224,15 @@ diff -Naur cyrus-imapd-2.2.10/imap/mboxlist.c cyrus-imapd-2.2.10.rmquota+deletem
char *acl; char *acl;
long access; long access;
struct mailbox mailbox; struct mailbox mailbox;
@@ -907,6 +913,7 @@ @@ -904,6 +910,7 @@
int deleteright = get_deleteright(); int mbtype;
const char *p; const char *p;
mupdate_handle *mupdate_h = NULL; mupdate_handle *mupdate_h = NULL;
+ char *quotaroot = NULL; + char *quotaroot = NULL;
if(!isadmin && force) return IMAP_PERMISSION_DENIED; if(!isadmin && force) return IMAP_PERMISSION_DENIED;
@@ -1018,13 +1025,44 @@ @@ -1016,13 +1023,44 @@
if ((r && !force) || isremote) goto done; if ((r && !force) || isremote) goto done;
@ -268,7 +268,7 @@ diff -Naur cyrus-imapd-2.2.10/imap/mboxlist.c cyrus-imapd-2.2.10.rmquota+deletem
+ auth_state, child_cb, (void *) &has_children); + auth_state, child_cb, (void *) &has_children);
+ +
+ if(!has_children) + if(!has_children)
+ if(!mboxlist_mylookup(quotaroot, NULL, NULL, NULL, NULL, NULL, 0 )) + if(!mboxlist_mylookup(quotaroot, NULL, NULL, NULL, NULL, NULL, NULL, 0 ))
+ has_children = 1; + has_children = 1;
+ } + }
+ /* If we want to remove the quota explicitely or the quota root folder has no subfolders + /* If we want to remove the quota explicitely or the quota root folder has no subfolders
@ -279,7 +279,7 @@ diff -Naur cyrus-imapd-2.2.10/imap/mboxlist.c cyrus-imapd-2.2.10.rmquota+deletem
} }
done: done:
@@ -2357,6 +2395,7 @@ @@ -2478,6 +2516,7 @@
if (r) return r; if (r) return r;
crock.quota = &quota; crock.quota = &quota;
@ -287,7 +287,7 @@ diff -Naur cyrus-imapd-2.2.10/imap/mboxlist.c cyrus-imapd-2.2.10.rmquota+deletem
crock.tid = &tid; crock.tid = &tid;
/* top level mailbox */ /* top level mailbox */
if(have_mailbox) if(have_mailbox)
@@ -2375,17 +2414,21 @@ @@ -2496,17 +2535,21 @@
*/ */
int mboxlist_unsetquota(const char *root) int mboxlist_unsetquota(const char *root)
{ {
@ -311,7 +311,7 @@ diff -Naur cyrus-imapd-2.2.10/imap/mboxlist.c cyrus-imapd-2.2.10.rmquota+deletem
if (r == IMAP_QUOTAROOT_NONEXISTENT) { if (r == IMAP_QUOTAROOT_NONEXISTENT) {
/* already unset */ /* already unset */
return 0; return 0;
@@ -2402,13 +2445,45 @@ @@ -2523,13 +2566,45 @@
} }
else else
strlcat(pattern, ".*", sizeof(pattern)); strlcat(pattern, ".*", sizeof(pattern));
@ -363,7 +363,7 @@ diff -Naur cyrus-imapd-2.2.10/imap/mboxlist.c cyrus-imapd-2.2.10.rmquota+deletem
return r; return r;
} }
@@ -2506,6 +2581,7 @@ @@ -2627,6 +2702,7 @@
struct mailbox mailbox; struct mailbox mailbox;
struct change_rock *crock = (struct change_rock *) rock; struct change_rock *crock = (struct change_rock *) rock;
struct quota *mboxlist_newquota = crock->quota; struct quota *mboxlist_newquota = crock->quota;
@ -371,7 +371,7 @@ diff -Naur cyrus-imapd-2.2.10/imap/mboxlist.c cyrus-imapd-2.2.10.rmquota+deletem
struct txn **tid = crock->tid; struct txn **tid = crock->tid;
assert(rock != NULL); assert(rock != NULL);
@@ -2523,27 +2599,24 @@ @@ -2644,27 +2720,24 @@
if (r) goto error; if (r) goto error;
if (mailbox.quota.root) { if (mailbox.quota.root) {
@ -385,39 +385,36 @@ diff -Naur cyrus-imapd-2.2.10/imap/mboxlist.c cyrus-imapd-2.2.10.rmquota+deletem
- if (r) goto error; - if (r) goto error;
- if (mailbox.quota.used >= mailbox.quota_mailbox_used) { - if (mailbox.quota.used >= mailbox.quota_mailbox_used) {
- mailbox.quota.used -= mailbox.quota_mailbox_used; - mailbox.quota.used -= mailbox.quota_mailbox_used;
- } + if(mboxlist_oldquota) {
- else { + if (strlen(mailbox.quota.root) > strlen(mboxlist_oldquota->root)) {
+ /* Part of a child quota root */
+ mailbox_close(&mailbox);
+ return 0;
+ }
}
else {
- mailbox.quota.used = 0; - mailbox.quota.used = 0;
- } - }
- r = quota_write(&mailbox.quota, tid); - r = quota_write(&mailbox.quota, tid);
- if (r) { - if (r) {
- syslog(LOG_ERR, - syslog(LOG_ERR,
- "LOSTQUOTA: unable to record free of %lu bytes in quota %s", - "LOSTQUOTA: unable to record free of " UQUOTA_T_FMT " bytes in quota %s",
- mailbox.quota_mailbox_used, mailbox.quota.root); - mailbox.quota_mailbox_used, mailbox.quota.root);
- } + if (strlen(mailbox.quota.root) >= strlen(mboxlist_newquota->root)) {
+ /* Part of a child quota root */
+ mailbox_close(&mailbox);
+ return 0;
+ }
}
- free(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); + r = mailbox_updatequota(&mailbox,tid);
+ if (r) + if (r)
+ goto error; + goto error;
} }
mailbox.quota.root = xstrdup(mboxlist_newquota->root); mailbox.quota.root = xstrdup(mboxlist_newquota->root);
@@ -2553,18 +2626,24 @@ @@ -2674,18 +2747,24 @@
mboxlist_newquota->used += mailbox.quota_mailbox_used; mboxlist_newquota->used += mailbox.quota_mailbox_used;
mailbox_close(&mailbox); mailbox_close(&mailbox);
return 0; return 0;
@ -444,10 +441,10 @@ diff -Naur cyrus-imapd-2.2.10/imap/mboxlist.c cyrus-imapd-2.2.10.rmquota+deletem
/* must be called after cyrus_init */ /* must be called after cyrus_init */
void mboxlist_init(int myflags) void mboxlist_init(int myflags)
{ {
diff -Naur cyrus-imapd-2.2.10/imap/mboxlist.h cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/mboxlist.h diff -Naur cyrus-imapd-2.3.1.orig/imap/mboxlist.h cyrus-imapd-2.3.1/imap/mboxlist.h
--- cyrus-imapd-2.2.10/imap/mboxlist.h 2004-03-17 20:07:49.000000000 +0200 --- cyrus-imapd-2.3.1.orig/imap/mboxlist.h 2005-02-21 20:25:40.000000000 +0100
+++ cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/mboxlist.h 2004-11-24 13:30:54.000000000 +0200 +++ cyrus-imapd-2.3.1/imap/mboxlist.h 2006-01-16 11:10:56.000000000 +0100
@@ -122,7 +122,7 @@ @@ -125,7 +125,7 @@
* the planet */ * the planet */
int mboxlist_deletemailbox(const char *name, int isadmin, char *userid, int mboxlist_deletemailbox(const char *name, int isadmin, char *userid,
struct auth_state *auth_state, int checkacl, struct auth_state *auth_state, int checkacl,
@ -456,10 +453,10 @@ diff -Naur cyrus-imapd-2.2.10/imap/mboxlist.h cyrus-imapd-2.2.10.rmquota+deletem
/* Rename/move a mailbox (hierarchical) */ /* Rename/move a mailbox (hierarchical) */
int mboxlist_renamemailbox(char *oldname, char *newname, char *partition, int mboxlist_renamemailbox(char *oldname, char *newname, char *partition,
diff -Naur cyrus-imapd-2.2.10/imap/mupdate.c cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/mupdate.c diff -Naur cyrus-imapd-2.3.1.orig/imap/mupdate.c cyrus-imapd-2.3.1/imap/mupdate.c
--- cyrus-imapd-2.2.10/imap/mupdate.c 2004-05-29 08:18:21.000000000 +0300 --- cyrus-imapd-2.3.1.orig/imap/mupdate.c 2005-11-04 14:34:23.000000000 +0100
+++ cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/mupdate.c 2004-11-24 13:30:54.000000000 +0200 +++ cyrus-imapd-2.3.1/imap/mupdate.c 2006-01-16 11:10:56.000000000 +0100
@@ -2191,7 +2191,7 @@ @@ -2297,7 +2297,7 @@
remote_boxes.head = r->next; remote_boxes.head = r->next;
} else if (ret < 0) { } else if (ret < 0) {
/* Local without corresponding remote, delete it */ /* Local without corresponding remote, delete it */
@ -468,7 +465,7 @@ diff -Naur cyrus-imapd-2.2.10/imap/mupdate.c cyrus-imapd-2.2.10.rmquota+deletema
local_boxes.head = l->next; local_boxes.head = l->next;
} else /* (ret > 0) */ { } else /* (ret > 0) */ {
/* Remote without corresponding local, insert it */ /* Remote without corresponding local, insert it */
@@ -2206,7 +2206,7 @@ @@ -2312,7 +2312,7 @@
if(l && !r) { if(l && !r) {
/* we have more deletes to do */ /* we have more deletes to do */
while(l) { while(l) {
@ -477,15 +474,75 @@ diff -Naur cyrus-imapd-2.2.10/imap/mupdate.c cyrus-imapd-2.2.10.rmquota+deletema
local_boxes.head = l->next; local_boxes.head = l->next;
l = local_boxes.head; l = local_boxes.head;
} }
diff -Naur cyrus-imapd-2.2.10/imap/nntpd.c cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/nntpd.c diff -Naur cyrus-imapd-2.3.1.orig/imap/nntpd.c cyrus-imapd-2.3.1/imap/nntpd.c
--- cyrus-imapd-2.2.10/imap/nntpd.c 2004-09-09 19:21:26.000000000 +0300 --- cyrus-imapd-2.3.1.orig/imap/nntpd.c 2005-12-13 20:36:06.000000000 +0100
+++ cyrus-imapd-2.2.10.rmquota+deletemailbox.uncompiled/imap/nntpd.c 2004-11-24 13:30:54.000000000 +0200 +++ cyrus-imapd-2.3.1/imap/nntpd.c 2006-01-16 11:10:56.000000000 +0100
@@ -3234,7 +3234,7 @@ @@ -3342,7 +3342,7 @@
/* XXX should we delete right away, or wait until empty? */ /* XXX should we delete right away, or wait until empty? */
r = mboxlist_deletemailbox(mailboxname, 0, r = mboxlist_deletemailbox(mailboxname, 0,
- newsmaster, newsmaster_authstate, 1, 0, 0); - newsmaster, newsmaster_authstate, 1, 0, 0);
+ newsmaster, newsmaster_authstate, 1, 0, 0, 1); + newsmaster, newsmaster_authstate, 1, 0, 0, 1);
return r; if (!r) sync_log_mailbox(mailboxname);
}
diff -Naur cyrus-imapd-2.3.1.orig/imap/sync_reset.c cyrus-imapd-2.3.1/imap/sync_reset.c
--- cyrus-imapd-2.3.1.orig/imap/sync_reset.c 2005-12-13 16:31:10.000000000 +0100
+++ cyrus-imapd-2.3.1/imap/sync_reset.c 2006-01-16 11:12:34.000000000 +0100
@@ -254,7 +254,7 @@
if (r) goto fail;
for (item = list->head ; item ; item = item->next) {
- r=mboxlist_deletemailbox(item->name, 1, NULL, sync_authstate, 1, 0, 0);
+ r=mboxlist_deletemailbox(item->name, 1, NULL, sync_authstate, 1, 0, 0, 1);
if (r) goto fail;
}
@@ -270,7 +270,7 @@
if (r) goto fail;
for (item = list->head ; item ; item = item->next) {
- r=mboxlist_deletemailbox(item->name, 1, NULL, sync_authstate, 1, 0, 0);
+ r=mboxlist_deletemailbox(item->name, 1, NULL, sync_authstate, 1, 0, 0, 1);
if (r) goto fail;
}
@@ -278,7 +278,7 @@
/* Nuke inbox (recursive nuke possible?) */
snprintf(buf, sizeof(buf)-1, "user.%s", user);
- r = mboxlist_deletemailbox(buf, 1, "cyrus", sync_authstate, 1, 0, 0);
+ r = mboxlist_deletemailbox(buf, 1, "cyrus", sync_authstate, 1, 0, 0, 1);
if (r && (r != IMAP_MAILBOX_NONEXISTENT)) goto fail;
if ((r=user_deletedata(user, sync_userid, sync_authstate, 1)))
diff -Naur cyrus-imapd-2.3.1.orig/imap/sync_server.c cyrus-imapd-2.3.1/imap/sync_server.c
--- cyrus-imapd-2.3.1.orig/imap/sync_server.c 2005-12-20 16:54:43.000000000 +0100
+++ cyrus-imapd-2.3.1/imap/sync_server.c 2006-01-16 11:13:02.000000000 +0100
@@ -1569,7 +1569,7 @@
for (item = list->head ; item ; item = item->next) {
r=mboxlist_deletemailbox(item->name, sync_userisadmin, sync_userid,
- sync_authstate, 0, 0, 1);
+ sync_authstate, 0, 0, 1, 1);
if (r) goto fail;
}
@@ -1579,7 +1579,7 @@
(sync_namespacep->mboxname_tointernal)(sync_namespacep, "INBOX",
user, buf);
r = mboxlist_deletemailbox(buf, sync_userisadmin, sync_userid,
- sync_authstate, 0, 0, 1);
+ sync_authstate, 0, 0, 1, 1);
if (r && (r != IMAP_MAILBOX_NONEXISTENT)) goto fail;
if ((r=user_deletedata(user, sync_userid, sync_authstate, 1)))
@@ -2501,7 +2501,7 @@
/* Delete with admin priveleges */
r = mboxlist_deletemailbox(name, sync_userisadmin, sync_userid,
- sync_authstate, 0, 0, 1);
+ sync_authstate, 0, 0, 1, 1);
if (r)
prot_printf(sync_out, "NO Failed to delete %s: %s\r\n",

Binary file not shown.

View File

@ -7,7 +7,7 @@ This is a _very_ 'quick and dirty' install howto.
The following steps should lead you to a running Cyrus IMAP server: The following steps should lead you to a running Cyrus IMAP server:
1) Install on a distribution which is supported by this RPM. Don't install 1) Install on a distribution which is supported by this RPM. Don't install
on a dirty system, where you have previously tried to install from source. on a dirty system, where you have previously installed from source.
2) Don't install if you have a previous Cyrus IMAPd installation <=2.1.x on 2) Don't install if you have a previous Cyrus IMAPd installation <=2.1.x on
your box. Upgrading any Invoca rpm based installation should be fine. your box. Upgrading any Invoca rpm based installation should be fine.
3) Make sure you understand that this RPM installs in FHS compliant 3) Make sure you understand that this RPM installs in FHS compliant
@ -17,7 +17,8 @@ The following steps should lead you to a running Cyrus IMAP server:
needed and do 'chkconfig saslauthd on ; service saslauthd start' needed and do 'chkconfig saslauthd on ; service saslauthd start'
6) Install the cyrus-imapd RPMs. 6) Install the cyrus-imapd RPMs.
7) If it's your first install of Cyrus IMAPd, then set a password for the 7) If it's your first install of Cyrus IMAPd, then set a password for the
cyrus user in whatever database you are using to authenticate. cyrus user in whatever database you are using to authenticate. When
using a local account, this should be 'passwd cyrus'.
8) Make sure your MTA delivers to Cyrus IMAPd, I recommend LMTP for this. 8) Make sure your MTA delivers to Cyrus IMAPd, I recommend LMTP for this.
9) Start Cyrus IMAPd with 'service cyrus-imapd start' 9) Start Cyrus IMAPd with 'service cyrus-imapd start'
10) Run cyradm and create a user. Usually it's something like this: 10) Run cyradm and create a user. Usually it's something like this:
@ -30,4 +31,7 @@ The following steps should lead you to a running Cyrus IMAP server:
info priority with something like 'mail.info /var/log/maillog' in info priority with something like 'mail.info /var/log/maillog' in
/etc/syslog.conf. /etc/syslog.conf.
Read the file "README.buildoptions" in this directory to find out which
build time options have been used to build this package.
Enjoy! Enjoy!

View File

@ -0,0 +1,21 @@
From http://article.gmane.org/gmane.mail.imap.cyrus/18840
We have also seen skiplist corruption in seen databases. I don't have a
recovery tool, but I have been able to manually recover seen db's to the
point of corruption so that at least most of the users mails are in the
correct 'read' state. Typically, you will see errors like:
DBERROR: skiplist recovery /usr/local/imap/user/k/kdelaney.seen: 0D2C
should be ADD or DELETE
If you truncate the file at this point, it should fix the problem, and
the users mail read state will be valid upto the point of corruption.
To do this, convert the hex to decimal (above would be 1372) and use the
dd command:
dd if=kdelaney.seen of=kdelaney.seen.fixed bs=1 count=1372
replace the corrupted .seen file with the fixed one and have user log in
and should be ok.
Seems to work on the couple I have tried it on.

View File

@ -1,7 +0,0 @@
CONFIG_DB_DUPLICATE=berkeley
CONFIG_DB_MBOX=skiplist
CONFIG_DB_SEEN=skiplist
CONFIG_DB_SUBS=flat
CONFIG_DB_TLS=berkeley
CONFIG_DB_ANNOTATION=skiplist
CONFIG_DB_SIEVE=2.2.3

View File

@ -1,18 +0,0 @@
--- cyrus-imapd-2.2.10/tools/config2header.orig 2005-03-04 17:18:04.519026273 -0500
+++ cyrus-imapd-2.2.10/tools/config2header 2005-03-04 17:19:45.234962450 -0500
@@ -214,7 +214,6 @@
print HFILE <<EOF
IMAPOPT_LAST
};
-extern struct imapopt_s imapopts[];
enum enum_value {
IMAP_ENUM_ZERO = 0,
@@ -260,6 +259,7 @@
print HFILE <<EOF
};
+extern struct imapopt_s imapopts[];
#endif /* INCLUDED_IMAPOPTIONS_H */
EOF
;

View File

@ -70,6 +70,35 @@
# #
# v1.0.12, Dec 16 2004 Simon Matter <simon.matter@invoca.ch> # v1.0.12, Dec 16 2004 Simon Matter <simon.matter@invoca.ch>
# - use runuser instead of su if available # - use runuser instead of su if available
#
# v1.0.13, Jul 15 2005 Simon Matter <simon.matter@invoca.ch>
# - don't use flat in the two step conversion, use skiplist instead
#
# v1.0.14, Jul 18 2005 Simon Matter <simon.matter@invoca.ch>
# - replace the order of the magic files in the file call to make
# sure skiplist is detected correctly.
#
# v1.0.15, Aug 17 2005 Simon Matter <simon.matter@invoca.ch>
# - add functionality to export all berkeley db files to skiplist
#
# v1.1.0, Aug 18 2005 Simon Matter <simon.matter@invoca.ch>
# - fix export functionality, try to recover Berkeley databases
# as much as possible before any conversion.
#
# v1.1.1, Dec 05 2005 Simon Matter <simon.matter@invoca.ch>
# - run db_checkpoint in background with a timeout to prevent
# that cyrus-imapd doesn't start at all if it hangs.
#
# v1.1.2, Dec 06 2005 Simon Matter <simon.matter@invoca.ch>
# - make handling of db_checkpoint more robust
#
# v1.2.0, Jan 12 2006 Simon Matter <simon.matter@invoca.ch>
# - adopt for cyrus-imapd-2.3
#
# v1.2.1, Jan 13 2006 Simon Matter <simon.matter@invoca.ch>
# - code cleanup
VERSION=1.2.1
if [ -n "$(/sbin/pidof cyrus-master)" ]; then if [ -n "$(/sbin/pidof cyrus-master)" ]; then
echo "ERROR: cyrus-master is running, unable to convert mailboxes!" echo "ERROR: cyrus-master is running, unable to convert mailboxes!"
@ -90,12 +119,18 @@ fi
# force cyrus user for security reasons # force cyrus user for security reasons
if [ ! $(whoami) = "cyrus" ]; then if [ ! $(whoami) = "cyrus" ]; then
exec $RUNUSER - cyrus -c "cd $PWD < /dev/null ; $0" exec $RUNUSER - cyrus -c "cd $PWD < /dev/null ; $0 $*"
fi fi
# special function for migration
EXPORT=$1
# files get mode 0600 # files get mode 0600
umask 166 umask 166
# show version info in log files
echo "cvt_cyrusdb_all version: $VERSION"
# get_config [config default] # get_config [config default]
# extracts config option from config file # extracts config option from config file
get_config() { get_config() {
@ -107,13 +142,16 @@ get_config() {
} }
# where to find files and directories # where to find files and directories
data_dir=/usr/share/cyrus-imapd/rpm
lib_dir=/usr/lib/cyrus-imapd
system_magic=$(file --version | awk '/magic file/ {print $4}') system_magic=$(file --version | awk '/magic file/ {print $4}')
cyrus_magic=/usr/share/cyrus-imapd/rpm/magic cyrus_magic=${data_dir}/magic
cvt_cyrusdb=/usr/lib/cyrus-imapd/cvt_cyrusdb cvt_cyrusdb=${lib_dir}/cvt_cyrusdb
sievec=/usr/lib/cyrus-imapd/sievec sievec=${lib_dir}/sievec
masssievec=${lib_dir}/masssievec
imap_prefix=$(get_config configdirectory /var/lib/imap) imap_prefix=$(get_config configdirectory /var/lib/imap)
sieve_dir=$(get_config sievedir /var/lib/imap/sieve) sieve_dir=$(get_config sievedir /var/lib/imap/sieve)
db_cfg=/usr/share/cyrus-imapd/rpm/db.cfg db_cfg=${data_dir}/db.cfg
db_current=${imap_prefix}/rpm/db.cfg.current db_current=${imap_prefix}/rpm/db.cfg.current
db_cache=${imap_prefix}/rpm/db.cfg.cache db_cache=${imap_prefix}/rpm/db.cfg.cache
@ -121,27 +159,33 @@ db_cache=${imap_prefix}/rpm/db.cfg.cache
. $db_cfg . $db_cfg
# get configured db backend config # get configured db backend config
CONFIG_DB_DUPLICATE=$(get_config duplicate_db $CONFIG_DB_DUPLICATE) duplicate_db=$(get_config duplicate_db $duplicate_db)
CONFIG_DB_MBOX=$(get_config mboxlist_db $CONFIG_DB_MBOX) mboxlist_db=$(get_config mboxlist_db $mboxlist_db)
CONFIG_DB_SEEN=$(get_config seenstate_db $CONFIG_DB_SEEN) seenstate_db=$(get_config seenstate_db $seenstate_db)
CONFIG_DB_SUBS=$(get_config subscription_db $CONFIG_DB_SUBS) subscription_db=$(get_config subscription_db $subscription_db)
CONFIG_DB_TLS=$(get_config tlscache_db $CONFIG_DB_TLS) tlscache_db=$(get_config tlscache_db $tlscache_db)
CONFIG_DB_ANNOTATION=$(get_config annotation_db $CONFIG_DB_ANNOTATION) annotation_db=$(get_config annotation_db $annotation_db)
mboxkey_db=$(get_config mboxkey_db $mboxkey_db)
ptscache_db=$(get_config ptscache_db $ptscache_db)
quota_db=$(get_config quota_db $quota_db)
# remember current db backend config # remember current db backend config
{ {
echo "CONFIG_DB_DUPLICATE=$CONFIG_DB_DUPLICATE" echo "duplicate_db=$duplicate_db"
echo "CONFIG_DB_MBOX=$CONFIG_DB_MBOX" echo "mboxlist_db=$mboxlist_db"
echo "CONFIG_DB_SEEN=$CONFIG_DB_SEEN" echo "seenstate_db=$seenstate_db"
echo "CONFIG_DB_SUBS=$CONFIG_DB_SUBS" echo "subscription_db=$subscription_db"
echo "CONFIG_DB_TLS=$CONFIG_DB_TLS" echo "tlscache_db=$tlscache_db"
echo "CONFIG_DB_ANNOTATION=$CONFIG_DB_ANNOTATION" echo "annotation_db=$annotation_db"
echo "CONFIG_DB_SIEVE=$CONFIG_DB_SIEVE" echo "mboxkey_db=$mboxkey_db"
} > $db_current echo "ptscache_db=$ptscache_db"
echo "quota_db=$quota_db"
echo "sieve_version=$sieve_version"
} | sort > $db_current
# file_type [file] # file_type [file]
file_type() { file_type() {
this_type=$(file -b -m "$system_magic:$cyrus_magic" "$1" 2> /dev/null) this_type=$(file -b -m "$cyrus_magic:$system_magic" "$1" 2> /dev/null)
if echo "$this_type" | grep -qi skip > /dev/null 2>&1; then if echo "$this_type" | grep -qi skip > /dev/null 2>&1; then
echo skiplist echo skiplist
elif echo "$this_type" | grep -qi text > /dev/null 2>&1; then elif echo "$this_type" | grep -qi text > /dev/null 2>&1; then
@ -160,32 +204,32 @@ cvt_file() {
if [ ! "$old_db" = "$new_db" ]; then if [ ! "$old_db" = "$new_db" ]; then
# The two-step conversion is paranoia against the filenames being encoded # The two-step conversion is paranoia against the filenames being encoded
# inside the database or logfiles (berkeley does this, for example). # inside the database or logfiles (berkeley does this, for example).
rm -f "${target}.flat" rm -f "${target}.skiplist"
if [ "$old_db" = "flat" ]; then if [ "$old_db" = "skiplist" ]; then
cp -a "$target" "${target}.flat" cp -a "$target" "${target}.skiplist"
else else
$cvt_cyrusdb "$target" "$old_db" "${target}.flat" flat $cvt_cyrusdb "$target" "$old_db" "${target}.skiplist" skiplist
fi fi
RETVAL=$? RETVAL=$?
ERRVAL=$[ $ERRVAL + $RETVAL ] ERRVAL=$[ $ERRVAL + $RETVAL ]
if [ $RETVAL -eq 0 ]; then if [ $RETVAL -eq 0 ]; then
rm -f "$target" rm -f "$target"
if [ -s "${target}.flat" ]; then if [ -s "${target}.skiplist" ]; then
if [ "$new_db" = "flat" ]; then if [ "$new_db" = "skiplist" ]; then
cp -a "${target}.flat" "$target" cp -a "${target}.skiplist" "$target"
else else
$cvt_cyrusdb "${target}.flat" flat "$target" "$new_db" $cvt_cyrusdb "${target}.skiplist" skiplist "$target" "$new_db"
fi fi
fi fi
RETVAL=$? RETVAL=$?
ERRVAL=$[ $ERRVAL + $RETVAL ] ERRVAL=$[ $ERRVAL + $RETVAL ]
if [ $RETVAL -eq 0 ]; then if [ $RETVAL -eq 0 ]; then
rm -f "${target}.flat" rm -f "${target}.skiplist"
else else
echo "ERROR: unable to convert ${target}.flat from flat to $new_db" echo "ERROR: unable to convert ${target}.skiplist from skiplist to $new_db"
fi fi
else else
echo "ERROR: unable to convert $target from $old_db to flat" echo "ERROR: unable to convert $target from $old_db to skiplist"
fi fi
fi fi
fi fi
@ -211,27 +255,77 @@ cvt_to_utf8() {
ERRVAL=0 ERRVAL=0
# do we need to convert databases ? # make sure our Berkeley databases are in a sane state
if ! cmp -s $db_current $db_cache; then # wait for db_checkpoint to end successfully or kill it after a timeout
# we treat sieve scripts the same way like db files db_checkpoint -v -1 -h $imap_prefix/db &
find ${sieve_dir}/ -name "*.script" -type f | while read db_file trash; do DB_CHECK_PID=$!
cvt_to_utf8 "$db_file" CNT=0
done while [ $CNT -lt 60 ]; do
/usr/lib/cyrus-imapd/masssievec /usr/lib/cyrus-imapd/sievec if ! kill -0 $DB_CHECK_PID > /dev/null 2>&1; then
# convert all db files break
cvt_file $imap_prefix/deliver.db "$CONFIG_DB_DUPLICATE" fi
cvt_file $imap_prefix/mailboxes.db "$CONFIG_DB_MBOX" sleep 1
cvt_file $imap_prefix/tls_sessions.db "$CONFIG_DB_TLS" let CNT+=1
cvt_file $imap_prefix/annotations.db "$CONFIG_DB_ANNOTATION" done
find ${imap_prefix}/user/ -name "*.seen" -type f | while read db_file trash; do if kill -0 $DB_CHECK_PID > /dev/null 2>&1; then
cvt_file "$db_file" "$CONFIG_DB_SEEN" kill -USR1 $DB_CHECK_PID > /dev/null 2>&1
done sleep 1
find ${imap_prefix}/user/ -name "*.sub" -type f | while read db_file trash; do kill -KILL $DB_CHECK_PID > /dev/null 2>&1
cvt_file "$db_file" "$CONFIG_DB_SUBS" wait $DB_CHECK_PID > /dev/null 2>&1
done
fi fi
# copy the current config file so we can check whether something has changed # do a normal recovery
db_recover -v -h $imap_prefix/db
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
# try a catastrophic recovery instead of normal recovery
db_recover -v -c -h $imap_prefix/db
RETVAL=$?
ERRVAL=$[ $ERRVAL + $RETVAL ]
if [ $RETVAL -ne 0 ]; then
echo "ERROR: catastrophic recovery of Berkeley databases failed"
fi
fi
if [ "$EXPORT" = "export" ]; then
# convert all db files to skiplist for migration
# TODO: quota_db, we don't touch it for now
cvt_file $imap_prefix/deliver.db "skiplist"
cvt_file $imap_prefix/mailboxes.db "skiplist"
cvt_file $imap_prefix/tls_sessions.db "skiplist"
cvt_file $imap_prefix/annotations.db "skiplist"
cvt_file $imap_prefix/ptclient/ptscache.db "skiplist"
rm -vf $imap_prefix/db/log.*
rm -vf $imap_prefix/db/__db.*
else
# always convert db files which have been converted to skiplist
# TODO: quota_db, we don't touch it for now
cvt_file $imap_prefix/deliver.db "$duplicate_db"
cvt_file $imap_prefix/mailboxes.db "$mboxlist_db"
cvt_file $imap_prefix/tls_sessions.db "$tlscache_db"
cvt_file $imap_prefix/annotations.db "$annotation_db"
cvt_file $imap_prefix/ptclient/ptscache.db "$ptscache_db"
# do we have to convert all databases?
if ! cmp -s $db_current $db_cache; then
# we treat sieve scripts the same way like db files
find ${sieve_dir}/ -name "*.script" -type f | while read db_file trash; do
cvt_to_utf8 "$db_file"
done
$masssievec $sievec
# convert all db files left
find ${imap_prefix}/user/ -name "*.seen" -type f | while read db_file trash; do
cvt_file "$db_file" "$seenstate_db"
done
find ${imap_prefix}/user/ -name "*.sub" -type f | while read db_file trash; do
cvt_file "$db_file" "$subscription_db"
done
find ${imap_prefix}/user/ -name "*.mboxkey" -type f | while read db_file trash; do
cvt_file "$db_file" "$mboxkey_db"
done
fi
fi
# update the config cache file so we can check whether something has changed
if [ $ERRVAL -eq 0 ]; then if [ $ERRVAL -eq 0 ]; then
mv -f $db_current $db_cache mv -f $db_current $db_cache
else else

View File

@ -7,22 +7,9 @@
# config: /etc/imapd.conf # config: /etc/imapd.conf
# pidfile: /var/run/cyrus-master.pid # pidfile: /var/run/cyrus-master.pid
# author: Simon Matter, Invoca Systems <simon.matter@invoca.ch> # author: Simon Matter, Invoca Systems <simon.matter@invoca.ch>
# version: 2005010600 # version: 2005111100
# changed: 2002020200 chkconfig modified # changed: add quickstart/stop option to init script to bypass db import/export
# 2002042500 rewrote start function
# 2002091800 added auto db converting functionality
# 2003020400 modified to use builtin daemon mode
# 2003050200 modified exec path
# 2003050900 return RETVAL from rhstatus(), did some cleanup
# 2003060700 added umask for cvt_cyrusdb_all log
# 2004012300 modified auto db converting functionality for 2.2
# 2004012700 fixed startup procedure
# 2004022400 change su within init script to get input from
# /dev/null, this prevents hang when running in SELinux
# 2004052000 don't enable cyrus-imapd per default
# 2004111900 use runuser instead of su if available
# 2005010600 removed LIB placeholder
# Source function library # Source function library
if [ -f /etc/init.d/functions ]; then if [ -f /etc/init.d/functions ]; then
@ -50,17 +37,6 @@ if [ -L $0 ]; then
BASENAME=$(basename $BASENAME) BASENAME=$(basename $BASENAME)
fi fi
# fallback to su if runuser not available
if [ -x /sbin/runuser ]; then
RUNUSER=runuser
else
RUNUSER=su
fi
CYRUSMASTER=/usr/lib/cyrus-imapd/cyrus-master
CYRUS_PROC_NAME=$(basename $CYRUSMASTER)
ALWAYS_CONVERT=1
# Source service configuration. # Source service configuration.
if [ -f /etc/sysconfig/$BASENAME ]; then if [ -f /etc/sysconfig/$BASENAME ]; then
. /etc/sysconfig/$BASENAME . /etc/sysconfig/$BASENAME
@ -69,29 +45,59 @@ else
exit 1 exit 1
fi fi
# get_config [config default]
# extracts config option from config file
get_config() {
if config=$(grep "^$1" /etc/imapd.conf); then
echo $config | cut -d: -f2
else
echo $2
fi
}
# where to find files and directories
CONFIGDIRECTORY=$(get_config configdirectory /var/lib/imap)
CYRUSMASTER=/usr/lib/cyrus-imapd/cyrus-master
CYRUS_PROC_NAME=$(basename $CYRUSMASTER)
ALWAYS_CONVERT=1
# fallback to su if runuser not available
if [ -x /sbin/runuser ]; then
RUNUSER=runuser
else
RUNUSER=su
fi
RETVAL=0 RETVAL=0
RETVAL2=1
QUICK=0
start() { start() {
echo -n $"Starting $BASENAME: "
if [ $(/sbin/pidof -s $CYRUSMASTER) ]; then if [ $(/sbin/pidof -s $CYRUSMASTER) ]; then
echo -n $"$BASENAME already running." echo -n $"$BASENAME already running."
false false
echo
else else
echo -n $"preparing databases... " if [ $QUICK -eq 0 ]; then
$RUNUSER - cyrus -c "umask 166 ; /usr/lib/cyrus-imapd/cvt_cyrusdb_all > /var/lib/imap/rpm/cvt_cyrusdb_all.log 2>&1" < /dev/null echo -n $"Importing $BASENAME databases: "
RETVAL=$? cd $CONFIGDIRECTORY
$RUNUSER - cyrus -c "umask 166 ; /usr/lib/cyrus-imapd/cvt_cyrusdb_all > ${CONFIGDIRECTORY}/rpm/db_import.log 2>&1" < /dev/null
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
success $"$BASENAME importing databases"
else
failure $"$BASENAME error importing databases, check ${CONFIGDIRECTORY}/rpm/db_import.log"
fi
echo
fi
if [ $RETVAL -eq 0 ]; then if [ $RETVAL -eq 0 ]; then
echo -n $"done. " echo -n $"Starting $BASENAME: "
daemon $CYRUSMASTER -d $CYRUSOPTIONS daemon $CYRUSMASTER -d $CYRUSOPTIONS
else RETVAL2=$?
echo -n $"error! " echo
initlog -n $BASENAME -s "error converting databases, check /var/lib/imap/rpm/cvt_cyrusdb_all.log"
failure $"$BASENAME startup"
fi fi
fi fi
RETVAL=$? [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/$BASENAME
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASENAME
return $RETVAL return $RETVAL
} }
@ -99,8 +105,22 @@ stop() {
echo -n $"Shutting down $BASENAME: " echo -n $"Shutting down $BASENAME: "
killproc $CYRUSMASTER killproc $CYRUSMASTER
RETVAL=$? RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$BASENAME if [ $QUICK -eq 0 ]; then
if [ ! $(/sbin/pidof -s $CYRUSMASTER) ]; then
echo
echo -n $"Exporting $BASENAME databases: "
cd $CONFIGDIRECTORY
$RUNUSER - cyrus -c "umask 166 ; /usr/lib/cyrus-imapd/cvt_cyrusdb_all export > ${CONFIGDIRECTORY}/rpm/db_export.log 2>&1" < /dev/null
RETVAL2=$?
if [ $RETVAL2 -eq 0 ]; then
success $"$BASENAME exporting databases"
else
failure $"$BASENAME error exporting databases, check ${CONFIGDIRECTORY}/rpm/db_export.log"
fi
fi
fi
echo echo
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /var/lock/subsys/$BASENAME
return $RETVAL return $RETVAL
} }
@ -146,8 +166,16 @@ case "$1" in
status) status)
rhstatus rhstatus
;; ;;
quickstart)
QUICK=1
start
;;
quickstop)
QUICK=1
stop
;;
*) *)
echo $"Usage: $BASENAME {start|stop|restart|reload|condrestart|status}" echo $"Usage: $BASENAME {start|stop|restart|reload|condrestart|status|quickstart|quickstop}"
RETVAL=1 RETVAL=1
esac esac

View File

@ -8,18 +8,18 @@ if [ "x$CONFDIR" = "x" ]; then
fi fi
find $CONFDIR -type d ! -name "lost+found" -exec chmod 700 {} \; -exec chown cyrus:mail {} \; find $CONFDIR -type d ! -name "lost+found" -exec chmod 700 {} \; -exec chown cyrus:mail {} \;
grep -se "^partition-.*:" $IMAPCONF | cut -d":" -f2 | while read SPOOLDIR; do grep -sE "^(meta|)partition-.*:" $IMAPCONF | cut -d":" -f2 | while read SPOOLDIR; do
if [ "x$SPOOLDIR" = "x" ]; then if [ "x$SPOOLDIR" = "x" ]; then
echo "$0 warning: invalid partition configuration in /etc/imapd.conf found!" echo "$0 warning: invalid (meta)partition configuration in /etc/imapd.conf found!"
else else
find $SPOOLDIR -type d ! -name "lost+found" -exec chmod 700 {} \; -exec chown cyrus:mail {} \; find $SPOOLDIR -type d ! -name "lost+found" -exec chmod 700 {} \; -exec chown cyrus:mail {} \;
fi fi
done done
find $CONFDIR -type f ! -name "lost+found" -exec chmod 600 {} \; -exec chown cyrus:mail {} \; find $CONFDIR -type f ! -name "lost+found" -exec chmod 600 {} \; -exec chown cyrus:mail {} \;
grep -se "^partition-.*:" $IMAPCONF | cut -d":" -f2 | while read SPOOLDIR; do grep -sE "^(meta|)partition-.*:" $IMAPCONF | cut -d":" -f2 | while read SPOOLDIR; do
if [ "x$SPOOLDIR" = "x" ]; then if [ "x$SPOOLDIR" = "x" ]; then
echo "$0 warning: invalid partition configuration in /etc/imapd.conf found!" echo "$0 warning: invalid (meta)partition configuration in /etc/imapd.conf found!"
else else
find $SPOOLDIR -type f ! -name "lost+found" -exec chmod 600 {} \; -exec chown cyrus:mail {} \; find $SPOOLDIR -type f ! -name "lost+found" -exec chmod 600 {} \; -exec chown cyrus:mail {} \;
fi fi

View File

@ -1,6 +1,6 @@
Name: cyrus-imapd Name: cyrus-imapd
Version: 2.2.12 Version: 2.3.1
Release: 1.fc5 Release: 2.fc5
# ********************** BUILD TIME OPTIONS START ********************** # ********************** BUILD TIME OPTIONS START **********************
@ -8,139 +8,150 @@ Release: 1.fc5
# rpm --rebuild --define='SEEN_DB skiplist' cyrus-imapd-2.x.x-x.src.rpm # rpm --rebuild --define='SEEN_DB skiplist' cyrus-imapd-2.x.x-x.src.rpm
# use saslauth group # use saslauth group
%{!?SASLGROUP: %define SASLGROUP 0} %{!?SASLGROUP: %define SASLGROUP 0}
# include deliver-wrapper # include deliver-wrapper
%{!?DEL_WRAP: %define DEL_WRAP 0} %{!?DEL_WRAP: %define DEL_WRAP 0}
# use preforking cyrus.conf # use preforking cyrus.conf
%{!?PREFORK: %define PREFORK 1} %{!?PREFORK: %define PREFORK 1}
# enable Netscape hack (recommended) # enable Netscape hack (recommended)
%{!?NETSCAPEHACK: %define NETSCAPEHACK 1} %{!?NETSCAPEHACK: %define NETSCAPEHACK 1}
# enable IMAP4 LIST extensions # enable IMAP4 LIST extensions
%{!?LISTEXT: %define LISTEXT 1} %{!?LISTEXT: %define LISTEXT 1}
# enable IDLED support # enable IDLED support
%{!?IDLED: %define IDLED 1} %{!?IDLED: %define IDLED 1}
# enable SNMP support
%{!?SNMP: %define SNMP 0}
# force syncronous updates on ext3 # force syncronous updates on ext3
%{!?FORCESYNCEXT3: %define FORCESYNCEXT3 0} %{!?FORCESYNCEXT3: %define FORCESYNCEXT3 0}
# include autocreate feature # include autocreate feature
%{!?AUTOCREATE: %define AUTOCREATE 1} %{!?AUTOCREATE: %define AUTOCREATE 1}
# include groupcache feature # include groupcache feature
%{!?GROUPCACHE: %define GROUPCACHE 1} %{!?GROUPCACHE: %define GROUPCACHE 1}
# don't check for RFC compliant line termination (bare newlines) # don't check for RFC compliant line termination (bare newlines)
%{!?NO_BARE_NL: %define NO_BARE_NL 0} %{!?NO_BARE_NL: %define NO_BARE_NL 0}
# used syslog facility for logging # used syslog facility for logging
%{!?SYSLOGFACILITY: %define SYSLOGFACILITY MAIL} %{!?SYSLOGFACILITY: %define SYSLOGFACILITY MAIL}
# use -fpie for linking # use -fpie for linking
%{!?USEPIE: %define USEPIE 0} %{!?USEPIE: %define USEPIE 0}
# OutlookExpress seenstate patch
%{!?OE_SEEN_ST: %define OE_SEEN_ST 1}
# use authorization module METHOD [unix|krb5]
%{!?AUTH_METHOD: %define AUTH_METHOD unix}
# ********************** BUILD TIME OPTIONS END ************************ # ********************** BUILD TIME OPTIONS END ************************
%define _use_internal_dependency_generator 0 %define _acversion 2.59
%define _rhver %(eval rpm -q --queryformat '%{VERSION}' $(rpm -qf /etc/redhat-release)) %define _use_internal_dependency_generator 0
%define _rhrelease %(eval %{__cat} /etc/redhat-release) %define _rhver %(eval rpm -q --queryformat '%{VERSION}' $(rpm -qf /etc/redhat-release))
%define _dbver db4 %define _rhrelease %(eval %{__cat} /etc/redhat-release)
%define _dbrpmver %(eval "rpm -q %{_dbver}") %define _dbver db4
%define _dbrpmver %(eval "rpm -q %{_dbver}")
# Do we need the perl install hack for RedHat > 7.3 ? # Do we need the perl install hack for RedHat > 7.3 ?
%define _perlhack %(eval [ %{_rhver} = "6.2" -o %{_rhver} = "7.0" -o %{_rhver} = "7.1" -o %{_rhver} = "7.2" -o %{_rhver} = "7.3" -o %{_rhver} = "2.1AS" -o %{_rhver} = "2.1ES" ] && echo 0 || echo 1) %define _perlhack %(eval [ %{_rhver} = "6.2" -o %{_rhver} = "7.0" -o %{_rhver} = "7.1" -o %{_rhver} = "7.2" -o %{_rhver} = "7.3" -o %{_rhver} = "2.1AS" -o %{_rhver} = "2.1ES" ] && echo 0 || echo 1)
%define _perl_man3dir %(eval "$(perl -V:man3dir)"; echo $man3dir) %define _perl_man3dir %(eval "$(perl -V:man3dir)"; echo $man3dir)
%define _withldap %(eval "rpm -q --requires openldap | grep -q ^libsasl2 && echo 1 || echo 0")
%define _snmpver %(eval "rpm -q --quiet ucd-snmp && echo ucd || echo net")
# Disable -debuginfo package generation # Disable -debuginfo package generation
#define debug_package %{nil} #define debug_package %{nil}
# Do we have filesystem >= 2.3.2 (new pki location) ?
%define use_etc_pki %(eval [ $(rpm -q --queryformat '%{VERSION}' filesystem \| sed -e "s/\\.//g") -ge 232 ] && echo 1 || echo 0 )
%if %{use_etc_pki}
%define certs_dir %{_sysconfdir}/pki/tls/certs
%define pki_dir %{_sysconfdir}/pki/%{name} %define pki_dir %{_sysconfdir}/pki/%{name}
%define ssl_pem_file %{pki_dir}/%{name}.pem
Summary: A high-performance mail server with IMAP, POP3, NNTP and SIEVE support.
License: BSD
Group: System Environment/Daemons
URL: http://asg.web.cmu.edu/cyrus/imapd/
#Packager: Simon Matter <simon.matter@invoca.ch>
#Vendor: Invoca Systems
#Distribution: Invoca Linux Server
Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus/%{name}-%{version}.tar.gz
Source1: ftp://ftp.andrew.cmu.edu/pub/cyrus/%{name}-%{version}.tar.gz.sig
Source2: cyrus-procmailrc
Source3: cyrus-deliver-wrapper.c
Source4: cyrus-user-procmailrc.template
Source5: cyrus-imapd.logrotate
Source6: cyrus-imapd.imap-2.2.x-conf
Source7: cyrus-imapd.pam-config
Source8: http://email.uoa.gr/projects/cyrus/autocreate/README.autocreate-cyrus-2.2
Source9: http://email.uoa.gr/projects/cyrus/autosievefolder/README.autosievefolder
Source10: cyrus-imapd-db.cfg
Source11: cyrus-imapd.init
Source12: cyrus-imapd.sysconfig
Source13: cyrus-imapd.cvt_cyrusdb_all
Source14: cyrus-imapd.magic
Source15: http://clement.hermann.free.fr/scripts/Cyrus/imapcreate.pl
Source16: http://eu.dl.sourceforge.net/cyrus-utils/cyrus_ldap_quota.pl
Source17: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/batchreconstruct
Source18: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/bsd2cyrus
Source19: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/cpmsg
Source20: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/folderxfer
Source21: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/inboxfer
Source22: http://email.uoa.gr/download/cyrus/cyrus_sharedbackup/cyrus_sharedbackup-0.1.tar.gz
Source23: cyrus-imapd-README.RPM
Source24: cyrus-imapd-README.HOWTO-recover-mailboxes.db
Source25: cyrus-imapd.cron-daily
Source27: cyrus-imapd-procmail+cyrus.mc
Source28: cyrus-imapd.rpm_set_permissions
Source29: cyrus-imapd-sendmail-8.12.9-cyrusv2.m4
Source30: cyrus-imapd-README.contrib
Source31: cyrus-imapd-README.groupcache
Source32: cyrus-imapd.upd_groupcache
Patch0: cyrus-imapd-2.1.9-fdatasync.patch
Patch1: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.2.12/cyrus-imapd-2.2.12-autocreate-0.9.2.diff
Patch2: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.2.12/cyrus-imapd-2.2.12-autosievefolder-0.6.diff
Patch3: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.2.10/cyrus-imapd-2.2.10-rmquota+deletemailbox-0.1.diff
Patch4: http://servercc.oakton.edu/~jwade/cyrus/cyrus-imapd-2.1.3/cyrus-imapd-2.1.3-flock.patch
Patch5: cyrus-imapd-2.2.4-munge8bit.patch
Patch6: cyrus-imapd-2.1.16-getrlimit.patch
Patch7: cyrus-imapd-2.1.15-nobarenewlinescheck.patch
Patch8: cyrus-imapd-2.2.10-groupcache.patch
Patch9: cyrus-imapd-2.2.4-OE-seenstate.patch
Patch10: cyrus-imapd-acceptinvalidfrom.patch
Patch50: cyrus-imapd-gcc4.patch
# Patches >= 100 are fixed in CVS
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Prereq: e2fsprogs, diffutils, /sbin/chkconfig, /sbin/service
Requires: cyrus-sasl >= 2.1.15, file >= 3.35-1
Requires: filesystem >= 2.3.2-1
Requires: openssl >= 0.9.7f-4
BuildPrereq: cyrus-sasl-devel >= 2.1.15-1, perl, tcp_wrappers, %{_dbver}-devel, openssl-devel
BuildPrereq: flex, bison, groff >= 1.15-8, autoconf
%define uid 76
%if %{SASLGROUP}
%define gid 76
%define _saslgroup saslauth
%endif
%define _cyrususer cyrus
%define _cyrusgroup mail
%define _vardata %{_var}/lib/imap
%define _spooldata %{_var}/spool/imap
%define _cyrexecdir %{_exec_prefix}/lib/%{name}
%define _confdir master/conf
%define _contribdir doc/contrib
%if %{PREFORK}
%define _cyrusconf %{_confdir}/prefork.conf
%else %else
%define _cyrusconf %{_confdir}/normal.conf %define certs_dir %{_datadir}/ssl/certs
%define pki_dir %{_datadir}/ssl/certs
%endif %endif
%define ssl_pem_file %{pki_dir}/%{name}.pem
%define uid 76
%if %{SASLGROUP}
%define gid 76
%define _saslgroup saslauth
%endif
%define _cyrususer cyrus
%define _cyrusgroup mail
%define _vardata %{_var}/lib/imap
%define _spooldata %{_var}/spool/imap
%define _cyrexecdir %{_exec_prefix}/lib/%{name}
%define _confdir master/conf
%define _contribdir doc/contrib
%if %{PREFORK}
%define _cyrusconf %{_confdir}/prefork.conf
%else
%define _cyrusconf %{_confdir}/normal.conf
%endif
Summary: A high-performance mail server with IMAP, POP3, NNTP and SIEVE support.
License: BSD
Group: System Environment/Daemons
URL: http://asg.web.cmu.edu/cyrus/imapd/
#Packager: Simon Matter <simon.matter@invoca.ch>
#Vendor: Invoca Systems
#Distribution: Invoca Linux Server
Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus/%{name}-%{version}.tar.gz
Source1: ftp://ftp.andrew.cmu.edu/pub/cyrus/%{name}-%{version}.tar.gz.sig
Source2: http://ftp.gnu.org/gnu/autoconf/autoconf-%{_acversion}.tar.gz
Source3: cyrus-deliver-wrapper.c
Source4: cyrus-user-procmailrc.template
Source5: cyrus-imapd.logrotate
Source6: cyrus-imapd.imap-2.3.x-conf
Source7: cyrus-imapd.pam-config
Source8: http://email.uoa.gr/projects/cyrus/autocreate/README.autocreate-cyrus-2.3
Source9: http://email.uoa.gr/projects/cyrus/autosievefolder/README.autosievefolder
Source10: http://oss.netfarm.it/download/skiplist.py
Source11: cyrus-imapd.init
Source12: cyrus-imapd.sysconfig
Source13: cyrus-imapd.cvt_cyrusdb_all
Source14: cyrus-imapd.magic
Source15: http://clement.hermann.free.fr/scripts/Cyrus/imapcreate.pl
Source16: http://eu.dl.sourceforge.net/cyrus-utils/cyrus_ldap_quota.pl
Source17: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/batchreconstruct
Source18: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/bsd2cyrus
Source19: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/cpmsg
Source20: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/folderxfer
Source21: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/inboxfer
Source22: http://email.uoa.gr/download/cyrus/cyrus_sharedbackup/cyrus_sharedbackup-0.1.tar.gz
Source23: cyrus-imapd-README.RPM
Source24: cyrus-imapd-README.HOWTO-recover-mailboxes.db
Source25: cyrus-imapd.cron-daily
Source26: cyrus-procmailrc
Source27: cyrus-imapd-procmail+cyrus.mc
Source28: cyrus-imapd.rpm_set_permissions
Source29: cyrus-imapd-sendmail-8.12.9-cyrusv2.m4
Source30: cyrus-imapd-README.contrib
Source31: cyrus-imapd-README.groupcache
Source32: cyrus-imapd.upd_groupcache
Source33: cyrus-imapd-README.skiplist_recovery
Patch0: cyrus-imapd-2.2.12-no_transfig.patch
Patch1: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.1/cyrus-imapd-2.3.1-autocreate-0.10-0.diff
Patch2: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.1/cyrus-imapd-2.3.1-autosievefolder-0.6-0.diff
Patch3: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.1/cyrus-imapd-2.3.1-rmquota+deletemailbox-0.2-1.diff
Patch4: http://servercc.oakton.edu/~jwade/cyrus/cyrus-imapd-2.1.3/cyrus-imapd-2.1.3-flock.patch
Patch5: cyrus-imapd-2.2.12-munge8bit.patch
Patch6: cyrus-imapd-2.1.16-getrlimit.patch
Patch7: cyrus-imapd-2.1.15-nobarenewlinescheck.patch
Patch8: cyrus-imapd-2.2.10-groupcache.patch
Patch9: cyrus-imapd-2.3.1-config_defaults.patch
Patch10: cyrus-imapd-acceptinvalidfrom.patch
Patch11: cyrus-imapd-2.2.12-dam_invalid_id-christos.patch
Patch12: cyrus-imapd-2.2.12-notify_sms.patch
Patch13: allow_auth_plain_proxying.patch
Patch14: cyrus-imapd-2.3.1-authid_normalize.patch
Patch15: cyrus-imapd-2.3.1-make_md5_defaults.patch
# Patches >= 100 are / will be fixed in CVS
Patch100: cyrus-imapd-2.3.1-make_md5.patch
Patch101: cyrus-imapd-2.3.1-backend_sigsegv.patch
Patch102: cyrus-imapd-2.3.1-replication_policycheck.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildPrereq: cyrus-sasl-devel >= 2.1.15-1, perl, tcp_wrappers
BuildPrereq: %{_dbver}-devel, openssl-devel, pkgconfig
BuildPrereq: flex, bison, groff >= 1.15-8, automake
%if %{_withldap}
BuildPrereq: openldap-devel
%endif
%if %{SNMP}
BuildPrereq: %{_snmpver}-snmp-devel, lm_sensors-devel
%endif
Prereq: e2fsprogs, /sbin/chkconfig, /sbin/service
Prereq: %{name}-utils = %{version}-%{release}
Requires: cyrus-sasl >= 2.1.15, file >= 3.35-1, %{_dbver}-utils
Obsoletes: %{name}-murder, %{name}-nntp
%description %description
The %{name} package contains the core of the Cyrus IMAP server. The %{name} package contains the core of the Cyrus IMAP server.
@ -151,33 +162,24 @@ internet mail technologies.
A full Cyrus IMAP implementation allows a seamless mail and bulletin A full Cyrus IMAP implementation allows a seamless mail and bulletin
board environment to be set up across multiple servers. It differs from board environment to be set up across multiple servers. It differs from
other IMAP server implementations in that it is run on "sealed" other IMAP server implementations in that it is run on "sealed"
servers, where users are not normally permitted to log in. The mailbox servers, where users are not normally permitted to log in and have no
database is stored in parts of the filesystem that are private to the system account on the server. The mailbox database is stored in parts
Cyrus IMAP server. All user access to mail is through software using of the filesystem that are private to the Cyrus IMAP server. All user
the IMAP, POP3, or KPOP protocols. TLSv1 and SSL are supported for access to mail is through software using the IMAP, POP3 or KPOP
security. protocols. It also includes support for virtual domains, NNTP,
mailbox annotations, and much more. The private mailbox database design
gives the server large advantages in efficiency, scalability and
administratability. Multiple concurrent read/write connections to the
same mailbox are permitted. The server supports access control lists on
mailboxes and storage quotas on mailbox hierarchies.
%package murder The Cyrus IMAP server supports the IMAP4rev1 protocol described
Group: System Environment/Daemons in RFC 3501. IMAP4rev1 has been approved as a proposed standard.
Summary: Cyrus IMAP server murder aggregator system files. It supports any authentication mechanism available from the SASL
Requires: %{name} = %{version}-%{release} library, imaps/pop3s/nntps (IMAP/POP3/NNTP encrypted using SSL and
TLSv1) can be used for security. The server supports single instance
%description murder store where possible when an email message is addressed to multiple
The %{name}-murder package contains the Cyrus murder aggregator system, recipients, SIEVE provides server side email filtering.
i.e. IMAP, POP3 and LMTP proxies, and the mupdate mailbox master daemon.
It allows for cluster setups where there are many backend Cyrus spools
and frontend proxy servers.
%package nntp
Group: System Environment/Daemons
Summary: Cyrus IMAP server NNTP system files.
Requires: %{name} = %{version}-%{release}
%description nntp
The %{name}-nntp package contains the Cyrus NNTP server component.
Cyrus has the ability to export Usenet via IMAP and/or export shared IMAP
mailboxes via NNTP. This is made possible by a new NNTP daemon which is
included with Cyrus.
%package devel %package devel
Group: Development/Libraries Group: Development/Libraries
@ -199,6 +201,7 @@ Cyrus IMAP server administration utilities.
%package utils %package utils
Group: Applications/System Group: Applications/System
Summary: Cyrus IMAP server administration utilities. Summary: Cyrus IMAP server administration utilities.
Prereq: diffutils, findutils, grep, sed
Requires: perl-Cyrus = %{version}-%{release} Requires: perl-Cyrus = %{version}-%{release}
%description utils %description utils
@ -207,8 +210,8 @@ Cyrus IMAP server. It can be installed on systems other than the
one running the server. one running the server.
%prep %prep
%setup -q %setup -q -a 2
%patch0 -p0 -b .fdatasync %patch0 -p1 -b .no_transfig
%if %{AUTOCREATE} %if %{AUTOCREATE}
%patch1 -p1 -b .autocreate %patch1 -p1 -b .autocreate
%patch2 -p1 -b .autosievefolder %patch2 -p1 -b .autosievefolder
@ -223,18 +226,37 @@ one running the server.
%if %{GROUPCACHE} %if %{GROUPCACHE}
%patch8 -p1 -b .groupcache %patch8 -p1 -b .groupcache
%endif %endif
%if %{OE_SEEN_ST} %patch9 -p1 -b .config_defaults
%patch9 -p1 -b .oeseenstate
%endif
%patch10 -p1 -b .acceptinvalidfrom %patch10 -p1 -b .acceptinvalidfrom
%patch50 -p1 %patch11 -p1 -b .dam_invalid_id
%patch12 -p1 -b .notify_sms
%patch13 -p0 -b .allow_auth_plain
%patch14 -p1 -b .authid_normalize
%patch15 -p1 -b .make_md5_defaults
%patch100 -p1 -b .make_md5
%patch101 -p1 -b .backend_sigsegv
%patch102 -p1 -b .replication_policycheck
# build and run private autoconf
autodir=$(pwd)/auto-instroot
pushd autoconf-%{_acversion}
./configure --prefix=$autodir
make all install
popd
PATH=${autodir}/bin:${PATH}
aclocal -I cmulocal
autoheader
autoconf -f
%build %build
# kerberos include is needed (because of openssl-0.9.7 ?) CPPFLAGS="-I%{_includedir}/et"; export CPPFLAGS
CPPFLAGS="-I%{_includedir}/et -I%{_prefix}/kerberos/include"; export CPPFLAGS
CFLAGS="$RPM_OPT_FLAGS -fPIC"; export CFLAGS CFLAGS="$RPM_OPT_FLAGS -fPIC"; export CFLAGS
if pkg-config openssl; then
CPPFLAGS="$(pkg-config --cflags-only-I openssl) $CPPFLAGS"; export CPPFLAGS
CFLAGS="$(pkg-config --cflags openssl) $CFLAGS"; export CFLAGS
LDFLAGS="$(pkg-config --libs-only-L openssl) $LDFLAGS"; export LDFLAGS
fi
CCDLFLAGS="-rdynamic"; export CCDLFLAGS CCDLFLAGS="-rdynamic"; export CCDLFLAGS
LDFLAGS="-L%{_prefix}/kerberos/%{_lib}"; export LDFLAGS
%if %{USEPIE} %if %{USEPIE}
%ifnarch ppc ppc64 %ifnarch ppc ppc64
LDFLAGS="$LDFLAGS -pie"; export LDFLAGS LDFLAGS="$LDFLAGS -pie"; export LDFLAGS
@ -249,20 +271,30 @@ LDFLAGS="$LDFLAGS -pie"; export LDFLAGS
--enable-listext \ --enable-listext \
%endif %endif
%if %{IDLED} %if %{IDLED}
--with-idle=idled \ --enable-idled \
%endif
%if %{_withldap}
--with-ldap \
%endif
%if %{SNMP}
--with-snmp \
%else
--without-snmp \
%endif %endif
--enable-murder \ --enable-murder \
--enable-replication \
--enable-nntp \ --enable-nntp \
--without-snmp \
--with-perl=%{__perl} \ --with-perl=%{__perl} \
--with-cyrus-prefix=%{_cyrexecdir} \ --with-cyrus-prefix=%{_cyrexecdir} \
--with-service-path=%{_cyrexecdir} \ --with-service-path=%{_cyrexecdir} \
--with-auth=%{AUTH_METHOD} \
--with-bdb-incdir=%{_includedir}/%{_dbver} \ --with-bdb-incdir=%{_includedir}/%{_dbver} \
--with-extraident="Invoca-RPM-%{version}-%{release}" \ --with-extraident="Invoca-RPM-%{version}-%{release}" \
--with-syslogfacility=%{SYSLOGFACILITY} --with-syslogfacility=%{SYSLOGFACILITY}
%{__make} -C man -f Makefile.dist
%{__make} -C doc -f Makefile.dist
%{__make} %{__make}
%{__make} -C notifyd notifytest
%if %{DEL_WRAP} %if %{DEL_WRAP}
%{__cc} $CFLAGS -DLIBEXECDIR=\"%{_cyrexecdir}\" -Wall -o deliver-wrapper %{SOURCE3} %{__cc} $CFLAGS -DLIBEXECDIR=\"%{_cyrexecdir}\" -Wall -o deliver-wrapper %{SOURCE3}
%endif %endif
@ -286,15 +318,15 @@ find . -type f -name "*.pl" -exec %{__chmod} 755 {} \;
# Cleanup of doc dir # Cleanup of doc dir
find doc perl -name CVS -type d | xargs -r %{__rm} -fr find doc perl -name CVS -type d | xargs -r %{__rm} -fr
find doc perl -name .cvsignore -type f | xargs -r %{__rm} -f
find doc -name "*~" -type f | xargs -r %{__rm} -f find doc -name "*~" -type f | xargs -r %{__rm} -f
%{__rm} -f doc/Makefile.dist find doc -name "*.html.*" -type f | xargs -r %{__rm} -f
%{__rm} -f doc/Makefile.dist*
%{__rm} -f doc/text/htmlstrip.c %{__rm} -f doc/text/htmlstrip.c
# Create README.buildoptions # Create README.buildoptions
%{__cat} << EOF >> doc/README.buildoptions %{__cat} << EOF >> doc/README.buildoptions
This RPM has been compiled on %{_rhrelease} using This RPM has been built on %{_rhrelease} using the following options:
Berkeley DB version %{_dbrpmver} with the following source
RPM build options:
use saslauth group use saslauth group
SASLGROUP : %{SASLGROUP} SASLGROUP : %{SASLGROUP}
@ -314,6 +346,9 @@ LISTEXT : %{LISTEXT}
enable IDLED support enable IDLED support
IDLED : %{IDLED} IDLED : %{IDLED}
enable SNMP support
SNMP : %{SNMP}
force syncronous updates on ext3 force syncronous updates on ext3
FORCESYNCEXT3 : %{FORCESYNCEXT3} FORCESYNCEXT3 : %{FORCESYNCEXT3}
@ -332,11 +367,11 @@ SYSLOGFACILITY : %{SYSLOGFACILITY}
used -fpie for linking used -fpie for linking
USEPIE : %{USEPIE} USEPIE : %{USEPIE}
include OutlookExpress seenstate patch enable LDAP support
OE_SEEN_ST : %{OE_SEEN_ST} (autodetected) : %{_withldap}
use authorization module METHOD [unix|krb5] Berkeley DB version
AUTH_METHOD : %{AUTH_METHOD} (autodetected) : %{_dbrpmver}
To modify parameters, edit the .spec file or build like this: To modify parameters, edit the .spec file or build like this:
@ -348,12 +383,13 @@ EOF
%if %{GROUPCACHE} %if %{GROUPCACHE}
%{__install} -m 644 %{SOURCE31} doc/README.groupcache %{__install} -m 644 %{SOURCE31} doc/README.groupcache
%endif %endif
%{__install} -m 644 %{SOURCE33} doc/README.skiplist_recovery
%if %{AUTOCREATE} %if %{AUTOCREATE}
%{__install} -m 644 %{SOURCE8} doc/README.autocreate %{__install} -m 644 %{SOURCE8} doc/README.autocreate
%{__install} -m 644 %{SOURCE9} doc/README.autosievefolder %{__install} -m 644 %{SOURCE9} doc/README.autosievefolder
%endif %endif
%{__install} -d doc/m4 %{__install} -d doc/m4
%{__install} -m 644 %{SOURCE2} doc/m4/cyrus-procmailrc %{__install} -m 644 %{SOURCE26} doc/m4/cyrus-procmailrc
%{__install} -m 644 %{SOURCE4} doc/m4/cyrus-user-procmailrc.template %{__install} -m 644 %{SOURCE4} doc/m4/cyrus-user-procmailrc.template
%{__install} -m 644 %{SOURCE27} doc/m4/%{name}-procmail+cyrus.mc %{__install} -m 644 %{SOURCE27} doc/m4/%{name}-procmail+cyrus.mc
%{__install} -m 644 %{SOURCE29} doc/m4/%{name}-sendmail-8.12.9-cyrusv2.m4 %{__install} -m 644 %{SOURCE29} doc/m4/%{name}-sendmail-8.12.9-cyrusv2.m4
@ -389,10 +425,11 @@ popd
%endif %endif
%if %{DEL_WRAP} %if %{DEL_WRAP}
%{__install} -m 2755 deliver-wrapper %{buildroot}%{_cyrexecdir}/ %{__install} -m 2755 deliver-wrapper %{buildroot}%{_cyrexecdir}/
%endif %endif
%{__install} -m 755 imtest/imtest %{buildroot}%{_cyrexecdir}/ %{__install} -m 755 imtest/imtest %{buildroot}%{_bindir}/
%{__install} -m 755 perl/imap/cyradm %{buildroot}%{_cyrexecdir}/ %{__install} -m 755 notifyd/notifytest %{buildroot}%{_bindir}/
%{__install} -m 755 perl/imap/cyradm %{buildroot}%{_bindir}/
# Install tools # Install tools
for tool in tools/* ; do for tool in tools/* ; do
@ -403,9 +440,11 @@ done
%{__install} -d \ %{__install} -d \
%{buildroot}%{_sysconfdir}/{rc.d/init.d,logrotate.d,pam.d,sysconfig,cron.daily} \ %{buildroot}%{_sysconfdir}/{rc.d/init.d,logrotate.d,pam.d,sysconfig,cron.daily} \
%{buildroot}%{_libdir}/sasl \ %{buildroot}%{_libdir}/sasl \
%{buildroot}%{_bindir} \
%{buildroot}%{_spooldata} \ %{buildroot}%{_spooldata} \
%{buildroot}%{_vardata}/{user,quota,proc,log,msg,socket,db,sieve,rpm,backup} \ %{buildroot}%{_vardata}/{user,quota,proc,log,msg,socket,db,sieve,sync,md5,rpm,backup} \
%if %{_withldap}
%{buildroot}%{_vardata}/ptclient \
%endif
%{buildroot}%{_datadir}/%{name}/rpm \ %{buildroot}%{_datadir}/%{name}/rpm \
%{buildroot}%{pki_dir} \ %{buildroot}%{pki_dir} \
%{_contribdir} %{_contribdir}
@ -417,7 +456,7 @@ done
%endif %endif
%{__install} -m 755 %{SOURCE28} %{buildroot}%{_cyrexecdir}/rpm_set_permissions %{__install} -m 755 %{SOURCE28} %{buildroot}%{_cyrexecdir}/rpm_set_permissions
%{__install} -m 644 %{SOURCE14} %{buildroot}%{_datadir}/%{name}/rpm/magic %{__install} -m 644 %{SOURCE14} %{buildroot}%{_datadir}/%{name}/rpm/magic
%{__install} -m 644 %{SOURCE10} %{buildroot}%{_datadir}/%{name}/rpm/db.cfg %{__install} -m 644 %{SOURCE10} %{_contribdir}/
%{__install} -m 644 %{SOURCE15} %{_contribdir}/imapcreate %{__install} -m 644 %{SOURCE15} %{_contribdir}/imapcreate
%{__install} -m 644 %{SOURCE16} %{_contribdir}/cyrus_ldap_quota %{__install} -m 644 %{SOURCE16} %{_contribdir}/cyrus_ldap_quota
%{__install} -m 644 %{SOURCE17} %{_contribdir}/batchreconstruct %{__install} -m 644 %{SOURCE17} %{_contribdir}/batchreconstruct
@ -437,6 +476,7 @@ done
%{__install} -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/mupdate %{__install} -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/mupdate
%{__install} -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/lmtp %{__install} -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/lmtp
%{__install} -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/nntp %{__install} -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/nntp
%{__install} -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/csync
%{__install} -m 644 %{SOURCE12} %{buildroot}%{_sysconfdir}/sysconfig/%{name} %{__install} -m 644 %{SOURCE12} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
%{__install} -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} %{__install} -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
%{__install} -m 755 %{SOURCE25} %{buildroot}%{_sysconfdir}/cron.daily/%{name} %{__install} -m 755 %{SOURCE25} %{buildroot}%{_sysconfdir}/cron.daily/%{name}
@ -446,14 +486,20 @@ done
%{__install} -m 755 -d doc/conf %{__install} -m 755 -d doc/conf
%{__install} -m 644 %{_confdir}/*.conf doc/conf/ %{__install} -m 644 %{_confdir}/*.conf doc/conf/
# Generate db config file
( grep '^{' lib/imapoptions | grep _db | cut -d'"' -f 2,4 | \
sed -e 's/^ *//' -e 's/-nosync//' -e 's/ *$//' -e 's/"/=/'
echo sieve_version=2.2.3 ) | sort > %{buildroot}%{_datadir}/%{name}/rpm/db.cfg
# create the ghost pem file # create the ghost pem file
touch %{buildroot}%{ssl_pem_file} touch %{buildroot}%{ssl_pem_file}
%if %{use_etc_pki}
# change config file so ssl certificates are under /etc rather than /usr/share # change config file so ssl certificates are under /etc rather than /usr/share
%{__perl} -pi -e \ %{__perl} -pi -e \
's@/usr/share/ssl/certs/cyrus-imapd.pem@%{ssl_pem_file}@g; \ 's@/usr/share/ssl/certs/%{name}.pem@%{ssl_pem_file}@g; \
s@/usr/share/ssl/certs/ca-bundle.crt@/etc/pki/tls/certs/ca-bundle.crt@' \ s@/usr/share/ssl/certs/ca-bundle.crt@/etc/pki/tls/certs/ca-bundle.crt@' \
%{buildroot}%{_sysconfdir}/imapd.conf %{buildroot}%{_sysconfdir}/imapd.conf
%endif
# Rename 'master' binary and manpage to avoid crash with postfix # Rename 'master' binary and manpage to avoid crash with postfix
%{__mv} -f %{buildroot}%{_cyrexecdir}/master %{buildroot}%{_cyrexecdir}/cyrus-master %{__mv} -f %{buildroot}%{_cyrexecdir}/master %{buildroot}%{_cyrexecdir}/cyrus-master
@ -477,10 +523,6 @@ touch %{buildroot}%{ssl_pem_file}
%{__perl} -pi -e 's/Fetchnews/Cyrfetchnews/g' doc/man/cyrfetchnews.8.html %{__perl} -pi -e 's/Fetchnews/Cyrfetchnews/g' doc/man/cyrfetchnews.8.html
%{__perl} -pi -e 's/FETCHNEWS/CYRFETCHNEWS/g' doc/man/cyrfetchnews.8.html %{__perl} -pi -e 's/FETCHNEWS/CYRFETCHNEWS/g' doc/man/cyrfetchnews.8.html
# Create symlinks
%{__ln_s} -f %{_exec_prefix}/lib/%{name}/cyradm %{buildroot}%{_bindir}/
%{__ln_s} -f %{_exec_prefix}/lib/%{name}/imtest %{buildroot}%{_bindir}/
# Create filelist for perl package, compress manpages before # Create filelist for perl package, compress manpages before
[ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress [ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress
find %{buildroot}%{perl_sitearch}/Cyrus %{buildroot}%{perl_sitearch}/auto/Cyrus -type f -print | find %{buildroot}%{perl_sitearch}/Cyrus %{buildroot}%{perl_sitearch}/auto/Cyrus -type f -print |
@ -499,7 +541,7 @@ fi
# Remove installed but not packaged files # Remove installed but not packaged files
%{__rm} -f %{buildroot}%{_cyrexecdir}/not-mkdep %{__rm} -f %{buildroot}%{_cyrexecdir}/not-mkdep
%{__rm} -f %{buildroot}%{_cyrexecdir}/config2header %{__rm} -f %{buildroot}%{_cyrexecdir}/config2header*
%{__rm} -f %{buildroot}%{_cyrexecdir}/config2man %{__rm} -f %{buildroot}%{_cyrexecdir}/config2man
%{__rm} -f %{buildroot}%{_cyrexecdir}/pop3proxyd %{__rm} -f %{buildroot}%{_cyrexecdir}/pop3proxyd
find %{buildroot} -name "perllocal.pod" -exec %{__rm} -f {} \; find %{buildroot} -name "perllocal.pod" -exec %{__rm} -f {} \;
@ -508,6 +550,9 @@ find %{buildroot} -name ".packlist" -exec %{__rm} -f {} \;
%{__rm} -f %{buildroot}%{_mandir}/man8/idled.8* %{__rm} -f %{buildroot}%{_mandir}/man8/idled.8*
%{__rm} -f doc/man/idled.8.html %{__rm} -f doc/man/idled.8.html
%endif %endif
%{__rm} -f doc/text/Makefile
%{__rm} -f %{buildroot}%{_mandir}/man8/syncnews.8*
%{__rm} -f doc/man/syncnews.8.html
# On RedHat 7.3, this file is created here # On RedHat 7.3, this file is created here
%{__rm} -f /perllocal.pod %{__rm} -f /perllocal.pod
@ -516,15 +561,6 @@ find %{buildroot} -name ".packlist" -exec %{__rm} -f {} \;
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot} [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%pre %pre
# Create 'cyrus' user on target host
%if %{SASLGROUP}
/usr/sbin/groupadd -g %{gid} -r %{_saslgroup} 2> /dev/null || :
/usr/sbin/useradd -c "Cyrus IMAP Server" -d %{_vardata} -g %{_cyrusgroup} \
-G %{_saslgroup} -s /bin/bash -u %{uid} -r %{_cyrususer} 2> /dev/null || :
%else
/usr/sbin/useradd -c "Cyrus IMAP Server" -d %{_vardata} -g %{_cyrusgroup} \
-s /bin/bash -u %{uid} -r %{_cyrususer} 2> /dev/null || :
%endif
# Let postun know whether cyrus-imapd was running # Let postun know whether cyrus-imapd was running
if [ -e /var/lock/subsys/cyrus-imapd ]; then if [ -e /var/lock/subsys/cyrus-imapd ]; then
/sbin/service %{name} stop >/dev/null 2>&1 || : /sbin/service %{name} stop >/dev/null 2>&1 || :
@ -534,30 +570,6 @@ fi
%post %post
/sbin/chkconfig --add %{name} /sbin/chkconfig --add %{name}
# Create SSL certificates
exec > /dev/null 2> /dev/null
# if the certificate is only in the old location, move it to the new location
if [ -f %{_datadir}/ssl/certs/%{name}.pem -a ! %{ssl_pem_file} ]; then
mv %{_datadir}/ssl/certs/%{name}.pem %{ssl_pem_file}
fi
if [ ! -f %{ssl_pem_file} ]; then
pushd /etc/pki/tls/certs
umask 077
%{__cat} << EOF | make %{name}.pem
--
SomeState
SomeCity
SomeOrganization
SomeOrganizationalUnit
localhost.localdomain
root@localhost.localdomain
EOF
%{__chown} root.%{_cyrusgroup} %{name}.pem
%{__chmod} 640 %{name}.pem
mv %{name}.pem %{ssl_pem_file}
popd
fi
# Force synchronous updates, usually only on ext2 filesystems # Force synchronous updates, usually only on ext2 filesystems
for i in %{_vardata}/{user,quota} %{_spooldata} for i in %{_vardata}/{user,quota} %{_spooldata}
do do
@ -586,14 +598,104 @@ fi
fi fi
%endif %endif
%if %{use_etc_pki}
# change existing config so ssl certificates are under /etc rather than /usr/share
%{__perl} -pi -e \
's@/usr/share/ssl/certs/%{name}.pem@%{ssl_pem_file}@g; \
s@/usr/share/ssl/certs/ca-bundle.crt@/etc/pki/tls/certs/ca-bundle.crt@' \
%{_sysconfdir}/imapd.conf
%endif
%preun %preun
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
/sbin/service %{name} stop >/dev/null 2>&1 || : /sbin/service %{name} stop >/dev/null 2>&1 || :
/sbin/chkconfig --del %{name} /sbin/chkconfig --del %{name}
%{__rm} -f %{_vardata}/socket/lmtp 2> /dev/null %{__rm} -f %{_vardata}/socket/* 2> /dev/null
%{__rm} -f %{_vardata}/proc/* 2> /dev/null
%if %{_withldap}
%{__rm} -f %{_vardata}/ptclient/ptsock 2> /dev/null
%endif
fi fi
%postun %postun
if [ $1 != 0 ]; then
/sbin/service %{name} condrestart >/dev/null 2>&1 || :
fi
%pre utils
# Create 'cyrus' user on target host
%if %{SASLGROUP}
/usr/sbin/groupadd -g %{gid} -r %{_saslgroup} 2> /dev/null || :
/usr/sbin/useradd -c "Cyrus IMAP Server" -d %{_vardata} -g %{_cyrusgroup} \
-G %{_saslgroup} -s /bin/bash -u %{uid} -r %{_cyrususer} 2> /dev/null || :
%else
/usr/sbin/useradd -c "Cyrus IMAP Server" -d %{_vardata} -g %{_cyrusgroup} \
-s /bin/bash -u %{uid} -r %{_cyrususer} 2> /dev/null || :
%endif
%post utils
# Create SSL certificates
exec > /dev/null 2> /dev/null
%if %{use_etc_pki}
# if the certificate is only in the old location, move it to the new location
if [ -f %{_datadir}/ssl/certs/%{name}.pem -a ! -f %{ssl_pem_file} ]; then
mv %{_datadir}/ssl/certs/%{name}.pem %{ssl_pem_file}
fi
%endif
if [ ! -f %{ssl_pem_file} ]; then
pushd %{certs_dir}
umask 077
%{__cat} << EOF | make %{name}.pem
--
SomeState
SomeCity
SomeOrganization
SomeOrganizationalUnit
localhost.localdomain
root@localhost.localdomain
EOF
%{__chown} root.%{_cyrusgroup} %{name}.pem
%{__chmod} 640 %{name}.pem
%if %{use_etc_pki}
mv %{name}.pem %{ssl_pem_file}
%endif
popd
fi
# Add service entries if necessary
if ! %{__grep} -q ^lmtp %{_sysconfdir}/services; then
echo -e 'lmtp\t\t24/tcp\t\t\t\t# LMTP Mail Delivery over TCP' >> %{_sysconfdir}/services
echo -e 'lmtp\t\t24/udp\t\t\t\t# LMTP Mail Delivery over TCP' >> %{_sysconfdir}/services
fi
if ! %{__grep} -q ^nntps %{_sysconfdir}/services; then
echo -e 'nntps\t\t563/tcp\t\t\t\t# NNTP over SSL' >> %{_sysconfdir}/services
echo -e 'nntps\t\t563/udp\t\t\t\t# NNTP over SSL' >> %{_sysconfdir}/services
fi
if ! %{__grep} -q ^pop3s %{_sysconfdir}/services; then
echo -e 'pop3s\t\t995/tcp\t\t\t\t# POP-3 over SSL' >> %{_sysconfdir}/services
echo -e 'pop3s\t\t995/udp\t\t\t\t# POP-3 over SSL' >> %{_sysconfdir}/services
fi
if ! %{__grep} -q ^imaps %{_sysconfdir}/services; then
echo -e 'imaps\t\t993/tcp\t\t\t\t# IMAP over SSL' >> %{_sysconfdir}/services
echo -e 'imaps\t\t993/udp\t\t\t\t# IMAP over SSL' >> %{_sysconfdir}/services
fi
if ! %{__grep} -q ^sieve %{_sysconfdir}/services; then
echo -e 'sieve\t\t2000/tcp\t\t\t# Sieve Mail Filter Daemon' >> %{_sysconfdir}/services
echo -e 'sieve\t\t2000/udp\t\t\t# Sieve Mail Filter Daemon' >> %{_sysconfdir}/services
fi
if ! %{__grep} -q ^csync %{_sysconfdir}/services; then
echo -e 'csync\t\t2005/tcp\t\t\t# Cyrus IMAP Replication Daemon' >> %{_sysconfdir}/services
echo -e 'csync\t\t2005/udp\t\t\t# Cyrus IMAP Replication Daemon' >> %{_sysconfdir}/services
fi
if ! %{__grep} -q ^mupdate %{_sysconfdir}/services; then
echo -e 'mupdate\t\t3905/tcp\t\t\t# Cyrus IMAP Mupdate Daemon' >> %{_sysconfdir}/services
echo -e 'mupdate\t\t3905/udp\t\t\t# Cyrus IMAP Mupdate Daemon' >> %{_sysconfdir}/services
fi
if ! %{__grep} -q ^fud %{_sysconfdir}/services; then
echo -e 'fud\t\t4201/udp\t\t\t# Cyrus IMAP FUD Daemon' >> %{_sysconfdir}/services
fi
%postun utils
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
/usr/sbin/userdel %{_cyrususer} 2> /dev/null || : /usr/sbin/userdel %{_cyrususer} 2> /dev/null || :
%if %{SASLGROUP} %if %{SASLGROUP}
@ -601,8 +703,6 @@ if [ $1 = 0 ]; then
/usr/sbin/groupdel %{_saslgroup} 2> /dev/null || : /usr/sbin/groupdel %{_saslgroup} 2> /dev/null || :
fi fi
%endif %endif
else
/sbin/service %{name} condrestart >/dev/null 2>&1 || :
fi fi
%files %files
@ -616,6 +716,9 @@ fi
%config(noreplace) %{_sysconfdir}/pam.d/imap %config(noreplace) %{_sysconfdir}/pam.d/imap
%config(noreplace) %{_sysconfdir}/pam.d/sieve %config(noreplace) %{_sysconfdir}/pam.d/sieve
%config(noreplace) %{_sysconfdir}/pam.d/lmtp %config(noreplace) %{_sysconfdir}/pam.d/lmtp
%config(noreplace) %{_sysconfdir}/pam.d/mupdate
%config(noreplace) %{_sysconfdir}/pam.d/csync
%config(noreplace) %{_sysconfdir}/pam.d/nntp
%attr(0755,root,root) %config %{_sysconfdir}/cron.daily/%{name} %attr(0755,root,root) %config %{_sysconfdir}/cron.daily/%{name}
%dir %{_cyrexecdir} %dir %{_cyrexecdir}
%attr(0755,root,root) %{_cyrexecdir}/arbitron %attr(0755,root,root) %{_cyrexecdir}/arbitron
@ -638,6 +741,7 @@ fi
%attr(0755,root,root) %{_cyrexecdir}/masssievec %attr(0755,root,root) %{_cyrexecdir}/masssievec
%attr(0755,root,root) %{_cyrexecdir}/mbexamine %attr(0755,root,root) %{_cyrexecdir}/mbexamine
%attr(0755,root,root) %{_cyrexecdir}/mbpath %attr(0755,root,root) %{_cyrexecdir}/mbpath
%attr(0755,root,root) %{_cyrexecdir}/migrate-metadata
%attr(0755,root,root) %{_cyrexecdir}/mkimap %attr(0755,root,root) %{_cyrexecdir}/mkimap
%attr(0755,root,root) %{_cyrexecdir}/mknewsgroups %attr(0755,root,root) %{_cyrexecdir}/mknewsgroups
%attr(0755,root,root) %{_cyrexecdir}/notifyd %attr(0755,root,root) %{_cyrexecdir}/notifyd
@ -652,6 +756,7 @@ fi
%attr(0755,root,root) %{_cyrexecdir}/tls_prune %attr(0755,root,root) %{_cyrexecdir}/tls_prune
%attr(0755,root,root) %{_cyrexecdir}/translatesieve %attr(0755,root,root) %{_cyrexecdir}/translatesieve
%attr(0755,root,root) %{_cyrexecdir}/undohash %attr(0755,root,root) %{_cyrexecdir}/undohash
%attr(0755,root,root) %{_cyrexecdir}/unexpunge
%attr(0755,root,root) %{_cyrexecdir}/upgradesieve %attr(0755,root,root) %{_cyrexecdir}/upgradesieve
%attr(0755,root,root) %{_cyrexecdir}/cvt_cyrusdb_all %attr(0755,root,root) %{_cyrexecdir}/cvt_cyrusdb_all
%if %{GROUPCACHE} %if %{GROUPCACHE}
@ -664,6 +769,20 @@ fi
%if %{AUTOCREATE} %if %{AUTOCREATE}
%attr(0755,root,root) %{_cyrexecdir}/compile_sieve %attr(0755,root,root) %{_cyrexecdir}/compile_sieve
%endif %endif
%attr(0755,root,root) %{_cyrexecdir}/mupdate
%attr(0755,root,root) %{_cyrexecdir}/mupdate-loadgen.pl
%attr(0755,root,root) %{_cyrexecdir}/proxyd
%attr(0755,root,root) %{_cyrexecdir}/make_md5
%attr(0755,root,root) %{_cyrexecdir}/sync_client
%attr(0755,root,root) %{_cyrexecdir}/sync_reset
%attr(0755,root,root) %{_cyrexecdir}/sync_server
%attr(0755,root,root) %{_cyrexecdir}/cyrfetchnews
%attr(0755,root,root) %{_cyrexecdir}/nntpd
%if %{_withldap}
%attr(0755,root,root) %{_cyrexecdir}/ptdump
%attr(0755,root,root) %{_cyrexecdir}/ptexpire
%attr(0755,root,root) %{_cyrexecdir}/ptloader
%endif
%if %{DEL_WRAP} %if %{DEL_WRAP}
%attr(2755,%{_cyrususer},%{_cyrusgroup}) %{_cyrexecdir}/deliver-wrapper %attr(2755,%{_cyrususer},%{_cyrusgroup}) %{_cyrexecdir}/deliver-wrapper
%endif %endif
@ -676,8 +795,13 @@ fi
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/msg %attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/msg
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/db %attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/db
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/sieve %attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/sieve
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/sync
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/md5
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/rpm %attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/rpm
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/backup %attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/backup
%if %{_withldap}
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/ptclient
%endif
%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_spooldata} %attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_spooldata}
%dir %{_datadir}/%{name} %dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/rpm %dir %{_datadir}/%{name}/rpm
@ -686,22 +810,11 @@ fi
%{_mandir}/man8/* %{_mandir}/man8/*
%doc COPYRIGHT README %doc COPYRIGHT README
%doc doc/* %doc doc/*
%if %{use_etc_pki}
%dir %{pki_dir} %dir %{pki_dir}
%endif
%attr(0640,root,%{_cyrusgroup}) %ghost %config(missingok,noreplace) %verify(not md5 size mtime) %{ssl_pem_file} %attr(0640,root,%{_cyrusgroup}) %ghost %config(missingok,noreplace) %verify(not md5 size mtime) %{ssl_pem_file}
%files murder
%defattr(0644,root,root,0755)
%config(noreplace) %{_sysconfdir}/pam.d/mupdate
%attr(0755,root,root) %{_cyrexecdir}/lmtpproxyd
%attr(0755,root,root) %{_cyrexecdir}/mupdate
%attr(0755,root,root) %{_cyrexecdir}/proxyd
%files nntp
%defattr(0644,root,root,0755)
%config(noreplace) %{_sysconfdir}/pam.d/nntp
%attr(0755,root,root) %{_cyrexecdir}/cyrfetchnews
%attr(0755,root,root) %{_cyrexecdir}/nntpd
%files devel %files devel
%defattr(0644,root,root,0755) %defattr(0644,root,root,0755)
%{_includedir}/cyrus %{_includedir}/cyrus
@ -716,13 +829,158 @@ fi
%files utils %files utils
%defattr(0644,root,root,0755) %defattr(0644,root,root,0755)
%attr(0755,root,root) %{_cyrexecdir}/cyradm
%attr(0755,root,root) %{_cyrexecdir}/imtest
%attr(0755,root,root) %{_cyrexecdir}/mupdate-loadgen.pl
%attr(0755,root,root) %{_bindir}/* %attr(0755,root,root) %{_bindir}/*
%{_mandir}/man1/* %{_mandir}/man1/*
%changelog %changelog
* Wed Jan 25 2006 Simon Matter <simon.matter@invoca.ch> 2.3.1-2
- add backend_sigsegv patch
- add replication_policycheck patch
* Mon Jan 23 2006 Simon Matter <simon.matter@invoca.ch> 2.3.1-1
- update to official autocreate and autosievefolder patches
* Thu Jan 19 2006 Simon Matter <simon.matter@invoca.ch> 2.3.1-0.18
- update rpm_set_permissions script
- add snmp support as build time option, disabled by default
because it doesn't build on older distributions
* Wed Jan 18 2006 Simon Matter <simon.matter@invoca.ch> 2.3.1-0.15
- add make_md5 patch
* Mon Jan 16 2006 Simon Matter <simon.matter@invoca.ch> 2.3.1-0.13
- add autosievefolder patch
- add rmquota+deletemailbox patch
- change default path for make_md5, add md5 directory
* Fri Jan 13 2006 Simon Matter <simon.matter@invoca.ch> 2.3.1-0.10
- spec file cleanup
- add more cvt_cyrusdb_all fixes
- fix pre/post scripts
- fix requirements
- add patch to set Invoca RPM config defaults
- add sync directory used for replication
- add autocreate patch
* Thu Jan 12 2006 Simon Matter <simon.matter@invoca.ch> 2.3.1-0.8
- update cvt_cyrusdb_all script
- build db.cfg on the fly
* Thu Jan 05 2006 Simon Matter <simon.matter@invoca.ch> 2.3.1-0.5
- create ptclient directory if ldap enabled
* Wed Jan 04 2006 Simon Matter <simon.matter@invoca.ch> 2.3.1-0.4
- build without ldap support if openldap is linked against SASLv1
* Tue Jan 03 2006 Simon Matter <simon.matter@invoca.ch> 2.3.1-0.3
- fix ldap support
* Mon Jan 02 2006 Simon Matter <simon.matter@invoca.ch> 2.3.1-0.2
- add openldap-devel to buildprereq, build with ldap support
* Wed Dec 21 2005 Simon Matter <simon.matter@invoca.ch> 2.3.1-0.1
- update to 2.3.1, officially called BETA-quality release
* Fri Dec 16 2005 Simon Matter <simon.matter@invoca.ch> 2.3.0-0.4
- add skiplist.py to contrib/
- port authid_normalize patch
* Thu Dec 15 2005 Simon Matter <simon.matter@invoca.ch> 2.3.0-0.3
- reintroduce subpackage utils, fix requirements
- move some utils to %{_bindir}/
* Wed Dec 14 2005 Simon Matter <simon.matter@invoca.ch> 2.3.0-0.2
- integrate subpackages murder, nntp, replication, utils
* Tue Dec 13 2005 Simon Matter <simon.matter@invoca.ch> 2.3.0-0.1
- update to 2.3.0, officially called BETA-quality release
- add replication subpackage
* Fri Dec 09 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-15.1
- add missing automake to buildprereq
- change package description
* Tue Dec 06 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-15
- update cvt_cyrusdb_all script
- update autocreate patches
* Mon Dec 05 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-14
- update cvt_cyrusdb_all script
* Mon Nov 14 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-13
- add 64bit quota support backported from 2.3
* Fri Nov 11 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-12
- add quickstart/stop option to init script to bypass db import/export
- add authid_normalize patch
- add allow_auth_plain_proxying patch
- update gcc4 patch
- remove useless fdatasync patch
- add private autoconf used for build, remove autoconf dependency
- generate correct docs including man pages
- remove unneeded files from doc directory
* Fri Nov 04 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-11
- add mupdate thread-safe patch
* Mon Oct 24 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-9.4
- add spool patch, which is already fixed in CVS
* Tue Aug 30 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-9.2
- pull in CPPFLAGS and LDFLAGS from openssl's pkg-config data, if it exists
* Wed Aug 24 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-9.1
- add timsieved_reset_sasl_conn patch
* Mon Aug 22 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-9
- cosmetic changes in pre and post scripts
* Fri Aug 19 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-8
- add more pki dir fixes for inplace upgrades
* Thu Aug 18 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-7
- include requirement for Berkeley DB utils
* Thu Aug 18 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-6
- fix recovery problems with db4, which do not exist with db3
- fix logic for handling ssl certs
- remove initlog from init script
* Wed Aug 17 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-5
- add notifytest to the distribution
- add functionality to convert all berkeley databases to skiplist
on shutdown and convert them back as needed on startup. This should
solve the upgrade problems with Berkeley databases.
* Tue Aug 16 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-4.14
- add gcc4 patch
- determine and handle pki directory for openssl correctly
- add skiplist recovery docs
- add notify_sms patch
* Mon Jul 18 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-4.10
- update cvt_cyrusdb_all script
- update autocreate patches
* Fri Jul 15 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-4.9
- add patch to remove ACLs with invalid identifier
- update cvt_cyrusdb_all script
* Sat Jun 18 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-4.1
- update munge8bit patch
* Wed Jun 08 2005 Simon Matter <simon.matter@invoca.ch> 2.2.12-4
- updated seenstate patch
* Thu Jun 02 2005 Simon Matter <simon.matter@invoca.ch>
- removed nolinkimapspool patch, added singleinstancestore patch instead
* Thu Jun 02 2005 Simon Matter <simon.matter@invoca.ch>
- added nolinkimapspool patch
- fix debug_package macro, it was still being expanded,
comments don't hide macro expansion
- change license field to BSD, its not exact BSD, but BSD is the closest
* Fri Apr 22 2005 John Dennis <jdennis@redhat.com> - 2.2.12-6.fc4 * Fri Apr 22 2005 John Dennis <jdennis@redhat.com> - 2.2.12-6.fc4
- the openssl package moved all its certs, CA, Makefile, etc. to /etc/pki - the openssl package moved all its certs, CA, Makefile, etc. to /etc/pki
now we are consistent with the openssl directory changes. now we are consistent with the openssl directory changes.
@ -748,6 +1006,9 @@ fi
* Mon Apr 4 2005 John Dennis <jdennis@redhat.com> - 2.2.12-1.1.fc4 * Mon Apr 4 2005 John Dennis <jdennis@redhat.com> - 2.2.12-1.1.fc4
- bring up to 2.2.12, includes security fix for CAN-2005-0546 - bring up to 2.2.12, includes security fix for CAN-2005-0546
* Mon Mar 07 2005 Simon Matter <simon.matter@invoca.ch>
- updated rmquota+deletemailbox patches
* Fri Mar 4 2005 John Dennis <jdennis@redhat.com> - 2.2.10-11.4.fc4 * Fri Mar 4 2005 John Dennis <jdennis@redhat.com> - 2.2.10-11.4.fc4
- fix gcc4 build problems - fix gcc4 build problems
@ -830,7 +1091,7 @@ fi
fixes bug #139382, fixes bug #139382,
security advisories: CAN-2004-1011 CAN-2004-1012 CAN-2004-1013 CAN-2004-1015 security advisories: CAN-2004-1011 CAN-2004-1012 CAN-2004-1013 CAN-2004-1015
* Tue Nov 24 2004 Simon Matter <simon.matter@invoca.ch> * Wed Nov 24 2004 Simon Matter <simon.matter@invoca.ch>
- updated to 2.2.10 - updated to 2.2.10
* Tue Nov 23 2004 Simon Matter <simon.matter@invoca.ch> * Tue Nov 23 2004 Simon Matter <simon.matter@invoca.ch>

172
skiplist.py Normal file
View File

@ -0,0 +1,172 @@
#!/usr/bin/env python
# -*- Mode: Python; tab-width: 4 -*-
#
# Cyrus Imapd Skiplist db recovery tool
#
# Copyright (C) 2004 Gianluigi Tiesi <sherpya@netfarm.it>
# Copyright (C) 2004 NetFarm S.r.l. [http://www.netfarm.it]
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
# ======================================================================
__version__= '0.1'
__doc__="""Cyrus skiplist db recover"""
from sys import argv,exit,stdout,stderr
from struct import unpack
from time import localtime, strftime
### User Conf
debug = 0
###
TIMEFMT ='%a, %d %b %Y %H:%M:%S %z'
PADDING = '\xff' * 4
INORDER = 1
ADD = 2
DELETE = 4
COMMIT = 255
DUMMY = 257
HEADER = -1
MAIN = -2
types = {
1: 'INORDER',
2: 'ADD',
4: 'DELETE',
255: 'COMMIT',
257: 'DUMMY',
-1: 'HEADER',
-2: '*'
}
def log(rtype, text):
global debug
if debug:
out = '[%s] %s\n' % (types[rtype], text)
stdout.write(out)
stdout.flush()
def roundto4(value):
if value % 4:
return ((value / 4) + 1) * 4
return value
def get_header(fp):
#### Magic ??
fp.seek(4)
sign = fp.read(16)
log(HEADER, sign[:-3])
version = unpack('>I', fp.read(4))[0]
version_minor = unpack('>I', fp.read(4))[0]
log(HEADER, 'Version %d,%d' % (version, version_minor))
maxlevel = unpack('>I', fp.read(4))[0]
curlevel = unpack('>I', fp.read(4))[0]
log(HEADER, 'Level %d/%d' % (curlevel, maxlevel))
listsize = unpack('>I', fp.read(4))[0]
log(HEADER, 'List size %d' % listsize)
logstart = unpack('>I', fp.read(4))[0]
log(HEADER, 'Offset %d' % logstart)
lastrecovery = localtime(unpack('>I', fp.read(4))[0])
lastrecovery = strftime(TIMEFMT, lastrecovery)
log(HEADER, 'Last Recovery %s' % lastrecovery)
return { 'version' : [version, version_minor],
'level' : [curlevel, maxlevel],
'listsize' : listsize,
'logstart' : logstart,
'lastrecover': lastrecovery
}
def getkeys(fp):
values = []
keys = {}
keystring = ''
datastring = ''
while 1:
log(MAIN, '-'*78)
stype = fp.read(4)
### EOF
if len(stype) != 4:
break
rtype = unpack('>I', stype)[0]
if not types.has_key(rtype):
log(MAIN, 'Invalid type %d' % rtype)
continue
log(rtype, 'Record type %s' % types[rtype])
if rtype == DELETE:
ptr = unpack('>I', fp.read(4))[0]
log(rtype, 'DELETE %d (0x%x)' % (ptr, ptr))
continue
if rtype == COMMIT:
continue
ksize = unpack('>I', fp.read(4))[0]
log(rtype, 'Key size %d (%d)' % (ksize, roundto4(ksize)))
if ksize:
keystring = fp.read(roundto4(ksize))[:ksize]
log(rtype, 'Key String %s' % keystring)
datasize = unpack('>I', fp.read(4))[0]
log(rtype, 'Data size %d (%d)' % (datasize, roundto4(datasize)))
if datasize:
datastring = fp.read(roundto4(datasize))[:datasize]
log(rtype, 'Data String %s' % datastring)
n = 0
while 1:
str_p = fp.read(4)
if str_p == PADDING:
break
spointer = unpack('>I', str_p)[0]
n = n +1
if spointer: log(rtype, 'Skip pointer %d' % spointer)
log(rtype, 'Total Skip pointers: %d' % n)
if rtype != DUMMY:
if keystring not in values:
values.append(keystring)
keys[keystring] = datastring
return values, keys
if __name__ == '__main__':
if len(argv) != 2:
print 'Usage: %s skiplist.file' % argv[0]
exit()
fp = open(argv[1], 'rb')
header = get_header(fp)
values, keys = getkeys(fp)
fp.close()
if debug: exit()
for v in values:
print '%s\t%s' % (v, keys[v])

View File

@ -1,2 +1,2 @@
70b3bba526a8d36d3bb23a87d37e9188 cyrus-imapd-2.2.12.tar.gz cde15876d5c953bba9ad9f7811aff695 cyrus-imapd-2.3.1.tar.gz
8f7a26b0556369827bb5c8084a3e3ea1 cyrus_sharedbackup-0.1.tar.gz 8f7a26b0556369827bb5c8084a3e3ea1 cyrus_sharedbackup-0.1.tar.gz