diff options
author | CHTEKK <CHTEKK@localhost> | 2007-04-26 23:21:11 +0000 |
---|---|---|
committer | CHTEKK <CHTEKK@localhost> | 2007-04-26 23:21:11 +0000 |
commit | ea987e035bee47f899c56d42796a5d5448441531 (patch) | |
tree | a9310de347fea619eb5172c7cd3728e378af4bb1 | |
parent | Rename correctly for easier releases. (diff) | |
download | chtekk-ea987e035bee47f899c56d42796a5d5448441531.tar.gz chtekk-ea987e035bee47f899c56d42796a5d5448441531.tar.bz2 chtekk-ea987e035bee47f899c56d42796a5d5448441531.zip |
Update VDA-NG to correctly handle broken maildirsize file, thanks to Tomas Macek.
svn path=/; revision=44
-rw-r--r-- | vda/postfix-2.4.0-vda-ng.patch | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/vda/postfix-2.4.0-vda-ng.patch b/vda/postfix-2.4.0-vda-ng.patch index 32a4b72..553939f 100644 --- a/vda/postfix-2.4.0-vda-ng.patch +++ b/vda/postfix-2.4.0-vda-ng.patch @@ -345,8 +345,8 @@ diff -Nru postfix-2.4.0/src/virtual/mailbox.c postfix-2.4.0-vda/src/virtual/mail * Cleanup. diff -Nru postfix-2.4.0/src/virtual/maildir.c postfix-2.4.0-vda/src/virtual/maildir.c --- postfix-2.4.0/src/virtual/maildir.c 2006-06-26 14:59:19.000000000 +0200 -+++ postfix-2.4.0-vda/src/virtual/maildir.c 2007-04-23 16:07:19.000000000 +0200 -@@ -63,28 +63,382 @@ ++++ postfix-2.4.0-vda/src/virtual/maildir.c 2007-04-27 01:20:11.000000000 +0200 +@@ -63,28 +63,394 @@ #include <mbox_open.h> #include <dsn_util.h> @@ -401,6 +401,7 @@ diff -Nru postfix-2.4.0/src/virtual/maildir.c postfix-2.4.0-vda/src/virtual/mail + if (!sizefile || (stat(vstring_str(sizefilename), &statbuf) < 0) || (statbuf.st_size > SIZEFILE_MAX)) { + if (sizefile) { + vstream_fclose(sizefile); ++ unlink(sizefilename); + } + + return 0; @@ -428,9 +429,20 @@ diff -Nru postfix-2.4.0/src/virtual/maildir.c postfix-2.4.0-vda/src/virtual/mail + continue; + } + -+ sscanf(q, "%ld %ld", &n, &c); -+ sum += n; -+ count += c; ++ if(sscanf(q, "%ld %ld", &n, &c) == 2) { ++ sum += n; ++ count += c; ++ } ++ else { ++ if (sizefile) { ++ vstream_fclose(sizefile); ++ unlink(sizefilename); ++ } ++ ++ msg_warn("read_maildirsize: invalid line '%s' found in %s, removing maildirsize file", q, sizefilename); ++ ++ return 0; ++ } + } + + vstream_fclose(sizefile); @@ -592,7 +604,8 @@ diff -Nru postfix-2.4.0/src/virtual/maildir.c postfix-2.4.0-vda/src/virtual/mail + } + } + 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); + @@ -623,8 +636,7 @@ diff -Nru postfix-2.4.0/src/virtual/maildir.c postfix-2.4.0-vda/src/virtual/mail + + return(ret); +} - --int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr) ++ +/* Check if maildirfilter file is up-to-date compared to SQL, (re)write it if not. */ +static long sql2file(char *filename, char *user) +{ @@ -741,7 +753,7 @@ diff -Nru postfix-2.4.0/src/virtual/maildir.c postfix-2.4.0-vda/src/virtual/mail GETTIMEOFDAY(&starttime); -@@ -93,15 +447,14 @@ +@@ -93,15 +459,14 @@ */ state.level++; if (msg_verbose) @@ -760,7 +772,7 @@ diff -Nru postfix-2.4.0/src/virtual/maildir.c postfix-2.4.0-vda/src/virtual/mail } /* -@@ -109,17 +462,81 @@ +@@ -109,17 +474,81 @@ * attribute to reflect the final recipient. */ if (vstream_fseek(state.msg_attr.fp, state.msg_attr.offset, SEEK_SET) < 0) @@ -773,7 +785,10 @@ diff -Nru postfix-2.4.0/src/virtual/maildir.c postfix-2.4.0-vda/src/virtual/mail - copy_flags = MAIL_COPY_TOFILE | MAIL_COPY_RETURN_PATH - | MAIL_COPY_DELIVERED | MAIL_COPY_ORIG_RCPT; + copy_flags = MAIL_COPY_TOFILE | MAIL_COPY_RETURN_PATH | MAIL_COPY_DELIVERED | MAIL_COPY_ORIG_RCPT; -+ + +- newdir = concatenate(usr_attr.mailbox, "new/", (char *) 0); +- tmpdir = concatenate(usr_attr.mailbox, "tmp/", (char *) 0); +- curdir = concatenate(usr_attr.mailbox, "cur/", (char *) 0); + /* + * Concatenate the maildir suffix (if set). + */ @@ -824,10 +839,7 @@ diff -Nru postfix-2.4.0/src/virtual/maildir.c postfix-2.4.0-vda/src/virtual/mail + /* There is no limit in the maps. Set n to 0. */ + n = 0; + } - -- newdir = concatenate(usr_attr.mailbox, "new/", (char *) 0); -- tmpdir = concatenate(usr_attr.mailbox, "tmp/", (char *) 0); -- curdir = concatenate(usr_attr.mailbox, "cur/", (char *) 0); ++ + /* + * Check quota before delivering the mail. + */ @@ -848,7 +860,7 @@ diff -Nru postfix-2.4.0/src/virtual/maildir.c postfix-2.4.0-vda/src/virtual/mail /* * Create and write the file as the recipient, so that file quota work. -@@ -174,46 +591,278 @@ +@@ -174,46 +603,278 @@ * [...] */ set_eugid(usr_attr.uid, usr_attr.gid); @@ -1164,7 +1176,7 @@ diff -Nru postfix-2.4.0/src/virtual/maildir.c postfix-2.4.0-vda/src/virtual/mail } set_eugid(var_owner_uid, var_owner_gid); -@@ -223,31 +872,57 @@ +@@ -223,31 +884,57 @@ * location possibly under user control. */ if (mail_copy_status & MAIL_COPY_STAT_CORRUPT) { |