SHA256
1
0
forked from pool/postfix

Accepting request 55672 from home:computersalat:devel:mail

OBS-URL: https://build.opensuse.org/request/show/55672
OBS-URL: https://build.opensuse.org/package/show/server:mail/postfix?expand=0&rev=54
This commit is contained in:
Andreas Schneider 2010-12-22 17:52:42 +00:00 committed by Git OBS Bridge
parent 70d3fd0f64
commit 994a243dc1
5 changed files with 149 additions and 333 deletions

View File

@ -1,225 +0,0 @@
diff -uNr postfix-2.5.6-vda-ng.orig/src/util/vbuf_print.c postfix-2.5.6/src/util/vbuf_print.c
--- postfix-2.5.6-vda-ng.orig/src/util/vbuf_print.c 2006-12-10 18:13:07.000000000 +0100
+++ postfix-2.5.6/src/util/vbuf_print.c 2008-08-25 12:20:41.032890016 +0200
@@ -193,8 +193,13 @@
msg_warn("%s: bad precision %d in %.50s", myname, prec, format);
prec = 0;
}
- if ((long_flag = (*cp == 'l')) != 0)/* long whatever */
+ if ((long_flag = (*cp == 'l')) != 0) { /* long whatever */
VSTRING_ADDCH(fmt, *cp++);
+ if (*cp == 'l') { /* we have long long param */
+ long_flag = 2;
+ VSTRING_ADDCH(fmt, *cp++);
+ }
+ }
if (*cp == 0) /* premature end, punt */
break;
VSTRING_ADDCH(fmt, *cp); /* type (checked below) */
@@ -226,8 +231,10 @@
case 'X':
if (VBUF_SPACE(bp, (width > prec ? width : prec) + INT_SPACE))
return (bp);
- if (long_flag)
+ if (long_flag == 1)
sprintf((char *) bp->ptr, vstring_str(fmt), va_arg(ap, long));
+ else if (long_flag == 2)
+ sprintf((char *) bp->ptr, vstring_str(fmt), va_arg(ap, long long));
else
sprintf((char *) bp->ptr, vstring_str(fmt), va_arg(ap, int));
VBUF_SKIP(bp);
diff -uNr postfix-2.5.6-vda-ng.orig/src/virtual/mailbox.c postfix-2.5.6/src/virtual/mailbox.c
--- postfix-2.5.6-vda-ng.orig/src/virtual/mailbox.c 2008-08-25 11:57:48.000000000 +0200
+++ postfix-2.5.6/src/virtual/mailbox.c 2008-08-25 12:20:41.032890016 +0200
@@ -120,7 +120,6 @@
myname, usr_attr.mailbox, OFF_T_MAX);
}
else {
- /* Invalid limit size (negative). Use default virtual_mailbox_limit. */
set_file_limit(var_virt_mailbox_limit);
status = NO;
}
diff -uNr postfix-2.5.6-vda-ng.orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/maildir.c
--- postfix-2.5.6-vda-ng.orig/src/virtual/maildir.c 2008-08-25 11:57:48.000000000 +0200
+++ postfix-2.5.6/src/virtual/maildir.c 2008-08-25 12:20:41.033889864 +0200
@@ -65,6 +65,8 @@
/* Patch library. */
+#include <syslog.h>
+#include <stdint.h>
#include <sys/types.h> /* opendir(3), stat(2) */
#include <sys/stat.h> /* stat(2) */
#include <dirent.h> /* opendir(3) */
@@ -98,14 +100,14 @@
* Returns the size of all mails as read from maildirsize,
* zero if it couldn't read the file.
*/
-static long read_maildirsize(char *dirname, long *countptr)
+static uint64_t read_maildirsize(char *dirname, uint64_t *countptr)
{
struct stat statbuf;
VSTRING *sizefilename = vstring_alloc(1024);
VSTREAM *sizefile;
char *p;
int len, first;
- long sum = 0, count = 0;
+ uint64_t sum = 0, count = 0;
vstring_sprintf(sizefilename, "%s/%s", dirname, "maildirsize");
@@ -128,7 +130,7 @@
first = 1;
while (*p) {
- long n = 0, c = 0;
+ uint64_t n = 0, c = 0;
char *q = p;
while (*p) {
@@ -143,7 +145,7 @@
continue;
}
- if(sscanf(q, "%ld %ld", &n, &c) == 2) {
+ if(sscanf(q, "%llu %llu", &n, &c) == 2) {
sum += n;
count += c;
}
@@ -179,7 +181,7 @@
* Returns the size given in ",S=<size>" in the filename,
* zero if it cannot find ",S=<size>" in the filename.
*/
-static long maildir_parsequota(const char *n)
+static uint64_t maildir_parsequota(const char *n)
{
const char *o;
int yes = 0;
@@ -204,7 +206,7 @@
}
if (yes) {
- long s = 0;
+ uint64_t s = 0;
while (*o >= '0' && *o <= '9')
s = s*10 + (*o++ - '0');
@@ -231,17 +233,17 @@
* Returns the sum of the sizes of all measurable files,
* zero if the directory could not be opened.
*/
-static long check_dir_size(char *dirname, long *countptr)
+static uint64_t check_dir_size(char *dirname, uint64_t *countptr)
{
char *myname = "check_dir_size";
DIR *dir;
- long sum = 0;
+ uint64_t sum = 0;
struct dirent *ent;
struct stat statbuf;
if (!var_virt_mailbox_limit_inbox && var_virt_maildir_extended && (sum = read_maildirsize(dirname, countptr))) {
if (msg_verbose)
- msg_info("%s: maildirsize used: dir=%s sum=%ld count=%ld", myname, dirname, sum, *countptr);
+ msg_info("%s: maildirsize used: dir=%s sum=%llu count=%llu", myname, dirname, sum, *countptr);
return sum;
}
@@ -262,7 +264,7 @@
while ((ent = readdir(dir)) != NULL) {
char *name = ent->d_name;
- long tmpsum = 0;
+ uint64_t tmpsum = 0;
VSTRING *buffer;
if (var_virt_trash_count) {
@@ -325,7 +327,7 @@
closedir(dir);
if (msg_verbose)
- msg_info("%s: full scan done: dir=%s sum=%ld count=%ld", myname, dirname, sum, *countptr);
+ msg_info("%s: full scan done: dir=%s sum=%llu count=%llu", myname, dirname, sum, *countptr);
return sum;
}
@@ -443,9 +445,9 @@
char *sizefilename = (char *) 0; /* Maildirsize file name. */
VSTRING *filequota; /* Quota setting from the maildirsize file. */
VSTREAM *sizefile; /* Maildirsize file handle. */
- long n = 0; /* Limit in long integer format. */
- long saved_count = 0; /* The total number of files. */
- long saved_size = 0; /* The total quota of all files. */
+ uint64_t n = 0; /* Limit in long integer format. */
+ uint64_t saved_count = 0; /* The total number of files. */
+ uint64_t saved_size = 0; /* The total quota of all files. */
struct stat mail_stat; /* To check the size of the mail to be written. */
struct stat sizefile_stat; /* To check the size of the maildirsize file. */
time_t tm; /* To check the age of the maildirsize file. */
@@ -520,7 +522,8 @@
* warn the user, else use the value directly as the maildir limit.
*/
if (*var_virt_mailbox_limit_maps != 0 && (limit_res = mail_addr_find(virtual_mailbox_limit_maps, state.msg_attr.user, (char **) NULL)) != 0) {
- n = atol(limit_res);
+ /* if there is some unexpected char in limit_res var, n will be zero! */
+ n = strtoull(limit_res, NULL, 10);
if (n > 0) {
if ((n < var_message_limit) && (!var_virt_mailbox_limit_override)) {
n = var_virt_mailbox_limit;
@@ -535,13 +538,13 @@
}
else {
if (msg_verbose)
- msg_info("%s: set virtual maildir limit size for %s to %ld",
+ msg_info("%s: set virtual maildir limit size for %s to %llu",
myname, usr_attr.mailbox, n);
}
}
else if (n == 0) {
if (msg_verbose)
- msg_info("%s: set virtual maildir limit size for %s to %ld",
+ msg_info("%s: set virtual maildir limit size for %s to %llu",
myname, usr_attr.mailbox, n);
}
else {
@@ -662,7 +665,7 @@
*/
if (stat(tmpfile, &mail_stat) == 0) {
if (n != 0) {
- saved_size += (long) mail_stat.st_size;
+ saved_size += (uint64_t) mail_stat.st_size;
saved_count++;
}
if (var_virt_maildir_extended) {
@@ -866,7 +869,9 @@
filequota = vstring_alloc(128);
vstring_get_null_bound(filequota, sizefile, 127);
vstream_fclose(sizefile);
- if (atol(vstring_export(filequota)) != n)
+ /* if there will be some unexpected char in filequota var, strtoull() return 0
+ and this probably != n, so file will be rewritten */
+ if (strtoull(vstring_export(filequota), NULL, 10) != n)
unlink(sizefilename);
}
@@ -886,7 +891,7 @@
/* If the creation worked, write to the file, otherwise just give up. */
if (sizefile) {
- vstream_fprintf(sizefile, "%ldS\n%ld %ld\n", n, saved_size, saved_count);
+ vstream_fprintf(sizefile, "%lluS\n%llu %llu\n", n, saved_size, saved_count);
vstream_fclose(sizefile);
}
}
diff -uNr postfix-2.5.6-vda-ng.orig/src/virtual/Makefile.in postfix-2.5.6/src/virtual/Makefile.in
--- postfix-2.5.6-vda-ng.orig/src/virtual/Makefile.in 2007-03-17 18:51:46.000000000 +0100
+++ postfix-2.5.6/src/virtual/Makefile.in 2008-08-25 12:20:41.034889712 +0200
@@ -4,7 +4,7 @@
HDRS = virtual.h
TESTSRC =
DEFS = -I. -I$(INC_DIR) -D$(SYSTYPE)
-CFLAGS = $(DEBUG) $(OPT) $(DEFS)
+CFLAGS = $(DEBUG) $(OPT) $(DEFS) -std=gnu99
PROG = virtual
TESTPROG=
INC_DIR = ../../include

View File

@ -1,6 +1,7 @@
--- postfix-2.2.9-orig/conf/main.cf 2005-03-04 17:48:25.000000000 +0000
+++ postfix-2.2.9/conf/main.cf 2008-08-04 19:08:01.086201423 +0000
@@ -642,3 +642,29 @@
diff -ruN postfix-2.7.1-orig/conf/main.cf postfix-2.7.1/conf/main.cf
--- postfix-2.7.1-orig/conf/main.cf 2007-12-18 14:50:25.000000000 +0100
+++ postfix-2.7.1/conf/main.cf 2010-12-11 20:47:20.000000000 +0100
@@ -649,3 +649,38 @@
# readme_directory: The location of the Postfix README files.
#
readme_directory =
@ -9,6 +10,7 @@
+############################################################
+# Start MySQL from postfixwiki.org
+############################################################
+relay_domains = $mydestination, hash:/etc/postfix/relay
+virtual_alias_maps = hash:/etc/postfix/virtual
+#virtual_uid_maps = static:303
+#virtual_gid_maps = static:303
@ -16,16 +18,24 @@
+#virtual_mailbox_base = /srv/maildirs
+#virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
+#virtual_mailbox_limit = 0
+#virtual_mailbox_limit_inbox = no
+#virtual_mailbox_limit_maps = hash:/etc/postfix/vquota
+#virtual_mailbox_limit_override = yes
+#virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
+#virtual_transport = virtual
+## Additional for quota support
+#virtual_create_maildirsize = yes
+#virtual_mailbox_extended = yes
+### Needs Maildir++ compatible IMAP servers, like Courier-IMAP
+#virtual_maildir_filter = yes
+#virtual_maildir_filter_maps = hash:/etc/postfix/vfilter
+#virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
+#virtual_mailbox_limit_override = yes
+#virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please try again later.
+#virtual_maildir_limit_message_maps = hash:/etc/postfix/vmsg
+#virtual_overquota_bounce = yes
+relay_domains = $mydestination, hash:/etc/postfix/relay
+#virtual_trash_count = yes
+#virtual_trash_name = ".Trash"
+############################################################
+# End MySQL from postfixwiki.org
+############################################################

View File

@ -1,6 +1,6 @@
diff -Nru postfix-2.5.6-orig/README_FILES/VDA_README postfix-2.5.6/README_FILES/VDA_README
--- postfix-2.5.6-orig/README_FILES/VDA_README 1969-12-31 21:00:00.000000000 -0300
+++ postfix-2.5.6/README_FILES/VDA_README 2009-01-16 08:55:22.000000000 -0200
diff -uNr postfix-2.7.1.orig/README_FILES/VDA_README postfix-2.7.1/README_FILES/VDA_README
--- postfix-2.7.1.orig/README_FILES/VDA_README 1970-01-01 01:00:00.000000000 +0100
+++ postfix-2.7.1/README_FILES/VDA_README 2010-03-02 08:18:28.000000000 +0100
@@ -0,0 +1,97 @@
+Installation:
+
@ -99,10 +99,10 @@ diff -Nru postfix-2.5.6-orig/README_FILES/VDA_README postfix-2.5.6/README_FILES/
+user2@domain.com.br # M2007022617 /^subject:.*Viagra.*/m REJECT /^subject:.*trash.*/m MOVE SpamFolder /^subject:.*pharmacy.*/m DISCARD
+
+More informations can be found at http://vda.sourceforge.net
diff -Nru postfix-2.5.6-orig/src/global/mail_params.h postfix-2.5.6/src/global/mail_params.h
--- postfix-2.5.6-orig/src/global/mail_params.h 2008-07-27 16:10:27.000000000 -0300
+++ postfix-2.5.6/src/global/mail_params.h 2009-01-16 08:55:22.000000000 -0200
@@ -2171,6 +2171,54 @@
diff -uNr postfix-2.7.1.orig/src/global/mail_params.h postfix-2.7.1/src/global/mail_params.h
--- postfix-2.7.1.orig/src/global/mail_params.h 2010-01-17 21:54:35.000000000 +0100
+++ postfix-2.7.1/src/global/mail_params.h 2010-03-02 08:18:28.000000000 +0100
@@ -2311,6 +2311,54 @@
#define DEF_VIRT_GID_MAPS ""
extern char *var_virt_gid_maps;
@ -157,9 +157,9 @@ diff -Nru postfix-2.5.6-orig/src/global/mail_params.h postfix-2.5.6/src/global/m
#define VAR_VIRT_MINUID "virtual_minimum_uid"
#define DEF_VIRT_MINUID 100
extern int var_virt_minimum_uid;
diff -Nru postfix-2.5.6-orig/src/util/file_limit.c postfix-2.5.6/src/util/file_limit.c
--- postfix-2.5.6-orig/src/util/file_limit.c 2003-10-22 16:48:36.000000000 -0200
+++ postfix-2.5.6/src/util/file_limit.c 2009-01-16 08:55:22.000000000 -0200
diff -uNr postfix-2.7.1.orig/src/util/file_limit.c postfix-2.7.1/src/util/file_limit.c
--- postfix-2.7.1.orig/src/util/file_limit.c 2003-10-22 20:48:36.000000000 +0200
+++ postfix-2.7.1/src/util/file_limit.c 2010-03-02 08:18:28.000000000 +0100
@@ -85,7 +85,11 @@
#else
struct rlimit rlim;
@ -173,9 +173,9 @@ diff -Nru postfix-2.5.6-orig/src/util/file_limit.c postfix-2.5.6/src/util/file_l
if (setrlimit(RLIMIT_FSIZE, &rlim) < 0)
msg_fatal("setrlimit: %m");
#ifdef SIGXFSZ
diff -Nru postfix-2.5.6-orig/src/virtual/mailbox.c postfix-2.5.6/src/virtual/mailbox.c
--- postfix-2.5.6-orig/src/virtual/mailbox.c 2008-07-25 22:22:37.000000000 -0300
+++ postfix-2.5.6/src/virtual/mailbox.c 2009-01-16 08:55:22.000000000 -0200
diff -uNr postfix-2.7.1.orig/src/virtual/mailbox.c postfix-2.7.1/src/virtual/mailbox.c
--- postfix-2.7.1.orig/src/virtual/mailbox.c 2008-07-26 03:22:37.000000000 +0200
+++ postfix-2.7.1/src/virtual/mailbox.c 2010-03-02 08:18:28.000000000 +0100
@@ -70,6 +70,70 @@
#define YES 1
#define NO 0
@ -355,10 +355,10 @@ diff -Nru postfix-2.5.6-orig/src/virtual/mailbox.c postfix-2.5.6/src/virtual/mai
/*
* Cleanup.
diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/maildir.c
--- postfix-2.5.6-orig/src/virtual/maildir.c 2006-06-26 09:59:19.000000000 -0300
+++ postfix-2.5.6/src/virtual/maildir.c 2009-01-16 08:55:22.000000000 -0200
@@ -63,28 +63,406 @@
diff -uNr postfix-2.7.1.orig/src/virtual/maildir.c postfix-2.7.1/src/virtual/maildir.c
--- postfix-2.7.1.orig/src/virtual/maildir.c 2006-06-26 14:59:19.000000000 +0200
+++ postfix-2.7.1/src/virtual/maildir.c 2010-03-02 08:28:18.000000000 +0100
@@ -63,28 +63,419 @@
#include <mbox_open.h>
#include <dsn_util.h>
@ -398,28 +398,36 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
+ * Returns the size of all mails as read from maildirsize,
+ * zero if it couldn't read the file.
+ */
+static long read_maildirsize(char *dirname, long *countptr)
+static long read_maildirsize(char *filename, long *sumptr, long *countptr)
+{
+ char *myname = "read_maildirsize";
+ struct stat statbuf;
+ VSTRING *sizefilename = vstring_alloc(1024);
+ VSTREAM *sizefile;
+ char *p;
+ int len, first;
+ long sum = 0, count = 0;
+ long sum = 0, count = 0, ret_value = -1;
+
+ vstring_sprintf(sizefilename, "%s/%s", dirname, "maildirsize");
+
+ sizefile = vstream_fopen(STR(sizefilename), O_RDONLY, 0);
+ if (!sizefile || (stat(STR(sizefilename), &statbuf) < 0) || (statbuf.st_size > SIZEFILE_MAX)) {
+ if (msg_verbose)
+ msg_info("%s: we will use sizefile = '%s'", myname, filename);
+
+ sizefile = vstream_fopen(filename, O_RDONLY, 0);
+ if (!sizefile) {
+ if (msg_verbose)
+ msg_info("%s: cannot open %s: %m (maybe file does not exist)", myname, filename);
+
+ return -1;
+ } else if (stat(filename, &statbuf) < 0 || statbuf.st_size > SIZEFILE_MAX) {
+ if (sizefile) {
+ vstream_fclose(sizefile);
+ unlink(STR(sizefilename));
+ unlink(filename);
+ }
+ vstring_free(sizefilename);
+
+ return 0;
+
+ if (msg_verbose)
+ msg_info("%s: stat() returned < 0 or filesize > SIZEFILE_MAX (filename = %s, filesize = %ld)", myname, filename, statbuf.st_size);
+
+ return -1;
+ }
+
+
+ VSTRING *sizebuf = vstring_alloc(SIZEFILE_MAX);
+ len = vstream_fread(sizefile, STR(sizebuf), SIZEFILE_MAX);
+
@ -443,30 +451,43 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
+ continue;
+ }
+
+ if(sscanf(q, "%ld %ld", &n, &c) == 2) {
+ if (sscanf(q, "%ld %ld", &n, &c) == 2) {
+ sum += n;
+ count += c;
+ /* if (msg_verbose)
+ msg_info("%s: we read line '%s', totals: sum = %ld, count = %ld", myname, q, sum, count); */
+ }
+ else {
+ vstream_fclose(sizefile);
+ unlink(STR(sizefilename));
+
+ msg_warn("read_maildirsize: invalid line '%s' found in %s, removing maildirsize file", q, STR(sizefilename));
+
+ vstring_free(sizefilename);
+ unlink(filename);
+ msg_warn("%s: invalid line '%s' found in %s, removing maildirsize file", myname, q, filename);
+ vstring_free(sizebuf);
+
+ return 0;
+ return -1;
+ }
+ }
+
+ vstream_fclose(sizefile);
+ vstring_free(sizefilename);
+ vstring_free(sizebuf);
+
+ *countptr = count;
+ *sumptr = sum;
+
+ if (sum < 0 || count < 0 || (sum == 0 && count != 0) || (sum != 0 && count == 0)) {
+ if (msg_verbose) {
+ msg_info("%s: we will return -1 and unlink %s, because file count or sum is <= 0 (sum = %ld, count = %ld)", myname, filename, sum, count);
+ }
+
+ unlink(filename);
+ ret_value = -1;
+ } else {
+ if (msg_verbose)
+ msg_info("%s: we will return Maildir size = %ld, count = %ld", myname, *sumptr, *countptr);
+
+ return sum;
+ ret_value = sum;
+ }
+
+ vstream_fclose(sizefile);
+ vstring_free(sizebuf);
+
+ return ret_value;
+}
+
+/*
@ -483,8 +504,7 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
+{
+ const char *o;
+ int yes = 0;
-int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr)
+
+ if ((o = strrchr(n, '/')) == 0)
+ o = n;
+
@ -540,12 +560,6 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
+ struct dirent *ent;
+ struct stat statbuf;
+
+ if (!var_virt_mailbox_limit_inbox && var_virt_maildir_extended && (sum = read_maildirsize(dirname, countptr))) {
+ if (msg_verbose)
+ msg_info("%s: maildirsize used: dir=%s sum=%ld count=%ld", myname, dirname, sum, *countptr);
+ return sum;
+ }
+
+ dir = opendir(dirname);
+ if (dir == NULL) {
+ if (make_dirs(dirname, 0700) == 0) { /* Try to create the dirs. */
@ -566,14 +580,12 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
+ long tmpsum = 0;
+ VSTRING *buffer;
+
+ if (var_virt_trash_count) {
+ if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
+ continue;
+ }
+ else {
+ if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0 || strcmp(name, var_virt_trash_name) == 0)
+ continue;
+ }
+ /* do not count dot a double-dot dirs */
+ if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
+ continue;
+ /* do not count if this is the trash subdir and if we should NOT count it */
+ else if (var_virt_trash_count == 0 && strcmp(name, var_virt_trash_name) == 0)
+ continue;
+
+ /*
+ * Here comes the real logic behind this function.
@ -624,7 +636,8 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
+ }
+ }
+ closedir(dir);
+
-int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr)
+ if (msg_verbose)
+ msg_info("%s: full scan done: dir=%s sum=%ld count=%ld", myname, dirname, sum, *countptr);
+
@ -777,7 +790,7 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
GETTIMEOFDAY(&starttime);
@@ -93,15 +471,14 @@
@@ -93,15 +484,14 @@
*/
state.level++;
if (msg_verbose)
@ -796,7 +809,7 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
}
/*
@@ -109,17 +486,91 @@
@@ -109,18 +499,110 @@
* attribute to reflect the final recipient.
*/
if (vstream_fseek(state.msg_attr.fp, state.msg_attr.offset, SEEK_SET) < 0)
@ -829,7 +842,15 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
+ tmpdir = concatenate(tmpdir, "tmp/", (char *) 0);
+ curdir = concatenate(curdir, "cur/", (char *) 0);
+ }
+
+ /* get the sizefilename, no matter if we use var_virt_maildir_extended */
+ if (*var_virt_maildir_suffix == 0) {
+ sizefilename = concatenate(usr_attr.mailbox, "maildirsize", (char *) 0);
+ } else {
+ sizefilename = concatenate(usr_attr.mailbox, var_virt_maildir_suffix, (char *) 0);
+ sizefilename = concatenate(sizefilename, "maildirsize", (char *) 0);
+ }
+
+ /*
+ * Look up the virtual maildir limit size for this user.
+ * Fall back to virtual_mailbox_limit in case lookup failed.
@ -845,12 +866,8 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
+ if ((n < var_message_limit) && (!var_virt_mailbox_limit_override)) {
+ n = var_virt_mailbox_limit;
+
+ msg_warn("%s: recipient %s - virtual maildir limit is "
+ "smaller than %s in %s - falling back to %s",
+ myname,
+ state.msg_attr.user,
+ VAR_MESSAGE_LIMIT,
+ virtual_mailbox_limit_maps->title,
+ msg_warn("%s: recipient %s - virtual maildir limit is smaller than %s in %s - falling back to %s",
+ myname, state.msg_attr.user, VAR_MESSAGE_LIMIT, virtual_mailbox_limit_maps->title,
+ VAR_VIRT_MAILBOX_LIMIT);
+ }
+ else {
@ -874,27 +891,42 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
+ n = var_virt_mailbox_limit;
+ }
+
+ /*
+ * Check quota before delivering the mail.
+ */
+ /* If there should is a quota on maildir generaly, check it
+ before dlivering the mail */
+ if (n != 0) {
+ set_eugid(usr_attr.uid, usr_attr.gid);
+ if (var_virt_mailbox_limit_inbox) {
+ /* Check Inbox only (new, cur and tmp dirs). */
+ saved_size = check_dir_size(newdir, &saved_count);
+ saved_size += check_dir_size(curdir, &saved_count);
+ saved_size += check_dir_size(tmpdir, &saved_count);
+ }
+ else {
+ /* Check all boxes. */
+ saved_size = check_dir_size(usr_attr.mailbox, &saved_count);
+ }
+ set_eugid(var_owner_uid, var_owner_gid);
+ /* try to read the quota from maildirsize file. Returned values by read_maildirsize:
+ x < 0 = something failed
+ x >= 0 = reading successfully finished - sum si returned, so sum size of Maildir was 0 or more */
+ if (!var_virt_mailbox_limit_inbox && var_virt_maildir_extended && read_maildirsize(sizefilename, &saved_size, &saved_count) >= 0) {
+ if (msg_verbose)
+ msg_info("%s: maildirsize used=%s sum=%ld count=%ld", myname, sizefilename, saved_size, saved_count);
+ } else {
+ if (msg_verbose)
+ msg_info("%s: var_virt_mailbox_limit == 1 OR var_virt_maildir_extended == 0 OR read_maildidrsize() returned value x < 0 as saying something failed", myname);
+
+ /* sanity */
+ saved_size = 0;
+ saved_count = 0;
+
+ if (var_virt_mailbox_limit_inbox) {
+ /* Check Inbox only (new, cur and tmp dirs). */
+ saved_size = check_dir_size(newdir, &saved_count);
+ saved_size += check_dir_size(curdir, &saved_count);
+ saved_size += check_dir_size(tmpdir, &saved_count);
+ } else {
+ /* Check all boxes. */
+ saved_size = check_dir_size(usr_attr.mailbox, &saved_count);
+ }
+
+ set_eugid(var_owner_uid, var_owner_gid);
+ }
+ }
+
/*
* Create and write the file as the recipient, so that file quota work.
@@ -174,46 +625,296 @@
* Create any missing directories on the fly. The file name is chosen
@@ -174,46 +656,288 @@
* [...]
*/
set_eugid(usr_attr.uid, usr_attr.gid);
@ -1162,14 +1194,6 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
+ if (var_virt_maildir_extended) {
+ time(&tm);
+
+ if (*var_virt_maildir_suffix == 0) {
+ sizefilename = concatenate(usr_attr.mailbox, "maildirsize", (char *) 0);
+ }
+ else {
+ sizefilename = concatenate(usr_attr.mailbox, var_virt_maildir_suffix, (char *) 0);
+ sizefilename = concatenate(sizefilename, "maildirsize", (char *) 0);
+ }
+
+ /* Check if the quota in the file is the same as the current one, if not, delete the file. */
+ sizefile = vstream_fopen(sizefilename, O_RDONLY, 0);
+ if (sizefile) {
@ -1228,7 +1252,7 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
}
set_eugid(var_owner_uid, var_owner_gid);
@@ -223,31 +924,64 @@
@@ -223,31 +947,64 @@
* location possibly under user control.
*/
if (mail_copy_status & MAIL_COPY_STAT_CORRUPT) {
@ -1312,9 +1336,9 @@ diff -Nru postfix-2.5.6-orig/src/virtual/maildir.c postfix-2.5.6/src/virtual/mai
+
return (deliver_status);
}
diff -Nru postfix-2.5.6-orig/src/virtual/virtual.c postfix-2.5.6/src/virtual/virtual.c
--- postfix-2.5.6-orig/src/virtual/virtual.c 2008-07-27 18:00:11.000000000 -0300
+++ postfix-2.5.6/src/virtual/virtual.c 2009-01-16 08:55:22.000000000 -0200
diff -uNr postfix-2.7.1.orig/src/virtual/virtual.c postfix-2.7.1/src/virtual/virtual.c
--- postfix-2.7.1.orig/src/virtual/virtual.c 2010-01-02 02:57:04.000000000 +0100
+++ postfix-2.7.1/src/virtual/virtual.c 2010-03-02 08:18:28.000000000 +0100
@@ -335,12 +335,30 @@
char *var_mail_spool_dir; /* XXX dependency fix */
bool var_strict_mbox_owner;
@ -1444,9 +1468,9 @@ diff -Nru postfix-2.5.6-orig/src/virtual/virtual.c postfix-2.5.6/src/virtual/vir
MAIL_SERVER_PRIVILEGED,
0);
}
diff -Nru postfix-2.5.6-orig/src/virtual/virtual.h postfix-2.5.6/src/virtual/virtual.h
--- postfix-2.5.6-orig/src/virtual/virtual.h 2006-01-07 21:59:47.000000000 -0200
+++ postfix-2.5.6/src/virtual/virtual.h 2009-01-16 08:55:22.000000000 -0200
diff -uNr postfix-2.7.1.orig/src/virtual/virtual.h postfix-2.7.1/src/virtual/virtual.h
--- postfix-2.7.1.orig/src/virtual/virtual.h 2006-01-08 00:59:47.000000000 +0100
+++ postfix-2.7.1/src/virtual/virtual.h 2010-03-02 08:18:28.000000000 +0100
@@ -34,6 +34,9 @@
extern MAPS *virtual_mailbox_maps;
extern MAPS *virtual_uid_maps;

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Sat Dec 11 19:50:25 UTC 2010 - chris@computersalat.de
- update vda patch
o remove 2.6.1-vda-ng.patch
o remove 2.6.1-vda-ng-64bit.patch
o add vda-2.7.1.patch
- rework main.cf.patch
o remove 2.2.9-main.cf.patch
o add 2.7.1-main.cf.patch
-------------------------------------------------------------------
Tue Dec 7 22:02:56 UTC 2010 - coolo@novell.com

View File

@ -36,9 +36,8 @@ Patch: dynamic_maps.patch
Patch1: dynamic_maps_pie.patch
Patch2: pointer_to_literals.patch
Patch3: ipv6_disabled.patch
Patch10: %{name}-2.2.9-main.cf.patch
Patch11: %{name}-2.6.1-vda-ng.patch
Patch12: %{name}-2.6.1-vda-ng-64bit.patch
Patch10: %{name}-2.7.1-main.cf.patch
Patch11: %{name}-vda-2.7.1.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: %insserv_prereq %fillup_prereq
PreReq: /usr/bin/getent
@ -171,9 +170,6 @@ Authors:
%patch3 -p1
%patch10 -p1
%patch11 -p1
%ifarch x86_64
%patch12 -p1
%endif
# ---------------------------------------------------------------------------
%build