rpms/cyrus-imapd/devel cyrus-imapd-2.3.16-autocreate-0.10-0.diff, NONE, 1.1 cyrus-imapd-2.3.16-autosieve-0.6.0.diff, NONE, 1.1 cyrus-imapd-README.RPM, 1.3, 1.4 cyrus-imapd.cvt_cyrusdb_all, 1.2, 1.3 cyrus-imapd.spec, 1.74, 1.75 README.HOWTO-recover-mailboxes.db, 1.1, NONE README.skiplist_recovery, 1.1, NONE allow_auth_plain_proxying.patch, 1.1, NONE batchreconstruct, 1.1, NONE bsd2cyrus, 1.1, NONE cpmsg, 1.1, NONE cyrus-deliver-wrapper.c, 1.1, NONE cyrus-imapd-2.1.16-getrlimit.patch, 1.1, NONE cyrus-imapd-2.2.12-no_transfig.patch, 1.1, NONE cyrus-imapd-2.3.12p2-autocreate-0.10-0.diff, 1.5, NONE cyrus-imapd-2.3.12p2-autosieve-0.6.0.diff, 1.1, NONE cyrus-imapd-2.3.7-krb4.patch, 1.2, NONE cyrus-imapd-2.3.7-notify_sms.patch, 1.2, NONE cyrus-imapd-2.3.9-rmquota+deletemailbox-0.2-1.diff, 1.1, NONE cyrus-imapd-README.groupcache, 1.1, NONE cyrus-imapd-acceptinvalidfrom.patch, 1.1, NONE cyrus-imapd-procmail+cyrus.mc, 1.1, NONE cyrus-imapd-sendmail-8.12.9-cyrusv2.m4, 1.1, NONE cyrus-imapd.rpm_set_permissions, 1.2, NONE cyrus-imapd.upd_groupcache, 1.1, NONE cyrus-procmailrc, 1.1, NONE cyrus-user-procmailrc.template, 1.1, NONE cyrus_ldap_quota.pl, 1.3, NONE folderxfer, 1.1, NONE imapcreate.pl, 1.3, NONE inboxfer, 1.1, NONE skiplist.py, 1.1, NONE

Michal Hlavinka mhlavink at fedoraproject.org
Tue Jun 8 11:01:40 UTC 2010


Author: mhlavink

Update of /cvs/pkgs/rpms/cyrus-imapd/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv9173

Modified Files:
	cyrus-imapd-README.RPM cyrus-imapd.cvt_cyrusdb_all 
	cyrus-imapd.spec 
Added Files:
	cyrus-imapd-2.3.16-autocreate-0.10-0.diff 
	cyrus-imapd-2.3.16-autosieve-0.6.0.diff 
Removed Files:
	README.HOWTO-recover-mailboxes.db README.skiplist_recovery 
	allow_auth_plain_proxying.patch batchreconstruct bsd2cyrus 
	cpmsg cyrus-deliver-wrapper.c 
	cyrus-imapd-2.1.16-getrlimit.patch 
	cyrus-imapd-2.2.12-no_transfig.patch 
	cyrus-imapd-2.3.12p2-autocreate-0.10-0.diff 
	cyrus-imapd-2.3.12p2-autosieve-0.6.0.diff 
	cyrus-imapd-2.3.7-krb4.patch 
	cyrus-imapd-2.3.7-notify_sms.patch 
	cyrus-imapd-2.3.9-rmquota+deletemailbox-0.2-1.diff 
	cyrus-imapd-README.groupcache 
	cyrus-imapd-acceptinvalidfrom.patch 
	cyrus-imapd-procmail+cyrus.mc 
	cyrus-imapd-sendmail-8.12.9-cyrusv2.m4 
	cyrus-imapd.rpm_set_permissions cyrus-imapd.upd_groupcache 
	cyrus-procmailrc cyrus-user-procmailrc.template 
	cyrus_ldap_quota.pl folderxfer imapcreate.pl inboxfer 
	skiplist.py 
Log Message:
- spec cleanup
- simplified packaging (merge -perl in -utils)
- remove obsoleted and/or unmaintained additional sources/patches
- remove long time not used files from the cvs/srpm
- update additional sources/patches from their upstream
step 1


cyrus-imapd-2.3.16-autocreate-0.10-0.diff:
 README.autocreate    |  211 ++++++++++++++++++
 imap/Makefile.in     |  157 +++++++------
 imap/autosieve.c     |  590 +++++++++++++++++++++++++++++++++++++++++++++++++++
 imap/compile_sieve.c |  365 +++++++++++++++++++++++++++++++
 imap/imapd.c         |   43 +++
 imap/lmtpd.c         |   92 +++++++
 imap/mboxlist.c      |  370 +++++++++++++++++++++++++++++++
 imap/mboxlist.h      |    5 
 imap/pop3d.c         |   46 +++
 lib/auth.c           |    8 
 lib/auth.h           |    2 
 lib/auth_krb.c       |   17 +
 lib/auth_krb5.c      |   16 +
 lib/auth_pts.c       |    9 
 lib/auth_unix.c      |   11 
 lib/imapoptions      |   49 ++++
 notifyd/Makefile.in  |    3 
 notifyd/notifyd.c    |    2 
 ptclient/Makefile.in |    3 
 19 files changed, 1920 insertions(+), 79 deletions(-)

--- NEW FILE cyrus-imapd-2.3.16-autocreate-0.10-0.diff ---
diff -Naur cyrus-imapd-2.3.16/README.autocreate cyrus-imapd-2.3.16-autocreate.uncompiled/README.autocreate
--- cyrus-imapd-2.3.16/README.autocreate	1970-01-01 02:00:00.000000000 +0200
+++ cyrus-imapd-2.3.16-autocreate.uncompiled/README.autocreate	2009-12-22 19:56:22.000000000 +0200
@@ -0,0 +1,211 @@
+Cyrus IMAP autocreate Inbox patch
+----------------------------------
+
+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/ 
+
+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,
+that has to be completed as part of the user email account creation procedure. 
+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).
+  b) Create the corresponding 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).
+Unlike what not careful readers may think, enabling the "autocreatequota" option, doesn't 
+lead to the automatic INBOX folder creation by Cyrus IMAP server.
+In fact, "autocreate" means that the IMAP clients are allowed to automatically create 
+the user INBOX. 
+
+This patch adds the functionality of automatic creation of the users' INBOX folders into
+the Cyrus IMAP server. It is implemented as two features, namely the  "create on login"
+and "create on post".
+ 
+
+
+Create on login
+===============
+This feauture provides automatic creation of a user's INBOX folder when all of the 
+following requirements are met:
+
+i)  The user has succesfully passed the authentication procedure.
+
+ii) The user's authorisation ID (typically the same as the user's
+authentication ID)  doesn't belong to the imap_admins or admins
+accounts (see imapd.conf).
+
+iii) The "autocreatequota" option in the imap configuration file 
+has been set to a non zero value. 
+
+iv) The corresponding to the user's authorisation ID INBOX folder
+does not exist.
+
+The user's first login is the most typical case when all four requirements are met. 
+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 
+will be created.
+
+
+
+Create on post
+==============
+This feauture provides automatic creation of a user's INBOX folder when all of the 
+following requirements are met. 
+
+i) An email message addressed to the user has been received.  
+
+ii) The recipient is not any of the imap_admins or admins accounts. 
+Note that passing emails to admins or imap_admins accounts from 
+the MTA to LMTP should be avoided in any case.
+
+iii) The recipient's INBOX does not exist.
+
+iv) The "autocreatequota" option in the imap configuration file 
+has been set to a non zero value. 
+
+v) The "createonpost" option in the imap configuration file 
+has been switched on. 
+
+
+Besides the automatic creation of INBOX folder, additional functionalities are
+provided:
+
+  (A) Automatic creation of INBOX subfolders controlled by "autocreateinboxfolders"
+configuration option. eg 
+
+autocreateinboxfolders: sent|drafts|spam|templates
+
+  (B) Automatic subscription of INBOX subfolders controlled by "autosubscribeinboxfolders"
+configuration option. eg
+
+autosubscribeinboxfolders: sent|spam
+
+Obviously, only subscription to subfolders included in the "autocreateinboxfolder"
+list is meaningful. 
+
+  (C) Automatic subscription to shared folders (bulletin boards). The user gets
+automatically subscribed to the shared folders declared in the "autosubscribesharedfolders"
+configuration option in imapd.conf.
+eg autosubscribesharedfolders: public_folder | public_folder.subfolder
+
+In order the above action to succeed, the shared folder has to pre-exist the INBOX creation
+and the user must have the appropriate permissions in order to be able to subscribe to the
+shared folder.
+
+* A new config option has been added. 'autosubscribe_all_sharedfolders' is a yes/no
+option. When set to yes, the user is automatically subscribed to all shared folders one 
+has permission to subscribe to. Please, note that when this option is set to yes, then
+'autosubscribesharedfolders' option is overriden.
+
+  (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
+default anti-spam script may me be written in a file and copied to each user
+sieve scripts upon the INBOX creation. The imapd.conf options that have been added
+are 'autocreate_sieve_script', 'autocreate_sieve_compiledscript' and 
+'generate_compiled_sieve_script'. 
+
+autocreate_sieve_script configuration option refers to the full path of the file 
+that contains the sieve script. The default value is null and if no file is defined,
+then no default script is created upon INBOX creation. (The feature is disabled)
+eg autocreate_sieve_script: /etc/default_sieve_script
+
+autocreate_sieve_compiledscript configuration option refers to the full path of the
+file that contains the bytecode compiled sieve script. If this filename is defined
+in imapd.conf and the file exists, then it is automatically copied in the user's sieve
+directory. If it is not defined, then a bytecode sieve script gets on the fly compiled
+by the daemon. 
+eg autocreate_sieve_compiledscript: /etc/default_sieve_script.bc
+
+generate_compiled_sieve_script is a boolean option that triggers the compilation of the 
+source sieve script to bytecode sieve script. The file that the bytecode script will
+be saved is pointed by autocreate_sieve_compiledscript.
+
+Ways of compiling a sieve script : 
+1. Compile a sieve script using the standard sievec utility, distributed by CMU
+2. Compile a sieve script using the compile_sieve utility, released by UoA. This 
+   tool is almost identical to the sievec utility, with the difference that it 
+   reads the input and output file from autocreate_sieve_script and 
+   autocreate_sieve_compiledscript options in imapd.conf
+3. Let cyrus create a compiled sieve script using a source script. Cyrus can be
+   instructed to save the compiled script any time a compiled script does not exist.
+
+NOTES : 
+1. In order this functionality to work, the following requirements must have been met:
+   - 'sieveusehomedir' option must be 'no' in the configuration (default).
+   - 'sievedir' option must have a valid value.
+2. Currently, this patch checks the validity of the source script while generating a 
+   bytecode compiled script, but not the validity of the bytecode sieve script file.
+   The administrator should make sure that the provided files contain a valid sieve
+   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 
+=======================
+
+I) In order to use the create on post feauture one should be absolutely sure that: 
+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 
+able to use the account database as user mailbox database". 
+b) Only authorised accounts/services can talk to LMTP.
+
+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 
+of the cases. 
+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
+Cyrus code. The way it was implemented may not have been the most performance
+optimised, but it produces a much cleaner and simple patch.
+
+
+
+Virtual Domains Support
+=======================
+
+Virtual domains are supported by all versions of the patch for cyrus-imapd-2.2.1-BETA and 
+later. However, it is not possible to declare different INBOX subfolders to be created or 
+shared folders to be subscribed to for every domain.
[...2002 lines suppressed...]
 #endif
 
 struct auth_mech auth_krb = 
@@ -382,4 +398,5 @@
     &mymemberof,
     &mynewstate,
     &myfreestate,
+    &mycanonuser,
 };
diff -Naur cyrus-imapd-2.3.16/lib/auth_krb5.c cyrus-imapd-2.3.16-autocreate.uncompiled/lib/auth_krb5.c
--- cyrus-imapd-2.3.16/lib/auth_krb5.c	2008-03-24 19:43:08.000000000 +0200
+++ cyrus-imapd-2.3.16-autocreate.uncompiled/lib/auth_krb5.c	2009-12-22 19:56:22.000000000 +0200
@@ -199,6 +199,14 @@
     free(auth_state);
 }
 
+static char *mycanonuser(struct auth_state *auth_state)
+{
+    if (auth_state)
+       return auth_state->userid;
+
+    return NULL;
+}
+
 #else /* HAVE_GSSAPI_H */
 
 static int mymemberof(
@@ -230,6 +238,13 @@
 	fatal("Authentication mechanism (krb5) not compiled in", EC_CONFIG);
 }
 
+static char *mycanonuser(
+    struct auth_state *auth_state __attribute__((unused)))
+{
+        fatal("Authentication mechanism (krb5) not compiled in", EC_CONFIG);
+	return NULL;
+}
+
 #endif
 
 struct auth_mech auth_krb5 = 
@@ -240,4 +255,5 @@
     &mymemberof,
     &mynewstate,
     &myfreestate,
+    &mycanonuser,
 };
diff -Naur cyrus-imapd-2.3.16/lib/auth_pts.c cyrus-imapd-2.3.16-autocreate.uncompiled/lib/auth_pts.c
--- cyrus-imapd-2.3.16/lib/auth_pts.c	2008-03-24 19:43:08.000000000 +0200
+++ cyrus-imapd-2.3.16-autocreate.uncompiled/lib/auth_pts.c	2009-12-22 19:56:22.000000000 +0200
@@ -512,6 +512,14 @@
     free(auth_state);
 }
 
+static char *mycanonuser(struct auth_state *auth_state)
+{
+    if (auth_state)
+       return auth_state->userid.id;
+
+    return NULL;
+}
+
 struct auth_mech auth_pts = 
 {
     "pts",		/* name */
@@ -520,4 +528,5 @@
     &mymemberof,
     &mynewstate,
     &myfreestate,
+    &mycanonuser,
 };
diff -Naur cyrus-imapd-2.3.16/lib/auth_unix.c cyrus-imapd-2.3.16-autocreate.uncompiled/lib/auth_unix.c
--- cyrus-imapd-2.3.16/lib/auth_unix.c	2009-03-31 07:11:22.000000000 +0300
+++ cyrus-imapd-2.3.16-autocreate.uncompiled/lib/auth_unix.c	2009-12-22 19:56:22.000000000 +0200
@@ -315,6 +315,16 @@
     free((char *)auth_state);
 }
 
+static char *mycanonuser(auth_state)
+    struct auth_state *auth_state;
+{
+    if (auth_state)
+         return auth_state->userid;
+
+    return NULL;
+}
+
+
 
 struct auth_mech auth_unix = 
 {
@@ -324,4 +334,5 @@
     &mymemberof,
     &mynewstate,
     &myfreestate,
+    &mycanonuser,
 };
diff -Naur cyrus-imapd-2.3.16/lib/imapoptions cyrus-imapd-2.3.16-autocreate.uncompiled/lib/imapoptions
--- cyrus-imapd-2.3.16/lib/imapoptions	2009-12-21 13:25:22.000000000 +0200
+++ cyrus-imapd-2.3.16-autocreate.uncompiled/lib/imapoptions	2009-12-22 19:56:22.000000000 +0200
@@ -236,6 +236,55 @@
 /* Number of seconds to wait before returning a timeout failure when
    performing a client connection (e.g., in a murder environment) */
 
+{ "createonpost", 0, SWITCH }
+/* If yes, when lmtpd receives an incoming mail for an INBOX that does not exist,
+   then the INBOX is automatically created by lmtpd. */
+
+{ "autocreateinboxfolders", NULL, STRING }
+/* If a user does not have an INBOX created then the INBOX as well as some INBOX 
+   subfolders are created under two conditions.
+     1. The user logins via the IMAP or the POP3 protocol. (autocreatequota option must have a nonzero value)
+     2. A message arrives for the user through the LMTPD protocol.(createonpost option must be yes)
+   autocreateinboxfolders is a list of INBOX's subfolders separated by a "|", that 
+   are automatically created by the server under the previous two situations. */
+
+{ "autosubscribeinboxfolders", NULL, STRING }
+/* A list of folder names, separated by "|", that the users get automatically subscribed to, 
+   when their INBOX is created. These folder names must have been included in the 
+   autocreateinboxfolders option of the imapd.conf. */
+
+{ "autosubscribesharedfolders", NULL, STRING }
+/* A list of shared folders (bulletin boards), separated by "|", that the users get
+   automatically subscribed to, after their INBOX is created. The shared folder must 
+   have been created and the user must have the required permissions to get subscribed 
+   to it. Otherwise, subscribing to the shared folder fails. */
+
+{ "autosubscribe_all_sharedfolders", 0, SWITCH }
+/* If set to yes, the user is automatically subscribed to all shared folders, one has permission
+   to subscribe to. */
+
+{ "autocreate_sieve_script", NULL, STRING }
+/* The full path of a file that contains a sieve script. This script automatically becomes a
+   user's initial default sieve filter script. When this option is not defined, no default 
+   sieve filter is created. The file must be readable by the cyrus daemon. */
+
+{ "autocreate_sieve_compiledscript", NULL, STRING }
+/* The full path of a file that contains a compiled in bytecode sieve script. This script 
+   automatically becomes a user's initial default sieve filter script.  If this option is 
+   not specified, or the filename doesn't exist then the script defined by 
+   autocreate_sieve_script is compiled on the fly and installed as the user's default
+   sieve script */
+
+{ "generate_compiled_sieve_script", 0, SWITCH }
+/* If set to yes and no compiled sieve script file exists, the sieve script which is 
+   compiled on the fly will be saved in the file name that autocreate_sieve_compiledscript 
+   option points to. In order a compiled script to be generated, autocreate_sieve_script and 
+   autocreate_sieve_compiledscript must have valid values */
+
+{ "autocreate_users", "anyone", STRING }
+/* A space separated list of users and/or groups that are allowed their INBOX to be
+   automatically created. */
+
 { "configdirectory", NULL, STRING }
 /* The pathname of the IMAP configuration directory.  This field is
    required. */
diff -Naur cyrus-imapd-2.3.16/notifyd/Makefile.in cyrus-imapd-2.3.16-autocreate.uncompiled/notifyd/Makefile.in
--- cyrus-imapd-2.3.16/notifyd/Makefile.in	2008-03-24 21:59:32.000000000 +0200
+++ cyrus-imapd-2.3.16-autocreate.uncompiled/notifyd/Makefile.in	2009-12-22 19:56:22.000000000 +0200
@@ -71,10 +71,11 @@
 SERVICE=../master/service.o
 
 IMAP_LIBS = @IMAP_LIBS@ @LIB_RT@
+SIEVE_LIBS = @SIEVE_LIBS@
 IMAP_COM_ERR_LIBS = @IMAP_COM_ERR_LIBS@
 LIB_WRAP = @LIB_WRAP@
 LIBS = @ZEPHYR_LIBS@ @LIBS@ $(IMAP_COM_ERR_LIBS)
-DEPLIBS=../imap/mutex_fake.o ../imap/libimap.a ../lib/libcyrus.a ../lib/libcyrus_min.a @DEPLIBS@
+DEPLIBS=../imap/mutex_fake.o ../imap/libimap.a $(SIEVE_LIBS) ../lib/libcyrus.a ../lib/libcyrus_min.a @DEPLIBS@
 
 PURIFY=/usr/local/bin/purify
 PUREOPT=-best-effort
diff -Naur cyrus-imapd-2.3.16/notifyd/notifyd.c cyrus-imapd-2.3.16-autocreate.uncompiled/notifyd/notifyd.c
--- cyrus-imapd-2.3.16/notifyd/notifyd.c	2008-03-24 21:59:32.000000000 +0200
+++ cyrus-imapd-2.3.16-autocreate.uncompiled/notifyd/notifyd.c	2009-12-22 19:56:22.000000000 +0200
@@ -96,7 +96,7 @@
 
 #define NOTIFY_MAXSIZE 8192
 
-int do_notify()
+static int do_notify()
 {
     struct sockaddr_un sun_data;
     socklen_t sunlen = sizeof(sun_data);
diff -Naur cyrus-imapd-2.3.16/ptclient/Makefile.in cyrus-imapd-2.3.16-autocreate.uncompiled/ptclient/Makefile.in
--- cyrus-imapd-2.3.16/ptclient/Makefile.in	2008-03-24 20:34:22.000000000 +0200
+++ cyrus-imapd-2.3.16-autocreate.uncompiled/ptclient/Makefile.in	2009-12-22 19:56:22.000000000 +0200
@@ -57,10 +57,11 @@
 AFS_LDFLAGS = @AFS_LDFLAGS@ @COM_ERR_LDFLAGS@
 AFS_LIBS = @AFS_LIBS@
 IMAP_LIBS = @IMAP_LIBS@ @LIB_RT@
+SIEVE_LIBS = @SIEVE_LIBS@
 LIBS = $(IMAP_LIBS) @COM_ERR_LIBS@
 LIB_SASL = @LIB_SASL@
 LIB_WRAP = @LIB_WRAP@
-DEPLIBS = ../imap/libimap.a ../lib/libcyrus.a ../lib/libcyrus_min.a @DEPLIBS@
+DEPLIBS = ../imap/libimap.a $(SIEVE_LIBS) ../lib/libcyrus.a ../lib/libcyrus_min.a @DEPLIBS@ 
 UTIL_LIBS = ../imap/mutex_fake.o ../imap/cli_fatal.o
 
 LDAP_LIBS=@LDAP_LIBS@

cyrus-imapd-2.3.16-autosieve-0.6.0.diff:
 README.autosievefolder |   42 +++++++++++++++++++++
 imap/lmtp_sieve.c      |   95 ++++++++++++++++++++++++++++++++++++++++++++++++-
 lib/imapoptions        |    9 ++++
 3 files changed, 145 insertions(+), 1 deletion(-)

--- NEW FILE cyrus-imapd-2.3.16-autosieve-0.6.0.diff ---
diff -Naur cyrus-imapd-2.3.16/README.autosievefolder cyrus-imapd-2.3.16-autosieve.uncompiled/README.autosievefolder
--- cyrus-imapd-2.3.16/README.autosievefolder	1970-01-01 02:00:00.000000000 +0200
+++ cyrus-imapd-2.3.16-autosieve.uncompiled/README.autosievefolder	2009-12-23 01:08:09.000000000 +0200
@@ -0,0 +1,42 @@
+Cyrus IMAP autosievefolder patch
+----------------------------------
+
+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 
+
+
+  When the lmtpd daemon receives an email message prior to delivering it to the 
+INBOX folder of the user, checks if the user has specified sieve filters. If the
+user has specified sieve filters the filters are evaluated. If the message matches
+any of the filters the action that is specified in the filter is executed. If the action 
+is FileInto it is stored in the subfolder specified in the filter. If the 
+subfolder doesn't exist then the message is sent to the INBOX folder of the user.
+
+  With this patch if the folder doesn't exist AND the name of the subfolder is 
+specified in the autosievefolders option, OR the anysievefolder is set to 
+yes in the cyrus-imap configuration file then the subfolder is created and the mail 
+is stored there.
+
+
+Check the following options of the imapd.conf file
+==================================================
+
+* anysievefolder : It must be "yes" in order to permit the autocreation of any 
+INBOX subfolder requested by a sieve filter, through the "fileinto" action. (default = no)
+* autosievefolders : It is a "|" separated list of subfolders of INBOX that will be 
+automatically created, if requested by a sieve filter, through the "fileinto" 
+action. (default = null)
+	i.e. autosievefolders: Junk | Spam
+
+WARNING: anysievefolder, takes precedence over autosievefolders . Which means that if 
+anysievefolder is set to "yes", cyrus will create any INBOX subfolder requested, no-matter what the value of autosievefolders is.
+
+
+Things to be done
+=================
+
+1. Support cyrus wildcards in the autosievefolders option. 
+
+
+For more information and updates please visit http://email.uoa.gr/projects/cyrus/autosievefolder
+
diff -Naur cyrus-imapd-2.3.16/imap/lmtp_sieve.c cyrus-imapd-2.3.16-autosieve.uncompiled/imap/lmtp_sieve.c
--- cyrus-imapd-2.3.16/imap/lmtp_sieve.c	2009-03-31 07:11:18.000000000 +0300
+++ cyrus-imapd-2.3.16-autosieve.uncompiled/imap/lmtp_sieve.c	2009-12-23 01:08:09.000000000 +0200
@@ -88,6 +88,9 @@
     struct auth_state *authstate;
 } script_data_t;
 
+static int autosieve_subfolder(char *userid, struct auth_state *auth_state,
+                               char *subfolder, struct namespace *namespace);
+
 static char *make_sieve_db(const char *user)
 {
     static char buf[MAX_MAILBOX_PATH+1];
@@ -484,7 +487,20 @@
 			      sd->username, mdata->notifyheader,
 			      namebuf, quotaoverride, 0);
     }
-
+    
+    if (ret == IMAP_MAILBOX_NONEXISTENT) {
+        /* if "plus" folder under INBOX, then try to create it */
+        ret = autosieve_subfolder((char *) sd->username, sd->authstate, namebuf, mdata->namespace);
+
+	/* Try to deliver the mail again. */
+        if (!ret)
+            ret = deliver_mailbox(md->f, mdata->content, mdata->stage, md->size,
+                                  fc->imapflags->flag, fc->imapflags->nflags,
+                                  (char *) sd->username, sd->authstate, md->id,
+                                  sd->username, mdata->notifyheader,
+                                  namebuf, quotaoverride, 0);
+    }
+    
     if (!ret) {
 	snmp_increment(SIEVE_FILEINTO, 1);
 	return SIEVE_OK;
@@ -935,3 +951,80 @@
        we'll do normal delivery */
     return r;
 }
+
+
+#define SEP '|'
+
+static int autosieve_subfolder(char *userid, struct auth_state *auth_state,
+                               char *subfolder, struct namespace *namespace)
+{
+     char option_name_external[MAX_MAILBOX_NAME + 1];
+     char option_name_internal[MAX_MAILBOX_NAME + 1];
+     const char *subf ;
+     char *p, *q, *next_subf;
+     int len, r = 0;
+     int createsievefolder = 0;
+
+    /* Check if subfolder or userid are NULL */
+    if(userid == NULL || subfolder == NULL)
+         return IMAP_MAILBOX_NONEXISTENT;
+
+    syslog(LOG_DEBUG, "autosievefolder: autosieve_subfolder() was called for user %s, folder %s", 
+		    userid, subfolder);
+
+    if (config_getswitch(IMAPOPT_ANYSIEVEFOLDER)) {
+         createsievefolder = 1;
+    } else if ((subf = config_getstring(IMAPOPT_AUTOSIEVEFOLDERS)) != NULL) {
+         /* Roll through subf */
+         next_subf = (char *) subf;
+         while (*next_subf) {
+              for (p = next_subf ; isspace((int) *p) || *p == SEP ; p++);
+              for (next_subf = p ; *next_subf && *next_subf != SEP ; next_subf++);
+              for (q = next_subf ; q > p && (isspace((int) *q) || *q == SEP || !*q); q--);
+
+              if (!*p) continue;
+                    
+              len = q - p + 1;
+             /*
+              * This is a preliminary length check based on the assumption
+              * that the *final* internal format will be something
+              * like user.userid.subfolder(s).
+              */
+              if (len > sizeof(option_name_external) - strlen(userid) - 5)
+                   return IMAP_MAILBOX_BADNAME;
+
+              strlcpy(option_name_external, namespace->prefix[NAMESPACE_INBOX], sizeof(option_name_external));
+	      strncat(option_name_external, p, len);
+                    
+              /* 
+               * Transform the option folder name to internal namespace and compare it
+	       * with what must be created.
+               */
+              r = namespace->mboxname_tointernal(namespace, option_name_external, userid, option_name_internal);
+              if (r) continue;
+
+              if (!strcmp(option_name_internal, subfolder)) {
+                  createsievefolder = 1;
+                  break;
+              }
+         }
+    }
+
+    if (createsievefolder) {
+        /* Folder is already in internal namespace format */
+        r = mboxlist_createmailbox(subfolder, MAILBOX_FORMAT_NORMAL, NULL,
+                                           1, userid, auth_state, 0, 0, 0);
+        if (!r) {
+            mboxlist_changesub(subfolder, userid, auth_state, 1, 1);
+            syslog(LOG_DEBUG, "autosievefolder: User %s, folder %s creation succeeded",
+                                                   userid, subfolder);
+            return 0;
+        } else {
+            syslog(LOG_ERR, "autosievefolder: User %s, folder %s creation failed. %s",
+                                                  userid, subfolder,error_message(r));
+            return r;
+        }
+    } else
+        return IMAP_MAILBOX_NONEXISTENT;
+}
+
diff -Naur cyrus-imapd-2.3.16/lib/imapoptions cyrus-imapd-2.3.16-autosieve.uncompiled/lib/imapoptions
--- cyrus-imapd-2.3.16/lib/imapoptions	2009-12-21 13:25:22.000000000 +0200
+++ cyrus-imapd-2.3.16-autosieve.uncompiled/lib/imapoptions	2009-12-23 01:08:09.000000000 +0200
@@ -1043,6 +1043,15 @@
 /* If enabled, lmtpd will look for Sieve scripts in user's home
    directories: ~user/.sieve. */
 
+{ "anysievefolder", 0, SWITCH }
+/* It must be "yes" in order to permit the autocreation of any INBOX subfolder 
+   requested by a sieve filter, through the "fileinto" action. (default = no) */
+
+{ "autosievefolders", NULL, STRING }
+/* It is a "|" separated list of subfolders of INBOX that will be automatically created, 
+   if requested by a sieve filter, through the "fileinto" action. (default = null)
+   i.e. autosievefolders: Junk | Spam */
+
 { "singleinstancestore", 1, SWITCH }
 /* If enabled, imapd, lmtpd and nntpd attempt to only write one copy
    of a message per partition and create hard links, resulting in a


Index: cyrus-imapd-README.RPM
===================================================================
RCS file: /cvs/pkgs/rpms/cyrus-imapd/devel/cyrus-imapd-README.RPM,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- cyrus-imapd-README.RPM	26 Nov 2009 13:32:55 -0000	1.3
+++ cyrus-imapd-README.RPM	8 Jun 2010 11:01:40 -0000	1.4
@@ -12,7 +12,7 @@ The following steps should lead you to a
     your box. Upgrading any Invoca rpm based installation should be fine.
 3)  Make sure you understand that this RPM installs in FHS compliant
     directories, like /var/lib/imap and /var/spool/imap
-4)  Make sure cyrus-sasl 2.x is installed.
+4)  Make sure cyrus-sasl is installed.
 5)  Make sure saslauthd is running. If not, edit /etc/sysconfig/saslauthd as
     needed and do 'chkconfig saslauthd on ; service saslauthd start'
 6)  Install the cyrus-imapd RPMs.


Index: cyrus-imapd.cvt_cyrusdb_all
===================================================================
RCS file: /cvs/pkgs/rpms/cyrus-imapd/devel/cyrus-imapd.cvt_cyrusdb_all,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- cyrus-imapd.cvt_cyrusdb_all	28 Feb 2006 20:04:01 -0000	1.2
+++ cyrus-imapd.cvt_cyrusdb_all	8 Jun 2010 11:01:40 -0000	1.3
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # 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
@@ -97,16 +97,62 @@
 #
 # v1.2.1, Jan 13 2006 Simon Matter <simon.matter at invoca.ch>
 # - code cleanup
+#
+# v1.2.2, Nov 29 2007 Simon Matter <simon.matter at invoca.ch>
+# - add ability to handle "@include" options in imapd.conf, patch
+#   provided by Tim Bannister
+#
+# v1.2.3, Feb 07 2008 Simon Matter <simon.matter at invoca.ch>
+# - add ability to handle tabs in imapd.conf, patch provided
+#   by Franz Knipp
+# - disable default values for some config options like sievedir
+#
+# v1.2.4, Apr 23 2008 Simon Matter <simon.matter at invoca.ch>
+# - add support for statuscache.db
+#
+# v1.3.0, Sep 29 2008 Simon Matter <simon.matter at invoca.ch>
+# - add multi-instance support
+#
+# v1.3.1, Oct 09 2008 Simon Matter <simon.matter at invoca.ch>
+# - improve variable handling
+#
+# v1.3.2, May 26 2009 Simon Matter <simon.matter at invoca.ch>
+# - add some sanity checks to multi-instance support
+#
+# v1.3.3, May 27 2009 Simon Matter <simon.matter at invoca.ch>
+# - make some cosmetic changes
+#
+# v1.3.4, Dec 22 2009 Simon Matter <simon.matter at invoca.ch>
+# - add support for user_deny.db
 
-VERSION=1.2.1
+VERSION=1.3.4
 
-if [ -n "$(/sbin/pidof cyrus-master)" ]; then
-  echo "ERROR: cyrus-master is running, unable to convert mailboxes!"
-  exit 1
+PIDFILE=/var/run/cyrus-master${INSTANCE}.pid
+
+# instance config
+CYRUSCONF=/etc/cyrus${INSTANCE}.conf
+IMAPDCONF=/etc/imapd${INSTANCE}.conf
+
+# make sure what we have is a valid instance
+# and that config files are present
+if [ -n "$INSTANCE" ]; then
+  [ -L /etc/rc.d/init.d/${BASENAME} ] || exit 0
+fi
+[ -f $CYRUSCONF ] || exit 0
+[ -f $IMAPDCONF ] || exit 0
+
+if [ -f $PIDFILE ]; then
+  read CYRUS_PID < $PIDFILE
+  if [ -n "$CYRUS_PID" ]; then
+    if ps -p $CYRUS_PID > /dev/null 2>&1; then
+      echo "ERROR: cyrus-master is running, unable to convert mailboxes!"
+      exit 1
+    fi
+  fi
 fi
 
-if [ ! -f /etc/imapd.conf ]; then
-  echo "ERROR: configuration file not found."
+if [ ! -f $IMAPDCONF ]; then
+  echo "ERROR: configuration file '${IMAPDCONF}' not found, exiting!"
   exit 1
 fi
 
@@ -119,7 +165,7 @@ fi
 
 # force cyrus user for security reasons
 if [ ! $(whoami) = "cyrus" ]; then
-  exec $RUNUSER - cyrus -c "cd $PWD < /dev/null ; $0 $*"
+  exec $RUNUSER - cyrus -c "cd $PWD < /dev/null ; INSTANCE=$INSTANCE $0 $*"
 fi
 
 # special function for migration
@@ -131,14 +177,33 @@ umask 166
 # show version info in log files
 echo "cvt_cyrusdb_all version: $VERSION"
 
-# get_config [config default]
+# expand_config <path>
+# handle "@include" sections from imapd style config file
+expand_config() {
+  while read line; do
+    if printf "%s\n" "${line}" | grep -q '^@include:'; then
+      expand_config "$( printf "%s\n" "${line}" | cut -d : -f 2- | sed -e 's/^[\t ]*//' )"
+    else
+      printf "%s\n" "${line}"
+    fi
+  done < $1
+}
+
+# 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 | sed -e 's/^ *//' -e 's/-nosync//' -e 's/ *$//'
+  searchstr=$1
+  if config="$(expand_config $IMAPDCONF | egrep "^${searchstr}:")"; then
+    CFGVAL="$(printf "%s\n" "$config" | cut -d : -f 2- | sed -e 's/^[\t ]*//')"
   else
-    echo $2
+    if [ -z "$2" ]; then
+      echo "ERROR: config option '$1' not found in ${IMAPDCONF}, exiting!" 1>&2
+      return 1
+    fi
+    CFGVAL="$2"
   fi
+  echo "get_config ${1}: $CFGVAL" 1>&2
+  echo "$CFGVAL"
 }
 
 # where to find files and directories
@@ -149,8 +214,8 @@ cyrus_magic=${data_dir}/magic
 cvt_cyrusdb=${lib_dir}/cvt_cyrusdb
 sievec=${lib_dir}/sievec
 masssievec=${lib_dir}/masssievec
-imap_prefix=$(get_config configdirectory /var/lib/imap)
-sieve_dir=$(get_config sievedir /var/lib/imap/sieve)
+imap_prefix=$(get_config configdirectory) || exit 1
+sieve_dir=$(get_config sievedir) || exit 1
 db_cfg=${data_dir}/db.cfg
 db_current=${imap_prefix}/rpm/db.cfg.current
 db_cache=${imap_prefix}/rpm/db.cfg.cache
@@ -159,33 +224,37 @@ db_cache=${imap_prefix}/rpm/db.cfg.cache
 . $db_cfg
 
 # get configured db backend config
-duplicate_db=$(get_config duplicate_db $duplicate_db)
-mboxlist_db=$(get_config mboxlist_db $mboxlist_db)
-seenstate_db=$(get_config seenstate_db $seenstate_db)
-subscription_db=$(get_config subscription_db $subscription_db)
-tlscache_db=$(get_config tlscache_db $tlscache_db)
-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)
+duplicate_db=$(get_config duplicate_db $duplicate_db) || exit 1
+mboxlist_db=$(get_config mboxlist_db $mboxlist_db) || exit 1
+seenstate_db=$(get_config seenstate_db $seenstate_db) || exit 1
+subscription_db=$(get_config subscription_db $subscription_db) || exit 1
+tlscache_db=$(get_config tlscache_db $tlscache_db) || exit 1
+annotation_db=$(get_config annotation_db $annotation_db) || exit 1
+mboxkey_db=$(get_config mboxkey_db $mboxkey_db) || exit 1
+ptscache_db=$(get_config ptscache_db $ptscache_db) || exit 1
+quota_db=$(get_config quota_db $quota_db) || exit 1
+statuscache_db=$(get_config statuscache_db $statuscache_db) || exit 1
+userdeny_db=$(get_config userdeny_db $userdeny_db) || exit 1
 
 # remember current db backend config
 {
-echo "duplicate_db=$duplicate_db"
-echo "mboxlist_db=$mboxlist_db"
-echo "seenstate_db=$seenstate_db"
-echo "subscription_db=$subscription_db"
-echo "tlscache_db=$tlscache_db"
-echo "annotation_db=$annotation_db"
-echo "mboxkey_db=$mboxkey_db"
-echo "ptscache_db=$ptscache_db"
-echo "quota_db=$quota_db"
-echo "sieve_version=$sieve_version"
+echo "duplicate_db=${duplicate_db}"
+echo "mboxlist_db=${mboxlist_db}"
+echo "seenstate_db=${seenstate_db}"
+echo "subscription_db=${subscription_db}"
+echo "tlscache_db=${tlscache_db}"
+echo "annotation_db=${annotation_db}"
+echo "mboxkey_db=${mboxkey_db}"
+echo "ptscache_db=${ptscache_db}"
+echo "quota_db=${quota_db}"
+echo "statuscache_db=${statuscache_db}"
+echo "userdeny_db=${userdeny_db}"
+echo "sieve_version=${sieve_version}"
 } | sort > $db_current
 
-# file_type [file]
+# file_type <file>
 file_type() {
-  this_type=$(file -b -m "$cyrus_magic:$system_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
     echo skiplist
   elif echo "$this_type" | grep -qi text > /dev/null 2>&1; then
@@ -195,7 +264,7 @@ file_type() {
   fi
 }
 
-# cvt_file [file] [db]
+# cvt_file <file> <db>
 cvt_file() {
   target="$1"
   new_db="$2"
@@ -208,21 +277,21 @@ cvt_file() {
       if [ "$old_db" = "skiplist" ]; then
         cp -a "$target" "${target}.skiplist"
       else
-        $cvt_cyrusdb "$target" "$old_db" "${target}.skiplist" skiplist
+        $cvt_cyrusdb -C $IMAPDCONF "$target" "$old_db" "${target}.skiplist" skiplist
       fi
       RETVAL=$?
-      ERRVAL=$[ $ERRVAL + $RETVAL ]
+      ERRVAL=$(( $ERRVAL + $RETVAL ))
       if [ $RETVAL -eq 0 ]; then
         rm -f "$target"
         if [ -s "${target}.skiplist" ]; then
           if [ "$new_db" = "skiplist" ]; then
             cp -a "${target}.skiplist" "$target"
           else
-            $cvt_cyrusdb "${target}.skiplist" skiplist "$target" "$new_db"
+            $cvt_cyrusdb -C $IMAPDCONF "${target}.skiplist" skiplist "$target" "$new_db"
           fi
         fi
         RETVAL=$?
-        ERRVAL=$[ $ERRVAL + $RETVAL ]
+        ERRVAL=$(( $ERRVAL + $RETVAL ))
         if [ $RETVAL -eq 0 ]; then
           rm -f "${target}.skiplist"
         else
@@ -235,18 +304,18 @@ cvt_file() {
   fi
 }
 
-# cvt_to_utf8 [file]
+# cvt_to_utf8 <file>
 cvt_to_utf8() {
   target="$1"
   if [ -s "$target" ]; then
-    if ! $sievec "$target" "${target}.sievec"; then
+    if ! $sievec -C $IMAPDCONF "$target" "${target}.sievec"; then
       iconv --from-code=ISO-8859-1 --to-code=UTF-8 --output="${target}.UTF-8" "$target"
       if [ -s "${target}.UTF-8" ]; then
         # preserve timestamp
-        touch --reference="$target" "${target}.UTF-8"
+        touch --reference="${target}" "${target}.UTF-8"
         mv -f "${target}.UTF-8" "$target"
       else
-        ERRVAL=$[ $ERRVAL + 1 ]
+        ERRVAL=$(( $ERRVAL + 1 ))
       fi
     fi
     rm -f "${target}.sievec"
@@ -257,7 +326,7 @@ ERRVAL=0
 
 # make sure our Berkeley databases are in a sane state
 # wait for db_checkpoint to end successfully or kill it after a timeout
-db_checkpoint -v -1 -h $imap_prefix/db &
+db_checkpoint -v -1 -h ${imap_prefix}/db &
 DB_CHECK_PID=$!
 CNT=0
 while [ $CNT -lt 60 ]; do
@@ -275,43 +344,47 @@ if kill -0 $DB_CHECK_PID > /dev/null 2>&
 fi
 
 # do a normal recovery
-db_recover -v -h $imap_prefix/db
+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
+  db_recover -v -c -h ${imap_prefix}/db
   RETVAL=$?
-  ERRVAL=$[ $ERRVAL + $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
+  # convert all db files to portable format 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.*
+  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"
+  cvt_file ${imap_prefix}/statuscache.db       "skiplist"
+  cvt_file ${imap_prefix}/user_deny.db         "flat"
+  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"
+  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"
+  cvt_file ${imap_prefix}/statuscache.db       "$statuscache_db"
+  cvt_file ${imap_prefix}/user_deny.db         "$userdeny_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
+    $masssievec $sievec $IMAPDCONF
     # 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"


Index: cyrus-imapd.spec
===================================================================
RCS file: /cvs/pkgs/rpms/cyrus-imapd/devel/cyrus-imapd.spec,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -p -r1.74 -r1.75
--- cyrus-imapd.spec	1 Jun 2010 14:14:01 -0000	1.74
+++ cyrus-imapd.spec	8 Jun 2010 11:01:40 -0000	1.75
@@ -1,11 +1,10 @@
-#TODO: merge all sub-packages (except -devel) into cyrus-imapd, they are all required
-
 Name: cyrus-imapd
 Version: 2.3.16
-Release: 4%{?dist}
+Release: 5%{?dist}
 
 %define ssl_pem_file %{_sysconfdir}/pki/%{name}/%{name}.pem
 
+#uid/gid reserved, see setup:/usr/share/doc/setup*/uidgid
 %define uid 76
 %define gid 76
 
@@ -18,43 +17,26 @@ License: BSD
 Group: System Environment/Daemons
 URL: http://cyrusimap.web.cmu.edu/
 Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus/%{name}-%{version}.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
-Source24: 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
-Source33: README.skiplist_recovery
-Patch0: cyrus-imapd-2.2.12-no_transfig.patch
-Patch1: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.12/cyrus-imapd-2.3.12p2-autocreate-0.10-0.diff
-Patch2: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.12/cyrus-imapd-2.3.12p2-autosieve-0.6.0.diff
-Patch4: http://servercc.oakton.edu/~jwade/cyrus/cyrus-imapd-2.1.3/cyrus-imapd-2.1.3-flock.patch
-Patch6: cyrus-imapd-2.1.16-getrlimit.patch
-Patch10: cyrus-imapd-acceptinvalidfrom.patch
-Patch12: cyrus-imapd-2.3.7-notify_sms.patch
+
+Patch1: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.16/cyrus-imapd-2.3.16-autocreate-0.10-0.diff
+
+Patch2: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.16/cyrus-imapd-2.3.16-autosieve-0.6.0.diff
+
+Patch4: http://www.oakton.edu/~jwade/cyrus/cyrus-imapd-2.1.3/cyrus-imapd-2.1.3-flock.patch
+
 Patch14: cyrus-imapd-2.3.1-authid_normalize.patch
+
 Patch15: cyrus-imapd-2.3.1-make_md5_defaults.patch
-Patch18: cyrus-imapd-2.3.7-krb4.patch
 
 # https://bugzilla.redhat.com/show_bug.cgi?id=461875
 Patch19: cyrus-imapd-2.3.12p2-current-db.patch
@@ -74,6 +56,7 @@ BuildRequires: flex, bison, groff, autom
 BuildRequires: openldap-devel
 BuildRequires: krb5-devel
 BuildRequires: net-snmp-devel
+BuildRequires: transfig
 
 Requires(post): e2fsprogs, chkconfig, initscripts, perl, grep, coreutils, findutils
 Requires(preun): chkconfig, initscripts, coreutils
@@ -119,21 +102,13 @@ Summary: Cyrus IMAP server development f
 The %{name}-devel package contains header files and libraries
 necessary for developing applications which use the imclient library.
 
-%package perl
-Group: System Environment/Libraries
-Summary: Cyrus IMAP server utility Perl modules
-
-%description perl
-The %{name}-perl contains Perl modules necessary to use the
-Cyrus IMAP server administration utilities.
-
 %package utils
 Group: Applications/System
 Summary: Cyrus IMAP server administration utilities
 Requires(pre): shadow-utils
 Requires(post): grep, coreutils, make, openssl
 Requires(postun): shadow-utils
-Requires: %{name}-perl = %{version}-%{release}
+Obsoletes: %{name}-perl < 2.3.16-5
 
 %description utils
 The %{name}-utils package contains administrative tools for the
@@ -142,27 +117,15 @@ one running the server.
 
 %prep
 %setup -q
-%patch0 -p1 -b .no_transfig
 %patch1 -p1 -b .autocreate
 %patch2 -p1 -b .autosieve
 %patch4 -p1 -b .flock
-%patch6 -p1 -b .getrlimit
-%patch10 -p1 -b .acceptinvalidfrom
-%patch12 -p1 -b .notify_sms
 %patch14 -p1 -b .authid_normalize
 %patch15 -p1 -b .make_md5_defaults
-%patch18 -p1 -b .krb4
 %patch19 -p1 -b .db4.7
 %patch20 -p1 -b .nodenny
 %patch21 -p1 -b .qos
 
-# add additional sources
-mkdir doc/{m4,contrib}
-%{__install} -m 644 %{SOURCE10} %{SOURCE15} %{SOURCE16} %{SOURCE17} \
-        %{SOURCE18} %{SOURCE19} %{SOURCE20} %{SOURCE21}     doc/contrib/
-%{__install} -m 644 %{SOURCE24} %{SOURCE33} %{SOURCE8}  %{SOURCE9}    doc/
-%{__install} -m 644 %{SOURCE26} %{SOURCE4}  %{SOURCE27} %{SOURCE29}   doc/m4/
-
 # only to update config.* files
 automake -a -f -c || :
 aclocal -I cmulocal
@@ -178,11 +141,13 @@ autoconf -f
 find . -type f -name "*.pl" | xargs %{__perl} -pi -e "s@/usr/local/bin/perl@%{__perl}@"
 
 # modify lmtp socket path in .conf files
-%{__perl} -pi -e "s@/var/imap/@%{_var}/lib/imap/@" master/conf/*.conf doc/cyrusv2.mc doc/m4/%{name}-sendmail-8.12.9-cyrusv2.m4
+%{__perl} -pi -e "s@/var/imap/@%{_var}/lib/imap/@" master/conf/*.conf doc/cyrusv2.mc #doc/m4/%{name}-sendmail-8.12.9-cyrusv2.m4
 
 # enable idled in .conf files to prevent error messages
 %{__perl} -pi -e "s/#  idled/  idled/" master/conf/*.conf
 
+# Fix permissions on perl programs
+find . -type f -name "*.pl" -exec %{__chmod} 755 {} \;
 
 %build
 CPPFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/et -I%{_includedir}/kerberosIV"; export CPPFLAGS
@@ -218,9 +183,6 @@ LDFLAGS="$LDFLAGS -pie"; export LDFLAGS
 %install
 %{__rm} -rf %{buildroot}
 
-# Fix permissions on perl programs
-find . -type f -name "*.pl" -exec %{__chmod} 755 {} \;
-
 # This is needed to install the perl files correctly
 pushd perl/imap
   %{__perl} Makefile.PL PREFIX=%{buildroot}%{_prefix} INSTALLDIRS=vendor
@@ -255,7 +217,6 @@ done
 
 # Install additional files
 %{__install} -m 755 %{SOURCE13}   %{buildroot}%{_cyrexecdir}/cvt_cyrusdb_all
-%{__install} -m 755 %{SOURCE28}   %{buildroot}%{_cyrexecdir}/rpm_set_permissions
 %{__install} -m 644 %{SOURCE14}   %{buildroot}%{_datadir}/%{name}/rpm/magic
 %{__install} -p -m 644 master/conf/prefork.conf %{buildroot}%{_sysconfdir}/cyrus.conf
 %{__install} -p -m 644 %{SOURCE6}    %{buildroot}%{_sysconfdir}/imapd.conf
@@ -272,8 +233,8 @@ done
 %{__install} -p -m 755 %{SOURCE25}   %{buildroot}%{_sysconfdir}/cron.daily/%{name}
 
 # Cleanup of doc dir
-find doc perl -name CVS -type d | xargs -r %{__rm} -rf
-find doc perl -name .cvsignore -type f | xargs -r %{__rm} -f
+find doc perl -name CVS -type d -prune -exec echo %{__rm} -rf {} \;
+find doc perl -name .cvsignore -type f -exec %{__rm} -rf {} \;
 %{__rm} -f doc/Makefile.dist*
 %{__rm} -f doc/text/htmlstrip.c
 %{__rm} -f doc/text/Makefile
@@ -308,9 +269,6 @@ touch %{buildroot}%{ssl_pem_file}
 %{__perl} -pi -e 's|fetchnews|cyrfetchnews|g;s|Fetchnews|Cyrfetchnews|g;s/FETCHNEWS/CYRFETCHNEWS/g' \
         %{buildroot}%{_mandir}/man8/cyrfetchnews.8
 
-# compress manpages
-[ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress
-
 #remove executable bit from docs
 for ddir in doc perl/imap/examples
 do
@@ -339,7 +297,7 @@ find %{buildroot}%{perl_vendorarch} -nam
 %post
 /sbin/chkconfig --add %{name}
 
-# Force synchronous updates, usually only on ext2 filesystems
+# Force synchronous updates, usually only on extX filesystems
 chattr -R +S $i %{_var}/lib/imap/{user,quota} %{_var}/spool/imap 2>/dev/null ||:
 
 # Create SSL certificates
@@ -374,14 +332,6 @@ if [ $1 != 0 ]; then
   /sbin/service %{name} condrestart >/dev/null 2>&1 || :
 fi
 
-%post utils
-# FIXME: remove when setup > 2.8.10 is released
-# Add service entries if necessary
-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
-
 %files
 %defattr(-,root,root,-)
 %doc COPYRIGHT README
@@ -444,7 +394,6 @@ fi
 %{_cyrexecdir}/unexpunge
 %{_cyrexecdir}/upgradesieve
 %{_cyrexecdir}/cvt_cyrusdb_all
-%{_cyrexecdir}/rpm_set_permissions
 %{_cyrexecdir}/idled
 %{_cyrexecdir}/compile_sieve
 %{_cyrexecdir}/mupdate
@@ -489,11 +438,12 @@ fi
 %{_libdir}/lib*.a
 %{_mandir}/man3/imclient.3*
 
-%files perl
+%files utils
 %defattr(-,root,root)
 %doc perl/imap/README
 %doc perl/imap/Changes
 %doc perl/imap/examples
+%{_bindir}/*
 %dir %{perl_vendorarch}/Cyrus
 %dir %{perl_vendorarch}/Cyrus/IMAP
 %{perl_vendorarch}/Cyrus/IMAP/Admin.pm
@@ -514,13 +464,16 @@ fi
 %{_mandir}/man3/Cyrus::IMAP.3pm.gz
 %{_mandir}/man3/Cyrus::IMAP::IMSP.3pm.gz
 %{_mandir}/man3/Cyrus::SIEVE::managesieve.3pm.gz
-
-%files utils
-%defattr(0644,root,root,0755)
-%attr(0755,root,root) %{_bindir}/*
 %{_mandir}/man1/*
 
 %changelog
+* Mon Jun 07 2010 Michal Hlavinka <mhlavink at redhat.com> - 2.3.16-5
+- spec cleanup
+- simplified packaging (merge -perl in -utils)
+- remove obsoleted and/or unmaintained additional sources/patches
+- remove long time not used files from the cvs/srpm
+- update additional sources/patches from their upstream
+
 * Tue Jun 01 2010 Marcela Maslanova <mmaslano at redhat.com> - 2.3.16-4
 - Mass rebuild with perl-5.12.0
 


--- README.HOWTO-recover-mailboxes.db DELETED ---


--- README.skiplist_recovery DELETED ---


--- allow_auth_plain_proxying.patch DELETED ---


--- batchreconstruct DELETED ---


--- bsd2cyrus DELETED ---


--- cpmsg DELETED ---


--- cyrus-deliver-wrapper.c DELETED ---


--- cyrus-imapd-2.1.16-getrlimit.patch DELETED ---


--- cyrus-imapd-2.2.12-no_transfig.patch DELETED ---


--- cyrus-imapd-2.3.12p2-autocreate-0.10-0.diff DELETED ---


--- cyrus-imapd-2.3.12p2-autosieve-0.6.0.diff DELETED ---


--- cyrus-imapd-2.3.7-krb4.patch DELETED ---


--- cyrus-imapd-2.3.7-notify_sms.patch DELETED ---


--- cyrus-imapd-2.3.9-rmquota+deletemailbox-0.2-1.diff DELETED ---


--- cyrus-imapd-README.groupcache DELETED ---


--- cyrus-imapd-acceptinvalidfrom.patch DELETED ---


--- cyrus-imapd-procmail+cyrus.mc DELETED ---


--- cyrus-imapd-sendmail-8.12.9-cyrusv2.m4 DELETED ---


--- cyrus-imapd.rpm_set_permissions DELETED ---


--- cyrus-imapd.upd_groupcache DELETED ---


--- cyrus-procmailrc DELETED ---


--- cyrus-user-procmailrc.template DELETED ---


--- cyrus_ldap_quota.pl DELETED ---


--- folderxfer DELETED ---


--- imapcreate.pl DELETED ---


--- inboxfer DELETED ---


--- skiplist.py DELETED ---



More information about the scm-commits mailing list