mupdate doesn't replicate quota information

Diego Woitasen diego at woitasen.com.ar
Tue Dec 4 12:22:39 EST 2007


I'm playing with Cyrus Murder in replicated mode. All operations are
working really fine, except quota informacion replication.

The scenario is described in:
http://lists.andrew.cmu.edu/pipermail/info-cyrus/2007-November/027829.html

After read the code quickly I saw it's not supported.

My solution is a little patch that adds quota_directory option in
imapd.conf. Using quota db type legacy, we can put the quotadb in the
shared storage. I didn't try with other db types.

diff -Nur cyrus-imapd-2.3.10/imap/quota_db.c cyrus-ws/imap/quota_db.c
--- cyrus-imapd-2.3.10/imap/quota_db.c	2007-08-15 14:20:57.000000000 -0300
+++ cyrus-ws/imap/quota_db.c	2007-11-30 14:05:14.993312000 -0300
@@ -242,12 +242,12 @@
 
     /* create db file name */
     if (!fname) {
-	size_t fname_len = strlen(config_dir)+strlen(FNAME_QUOTADB)+1;
+	size_t fname_len = strlen(quota_dir)+strlen(FNAME_QUOTADB)+1;
 	
 	fname = xmalloc(fname_len);
 	tofree = fname;
 
-	strlcpy(fname, config_dir, fname_len);
+	strlcpy(fname, quota_dir, fname_len);
 	strlcat(fname, FNAME_QUOTADB, fname_len);
     }
 
diff -Nur cyrus-imapd-2.3.10/lib/imapoptions cyrus-ws/lib/imapoptions
--- cyrus-imapd-2.3.10/lib/imapoptions	2007-10-18 15:14:48.000000000 -0300
+++ cyrus-ws/lib/imapoptions	2007-11-30 14:44:06.367646834 -0300
@@ -826,6 +826,9 @@
    allowed in envelope tests.  When disabled, ANY grammatically correct header
    will be allowed. */
 
+{ "quotadirectory", NULL, STRING }
+/* The pathname of the quota database directory. Default is config directory. */
+
 # Commented out - used by libsasl
 # { "sasl_auto_transition", 0, SWITCH }
 /* If enabled, the SASL library will automatically create authentication
diff -Nur cyrus-imapd-2.3.10/lib/libconfig.c cyrus-ws/lib/libconfig.c
--- cyrus-imapd-2.3.10/lib/libconfig.c	2007-07-18 15:56:11.000000000 -0300
+++ cyrus-ws/lib/libconfig.c	2007-11-30 14:09:09.031608000 -0300
@@ -69,6 +69,7 @@
 /* cached configuration variables accessible to the external world */
 const char *config_filename= NULL;       /* filename of configuration file */
 const char *config_dir = NULL;		 /* ie /var/imap */
+const char *quota_dir = NULL;		 /* ie /var/imap */
 const char *config_defpartition = NULL;  /* /var/spool/imap */
 const char *config_servername= NULL;	 /* gethostname() */
 const char *config_mupdate_server = NULL;/* NULL */
@@ -219,6 +220,8 @@
 	fatal("configdirectory option not specified in configuration file",
 	      EC_CONFIG);
     }
+    if (!quota_dir)
+    	quota_dir = config_dir;
 
     /* Scan options to see if we need to replace {configdirectory} */
     /* xxx need to scan overflow options as well! */
@@ -449,6 +452,8 @@
 
 		if(opt == IMAPOPT_CONFIGDIRECTORY)
 		    config_dir = imapopts[opt].val.s;
+		if(opt == IMAPOPT_QUOTADIRECTORY)
+		    quota_dir = imapopts[opt].val.s;
 
 		break;
 	    }
diff -Nur cyrus-imapd-2.3.10/lib/libconfig.h cyrus-ws/lib/libconfig.h
--- cyrus-imapd-2.3.10/lib/libconfig.h	2007-07-18 15:56:11.000000000 -0300
+++ cyrus-ws/lib/libconfig.h	2007-11-30 14:53:35.863766630 -0300
@@ -66,6 +66,7 @@
 /* cached configuration variables accessable to external world */
 extern const char *config_filename;
 extern const char *config_dir;
+extern const char *quota_dir;
 extern const char *config_defpartition;
 extern const char *config_servername;
 extern const char *config_mupdate_server;

-- 

--------------
Diego Woitasen


More information about the Info-cyrus mailing list