Fwd: [PATCH] make autocreate_quota:0 work as documented

Donald Buczek buczek at molgen.mpg.de
Mon Jun 15 08:39:58 EDT 2015


Anything wrong with this?

D.


-------- Forwarded Message --------
Subject: 	[PATCH] make autocreate_quota:0 work as documented
Date: 	Wed, 27 May 2015 13:57:59 +0200
From: 	Donald Buczek <buczek at molgen.mpg.de>
To: 	cyrus-devel at lists.andrew.cmu.edu
CC: 	Donald Buczek <buczek at molgen.mpg.de>



Hello,

with cyrus-imapd-2.5.3 the autocreate_quota parameter doesn't work as documented
by imapd.conf(5) when set to the value 0. This should enable autocreation with
unlimited quota, but it doesn't.

This patch fixed it for me.

Regards
   Donald Buczek


---
  imap/autocreate.c | 4 ++--
  imap/imapd.c      | 2 +-
  imap/lmtpd.c      | 2 +-
  3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/imap/autocreate.c b/imap/autocreate.c
index f4c78fd..2ddd6d7 100644
--- a/imap/autocreate.c
+++ b/imap/autocreate.c
@@ -698,14 +698,14 @@ int autocreate_user(struct namespace *namespace,
  	goto done;
      }
  
-    if (autocreatequota >= 0 || autocreatequotamessage >= 0) {
+    if (autocreatequota > 0 || autocreatequotamessage >= 0) {
  	quota_t newquotas[QUOTA_NUMRESOURCES];
  	int res;
  
  	for (res = 0 ; res < QUOTA_NUMRESOURCES ; res++)
  	    newquotas[res] = QUOTA_UNLIMITED;
  
-	newquotas[QUOTA_STORAGE] = autocreatequota;
+	newquotas[QUOTA_STORAGE] = autocreatequota !=0 ? autocreatequota : QUOTA_UNLIMITED;
  	newquotas[QUOTA_MESSAGE] = autocreatequotamessage;
  
  	r = mboxlist_setquotas(inboxname, newquotas, 0);
diff --git a/imap/imapd.c b/imap/imapd.c
index 1a553b4..838eacd 100644
--- a/imap/imapd.c
+++ b/imap/imapd.c
@@ -2277,7 +2277,7 @@ static void autocreate_inbox(void)
      if (imapd_userisadmin) return;
      if (imapd_userisproxyadmin) return;
  
-    if (config_getint(IMAPOPT_AUTOCREATE_QUOTA)) {
+    if (config_getint(IMAPOPT_AUTOCREATE_QUOTA)>=0) {
  	char *inboxname = mboxname_user_mbox(imapd_userid, NULL);
  	int r = mboxlist_lookup(inboxname, NULL, NULL);
  	free(inboxname);
diff --git a/imap/lmtpd.c b/imap/lmtpd.c
index 4d55ae1..f97a052 100644
--- a/imap/lmtpd.c
+++ b/imap/lmtpd.c
@@ -1111,7 +1111,7 @@ int autocreate_inbox(const char *user, const char *domain)
      /*
       * Check for autocreatequota and createonpost
       */
-    if (!config_getint(IMAPOPT_AUTOCREATE_QUOTA)) {
+    if (config_getint(IMAPOPT_AUTOCREATE_QUOTA)<0) {
  	free(username);
  	return IMAP_MAILBOX_NONEXISTENT;
      }
-- 
2.3.4



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.andrew.cmu.edu/pipermail/cyrus-devel/attachments/20150615/2eb129bd/attachment.html 


More information about the Cyrus-devel mailing list