dovecot-2.0: quota-fs: If FS quota is enabled, create (some of) ...

dovecot at dovecot.org dovecot at dovecot.org
Tue May 25 22:03:43 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/bd8ed4b97fe3
changeset: 11372:bd8ed4b97fe3
user:      Timo Sirainen <tss at iki.fi>
date:      Tue May 25 20:03:39 2010 +0100
description:
quota-fs: If FS quota is enabled, create (some of) users' temp files to /tmp.

diffstat:

 src/plugins/quota/quota-fs.c |  15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diffs (39 lines):

diff -r e63dd7e7ea6e -r bd8ed4b97fe3 src/plugins/quota/quota-fs.c
--- a/src/plugins/quota/quota-fs.c	Tue May 25 20:02:51 2010 +0100
+++ b/src/plugins/quota/quota-fs.c	Tue May 25 20:03:39 2010 +0100
@@ -5,6 +5,7 @@
 #include "lib.h"
 #include "array.h"
 #include "str.h"
+#include "hostpid.h"
 #include "mountpoint.h"
 #include "quota-private.h"
 #include "quota-fs.h"
@@ -87,6 +88,17 @@
 	return &root->root;
 }
 
+static const char *
+quota_fs_mail_user_get_temp_prefix(struct mail_user *user ATTR_UNUSED)
+{
+	/* when filesystem quota is used, temp files will decrease the user's
+	   quota if they're written under user's home. for example with lda
+	   large mails are also first written to this temp directory, so if it
+	   were in user's home, the user would always have two have twice
+	   as much space available as necessary. */
+	return t_strconcat("/tmp/dovecot.", my_pid, ".", NULL);
+}
+
 static int fs_quota_init(struct quota_root *_root, const char *args)
 {
 	struct fs_quota_root *root = (struct fs_quota_root *)_root;
@@ -112,6 +124,9 @@
 			return -1;
 		}
 	}
+
+	_root->quota->user->v.get_temp_prefix =
+		quota_fs_mail_user_get_temp_prefix;
 	return 0;
 }
 


More information about the dovecot-cvs mailing list