[dovecot-cvs] dovecot/src/plugins/quota quota-maildir.c,1.8,1.9

cras at dovecot.org cras at dovecot.org
Tue May 2 23:11:11 EEST 2006


Update of /var/lib/cvs/dovecot/src/plugins/quota
In directory talvi:/tmp/cvs-serv7152

Modified Files:
	quota-maildir.c 
Log Message:
When requesting quota resource, don't return it if it's unlimited. Also
treat 0 quota limits also in plugin parameters as unlimited.



Index: quota-maildir.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-maildir.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- quota-maildir.c	24 Apr 2006 09:49:52 -0000	1.8
+++ quota-maildir.c	2 May 2006 20:11:08 -0000	1.9
@@ -512,6 +512,7 @@
 {
 	struct maildir_quota_root *root;
 	const char *const *args;
+	unsigned long long size;
 
 	root = i_new(struct maildir_quota_root, 1);
 	root->root.name = i_strdup(name);
@@ -525,12 +526,14 @@
 
 	for (; *args != '\0'; args++) {
 		if (strncmp(*args, "storage=", 8) == 0) {
-			root->message_bytes_limit =
-				strtoull(*args + 8, NULL, 10) * 1024;
+			size = strtoull(*args + 8, NULL, 10) * 1024;
+			if (size != 0)
+				root->message_bytes_limit = size;
 			root->master_message_limits = TRUE;
 		} else if (strncmp(*args, "messages=", 9) == 0) {
-			root->message_count_limit =
-				strtoull(*args + 9, NULL, 10);
+			size = strtoull(*args + 9, NULL, 10);
+			if (size != 0)
+				root->message_count_limit = size;
 			root->master_message_limits = TRUE;
 		}
 	}
@@ -595,14 +598,16 @@
 				 maildir_quota_root_get_storage(_root)) < 0)
 		return -1;
 
-	if (root->message_bytes_limit == (uint64_t)-1 &&
-	    root->message_count_limit == (uint64_t)-1)
-		return 0;
-
 	if (strcmp(name, QUOTA_NAME_STORAGE) == 0) {
+		if (root->message_bytes_limit == (uint64_t)-1)
+			return 0;
+
 		*limit_r = root->message_bytes_limit / 1024;
 		*value_r = root->total_bytes / 1024;
 	} else if (strcmp(name, QUOTA_NAME_MESSAGES) == 0) {
+		if (root->message_count_limit == (uint64_t)-1)
+			return 0;
+
 		*limit_r = root->message_count_limit;
 		*value_r = root->total_count;
 	} else {



More information about the dovecot-cvs mailing list