postfix/postfix-2.6.1-vda-ng-64bit.patch
OBS User autobuild f0ff8ace09 Accepting request 21172 from server:mail
Copy from server:mail/postfix based on submit request 21172 from user varkoly

OBS-URL: https://build.opensuse.org/request/show/21172
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/postfix?expand=0&rev=37
2009-10-12 14:51:23 +00:00

226 lines
8.8 KiB
Diff

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