From 2bab04fe5f4d61aa485faa20ab24d454fa7f8fe7 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Tue, 13 Jan 2009 19:26:24 +0000 Subject: [PATCH] updated to 2.3.13 --- .cvsignore | 4 +- cyrus-imapd-2.3.1-authid_normalize.patch | 48 +- cyrus-imapd-2.3.1-make_md5_defaults.patch | 22 +- cyrus-imapd-2.3.12p2-autocreate-0.10-0.diff | 2137 +++++++++---------- cyrus-imapd.spec | 10 +- sources | 4 +- 6 files changed, 1105 insertions(+), 1120 deletions(-) diff --git a/.cvsignore b/.cvsignore index 92b6ae9..73d786e 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,3 +1,3 @@ +cyrus-imapd-2.3.13.tar.gz +cyrus-imapd-2.3.13.tar.gz.sig cyrus_sharedbackup-0.1.tar.gz -cyrus-imapd-2.3.12p2.tar.gz -cyrus-imapd-2.3.12p2.tar.gz.sig diff --git a/cyrus-imapd-2.3.1-authid_normalize.patch b/cyrus-imapd-2.3.1-authid_normalize.patch index 9ebffd7..f3f0334 100644 --- a/cyrus-imapd-2.3.1-authid_normalize.patch +++ b/cyrus-imapd-2.3.1-authid_normalize.patch @@ -1,7 +1,17 @@ -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 @@ +--- cyrus-imapd-2.3.13/lib/libcyr_cfg.h.authid_normalize 2008-07-30 18:03:39.000000000 +0200 ++++ cyrus-imapd-2.3.13/lib/libcyr_cfg.h 2009-01-13 11:41:59.000000000 +0100 +@@ -100,6 +100,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, + /* SQL database */ + CYRUSOPT_SQL_DATABASE, + /* SQL engine ("mysql") */ +--- cyrus-imapd-2.3.13/lib/auth_unix.c.authid_normalize 2009-01-13 11:38:08.000000000 +0100 ++++ cyrus-imapd-2.3.13/lib/auth_unix.c 2009-01-13 11:38:08.000000000 +0100 +@@ -155,10 +155,12 @@ size_t len; { static char retbuf[81]; @@ -37,10 +47,9 @@ diff -Naur cyrus-imapd-2.3.1.orig/lib/auth_unix.c cyrus-imapd-2.3.1/lib/auth_uni 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 @@ +--- cyrus-imapd-2.3.13/lib/imapoptions.authid_normalize 2009-01-13 11:38:08.000000000 +0100 ++++ cyrus-imapd-2.3.13/lib/imapoptions 2009-01-13 11:38:08.000000000 +0100 +@@ -1182,6 +1182,11 @@ interface, otherwise the user is assumed to be in the default domain (if set). */ @@ -52,12 +61,11 @@ diff -Naur cyrus-imapd-2.3.1.orig/lib/imapoptions cyrus-imapd-2.3.1/lib/imapopti /* .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 }, +--- cyrus-imapd-2.3.13/lib/libcyr_cfg.c.authid_normalize 2008-07-30 18:03:38.000000000 +0200 ++++ cyrus-imapd-2.3.13/lib/libcyr_cfg.c 2009-01-13 11:38:08.000000000 +0100 +@@ -150,6 +150,11 @@ + CFGVAL(long, 0), + CYRUS_OPT_SWITCH }, + { CYRUSOPT_NORMALIZEUID, + CFGVAL(long, 1), @@ -67,15 +75,3 @@ diff -Naur cyrus-imapd-2.3.1.orig/lib/libcyr_cfg.c cyrus-imapd-2.3.1/lib/libcyr_ { 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 - diff --git a/cyrus-imapd-2.3.1-make_md5_defaults.patch b/cyrus-imapd-2.3.1-make_md5_defaults.patch index 5e8892e..8b348a3 100644 --- a/cyrus-imapd-2.3.1-make_md5_defaults.patch +++ b/cyrus-imapd-2.3.1-make_md5_defaults.patch @@ -1,7 +1,6 @@ -diff -Nru -x'*.orig' cyrus-imapd-2.3.11.orig/imap/make_md5.c cyrus-imapd-2.3.11/imap/make_md5.c ---- cyrus-imapd-2.3.11.orig/imap/make_md5.c 2007-10-01 20:35:59.000000000 +0200 -+++ cyrus-imapd-2.3.11/imap/make_md5.c 2008-09-01 11:16:50.000000000 +0200 -@@ -814,7 +814,7 @@ +--- cyrus-imapd-2.3.13/imap/make_md5.c.make_md5_defaults 2008-10-02 16:05:44.000000000 +0200 ++++ cyrus-imapd-2.3.13/imap/make_md5.c 2009-01-13 11:44:24.000000000 +0100 +@@ -857,7 +857,7 @@ if (!md5_dir) md5_dir = config_getstring(IMAPOPT_MD5_DIR); if (!md5_dir) @@ -10,10 +9,9 @@ diff -Nru -x'*.orig' cyrus-imapd-2.3.11.orig/imap/make_md5.c cyrus-imapd-2.3.11/ if (max_children == 0) { /* Simple case */ -diff -Nru -x'*.orig' cyrus-imapd-2.3.11.orig/lib/imapoptions cyrus-imapd-2.3.11/lib/imapoptions ---- cyrus-imapd-2.3.11.orig/lib/imapoptions 2007-10-18 20:14:48.000000000 +0200 -+++ cyrus-imapd-2.3.11/lib/imapoptions 2008-09-01 11:16:50.000000000 +0200 -@@ -557,10 +557,14 @@ +--- cyrus-imapd-2.3.13/lib/imapoptions.make_md5_defaults 2009-01-13 11:44:24.000000000 +0100 ++++ cyrus-imapd-2.3.13/lib/imapoptions 2009-01-13 14:17:35.000000000 +0100 +@@ -634,10 +634,14 @@ mailspool, but each have their own "replicated" copy of mailboxes.db. */ @@ -21,11 +19,11 @@ diff -Nru -x'*.orig' cyrus-imapd-2.3.11.orig/lib/imapoptions cyrus-imapd-2.3.11/ +{ "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/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 ++ userid (e.g., /var/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 } diff --git a/cyrus-imapd-2.3.12p2-autocreate-0.10-0.diff b/cyrus-imapd-2.3.12p2-autocreate-0.10-0.diff index 5f68ea2..daa5049 100644 --- a/cyrus-imapd-2.3.12p2-autocreate-0.10-0.diff +++ b/cyrus-imapd-2.3.12p2-autocreate-0.10-0.diff @@ -1,485 +1,426 @@ -diff -Naur cyrus-imapd-2.3.12p2/README.autocreate cyrus-imapd-2.3.12p2-autocreate.uncompiled/README.autocreate ---- cyrus-imapd-2.3.12p2/README.autocreate 1970-01-01 02:00:00.000000000 +0200 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/README.autocreate 2008-05-06 14:48:41.000000000 +0300 -@@ -0,0 +1,211 @@ -+Cyrus IMAP autocreate Inbox patch -+---------------------------------- +--- cyrus-imapd-2.3.13/notifyd/notifyd.c.autocreate 2008-03-24 20:59:32.000000000 +0100 ++++ cyrus-imapd-2.3.13/notifyd/notifyd.c 2009-01-13 11:14:09.000000000 +0100 +@@ -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); +--- cyrus-imapd-2.3.13/notifyd/Makefile.in.autocreate 2008-03-24 20:59:32.000000000 +0100 ++++ cyrus-imapd-2.3.13/notifyd/Makefile.in 2009-01-13 11:14:09.000000000 +0100 +@@ -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 +--- cyrus-imapd-2.3.13/imap/mboxlist.c.autocreate 2008-10-08 17:47:08.000000000 +0200 ++++ cyrus-imapd-2.3.13/imap/mboxlist.c 2009-01-13 11:14:09.000000000 +0100 +@@ -83,6 +83,12 @@ + #include "quota.h" + #include "sync_log.h" + ++#ifdef USE_SIEVE ++extern int autoadd_sieve(char *userid, ++ const char *source_script); ++#endif + -+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: + #define DB config_mboxlist_db + #define SUBDB config_subscription_db + +@@ -100,11 +106,29 @@ + static int mboxlist_changequota(const char *name, int matchlen, int maycreate, + void *rock); + ++static int mboxlist_autochangesub(char *name, int matchlen, int maycreate, ++ void *rock); + -+ 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. ++static int mboxlist_autosubscribe_sharedfolders(struct namespace *namespace, ++ char *userid, char *auth_userid, ++ struct auth_state *auth_state); + -+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. + struct change_rock { + struct quota *quota; + struct txn **tid; + }; + ++/* ++ * Struct needed to be passed as void *rock to ++ * mboxlist_autochangesub(); ++ */ ++struct changesub_rock_st { ++ char *userid; ++ char *auth_userid; ++ struct auth_state *auth_state; ++}; + -+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". ++ + #define FNAME_SUBSSUFFIX ".sub" + + /* +@@ -3383,3 +3407,349 @@ + + return(config_delete_mode == IMAP_ENUM_DELETE_MODE_DELAYED); + } ++ ++/* ++ * Automatically subscribe user to *ALL* shared folders, ++ * one has permissions to be subscribed to. ++ * INBOX subfolders are excluded. ++ */ ++static int mboxlist_autochangesub(char *name, int matchlen, int maycreate, ++ void *rock) { ++ ++ struct changesub_rock_st *changesub_rock = (struct changesub_rock_st *) rock; ++ char *userid = changesub_rock->userid; ++ char *auth_userid = changesub_rock->auth_userid; ++ struct auth_state *auth_state = changesub_rock->auth_state; ++ int r; ++ ++ ++ if((strlen(name) == 5 && !strncmp(name, "INBOX", 5)) || /* Exclude INBOX */ ++ (strlen(name) > 5 && !strncmp(name, "INBOX.",6)) || /* Exclude INBOX subfolders */ ++ (strlen(name) > 4 && !strncmp(name, "user.", 5))) /* Exclude other users' folders */ ++ return 0; ++ ++ ++ r = mboxlist_changesub(name, userid, auth_state, 1, 0); ++ ++ if (r) { ++ syslog(LOG_WARNING, ++ "autosubscribe: User %s to folder %s, subscription failed: %s", ++ auth_userid, name, error_message(r)); ++ } else { ++ syslog(LOG_NOTICE, ++ "autosubscribe: User %s to folder %s, subscription succeeded", ++ auth_userid, name); ++ } ++ ++ return 0; ++} ++ ++#define SEP '|' ++ ++/* ++ * Automatically subscribe user to a shared folder. ++ * Subscription is done successfully, if the shared ++ * folder exists and the user has the necessary ++ * permissions. ++ */ ++static int mboxlist_autosubscribe_sharedfolders(struct namespace *namespace, ++ char *userid, char *auth_userid, ++ struct auth_state *auth_state) { ++ ++ const char *sub ; ++ char *p, *q, *next_sub; ++ char folder[MAX_MAILBOX_NAME+1], name[MAX_MAILBOX_NAME+1], mailboxname[MAX_MAILBOX_NAME+1]; ++ int len; ++ int r = 0; ++ int subscribe_all_sharedfolders = 0; ++ ++ subscribe_all_sharedfolders = config_getswitch(IMAPOPT_AUTOSUBSCRIBE_ALL_SHAREDFOLDERS); ++ ++ /* ++ * If subscribeallsharedfolders is set to yes in imapd.conf, then ++ * subscribe user to every shared folder one has the apropriate ++ * permissions. ++ */ ++ if(subscribe_all_sharedfolders) { ++ char pattern[MAX_MAILBOX_PATH+1]; ++ struct changesub_rock_st changesub_rock; ++ ++ strcpy(pattern, "*"); ++ changesub_rock.userid = userid; ++ changesub_rock.auth_userid = auth_userid; ++ changesub_rock.auth_state = auth_state; ++ ++ r = mboxlist_findall(namespace, pattern, 0, userid, ++ auth_state, mboxlist_autochangesub, &changesub_rock); ++ ++ return r; ++ } ++ ++ if ((sub=config_getstring(IMAPOPT_AUTOSUBSCRIBESHAREDFOLDERS)) == NULL) ++ return r; ++ ++ next_sub = (char *) sub; ++ while (*next_sub) { ++ for (p = next_sub ; isspace((int) *p) || *p == SEP ; p++); ++ for (next_sub = p ; *next_sub && *next_sub != SEP ; next_sub++); ++ for (q = next_sub ; q > p && (isspace((int) *q) || *q == SEP || !*q) ; q--); ++ if (!*p ) continue; ++ ++ len = q - p + 1; ++ /* Check for folder length */ ++ if (len > sizeof(folder)-1) ++ continue; ++ ++ if (!r) { ++ strncpy(folder, p, len); ++ folder[len] = '\0'; ++ ++ strlcpy(name, namespace->prefix[NAMESPACE_SHARED], sizeof(name)); ++ len = strlcat(name, folder, sizeof(name)); ++ ++ r = (namespace->mboxname_tointernal) (namespace, name, userid, ++ mailboxname); ++ } ++ ++ if (!r) ++ r = mboxlist_changesub(mailboxname, userid, auth_state, 1, 0); ++ ++ if (!r) { ++ syslog(LOG_NOTICE, "autosubscribe: User %s to %s succeeded", ++ userid, folder); ++ } else { ++ syslog(LOG_WARNING, "autosubscribe: User %s to %s failed: %s", ++ userid, folder, error_message(r)); ++ r = 0; ++ } ++ } ++ ++ return r; ++} ++ ++ ++ ++int mboxlist_autocreateinbox(struct namespace *namespace, ++ char *userid, ++ struct auth_state *auth_state, ++ char *mailboxname, int autocreatequota) { ++ char name [MAX_MAILBOX_NAME+1]; ++ char folder [MAX_MAILBOX_NAME+1]; ++ char *auth_userid = NULL; ++ char *partition = NULL; ++ const char *crt; ++ const char *sub; ++ char *p, *q, *next_crt, *next_sub; ++ int len; ++ int r = 0; ++ int numcrt = 0; ++ int numsub = 0; ++#ifdef USE_SIEVE ++ const char *source_script; ++#endif ++ ++ ++ ++ auth_userid = auth_canonuser(auth_state); ++ if (auth_userid == NULL) { ++ /* ++ * Couldn't get cannon userid ++ */ ++ syslog(LOG_ERR, ++ "autocreateinbox: Could not get canonified userid for user %s", userid); ++ return IMAP_PARTITION_UNKNOWN; ++ } ++ ++ /* Added this for debug information. */ ++ syslog(LOG_DEBUG, "autocreateinbox: autocreate inbox for user %s was called", auth_userid); ++ ++ /* ++ * While this is not needed for admins ++ * and imap_admins accounts, it would be ++ * better to separate *all* admins and ++ * proxyservers from normal accounts ++ * (accounts that have mailboxes). ++ * UOA Specific note(1): Even if we do not ++ * exclude these servers-classes here, ++ * UOA specific code, will neither return ++ * role, nor create INBOX, because none of these ++ * administrative accounts belong to the ++ * mailRecipient objectclass, or have imapPartition. ++ * UOA Specific note(2): Another good reason for doing ++ * this, is to prevent the code, from getting into ++ * cyrus_ldap.c because of the continues MSA logins to LMTPd. ++ */ ++ ++ /* ++ * admins and the coresponding imap ++ * service, had already been excluded. ++ */ ++ ++ /* ++ * Do we really need group membership ++ * for admins or service_admins? ++ */ ++ if (global_authisa(auth_state, IMAPOPT_ADMINS)) return 0; ++ ++ /* ++ * Do we really need group membership ++ * for proxyservers? ++ */ ++ if (global_authisa(auth_state, IMAPOPT_PROXYSERVERS)) return 0; ++ ++ /* ++ * Check if user belongs to the autocreate_users group. This option ++ * controls for whom the mailbox may be automatically created. Default ++ * value for this option is 'anyone'. So, if not declared, all mailboxes ++ * will be created. ++ */ ++ if (!global_authisa(auth_state, IMAPOPT_AUTOCREATE_USERS)) { ++ syslog(LOG_DEBUG, "autocreateinbox: User %s does not belong to the autocreate_users. No mailbox is created", ++ auth_userid); ++ return IMAP_MAILBOX_NONEXISTENT; ++ } ++ ++#if 0 ++ /* ++ * Get Partition info or return. ++ * (Here you should propably use ++ * you own "get_partition(char *userid)" ++ * function. Otherwise all new INBOXes will be ++ * created into whatever partition has been declared ++ * as default in your imapd.conf) ++ */ ++ ++ partition = get_partition(userid); ++ if (partition == NULL) { ++ /* ++ * Couldn't get partition info ++ */ ++ syslog(LOG_ERR, ++ "Could not get imapPartition info for user %s", userid); ++ return IMAP_PARTITION_UNKNOWN; ++ } ++#endif ++ ++ r = mboxlist_createmailbox(mailboxname, MAILBOX_FORMAT_NORMAL, NULL, ++ 1, userid, auth_state, 0, 0, 0); ++ ++ if (!r && autocreatequota > 0) ++ r = mboxlist_setquota(mailboxname, autocreatequota, 0); ++ ++ if (!r) ++ r = mboxlist_changesub(mailboxname, userid, ++ auth_state, 1, 1); ++ ++ if (!r) { ++ syslog(LOG_NOTICE, "autocreateinbox: User %s, INBOX was successfully created in partition %s", ++ auth_userid, partition == NULL ? "default" : partition); ++ } else { ++ syslog(LOG_ERR, "autocreateinbox: User %s, INBOX failed. %s", ++ auth_userid, error_message(r)); ++ } ++ ++#if 0 ++ /* Allocated from get_partition, and not needed any more */ ++ free_partition(partition); ++#endif ++ ++ if (r) return r; ++ ++ /* INBOX's subfolders */ ++ if ((crt=config_getstring(IMAPOPT_AUTOCREATEINBOXFOLDERS))) ++ sub=config_getstring(IMAPOPT_AUTOSUBSCRIBEINBOXFOLDERS); ++ ++ /* Roll through crt */ ++ next_crt = (char *) crt; ++ while (next_crt!=NULL && *next_crt) { ++ for (p = next_crt ; isspace((int) *p) || *p == SEP ; p++); ++ for (next_crt = p ; *next_crt && *next_crt != SEP ; next_crt++); ++ for (q = next_crt ; q > p && (isspace((int) *q) || *q == SEP || !*q); q--); ++ ++ if (!*p) continue; ++ ++ len = q - p + 1; ++ ++ /* First time we check for length */ ++ if (len > sizeof(folder) - 5) ++ r = IMAP_MAILBOX_BADNAME; ++ ++ if (!r) { ++ strncpy(folder, p, len); ++ folder[len] = '\0'; ++ ++ strlcpy(name, namespace->prefix[NAMESPACE_INBOX], sizeof(name)); ++ len = strlcat(name, folder, sizeof(name)); ++ } ++ ++ if (!r) ++ r = (namespace->mboxname_tointernal) (namespace, name, userid, ++ mailboxname); ++ if (!r) ++ r = mboxlist_createmailbox(mailboxname, MAILBOX_FORMAT_NORMAL, NULL, ++ 1, userid, auth_state, 0, 0, 0); ++ ++ if (!r) { ++ numcrt++; ++ syslog(LOG_NOTICE, "autocreateinbox: User %s, subfolder %s creation succeeded.", ++ auth_userid, name); ++ } else { ++ syslog(LOG_WARNING, "autocreateinbox: User %s, subfolder %s creation failed. %s", ++ auth_userid, name, error_message(r)); ++ r=0; ++ continue; ++ } ++ ++ /* Roll through sub */ ++ next_sub = (char *) sub; ++ while (next_sub!=NULL && *next_sub) { ++ for (p = next_sub ; isspace((int) *p) || *p == SEP ; p++); ++ for (next_sub = p ; *next_sub && *next_sub != SEP ; next_sub++); ++ for (q = next_sub ; q > p && (isspace((int) *q) || *q == SEP || !*q) ; q--); ++ if (!*p ) continue; ++ ++ len = q - p + 1; ++ ++ if (len != strlen(folder) || strncmp(folder, p, len)) ++ continue; ++ ++ r = mboxlist_changesub(mailboxname, userid, auth_state, 1, 1); ++ ++ if (!r) { ++ numsub++; ++ syslog(LOG_NOTICE,"autocreateinbox: User %s, subscription to %s succeeded", ++ auth_userid, name); ++ } else ++ syslog(LOG_WARNING, "autocreateinbox: User %s, subscription to %s failed. %s", ++ auth_userid, name, error_message(r)); ++ ++ break; ++ } ++ } ++ ++ if (crt!=NULL && *crt) ++ syslog(LOG_INFO, "User %s, Inbox subfolders, created %d, subscribed %d", ++ auth_userid, numcrt, numsub); ++ ++ /* ++ * Check if shared folders are available for subscription. ++ */ ++ mboxlist_autosubscribe_sharedfolders(namespace, userid, auth_userid, auth_state); ++ ++#ifdef USE_SIEVE ++ /* ++ * Here the autocreate sieve script feature is iniated from. ++ */ ++ source_script = config_getstring(IMAPOPT_AUTOCREATE_SIEVE_SCRIPT); + ++ if (source_script) { ++ if (!autoadd_sieve(userid, source_script)) ++ syslog(LOG_NOTICE, "autocreate_sieve: User %s, default sieve script creation succeeded", auth_userid); ++ else ++ syslog(LOG_WARNING, "autocreate_sieve: User %s, default sieve script creation failed", auth_userid); ++ } ++#endif + ++ return r; ++} + -+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. -+ -+ -+ -+Things to be done -+================= -+ -+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. -+ -+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 -+ -diff -Naur cyrus-imapd-2.3.12p2/imap/Makefile.in cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/Makefile.in ---- cyrus-imapd-2.3.12p2/imap/Makefile.in 2008-04-04 00:09:51.000000000 +0300 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/Makefile.in 2008-05-06 14:49:12.000000000 +0300 -@@ -101,7 +101,7 @@ - convert_code.o duplicate.o saslclient.o saslserver.o signals.o \ - annotate.o search_engines.o squat.o squat_internal.o mbdump.o \ - imapparse.o telemetry.o user.o notify.o idle.o quota_db.o \ -- sync_log.o $(SEEN) mboxkey.o backend.o tls.o message_guid.o \ -+ sync_log.o autosieve.o $(SEEN) mboxkey.o backend.o tls.o message_guid.o \ - statuscache_db.o - - IMAPDOBJS=pushstats.o imapd.o proxy.o imap_proxy.o index.o version.o -@@ -118,7 +118,7 @@ - fud smmapd reconstruct quota mbpath ipurge cyr_dbtool cyr_synclog \ - cyrdump chk_cyrus cvt_cyrusdb deliver ctl_mboxlist \ - ctl_deliver ctl_cyrusdb squatter mbexamine cyr_expire arbitron \ -- unexpunge @IMAP_PROGS@ -+ unexpunge compile_sieve @IMAP_PROGS@ - - BUILTSOURCES = imap_err.c imap_err.h pushstats.c pushstats.h \ - lmtpstats.c lmtpstats.h xversion.h mupdate_err.c mupdate_err.h \ -@@ -183,9 +183,9 @@ - mupdate_err.h: mupdate_err.c - - ### Services --idled: idled.o mutex_fake.o libimap.a $(DEPLIBS) -+idled: idled.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o idled \ -- idled.o mutex_fake.o libimap.a $(DEPLIBS) $(LIBS) -+ idled.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - - lmtpd: lmtpd.o proxy.o $(LMTPOBJS) $(SIEVE_OBJS) mutex_fake.o \ - libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) -@@ -199,158 +199,162 @@ - $(SERVICE) lmtpd.o proxy.o $(LMTPOBJS) $(SIEVE_OBJS) \ - mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) - --imapd: $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE) -+imapd: $(IMAPDOBJS) mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) - $(CC) $(LDFLAGS) -o imapd \ - $(SERVICE) $(IMAPDOBJS) mutex_fake.o \ -- libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) - --imapd.pure: $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE) -+imapd.pure: $(IMAPDOBJS) mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) - $(PURIFY) $(PUREOPT) $(CC) $(LDFLAGS) -o imapd.pure \ - $(SERVICE) $(IMAPDOBJS) mutex_fake.o libimap.a \ -- $(DEPLIBS) $(LIBS) $(LIB_WRAP) -+ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) - --imapd.quant: $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE) -+imapd.quant: $(IMAPDOBJS) mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) - $(QUANTIFY) $(QUANTOPT) $(CC) $(LDFLAGS) -o imapd.quant \ - $(SERVICE) $(IMAPDOBJS) mutex_fake.o libimap.a \ -- $(DEPLIBS) $(LIBS) $(LIB_WRAP) -+ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) - - mupdate: mupdate.o mupdate-slave.o mupdate-client.o mutex_pthread.o tls.o \ -- libimap.a $(DEPLIBS) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o mupdate \ - $(SERVICETHREAD) mupdate.o mupdate-slave.o mupdate-client.o \ - mutex_pthread.o tls.o libimap.a \ -- $(DEPLIBS) $(LIBS) $(LIB_WRAP) -lpthread -+ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) -lpthread - - mupdate.pure: mupdate.o mupdate-slave.o mupdate-client.o mutex_pthread.o \ -- libimap.a $(DEPLIBS) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(PURIFY) $(PUREOPT) $(CC) $(LDFLAGS) -o mupdate.pure \ - $(SERVICETHREAD) mupdate.o mupdate-slave.o mupdate-client.o \ -- mutex_pthread.o libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP) -lpthread -+ mutex_pthread.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) -lpthread - - pop3d: pop3d.o proxy.o backend.o tls.o mutex_fake.o libimap.a \ -- $(DEPLIBS) $(SERVICE) -+ $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) - $(CC) $(LDFLAGS) -o pop3d pop3d.o proxy.o backend.o tls.o $(SERVICE) \ -- mutex_fake.o libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP) -+ mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) - - nntpd: nntpd.o proxy.o backend.o index.o smtpclient.o spool.o tls.o \ -- mutex_fake.o nntp_err.o libimap.a $(DEPLIBS) $(SERVICE) -+ mutex_fake.o nntp_err.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) - $(CC) $(LDFLAGS) -o nntpd nntpd.o proxy.o backend.o index.o spool.o \ - smtpclient.o tls.o $(SERVICE) mutex_fake.o nntp_err.o \ -- libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) - --fud: fud.o libimap.a mutex_fake.o $(DEPLIBS) $(SERVICE) -+fud: fud.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) - $(CC) $(LDFLAGS) -o fud $(SERVICE) fud.o mutex_fake.o libimap.a \ -- $(DEPLIBS) $(LIBS) $(LIB_WRAP) -+ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) - --smmapd: smmapd.o libimap.a mutex_fake.o $(DEPLIBS) $(SERVICE) -+smmapd: smmapd.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) - $(CC) $(LDFLAGS) -o smmapd $(SERVICE) smmapd.o mutex_fake.o libimap.a \ -- $(DEPLIBS) $(LIBS) $(LIB_WRAP) -+ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) - - sync_server: sync_server.o sync_support.o sync_commit.o \ -- imapparse.o tls.o libimap.a mutex_fake.o $(DEPLIBS) $(SERVICE) -+ imapparse.o tls.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) - $(CC) $(LDFLAGS) -o \ - sync_server sync_server.o sync_support.o sync_commit.o \ - imapparse.o tls.o $(SERVICE) libimap.a mutex_fake.o \ -- $(DEPLIBS) $(LIBS) $(LIB_WRAP) -+ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) - - ### Command Line Utilities --arbitron: arbitron.o $(CLIOBJS) libimap.a $(DEPLIBS) -+arbitron: arbitron.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o arbitron arbitron.o $(CLIOBJS) \ -- libimap.a $(DEPLIBS) $(LIBS) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --cyr_dbtool: cyr_dbtool.o mutex_fake.o libimap.a $(DEPLIBS) -+cyr_dbtool: cyr_dbtool.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o cyr_dbtool cyr_dbtool.o $(CLIOBJS) \ -- libimap.a $(DEPLIBS) $(LIBS) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --cyr_synclog: cyr_synclog.o mutex_fake.o libimap.a $(DEPLIBS) -+cyr_synclog: cyr_synclog.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o cyr_synclog cyr_synclog.o $(CLIOBJS) \ -- libimap.a $(DEPLIBS) $(LIBS) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --cvt_cyrusdb: cvt_cyrusdb.o mutex_fake.o libimap.a $(DEPLIBS) -+cvt_cyrusdb: cvt_cyrusdb.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o cvt_cyrusdb cvt_cyrusdb.o $(CLIOBJS) \ -- libimap.a $(DEPLIBS) $(LIBS) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --chk_cyrus: chk_cyrus.o mutex_fake.o libimap.a $(DEPLIBS) -+chk_cyrus: chk_cyrus.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o chk_cyrus chk_cyrus.o $(CLIOBJS) \ -- libimap.a $(DEPLIBS) $(LIBS) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --deliver: deliver.o $(LMTPOBJS) proxy.o mutex_fake.o libimap.a $(DEPLIBS) -+deliver: deliver.o $(LMTPOBJS) proxy.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o deliver deliver.o $(LMTPOBJS) proxy.o \ -- mutex_fake.o libimap.a $(DEPLIBS) $(LIBS) -+ mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --ctl_deliver: ctl_deliver.o $(CLIOBJS) libimap.a $(DEPLIBS) -+ctl_deliver: ctl_deliver.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o \ -- $@ ctl_deliver.o $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) -+ $@ ctl_deliver.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --ctl_mboxlist: ctl_mboxlist.o mupdate-client.o $(CLIOBJS) libimap.a $(DEPLIBS) -+ctl_mboxlist: ctl_mboxlist.o mupdate-client.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o $@ ctl_mboxlist.o mupdate-client.o $(CLIOBJS) \ -- libimap.a $(DEPLIBS) $(LIBS) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --ctl_cyrusdb: ctl_cyrusdb.o $(CLIOBJS) libimap.a $(DEPLIBS) -+ctl_cyrusdb: ctl_cyrusdb.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o \ -- $@ ctl_cyrusdb.o $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) -+ $@ ctl_cyrusdb.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --cyr_expire: cyr_expire.o $(CLIOBJS) libimap.a $(DEPLIBS) -+cyr_expire: cyr_expire.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o $@ cyr_expire.o $(CLIOBJS) \ -- libimap.a $(DEPLIBS) $(LIBS) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --fetchnews: fetchnews.o $(CLIOBJS) libimap.a $(DEPLIBS) -+fetchnews: fetchnews.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o \ -- $@ fetchnews.o $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) -+ $@ fetchnews.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --squatter: squatter.o index.o squat_build.o $(CLIOBJS) libimap.a $(DEPLIBS) -+squatter: squatter.o index.o squat_build.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o squatter squatter.o index.o squat_build.o \ -- $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) -+ $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --mbpath: mbpath.o $(CLIOBJS) libimap.a $(DEPLIBS) -+mbpath: mbpath.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o mbpath mbpath.o $(CLIOBJS) libimap.a \ -- $(DEPLIBS) $(LIBS) -+ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --ipurge: ipurge.o $(CLIOBJS) libimap.a $(DEPLIBS) -+ipurge: ipurge.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o ipurge ipurge.o $(CLIOBJS) \ -- libimap.a $(DEPLIBS) $(LIBS) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --cyrdump: cyrdump.o index.o $(CLIOBJS) libimap.a $(DEPLIBS) -+cyrdump: cyrdump.o index.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o cyrdump cyrdump.o index.o $(CLIOBJS) \ -- libimap.a $(DEPLIBS) $(LIBS) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --mbexamine: mbexamine.o $(CLIOBJS) libimap.a $(DEPLIBS) -+mbexamine: mbexamine.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o \ -- mbexamine mbexamine.o $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) -+ mbexamine mbexamine.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --reconstruct: reconstruct.o $(CLIOBJS) libimap.a $(DEPLIBS) -+reconstruct: reconstruct.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o \ -- reconstruct reconstruct.o $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) -+ reconstruct reconstruct.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --quota: quota.o $(CLIOBJS) libimap.a $(DEPLIBS) -+quota: quota.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o quota quota.o $(CLIOBJS) \ -- libimap.a $(DEPLIBS) $(LIBS) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --tls_prune: tls_prune.o tls.o $(CLIOBJS) libimap.a $(DEPLIBS) -+tls_prune: tls_prune.o tls.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o \ -- $@ tls_prune.o tls.o $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) -+ $@ tls_prune.o tls.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --unexpunge: unexpunge.o $(CLIOBJS) libimap.a $(DEPLIBS) -+unexpunge: unexpunge.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o $@ unexpunge.o $(CLIOBJS) \ -- libimap.a $(DEPLIBS) $(LIBS) -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --make_md5: make_md5.o libimap.a mutex_fake.o $(DEPLIBS) -- $(CC) $(LDFLAGS) -o make_md5 make_md5.o libimap.a mutex_fake.o $(DEPLIBS) $(LIBS) -+make_md5: make_md5.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) -+ $(CC) $(LDFLAGS) -o make_md5 make_md5.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - --make_sha1: make_sha1.o libimap.a mutex_fake.o $(DEPLIBS) -- $(CC) $(LDFLAGS) -o make_sha1 make_sha1.o libimap.a mutex_fake.o $(DEPLIBS) $(LIBS) -+make_sha1: make_sha1.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) -+ $(CC) $(LDFLAGS) -o make_sha1 make_sha1.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - - sync_client: sync_client.o sync_support.o \ -- backend.o tls.o imapparse.o libimap.a mutex_fake.o $(DEPLIBS) -+ backend.o tls.o imapparse.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o \ - sync_client sync_client.o sync_support.o \ -- backend.o tls.o imapparse.o libimap.a mutex_fake.o $(DEPLIBS) $(LIBS) -+ backend.o tls.o imapparse.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - - sync_reset: sync_reset.o sync_support.o sync_commit.o \ -- libimap.a mutex_fake.o $(DEPLIBS) -+ libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) - $(CC) $(LDFLAGS) -o \ - sync_reset sync_reset.o sync_support.o sync_commit.o \ -- libimap.a mutex_fake.o $(DEPLIBS) $(LIBS) -+ libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) -+ -+compile_sieve: compile_sieve.o libimap.a $(DEPLIBS) $(SIEVE_LIBS) -+ $(CC) $(LDFLAGS) -o compile_sieve compile_sieve.o $(CLIOBJS) \ -+ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) - - ### Other Misc Targets - -diff -Naur cyrus-imapd-2.3.12p2/imap/autosieve.c cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/autosieve.c ---- cyrus-imapd-2.3.12p2/imap/autosieve.c 1970-01-01 02:00:00.000000000 +0200 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/autosieve.c 2008-05-06 14:48:41.000000000 +0300 +--- cyrus-imapd-2.3.13/imap/autosieve.c.autocreate 2009-01-13 11:14:09.000000000 +0100 ++++ cyrus-imapd-2.3.13/imap/autosieve.c 2009-01-13 11:14:09.000000000 +0100 @@ -0,0 +1,590 @@ +#include +#include @@ -1071,9 +1012,19 @@ diff -Naur cyrus-imapd-2.3.12p2/imap/autosieve.c cyrus-imapd-2.3.12p2-autocreate + * Pavlos. Author of cyrusmaster. So consider this patch as his birthday present + */ + -diff -Naur cyrus-imapd-2.3.12p2/imap/compile_sieve.c cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/compile_sieve.c ---- cyrus-imapd-2.3.12p2/imap/compile_sieve.c 1970-01-01 02:00:00.000000000 +0200 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/compile_sieve.c 2008-05-06 14:48:41.000000000 +0300 +--- cyrus-imapd-2.3.13/imap/mboxlist.h.autocreate 2008-03-24 18:09:18.000000000 +0100 ++++ cyrus-imapd-2.3.13/imap/mboxlist.h 2009-01-13 11:14:09.000000000 +0100 +@@ -212,4 +212,8 @@ + int mboxlist_abort(struct txn *tid); + + int mboxlist_delayed_delete_isenabled(void); ++int mboxlist_autocreateinbox(struct namespace *namespace,char *userid, ++ struct auth_state *auth_state, char *mailboxname, ++ int autocreatequota); ++ + #endif +--- cyrus-imapd-2.3.13/imap/compile_sieve.c.autocreate 2009-01-13 11:14:09.000000000 +0100 ++++ cyrus-imapd-2.3.13/imap/compile_sieve.c 2009-01-13 11:14:09.000000000 +0100 @@ -0,0 +1,365 @@ +/* This tool compiles the sieve script from a command +line so that it can be used wby the autoadd patch */ @@ -1440,83 +1391,277 @@ diff -Naur cyrus-imapd-2.3.12p2/imap/compile_sieve.c cyrus-imapd-2.3.12p2-autocr + + + -diff -Naur cyrus-imapd-2.3.12p2/imap/imapd.c cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/imapd.c ---- cyrus-imapd-2.3.12p2/imap/imapd.c 2008-04-13 18:40:29.000000000 +0300 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/imapd.c 2008-05-06 14:48:41.000000000 +0300 -@@ -208,6 +208,7 @@ - void motd_file(int fd); - void shut_down(int code); - void fatal(const char *s, int code); -+void autocreate_inbox(void); +--- cyrus-imapd-2.3.13/imap/Makefile.in.autocreate 2008-09-23 18:17:09.000000000 +0200 ++++ cyrus-imapd-2.3.13/imap/Makefile.in 2009-01-13 11:24:48.000000000 +0100 +@@ -101,7 +101,7 @@ + convert_code.o duplicate.o saslclient.o saslserver.o signals.o \ + annotate.o search_engines.o squat.o squat_internal.o mbdump.o \ + imapparse.o telemetry.o user.o notify.o idle.o quota_db.o \ +- sync_log.o $(SEEN) mboxkey.o backend.o tls.o message_guid.o \ ++ sync_log.o autosieve.o $(SEEN) mboxkey.o backend.o tls.o message_guid.o \ + statuscache_db.o - void cmdloop(void); - void cmd_login(char *tag, char *user); -@@ -1970,6 +1971,43 @@ - } + IMAPDOBJS=pushstats.o imapd.o proxy.o imap_proxy.o index.o version.o +@@ -118,7 +118,7 @@ + fud smmapd reconstruct quota mbpath ipurge cyr_dbtool cyr_synclog \ + cyrdump chk_cyrus cvt_cyrusdb deliver ctl_mboxlist \ + ctl_deliver ctl_cyrusdb squatter mbexamine cyr_expire arbitron \ +- unexpunge @IMAP_PROGS@ ++ unexpunge compile_sieve @IMAP_PROGS@ - /* -+ * Autocreate Inbox and subfolders upon login -+ */ -+void autocreate_inbox() -+{ -+ char inboxname[MAX_MAILBOX_NAME+1]; -+ int autocreatequota; -+ int r; -+ -+ /* -+ * Exlude admin's accounts -+ */ -+ if (imapd_userisadmin || imapd_userisproxyadmin) -+ return; -+ -+ /* -+ * Exclude anonymous -+ */ -+ if (!strcmp(imapd_userid, "anonymous")) -+ return; -+ -+ if ((autocreatequota = config_getint(IMAPOPT_AUTOCREATEQUOTA))) { -+ /* This is actyally not required -+ as long as the lenght of userid is ok */ -+ r = (*imapd_namespace.mboxname_tointernal) (&imapd_namespace, -+ "INBOX", imapd_userid, inboxname); -+ if (!r) -+ r = mboxlist_lookup(inboxname, NULL, NULL); -+ -+ if (r == IMAP_MAILBOX_NONEXISTENT) { -+ mboxlist_autocreateinbox(&imapd_namespace, imapd_userid, -+ imapd_authstate, inboxname, autocreatequota); -+ } -+ } -+} -+ -+ -+/* - * Perform a LOGIN command - */ - void cmd_login(char *tag, char *user) -@@ -2137,6 +2175,9 @@ - strcspn(imapd_userid, "@") : 0); + BUILTSOURCES = imap_err.c imap_err.h pushstats.c pushstats.h \ + lmtpstats.c lmtpstats.h xversion.h mupdate_err.c mupdate_err.h \ +@@ -183,9 +183,9 @@ + mupdate_err.h: mupdate_err.c - freebuf(&passwdbuf); -+ -+ autocreate_inbox(); -+ - return; - } + ### Services +-idled: idled.o mutex_fake.o libimap.a $(DEPLIBS) ++idled: idled.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o idled \ +- idled.o mutex_fake.o libimap.a $(DEPLIBS) $(LIBS) ++ idled.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) -@@ -2295,6 +2336,8 @@ - config_virtdomains ? - strcspn(imapd_userid, "@") : 0); + lmtpd: lmtpd.o proxy.o $(LMTPOBJS) $(SIEVE_OBJS) mutex_fake.o \ + libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) +@@ -199,163 +199,166 @@ + $(SERVICE) lmtpd.o proxy.o $(LMTPOBJS) $(SIEVE_OBJS) \ + mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) -+ autocreate_inbox(); -+ - return; - } +-imapd: $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE) ++imapd: $(IMAPDOBJS) mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) + $(CC) $(LDFLAGS) -o imapd \ + $(SERVICE) $(IMAPDOBJS) mutex_fake.o \ +- libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) -diff -Naur cyrus-imapd-2.3.12p2/imap/lmtpd.c cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/lmtpd.c ---- cyrus-imapd-2.3.12p2/imap/lmtpd.c 2008-04-11 23:07:00.000000000 +0300 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/lmtpd.c 2008-05-06 14:48:41.000000000 +0300 +-imapd.pure: $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE) ++imapd.pure: $(IMAPDOBJS) mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) + $(PURIFY) $(PUREOPT) $(CC) $(LDFLAGS) -o imapd.pure \ + $(SERVICE) $(IMAPDOBJS) mutex_fake.o libimap.a \ +- $(DEPLIBS) $(LIBS) $(LIB_WRAP) ++ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) + +-imapd.quant: $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE) ++imapd.quant: $(IMAPDOBJS) mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) + $(QUANTIFY) $(QUANTOPT) $(CC) $(LDFLAGS) -o imapd.quant \ + $(SERVICE) $(IMAPDOBJS) mutex_fake.o libimap.a \ +- $(DEPLIBS) $(LIBS) $(LIB_WRAP) ++ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) + + mupdate: mupdate.o mupdate-slave.o mupdate-client.o mutex_pthread.o tls.o \ +- libimap.a $(DEPLIBS) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o mupdate \ + $(SERVICETHREAD) mupdate.o mupdate-slave.o mupdate-client.o \ + mutex_pthread.o tls.o libimap.a \ +- $(DEPLIBS) $(LIBS) $(LIB_WRAP) -lpthread ++ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) -lpthread + + mupdate.pure: mupdate.o mupdate-slave.o mupdate-client.o mutex_pthread.o \ +- libimap.a $(DEPLIBS) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(PURIFY) $(PUREOPT) $(CC) $(LDFLAGS) -o mupdate.pure \ + $(SERVICETHREAD) mupdate.o mupdate-slave.o mupdate-client.o \ +- mutex_pthread.o libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP) -lpthread ++ mutex_pthread.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) -lpthread + + pop3d: pop3d.o proxy.o backend.o tls.o mutex_fake.o libimap.a \ +- $(DEPLIBS) $(SERVICE) ++ $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) + $(CC) $(LDFLAGS) -o pop3d pop3d.o proxy.o backend.o tls.o $(SERVICE) \ +- mutex_fake.o libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP) ++ mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) + + nntpd: nntpd.o proxy.o backend.o index.o smtpclient.o spool.o tls.o \ +- mutex_fake.o nntp_err.o libimap.a $(DEPLIBS) $(SERVICE) ++ mutex_fake.o nntp_err.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) + $(CC) $(LDFLAGS) -o nntpd nntpd.o proxy.o backend.o index.o spool.o \ + smtpclient.o tls.o $(SERVICE) mutex_fake.o nntp_err.o \ +- libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) + +-fud: fud.o libimap.a mutex_fake.o $(DEPLIBS) $(SERVICE) ++fud: fud.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) + $(CC) $(LDFLAGS) -o fud $(SERVICE) fud.o mutex_fake.o libimap.a \ +- $(DEPLIBS) $(LIBS) $(LIB_WRAP) ++ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) + +-smmapd: smmapd.o libimap.a mutex_fake.o $(DEPLIBS) $(SERVICE) ++smmapd: smmapd.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) + $(CC) $(LDFLAGS) -o smmapd $(SERVICE) smmapd.o mutex_fake.o libimap.a \ +- $(DEPLIBS) $(LIBS) $(LIB_WRAP) ++ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) + + sync_server: sync_server.o sync_support.o sync_commit.o \ +- imapparse.o tls.o libimap.a mutex_fake.o $(DEPLIBS) $(SERVICE) ++ imapparse.o tls.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(SERVICE) + $(CC) $(LDFLAGS) -o \ + sync_server sync_server.o sync_support.o sync_commit.o \ + imapparse.o tls.o $(SERVICE) libimap.a mutex_fake.o \ +- $(DEPLIBS) $(LIBS) $(LIB_WRAP) ++ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP) + + ### Command Line Utilities +-arbitron: arbitron.o $(CLIOBJS) libimap.a $(DEPLIBS) ++arbitron: arbitron.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o arbitron arbitron.o $(CLIOBJS) \ +- libimap.a $(DEPLIBS) $(LIBS) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-cyr_dbtool: cyr_dbtool.o mutex_fake.o libimap.a $(DEPLIBS) ++cyr_dbtool: cyr_dbtool.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o cyr_dbtool cyr_dbtool.o $(CLIOBJS) \ +- libimap.a $(DEPLIBS) $(LIBS) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-cyr_synclog: cyr_synclog.o mutex_fake.o libimap.a $(DEPLIBS) ++cyr_synclog: cyr_synclog.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o cyr_synclog cyr_synclog.o $(CLIOBJS) \ +- libimap.a $(DEPLIBS) $(LIBS) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-cvt_cyrusdb: cvt_cyrusdb.o mutex_fake.o libimap.a $(DEPLIBS) ++cvt_cyrusdb: cvt_cyrusdb.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o cvt_cyrusdb cvt_cyrusdb.o $(CLIOBJS) \ +- libimap.a $(DEPLIBS) $(LIBS) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-chk_cyrus: chk_cyrus.o mutex_fake.o libimap.a $(DEPLIBS) ++chk_cyrus: chk_cyrus.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o chk_cyrus chk_cyrus.o $(CLIOBJS) \ +- libimap.a $(DEPLIBS) $(LIBS) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-deliver: deliver.o $(LMTPOBJS) proxy.o mutex_fake.o libimap.a $(DEPLIBS) ++deliver: deliver.o $(LMTPOBJS) proxy.o mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o deliver deliver.o $(LMTPOBJS) proxy.o \ +- mutex_fake.o libimap.a $(DEPLIBS) $(LIBS) ++ mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-ctl_deliver: ctl_deliver.o $(CLIOBJS) libimap.a $(DEPLIBS) ++ctl_deliver: ctl_deliver.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o \ +- $@ ctl_deliver.o $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) ++ $@ ctl_deliver.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-ctl_mboxlist: ctl_mboxlist.o mupdate-client.o $(CLIOBJS) libimap.a $(DEPLIBS) ++ctl_mboxlist: ctl_mboxlist.o mupdate-client.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o $@ ctl_mboxlist.o mupdate-client.o $(CLIOBJS) \ +- libimap.a $(DEPLIBS) $(LIBS) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-ctl_cyrusdb: ctl_cyrusdb.o $(CLIOBJS) libimap.a $(DEPLIBS) ++ctl_cyrusdb: ctl_cyrusdb.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o \ +- $@ ctl_cyrusdb.o $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) ++ $@ ctl_cyrusdb.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-cyr_expire: cyr_expire.o $(CLIOBJS) libimap.a $(DEPLIBS) ++cyr_expire: cyr_expire.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o $@ cyr_expire.o $(CLIOBJS) \ +- libimap.a $(DEPLIBS) $(LIBS) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-fetchnews: fetchnews.o $(CLIOBJS) libimap.a $(DEPLIBS) ++fetchnews: fetchnews.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o \ +- $@ fetchnews.o $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) ++ $@ fetchnews.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-squatter: squatter.o index.o squat_build.o $(CLIOBJS) libimap.a $(DEPLIBS) ++squatter: squatter.o index.o squat_build.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o squatter squatter.o index.o squat_build.o \ +- $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) ++ $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-mbpath: mbpath.o $(CLIOBJS) libimap.a $(DEPLIBS) ++mbpath: mbpath.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o mbpath mbpath.o $(CLIOBJS) libimap.a \ +- $(DEPLIBS) $(LIBS) ++ $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-ipurge: ipurge.o $(CLIOBJS) libimap.a $(DEPLIBS) ++ipurge: ipurge.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o ipurge ipurge.o $(CLIOBJS) \ +- libimap.a $(DEPLIBS) $(LIBS) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-cyr_virusscan: cyr_virusscan.o index.o $(CLIOBJS) libimap.a $(DEPLIBS) ++cyr_virusscan: cyr_virusscan.o index.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o cyr_virusscan cyr_virusscan.o index.o $(CLIOBJS) \ +- libimap.a $(DEPLIBS) $(LIBS) -lclamav ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) -lclamav + +-cyrdump: cyrdump.o index.o $(CLIOBJS) libimap.a $(DEPLIBS) ++cyrdump: cyrdump.o index.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o cyrdump cyrdump.o index.o $(CLIOBJS) \ +- libimap.a $(DEPLIBS) $(LIBS) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-mbexamine: mbexamine.o $(CLIOBJS) libimap.a $(DEPLIBS) ++mbexamine: mbexamine.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o \ +- mbexamine mbexamine.o $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) ++ mbexamine mbexamine.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-reconstruct: reconstruct.o $(CLIOBJS) libimap.a $(DEPLIBS) ++reconstruct: reconstruct.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o \ +- reconstruct reconstruct.o $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) ++ reconstruct reconstruct.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-quota: quota.o $(CLIOBJS) libimap.a $(DEPLIBS) ++quota: quota.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o quota quota.o $(CLIOBJS) \ +- libimap.a $(DEPLIBS) $(LIBS) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-tls_prune: tls_prune.o tls.o $(CLIOBJS) libimap.a $(DEPLIBS) ++tls_prune: tls_prune.o tls.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o \ +- $@ tls_prune.o tls.o $(CLIOBJS) libimap.a $(DEPLIBS) $(LIBS) ++ $@ tls_prune.o tls.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-unexpunge: unexpunge.o $(CLIOBJS) libimap.a $(DEPLIBS) ++unexpunge: unexpunge.o $(CLIOBJS) libimap.a $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o $@ unexpunge.o $(CLIOBJS) \ +- libimap.a $(DEPLIBS) $(LIBS) ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-make_md5: make_md5.o libimap.a mutex_fake.o $(DEPLIBS) +- $(CC) $(LDFLAGS) -o make_md5 make_md5.o libimap.a mutex_fake.o $(DEPLIBS) $(LIBS) ++make_md5: make_md5.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) ++ $(CC) $(LDFLAGS) -o make_md5 make_md5.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + +-make_sha1: make_sha1.o libimap.a mutex_fake.o $(DEPLIBS) +- $(CC) $(LDFLAGS) -o make_sha1 make_sha1.o libimap.a mutex_fake.o $(DEPLIBS) $(LIBS) ++make_sha1: make_sha1.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) ++ $(CC) $(LDFLAGS) -o make_sha1 make_sha1.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + + sync_client: sync_client.o sync_support.o \ +- backend.o tls.o imapparse.o libimap.a mutex_fake.o $(DEPLIBS) ++ backend.o tls.o imapparse.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o \ + sync_client sync_client.o sync_support.o \ +- backend.o tls.o imapparse.o libimap.a mutex_fake.o $(DEPLIBS) $(LIBS) ++ backend.o tls.o imapparse.o libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + + sync_reset: sync_reset.o sync_support.o sync_commit.o \ +- libimap.a mutex_fake.o $(DEPLIBS) ++ libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) + $(CC) $(LDFLAGS) -o \ + sync_reset sync_reset.o sync_support.o sync_commit.o \ +- libimap.a mutex_fake.o $(DEPLIBS) $(LIBS) ++ libimap.a mutex_fake.o $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + ++compile_sieve: compile_sieve.o libimap.a $(DEPLIBS) $(SIEVE_LIBS) ++ $(CC) $(LDFLAGS) -o compile_sieve compile_sieve.o $(CLIOBJS) \ ++ libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) + ### Other Misc Targets + + clean: +--- cyrus-imapd-2.3.13/imap/lmtpd.c.autocreate 2008-04-22 15:11:18.000000000 +0200 ++++ cyrus-imapd-2.3.13/imap/lmtpd.c 2009-01-13 11:14:09.000000000 +0100 @@ -117,6 +117,8 @@ static FILE *spoolfile(message_data_t *msgdata); static void removespool(message_data_t *msgdata); @@ -1637,417 +1782,81 @@ diff -Naur cyrus-imapd-2.3.12p2/imap/lmtpd.c cyrus-imapd-2.3.12p2-autocreate.unc } } -diff -Naur cyrus-imapd-2.3.12p2/imap/mboxlist.c cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/mboxlist.c ---- cyrus-imapd-2.3.12p2/imap/mboxlist.c 2008-04-04 14:09:42.000000000 +0300 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/mboxlist.c 2008-05-06 14:48:41.000000000 +0300 -@@ -83,6 +83,12 @@ - #include "quota.h" - #include "sync_log.h" +--- cyrus-imapd-2.3.13/imap/imapd.c.autocreate 2008-10-08 17:47:06.000000000 +0200 ++++ cyrus-imapd-2.3.13/imap/imapd.c 2009-01-13 11:14:09.000000000 +0100 +@@ -209,6 +209,7 @@ + void motd_file(int fd); + void shut_down(int code); + void fatal(const char *s, int code); ++void autocreate_inbox(void); -+#ifdef USE_SIEVE -+extern int autoadd_sieve(char *userid, -+ const char *source_script); -+#endif -+ -+ - #define DB config_mboxlist_db - #define SUBDB config_subscription_db - -@@ -100,11 +106,29 @@ - static int mboxlist_changequota(const char *name, int matchlen, int maycreate, - void *rock); - -+static int mboxlist_autochangesub(char *name, int matchlen, int maycreate, -+ void *rock); -+ -+static int mboxlist_autosubscribe_sharedfolders(struct namespace *namespace, -+ char *userid, char *auth_userid, -+ struct auth_state *auth_state); -+ - struct change_rock { - struct quota *quota; - struct txn **tid; - }; - -+/* -+ * Struct needed to be passed as void *rock to -+ * mboxlist_autochangesub(); -+ */ -+struct changesub_rock_st { -+ char *userid; -+ char *auth_userid; -+ struct auth_state *auth_state; -+}; -+ -+ - #define FNAME_SUBSSUFFIX ".sub" + void cmdloop(void); + void cmd_login(char *tag, char *user); +@@ -1975,6 +1976,43 @@ + } /* -@@ -3383,3 +3407,349 @@ - - return(config_delete_mode == IMAP_ENUM_DELETE_MODE_DELAYED); - } -+ -+/* -+ * Automatically subscribe user to *ALL* shared folders, -+ * one has permissions to be subscribed to. -+ * INBOX subfolders are excluded. ++ * Autocreate Inbox and subfolders upon login + */ -+static int mboxlist_autochangesub(char *name, int matchlen, int maycreate, -+ void *rock) { -+ -+ struct changesub_rock_st *changesub_rock = (struct changesub_rock_st *) rock; -+ char *userid = changesub_rock->userid; -+ char *auth_userid = changesub_rock->auth_userid; -+ struct auth_state *auth_state = changesub_rock->auth_state; -+ int r; -+ -+ -+ if((strlen(name) == 5 && !strncmp(name, "INBOX", 5)) || /* Exclude INBOX */ -+ (strlen(name) > 5 && !strncmp(name, "INBOX.",6)) || /* Exclude INBOX subfolders */ -+ (strlen(name) > 4 && !strncmp(name, "user.", 5))) /* Exclude other users' folders */ -+ return 0; -+ -+ -+ r = mboxlist_changesub(name, userid, auth_state, 1, 0); -+ -+ if (r) { -+ syslog(LOG_WARNING, -+ "autosubscribe: User %s to folder %s, subscription failed: %s", -+ auth_userid, name, error_message(r)); -+ } else { -+ syslog(LOG_NOTICE, -+ "autosubscribe: User %s to folder %s, subscription succeeded", -+ auth_userid, name); -+ } -+ -+ return 0; -+} -+ -+#define SEP '|' -+ -+/* -+ * Automatically subscribe user to a shared folder. -+ * Subscription is done successfully, if the shared -+ * folder exists and the user has the necessary -+ * permissions. -+ */ -+static int mboxlist_autosubscribe_sharedfolders(struct namespace *namespace, -+ char *userid, char *auth_userid, -+ struct auth_state *auth_state) { -+ -+ const char *sub ; -+ char *p, *q, *next_sub; -+ char folder[MAX_MAILBOX_NAME+1], name[MAX_MAILBOX_NAME+1], mailboxname[MAX_MAILBOX_NAME+1]; -+ int len; -+ int r = 0; -+ int subscribe_all_sharedfolders = 0; -+ -+ subscribe_all_sharedfolders = config_getswitch(IMAPOPT_AUTOSUBSCRIBE_ALL_SHAREDFOLDERS); -+ -+ /* -+ * If subscribeallsharedfolders is set to yes in imapd.conf, then -+ * subscribe user to every shared folder one has the apropriate -+ * permissions. -+ */ -+ if(subscribe_all_sharedfolders) { -+ char pattern[MAX_MAILBOX_PATH+1]; -+ struct changesub_rock_st changesub_rock; -+ -+ strcpy(pattern, "*"); -+ changesub_rock.userid = userid; -+ changesub_rock.auth_userid = auth_userid; -+ changesub_rock.auth_state = auth_state; -+ -+ r = mboxlist_findall(namespace, pattern, 0, userid, -+ auth_state, mboxlist_autochangesub, &changesub_rock); -+ -+ return r; -+ } -+ -+ if ((sub=config_getstring(IMAPOPT_AUTOSUBSCRIBESHAREDFOLDERS)) == NULL) -+ return r; -+ -+ next_sub = (char *) sub; -+ while (*next_sub) { -+ for (p = next_sub ; isspace((int) *p) || *p == SEP ; p++); -+ for (next_sub = p ; *next_sub && *next_sub != SEP ; next_sub++); -+ for (q = next_sub ; q > p && (isspace((int) *q) || *q == SEP || !*q) ; q--); -+ if (!*p ) continue; -+ -+ len = q - p + 1; -+ /* Check for folder length */ -+ if (len > sizeof(folder)-1) -+ continue; -+ -+ if (!r) { -+ strncpy(folder, p, len); -+ folder[len] = '\0'; -+ -+ strlcpy(name, namespace->prefix[NAMESPACE_SHARED], sizeof(name)); -+ len = strlcat(name, folder, sizeof(name)); -+ -+ r = (namespace->mboxname_tointernal) (namespace, name, userid, -+ mailboxname); -+ } -+ -+ if (!r) -+ r = mboxlist_changesub(mailboxname, userid, auth_state, 1, 0); -+ -+ if (!r) { -+ syslog(LOG_NOTICE, "autosubscribe: User %s to %s succeeded", -+ userid, folder); -+ } else { -+ syslog(LOG_WARNING, "autosubscribe: User %s to %s failed: %s", -+ userid, folder, error_message(r)); -+ r = 0; -+ } -+ } -+ -+ return r; -+} -+ -+ -+ -+int mboxlist_autocreateinbox(struct namespace *namespace, -+ char *userid, -+ struct auth_state *auth_state, -+ char *mailboxname, int autocreatequota) { -+ char name [MAX_MAILBOX_NAME+1]; -+ char folder [MAX_MAILBOX_NAME+1]; -+ char *auth_userid = NULL; -+ char *partition = NULL; -+ const char *crt; -+ const char *sub; -+ char *p, *q, *next_crt, *next_sub; -+ int len; -+ int r = 0; -+ int numcrt = 0; -+ int numsub = 0; -+#ifdef USE_SIEVE -+ const char *source_script; -+#endif -+ -+ -+ -+ auth_userid = auth_canonuser(auth_state); -+ if (auth_userid == NULL) { -+ /* -+ * Couldn't get cannon userid -+ */ -+ syslog(LOG_ERR, -+ "autocreateinbox: Could not get canonified userid for user %s", userid); -+ return IMAP_PARTITION_UNKNOWN; -+ } -+ -+ /* Added this for debug information. */ -+ syslog(LOG_DEBUG, "autocreateinbox: autocreate inbox for user %s was called", auth_userid); -+ -+ /* -+ * While this is not needed for admins -+ * and imap_admins accounts, it would be -+ * better to separate *all* admins and -+ * proxyservers from normal accounts -+ * (accounts that have mailboxes). -+ * UOA Specific note(1): Even if we do not -+ * exclude these servers-classes here, -+ * UOA specific code, will neither return -+ * role, nor create INBOX, because none of these -+ * administrative accounts belong to the -+ * mailRecipient objectclass, or have imapPartition. -+ * UOA Specific note(2): Another good reason for doing -+ * this, is to prevent the code, from getting into -+ * cyrus_ldap.c because of the continues MSA logins to LMTPd. -+ */ -+ -+ /* -+ * admins and the coresponding imap -+ * service, had already been excluded. -+ */ -+ -+ /* -+ * Do we really need group membership -+ * for admins or service_admins? -+ */ -+ if (global_authisa(auth_state, IMAPOPT_ADMINS)) return 0; -+ -+ /* -+ * Do we really need group membership -+ * for proxyservers? -+ */ -+ if (global_authisa(auth_state, IMAPOPT_PROXYSERVERS)) return 0; -+ -+ /* -+ * Check if user belongs to the autocreate_users group. This option -+ * controls for whom the mailbox may be automatically created. Default -+ * value for this option is 'anyone'. So, if not declared, all mailboxes -+ * will be created. -+ */ -+ if (!global_authisa(auth_state, IMAPOPT_AUTOCREATE_USERS)) { -+ syslog(LOG_DEBUG, "autocreateinbox: User %s does not belong to the autocreate_users. No mailbox is created", -+ auth_userid); -+ return IMAP_MAILBOX_NONEXISTENT; -+ } -+ -+#if 0 -+ /* -+ * Get Partition info or return. -+ * (Here you should propably use -+ * you own "get_partition(char *userid)" -+ * function. Otherwise all new INBOXes will be -+ * created into whatever partition has been declared -+ * as default in your imapd.conf) -+ */ -+ -+ partition = get_partition(userid); -+ if (partition == NULL) { -+ /* -+ * Couldn't get partition info -+ */ -+ syslog(LOG_ERR, -+ "Could not get imapPartition info for user %s", userid); -+ return IMAP_PARTITION_UNKNOWN; -+ } -+#endif -+ -+ r = mboxlist_createmailbox(mailboxname, MAILBOX_FORMAT_NORMAL, NULL, -+ 1, userid, auth_state, 0, 0, 0); -+ -+ if (!r && autocreatequota > 0) -+ r = mboxlist_setquota(mailboxname, autocreatequota, 0); -+ -+ if (!r) -+ r = mboxlist_changesub(mailboxname, userid, -+ auth_state, 1, 1); -+ -+ if (!r) { -+ syslog(LOG_NOTICE, "autocreateinbox: User %s, INBOX was successfully created in partition %s", -+ auth_userid, partition == NULL ? "default" : partition); -+ } else { -+ syslog(LOG_ERR, "autocreateinbox: User %s, INBOX failed. %s", -+ auth_userid, error_message(r)); -+ } -+ -+#if 0 -+ /* Allocated from get_partition, and not needed any more */ -+ free_partition(partition); -+#endif -+ -+ if (r) return r; -+ -+ /* INBOX's subfolders */ -+ if ((crt=config_getstring(IMAPOPT_AUTOCREATEINBOXFOLDERS))) -+ sub=config_getstring(IMAPOPT_AUTOSUBSCRIBEINBOXFOLDERS); -+ -+ /* Roll through crt */ -+ next_crt = (char *) crt; -+ while (next_crt!=NULL && *next_crt) { -+ for (p = next_crt ; isspace((int) *p) || *p == SEP ; p++); -+ for (next_crt = p ; *next_crt && *next_crt != SEP ; next_crt++); -+ for (q = next_crt ; q > p && (isspace((int) *q) || *q == SEP || !*q); q--); -+ -+ if (!*p) continue; -+ -+ len = q - p + 1; -+ -+ /* First time we check for length */ -+ if (len > sizeof(folder) - 5) -+ r = IMAP_MAILBOX_BADNAME; -+ -+ if (!r) { -+ strncpy(folder, p, len); -+ folder[len] = '\0'; -+ -+ strlcpy(name, namespace->prefix[NAMESPACE_INBOX], sizeof(name)); -+ len = strlcat(name, folder, sizeof(name)); -+ } -+ -+ if (!r) -+ r = (namespace->mboxname_tointernal) (namespace, name, userid, -+ mailboxname); -+ if (!r) -+ r = mboxlist_createmailbox(mailboxname, MAILBOX_FORMAT_NORMAL, NULL, -+ 1, userid, auth_state, 0, 0, 0); -+ -+ if (!r) { -+ numcrt++; -+ syslog(LOG_NOTICE, "autocreateinbox: User %s, subfolder %s creation succeeded.", -+ auth_userid, name); -+ } else { -+ syslog(LOG_WARNING, "autocreateinbox: User %s, subfolder %s creation failed. %s", -+ auth_userid, name, error_message(r)); -+ r=0; -+ continue; -+ } -+ -+ /* Roll through sub */ -+ next_sub = (char *) sub; -+ while (next_sub!=NULL && *next_sub) { -+ for (p = next_sub ; isspace((int) *p) || *p == SEP ; p++); -+ for (next_sub = p ; *next_sub && *next_sub != SEP ; next_sub++); -+ for (q = next_sub ; q > p && (isspace((int) *q) || *q == SEP || !*q) ; q--); -+ if (!*p ) continue; -+ -+ len = q - p + 1; -+ -+ if (len != strlen(folder) || strncmp(folder, p, len)) -+ continue; -+ -+ r = mboxlist_changesub(mailboxname, userid, auth_state, 1, 1); -+ -+ if (!r) { -+ numsub++; -+ syslog(LOG_NOTICE,"autocreateinbox: User %s, subscription to %s succeeded", -+ auth_userid, name); -+ } else -+ syslog(LOG_WARNING, "autocreateinbox: User %s, subscription to %s failed. %s", -+ auth_userid, name, error_message(r)); -+ -+ break; -+ } -+ } -+ -+ if (crt!=NULL && *crt) -+ syslog(LOG_INFO, "User %s, Inbox subfolders, created %d, subscribed %d", -+ auth_userid, numcrt, numsub); -+ -+ /* -+ * Check if shared folders are available for subscription. -+ */ -+ mboxlist_autosubscribe_sharedfolders(namespace, userid, auth_userid, auth_state); -+ -+#ifdef USE_SIEVE -+ /* -+ * Here the autocreate sieve script feature is iniated from. -+ */ -+ source_script = config_getstring(IMAPOPT_AUTOCREATE_SIEVE_SCRIPT); ++void autocreate_inbox() ++{ ++ char inboxname[MAX_MAILBOX_NAME+1]; ++ int autocreatequota; ++ int r; + -+ if (source_script) { -+ if (!autoadd_sieve(userid, source_script)) -+ syslog(LOG_NOTICE, "autocreate_sieve: User %s, default sieve script creation succeeded", auth_userid); -+ else -+ syslog(LOG_WARNING, "autocreate_sieve: User %s, default sieve script creation failed", auth_userid); -+ } -+#endif -+ -+ return r; ++ /* ++ * Exlude admin's accounts ++ */ ++ if (imapd_userisadmin || imapd_userisproxyadmin) ++ return; ++ ++ /* ++ * Exclude anonymous ++ */ ++ if (!strcmp(imapd_userid, "anonymous")) ++ return; ++ ++ if ((autocreatequota = config_getint(IMAPOPT_AUTOCREATEQUOTA))) { ++ /* This is actyally not required ++ as long as the lenght of userid is ok */ ++ r = (*imapd_namespace.mboxname_tointernal) (&imapd_namespace, ++ "INBOX", imapd_userid, inboxname); ++ if (!r) ++ r = mboxlist_lookup(inboxname, NULL, NULL); ++ ++ if (r == IMAP_MAILBOX_NONEXISTENT) { ++ mboxlist_autocreateinbox(&imapd_namespace, imapd_userid, ++ imapd_authstate, inboxname, autocreatequota); ++ } ++ } +} + -diff -Naur cyrus-imapd-2.3.12p2/imap/mboxlist.h cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/mboxlist.h ---- cyrus-imapd-2.3.12p2/imap/mboxlist.h 2008-03-24 19:09:18.000000000 +0200 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/mboxlist.h 2008-05-06 14:48:41.000000000 +0300 -@@ -212,4 +212,8 @@ - int mboxlist_abort(struct txn *tid); - - int mboxlist_delayed_delete_isenabled(void); -+int mboxlist_autocreateinbox(struct namespace *namespace,char *userid, -+ struct auth_state *auth_state, char *mailboxname, -+ int autocreatequota); + - #endif -diff -Naur cyrus-imapd-2.3.12p2/imap/pop3d.c cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/pop3d.c ---- cyrus-imapd-2.3.12p2/imap/pop3d.c 2008-04-11 23:07:00.000000000 +0300 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/imap/pop3d.c 2008-05-06 14:48:41.000000000 +0300 ++/* + * Perform a LOGIN command + */ + void cmd_login(char *tag, char *user) +@@ -2151,6 +2189,9 @@ + strcspn(imapd_userid, "@") : 0); + + freebuf(&passwdbuf); ++ ++ autocreate_inbox(); ++ + return; + } + +@@ -2308,6 +2349,8 @@ + config_virtdomains ? + strcspn(imapd_userid, "@") : 0); + ++ autocreate_inbox(); ++ + return; + } + +--- cyrus-imapd-2.3.13/imap/pop3d.c.autocreate 2008-04-22 15:11:18.000000000 +0200 ++++ cyrus-imapd-2.3.13/imap/pop3d.c 2009-01-13 11:14:09.000000000 +0100 @@ -172,6 +172,8 @@ static char popd_apop_chal[45 + MAXHOSTNAMELEN + 1]; /* */ static void cmd_apop(char *response); @@ -2065,7 +1874,7 @@ diff -Naur cyrus-imapd-2.3.12p2/imap/pop3d.c cyrus-imapd-2.3.12p2-autocreate.unc } void cmd_pass(char *pass) -@@ -1545,6 +1548,43 @@ +@@ -1548,6 +1551,43 @@ } /* @@ -2109,7 +1918,7 @@ diff -Naur cyrus-imapd-2.3.12p2/imap/pop3d.c cyrus-imapd-2.3.12p2-autocreate.unc * Complete the login process by opening and locking the user's inbox */ int openinbox(void) -@@ -1573,6 +1613,12 @@ +@@ -1576,6 +1616,12 @@ if (!r) r = mboxlist_detail(inboxname, &type, NULL, NULL, &server, &acl, NULL); @@ -2122,9 +1931,237 @@ diff -Naur cyrus-imapd-2.3.12p2/imap/pop3d.c cyrus-imapd-2.3.12p2-autocreate.unc if (!r && (config_popuseacl = config_getswitch(IMAPOPT_POPUSEACL)) && (!acl || !((myrights = cyrus_acl_myrights(popd_authstate, acl)) & ACL_READ))) { -diff -Naur cyrus-imapd-2.3.12p2/lib/auth.c cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/auth.c ---- cyrus-imapd-2.3.12p2/lib/auth.c 2008-03-24 19:43:08.000000000 +0200 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/auth.c 2008-05-06 14:48:41.000000000 +0300 +--- cyrus-imapd-2.3.13/ptclient/Makefile.in.autocreate 2008-03-24 19:34:22.000000000 +0100 ++++ cyrus-imapd-2.3.13/ptclient/Makefile.in 2009-01-13 11:14:09.000000000 +0100 +@@ -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.13/README.autocreate.autocreate 2009-01-13 11:14:09.000000000 +0100 ++++ cyrus-imapd-2.3.13/README.autocreate 2009-01-13 11:14:09.000000000 +0100 +@@ -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. ++ ++ ++ ++Things to be done ++================= ++ ++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. ++ ++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 ++ +--- cyrus-imapd-2.3.13/lib/auth.c.autocreate 2008-03-24 18:43:08.000000000 +0100 ++++ cyrus-imapd-2.3.13/lib/auth.c 2009-01-13 11:14:09.000000000 +0100 @@ -118,3 +118,11 @@ auth->freestate(auth_state); @@ -2137,27 +2174,8 @@ diff -Naur cyrus-imapd-2.3.12p2/lib/auth.c cyrus-imapd-2.3.12p2-autocreate.uncom + return auth->auth_canonuser(auth_state); +} + -diff -Naur cyrus-imapd-2.3.12p2/lib/auth.h cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/auth.h ---- cyrus-imapd-2.3.12p2/lib/auth.h 2008-03-24 19:43:08.000000000 +0200 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/auth.h 2008-05-06 14:48:41.000000000 +0300 -@@ -55,6 +55,7 @@ - const char *identifier); - struct auth_state *(*newstate)(const char *identifier); - void (*freestate)(struct auth_state *auth_state); -+ char *(*auth_canonuser)(struct auth_state *auth_state); - }; - - extern struct auth_mech *auth_mechs[]; -@@ -77,5 +78,6 @@ - const char *identifier); - struct auth_state *auth_newstate(const char *identifier); - void auth_freestate(struct auth_state *auth_state); -+char *auth_canonuser(struct auth_state *auth_state); - - #endif /* INCLUDED_AUTH_H */ -diff -Naur cyrus-imapd-2.3.12p2/lib/auth_krb.c cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/auth_krb.c ---- cyrus-imapd-2.3.12p2/lib/auth_krb.c 2008-03-24 19:43:08.000000000 +0200 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/auth_krb.c 2008-05-06 14:48:41.000000000 +0300 +--- cyrus-imapd-2.3.13/lib/auth_krb.c.autocreate 2008-03-24 18:43:08.000000000 +0100 ++++ cyrus-imapd-2.3.13/lib/auth_krb.c 2009-01-13 11:14:09.000000000 +0100 @@ -340,6 +340,15 @@ free((char *)auth_state); } @@ -2194,9 +2212,48 @@ diff -Naur cyrus-imapd-2.3.12p2/lib/auth_krb.c cyrus-imapd-2.3.12p2-autocreate.u &myfreestate, + &mycanonuser, }; -diff -Naur cyrus-imapd-2.3.12p2/lib/auth_krb5.c cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/auth_krb5.c ---- cyrus-imapd-2.3.12p2/lib/auth_krb5.c 2008-03-24 19:43:08.000000000 +0200 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/auth_krb5.c 2008-05-06 14:48:41.000000000 +0300 +--- cyrus-imapd-2.3.13/lib/auth_pts.c.autocreate 2008-03-24 18:43:08.000000000 +0100 ++++ cyrus-imapd-2.3.13/lib/auth_pts.c 2009-01-13 11:14:09.000000000 +0100 +@@ -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, + }; +--- cyrus-imapd-2.3.13/lib/auth.h.autocreate 2008-03-24 18:43:08.000000000 +0100 ++++ cyrus-imapd-2.3.13/lib/auth.h 2009-01-13 11:14:09.000000000 +0100 +@@ -55,6 +55,7 @@ + const char *identifier); + struct auth_state *(*newstate)(const char *identifier); + void (*freestate)(struct auth_state *auth_state); ++ char *(*auth_canonuser)(struct auth_state *auth_state); + }; + + extern struct auth_mech *auth_mechs[]; +@@ -77,5 +78,6 @@ + const char *identifier); + struct auth_state *auth_newstate(const char *identifier); + void auth_freestate(struct auth_state *auth_state); ++char *auth_canonuser(struct auth_state *auth_state); + + #endif /* INCLUDED_AUTH_H */ +--- cyrus-imapd-2.3.13/lib/auth_krb5.c.autocreate 2008-03-24 18:43:08.000000000 +0100 ++++ cyrus-imapd-2.3.13/lib/auth_krb5.c 2009-01-13 11:14:09.000000000 +0100 @@ -199,6 +199,14 @@ free(auth_state); } @@ -2231,62 +2288,11 @@ diff -Naur cyrus-imapd-2.3.12p2/lib/auth_krb5.c cyrus-imapd-2.3.12p2-autocreate. &myfreestate, + &mycanonuser, }; -diff -Naur cyrus-imapd-2.3.12p2/lib/auth_pts.c cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/auth_pts.c ---- cyrus-imapd-2.3.12p2/lib/auth_pts.c 2008-03-24 19:43:08.000000000 +0200 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/auth_pts.c 2008-05-06 14:48:41.000000000 +0300 -@@ -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.12p2/lib/auth_unix.c cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/auth_unix.c ---- cyrus-imapd-2.3.12p2/lib/auth_unix.c 2008-03-24 19:43:08.000000000 +0200 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/auth_unix.c 2008-05-06 14:48:41.000000000 +0300 -@@ -312,6 +312,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 = - { -@@ -321,4 +331,5 @@ - &mymemberof, - &mynewstate, - &myfreestate, -+ &mycanonuser, - }; -diff -Naur cyrus-imapd-2.3.12p2/lib/imapoptions cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/imapoptions ---- cyrus-imapd-2.3.12p2/lib/imapoptions 2008-04-11 23:07:00.000000000 +0300 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/lib/imapoptions 2008-05-06 14:48:41.000000000 +0300 +--- cyrus-imapd-2.3.13/lib/imapoptions.autocreate 2008-10-08 19:18:12.000000000 +0200 ++++ cyrus-imapd-2.3.13/lib/imapoptions 2009-01-13 11:14:09.000000000 +0100 @@ -198,6 +198,55 @@ /* Number of seconds to wait before returning a timeout failure when - performing a client connection (e.g. in a murder environment) */ + 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, @@ -2340,47 +2346,28 @@ diff -Naur cyrus-imapd-2.3.12p2/lib/imapoptions cyrus-imapd-2.3.12p2-autocreate. { "configdirectory", NULL, STRING } /* The pathname of the IMAP configuration directory. This field is required. */ -diff -Naur cyrus-imapd-2.3.12p2/notifyd/Makefile.in cyrus-imapd-2.3.12p2-autocreate.uncompiled/notifyd/Makefile.in ---- cyrus-imapd-2.3.12p2/notifyd/Makefile.in 2008-03-24 21:59:32.000000000 +0200 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/notifyd/Makefile.in 2008-05-06 14:48:41.000000000 +0300 -@@ -71,10 +71,11 @@ - SERVICE=../master/service.o +--- cyrus-imapd-2.3.13/lib/auth_unix.c.autocreate 2008-08-26 21:20:39.000000000 +0200 ++++ cyrus-imapd-2.3.13/lib/auth_unix.c 2009-01-13 11:14:09.000000000 +0100 +@@ -314,6 +314,16 @@ + free((char *)auth_state); + } - 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@ ++static char *mycanonuser(auth_state) ++ struct auth_state *auth_state; ++{ ++ if (auth_state) ++ return auth_state->userid; ++ ++ return NULL; ++} ++ ++ - PURIFY=/usr/local/bin/purify - PUREOPT=-best-effort -diff -Naur cyrus-imapd-2.3.12p2/notifyd/notifyd.c cyrus-imapd-2.3.12p2-autocreate.uncompiled/notifyd/notifyd.c ---- cyrus-imapd-2.3.12p2/notifyd/notifyd.c 2008-03-24 21:59:32.000000000 +0200 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/notifyd/notifyd.c 2008-05-06 14:48:41.000000000 +0300 -@@ -96,7 +96,7 @@ - - #define NOTIFY_MAXSIZE 8192 - --int do_notify() -+static int do_notify() + struct auth_mech auth_unix = { - struct sockaddr_un sun_data; - socklen_t sunlen = sizeof(sun_data); -diff -Naur cyrus-imapd-2.3.12p2/ptclient/Makefile.in cyrus-imapd-2.3.12p2-autocreate.uncompiled/ptclient/Makefile.in ---- cyrus-imapd-2.3.12p2/ptclient/Makefile.in 2008-03-24 20:34:22.000000000 +0200 -+++ cyrus-imapd-2.3.12p2-autocreate.uncompiled/ptclient/Makefile.in 2008-05-06 14:48:41.000000000 +0300 -@@ -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@ +@@ -323,4 +333,5 @@ + &mymemberof, + &mynewstate, + &myfreestate, ++ &mycanonuser, + }; diff --git a/cyrus-imapd.spec b/cyrus-imapd.spec index 97b6b76..6439cec 100644 --- a/cyrus-imapd.spec +++ b/cyrus-imapd.spec @@ -1,7 +1,7 @@ -%define upstream_ver 2.3.12p2 +%define upstream_ver 2.3.13 Name: cyrus-imapd -Version: 2.3.12p2 -Release: 3%{?dist} +Version: 2.3.13 +Release: 1%{?dist} # ********************** BUILD TIME OPTIONS START ********************** @@ -704,6 +704,7 @@ fi %attr(0755,root,root) %{_cyrexecdir}/reconstruct %attr(0755,root,root) %{_cyrexecdir}/rehash %attr(0755,root,root) %{_cyrexecdir}/sievec +%attr(0755,root,root) %{_cyrexecdir}/sieved %attr(0755,root,root) %{_cyrexecdir}/smmapd %attr(0755,root,root) %{_cyrexecdir}/squatter %attr(0755,root,root) %{_cyrexecdir}/timsieved @@ -785,6 +786,9 @@ fi %{_mandir}/man1/* %changelog +* Tue Jan 13 2009 Michal Hlavinka - 2.3.13-1 +- updated to 2.3.13 + * Fri Sep 26 2008 Dan HorĂ¡k