On 09/18/2015 02:47 PM, Matt Brookings wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Drew, I know you've put a lot of effort into these patches, but they do not 
succeed against the
5.5.0 trunk.  Patches should be made against the most recent revision, which 
can be checked out via
Subversion from Sourceforge.

On 09/18/2015 08:11 AM, Drew Wells wrote:
On 09/17/2015 04:55 PM, Matt Brookings wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

On 09/17/2015 10:52 AM, Drew Wells wrote:
I basically did a diff from 5.4.29 to 5.4.33 and implemented that diff to 
5.5.0, some of
it had already been done to 5.5.0 and alot of it centered around the snprintf 
tidy up's
and the string_list implementation. The attached patch does not include any of 
the
changes I recently sent to the mailing list, just the changes from 5.4.[29->33].
This patch was generated from the 5.5.0 .tar.bz2, I had a look at SVN trunk and 
from what I
could see, it was 5.4.34.
The trunk on Sourceforge is the current 5.5.0.  The 5.4 series only appears in 
the tags and
branches area now.  I'll look over this patch and get it applied.  Thanks for 
putting it
together!

And lastly for now, someone has done a lot of work in tidying up/making safe 
all the calls to
snprintf(), the attached patch completes this work (I think).  This patch comes 
after the
5.4.[29->33] patch I did.



Ok, have have downloaded a snapshot .zip file from Sourceforge (vpopmail-code-1034.zip) and applied the changes to that and attached the patch. This is the 5.4.[29-33] changes patch, I'll do the snprintf() one later. Let me know if you need me to do anything else with it.


!DSPAM:55fc1de841551347274186!
diff -uPr vpopmail-code-1034-trunk.orig/backends/mysql/vmysql.c 
vpopmail-code-1034-trunk/backends/mysql/vmysql.c
--- vpopmail-code-1034-trunk.orig/backends/mysql/vmysql.c       2010-10-26 
18:15:36.000000000 +0100
+++ vpopmail-code-1034-trunk/backends/mysql/vmysql.c    2015-09-18 
15:00:09.810096680 +0100
@@ -1785,10 +1785,10 @@
         limits->maxforwards = atoi(row[2]);
         limits->maxautoresponders = atoi(row[3]);
         limits->maxmailinglists = atoi(row[4]);
-        limits->diskquota = atoi(row[5]);
-        limits->maxmsgcount = atoi(row[6]);
-        limits->defaultquota = atoi(row[7]);
-        limits->defaultmaxmsgcount = atoi(row[8]);
+        limits->diskquota = strtoll(row[5], NULL, 10);
+        limits->maxmsgcount = strtoll(row[6], NULL, 10);
+        limits->defaultquota = strtoll(row[7], NULL, 10);
+        limits->defaultmaxmsgcount = strtoll(row[8], NULL, 10);
         limits->disable_pop = atoi(row[9]);
         limits->disable_imap = atoi(row[10]);
         limits->disable_dialup = atoi(row[11]);
@@ -1808,8 +1808,8 @@
         limits->perm_maillist_users = perm & VLIMIT_DISABLE_ALL;
         perm >>= VLIMIT_DISABLE_BITS;
         limits->perm_maillist_moderators = perm & VLIMIT_DISABLE_ALL;
-        limits->perm_quota = atoi(row[23]);
-        limits->perm_defaultquota = atoi(row[24]);
+        limits->perm_quota = strtoll(row[23], NULL, 10);
+        limits->perm_defaultquota = strtoll(row[24], NULL, 10);
     }
     mysql_free_result(res_read);
 
@@ -1830,7 +1830,7 @@
         "diskquota = %d, maxmsgcount = %d, defaultquota = %d, 
defaultmaxmsgcount = %d, "
         "disable_pop = %d, disable_imap = %d, disable_dialup = %d, "
         "disable_passwordchanging = %d, disable_webmail = %d, disable_relay = 
%d, "
-        "disable_smtp = %d, disable_spamassassin = %d, delete_spam = %d, 
perm_account = %d, "
+        "disable_smtp = %d, disable_spamassassin = %d, delete_spam = %d, 
disable_maildrop = %d, perm_account = %d, "
         "perm_alias = %d, perm_forward = %d, perm_autoresponder = %d, 
perm_maillist = %d, "
         "perm_quota = %d, perm_defaultquota = %d "
         "ON DUPLICATE KEY UPDATE "
@@ -1847,7 +1847,7 @@
         limits->diskquota, limits->maxmsgcount, limits->defaultquota, 
limits->defaultmaxmsgcount,
         limits->disable_pop, limits->disable_imap, limits->disable_dialup,
         limits->disable_passwordchanging, limits->disable_webmail, 
limits->disable_relay,
-        limits->disable_smtp, limits->disable_spamassassin, 
limits->delete_spam, limits->perm_account,
+        limits->disable_smtp, limits->disable_spamassassin, 
limits->delete_spam, limits->disable_maildrop, limits->perm_account,
         limits->perm_alias, limits->perm_forward, limits->perm_autoresponder,
         (limits->perm_maillist |
             (limits->perm_maillist_users << VLIMIT_DISABLE_BITS) |
diff -uPr vpopmail-code-1034-trunk.orig/backends/mysql/vmysql.h.in 
vpopmail-code-1034-trunk/backends/mysql/vmysql.h.in
--- vpopmail-code-1034-trunk.orig/backends/mysql/vmysql.h.in    2010-10-26 
18:15:36.000000000 +0100
+++ vpopmail-code-1034-trunk/backends/mysql/vmysql.h.in 2015-09-18 
15:00:09.810096680 +0100
@@ -268,10 +268,10 @@
       maxforwards              INT(10) NOT NULL DEFAULT -1, \
       maxautoresponders        INT(10) NOT NULL DEFAULT -1, \
       maxmailinglists          INT(10) NOT NULL DEFAULT -1, \
-      diskquota                INT(12) NOT NULL DEFAULT 0, \
-      maxmsgcount              INT(12) NOT NULL DEFAULT 0, \
-      defaultquota             INT(12) NOT NULL DEFAULT 0, \
-      defaultmaxmsgcount       INT(12) NOT NULL DEFAULT 0, \
+      diskquota                BIGINT UNSIGNED NOT NULL DEFAULT 0, \
+      maxmsgcount              BIGINT UNSIGNED NOT NULL DEFAULT 0, \
+      defaultquota             BIGINT UNSIGNED NOT NULL DEFAULT 0, \
+      defaultmaxmsgcount       BIGINT UNSIGNED NOT NULL DEFAULT 0, \
       disable_pop              TINYINT(1) NOT NULL DEFAULT 0, \
       disable_imap             TINYINT(1) NOT NULL DEFAULT 0, \
       disable_dialup           TINYINT(1) NOT NULL DEFAULT 0, \
diff -uPr vpopmail-code-1034-trunk.orig/backfill.c 
vpopmail-code-1034-trunk/backfill.c
--- vpopmail-code-1034-trunk.orig/backfill.c    2009-12-10 16:04:45.000000000 
+0000
+++ vpopmail-code-1034-trunk/backfill.c 2015-09-18 15:00:09.811096625 +0100
@@ -13,7 +13,9 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <fcntl.h>
 #include "vpopmail.h"
+#include "file_lock.h"
 #include "vauth.h"
 #include "vauthmodule.h"
 
@@ -37,6 +39,7 @@
        int             fd;
 #ifdef FILE_LOCKING
        int             lockfd;
+       char            lockfile[MAX_BUFF];
 #endif
 
        if (stat(filename, &statbuf))
diff -uPr vpopmail-code-1034-trunk.orig/client.c 
vpopmail-code-1034-trunk/client.c
--- vpopmail-code-1034-trunk.orig/client.c      2009-12-10 16:04:45.000000000 
+0000
+++ vpopmail-code-1034-trunk/client.c   2015-09-18 15:00:09.811096625 +0100
@@ -78,66 +78,64 @@
 
    config = config_begin("vusagec.conf");
    if (config == NULL)
-         fprintf(stderr, "client_connect: warning: config_begin failed\n");
+         return NULL;
 
    /*
          Disabled check
    */
 
-   else {
-         str = config_fetch_by_name(config, "Server", "Disable");
-         if ((str) && (*str)) {
-                if (!(strcasecmp(str, "True"))) {
-                       config_kill(config);
-                       return NULL;
-                }
-         }
+   str = config_fetch_by_name(config, "Server", "Disable");
+   if ((str) && (*str)) {
+       if (!(strcasecmp(str, "True"))) {
+           config_kill(config);
+           return NULL;
+        }
+   }
 
-         /*
-                Get timeout
-         */
-
-         str = config_fetch_by_name(config, "Server", "Timeout");
-         if (str) {
-                fl = atoi(str);
-                if ((fl == -1) || (fl == 0))
-                       fprintf(stderr, "client_connect: configuration error: 
Server::Timeout: %s\n", str);
-                else
-                       timeout = fl;
-         }
+   /*
+         Get timeout
+   */
 
-         /*
-                Determine connection type
-         */
-
-         str = config_fetch_by_name(config, "Server", "Remote");
-         if (str) {
-                ret = ippp_parse(str, &addr);
-                if (!ret) {
-                       config_kill(config);
-                       fprintf(stderr, "client_connect: configuration error: 
Server::Remote: %s\n", str);
-                       return NULL;
-                }
-         }
+   str = config_fetch_by_name(config, "Server", "Timeout");
+   if (str) {
+       fl = atoi(str);
+       if ((fl == -1) || (fl == 0))
+           fprintf(stderr, "client_connect: configuration error: 
Server::Timeout: %s\n", str);
+       else
+           timeout = fl;
+       }
 
-         else {
-                str = config_fetch_by_name(config, "Server", "Filename");
-                if (str) {
-                       if (!(*str)) {
-                          config_kill(config);
-                          fprintf(stderr, "client_connect: configuration 
error: Server::Filename\n");
-                          return NULL;
-                       }
-
-                       fl = strlen(str);
-                       if (fl >= sizeof(socket_file))
-                          fl = (sizeof(socket_file) - 1);
+   /*
+         Determine connection type
+   */
 
-                       memcpy(socket_file, str, fl);
-                }
-         }
+   str = config_fetch_by_name(config, "Server", "Remote");
+   if (str) {
+       ret = ippp_parse(str, &addr);
+       if (!ret) {
+           config_kill(config);
+           fprintf(stderr, "client_connect: configuration error: 
Server::Remote: %s\n", str);
+           return NULL;
+       }
+   }
+
+   else {
+       str = config_fetch_by_name(config, "Server", "Filename");
+       if (str) {
+           if (!(*str)) {
+               config_kill(config);
+               fprintf(stderr, "client_connect: configuration error: 
Server::Filename\n");
+               return NULL;
+           }
+
+           fl = strlen(str);
+           if (fl >= sizeof(socket_file))
+               fl = (sizeof(socket_file) - 1);
+
+           memcpy(socket_file, str, fl);
+       }
 
-         config_kill(config);
+       config_kill(config);
    }
 
    /*
diff -uPr vpopmail-code-1034-trunk.orig/conf.c vpopmail-code-1034-trunk/conf.c
--- vpopmail-code-1034-trunk.orig/conf.c        2009-09-08 16:08:43.000000000 
+0100
+++ vpopmail-code-1034-trunk/conf.c     2015-09-18 15:00:09.812096572 +0100
@@ -787,13 +787,12 @@
 char *config_fetch_by_num(config_t *c, char *label, int num)
 {  
   int cur = 0;
+  config_label_t *l = NULL;
+  config_atom_t *a = NULL;
 
   if (c == NULL)
         return NULL;
 
-  config_label_t *l = NULL;
-  config_atom_t *a = NULL;
-
   if (c->labels == NULL)
      return NULL;
 
diff -uPr vpopmail-code-1034-trunk.orig/doc/UPGRADE 
vpopmail-code-1034-trunk/doc/UPGRADE
--- vpopmail-code-1034-trunk.orig/doc/UPGRADE   2009-12-10 16:04:45.000000000 
+0000
+++ vpopmail-code-1034-trunk/doc/UPGRADE        2015-09-18 15:00:09.813096521 
+0100
@@ -4,6 +4,15 @@
 into the vpopmail libraries.  These include QmailAdmin, qmail-smtpd (if 
 you have the chkuser patch applied), Courier-IMAP etc.
 
++Upgrading to vpopmail-5.4.33
++----------------------------
++If you are storing limits in MySQL, the following schema changes must be made:
++
++ALTER TABLE `limits` ADD `disable_maildrop` TINYINT(1) DEFAULT '0' NOT NULL 
AFTER `disable_spamassassin`;
++ALTER TABLE `limits` MODIFY `diskquota` BIGINT UNSIGNED NOT NULL DEFAULT 0;
++ALTER TABLE `limits` MODIFY `maxmsgcount` BIGINT UNSIGNED NOT NULL DEFAULT 0;
++ALTER TABLE `limits` MODIFY `defaultquota` BIGINT UNSIGNED NOT NULL DEFAULT 0;
++ALTER TABLE `limits` MODIFY `defaultmaxmsgcount` BIGINT UNSIGNED NOT NULL 
DEFAULT 0;
 
 Upgrading to vpopmail-5.4.18
 ----------------------------
diff -uPr vpopmail-code-1034-trunk.orig/maildirquota.c 
vpopmail-code-1034-trunk/maildirquota.c
--- vpopmail-code-1034-trunk.orig/maildirquota.c        2011-02-28 
17:21:03.000000000 +0000
+++ vpopmail-code-1034-trunk/maildirquota.c     2015-09-18 15:00:09.814096471 
+0100
@@ -42,16 +42,16 @@
 
 /* private functions - no name clashes with courier */
 static char *makenewmaildirsizename(const char *, int *);
-static int countcurnew(const char *dir, time_t *maxtime, off_t *sizep, int 
*cntp);
-static int countsubdir(const char *dir, const char *subdir, time_t *maxtime, 
off_t *sizep, int *cntp);
+static int countcurnew(const char *dir, time_t *maxtime, storage_t *sizep, 
storage_t *cntp);
+static int countsubdir(const char *dir, const char *subdir, time_t *maxtime, 
storage_t *sizep, storage_t *cntp);
 static int statcurnew(const char *dir, time_t *maxtimestamp);
 static int statsubdir(const char *dir, const char *subdir, time_t *maxtime);
 static int doaddquota(const char *dir, int maildirsize_fd, const char 
*quota_type, 
-                      long maildirsize_size, int maildirsize_cnt, int isnew);
+                      storage_t maildirsize_size, storage_t maildirsize_cnt, 
int isnew);
 static int docheckquota(const char *dir, int *maildirsize_fdptr, const char 
*quota_type, 
-                        long xtra_size, int xtra_cnt, int *percentage);
-static int docount(const char *dir, time_t *dirstamp, off_t *sizep, int *cntp);
-static int maildir_checkquota(const char *dir, int *maildirsize_fdptr, const 
char *quota_type, long xtra_size, int xtra_cnt);
+                        storage_t xtra_size, storage_t xtra_cnt, int 
*percentage);
+static int docount(const char *dir, time_t *dirstamp, storage_t *sizep, 
storage_t *cntp);
+static int maildir_checkquota(const char *dir, int *maildirsize_fdptr, const 
char *quota_type, storage_t xtra_size, storage_t xtra_cnt);
 /*  moved into maildirquota.h as non-static
 static int maildir_addquota(const char *dir, int maildirsize_fd,
        const char *quota_type, long maildirsize_size, int maildirsize_cnt);
@@ -59,7 +59,7 @@
 static int maildir_safeopen(const char *path, int mode, int perm);
 static char *str_pid_t(pid_t t, char *arg);
 static char *str_time_t(time_t t, char *arg);
-static int maildir_parsequota(const char *n, unsigned long *s);
+static int maildir_parsequota(const char *n, storage_t *s);
 
 #define  NUMBUFSIZE      60
 #define        MDQUOTA_SIZE    'S'     /* Total size of all messages in 
maildir */
@@ -75,10 +75,11 @@
 char   domdir[MAX_PW_DIR];
 char   *p;
 char   domain[256], qb[256] = { 0 };
-long    size = 0;
-unsigned long maxsize = 0;
-int    cnt = 0, ret = 0;
-int    maxcnt = 0;
+storage_t size = 0;
+storage_t maxsize = 0;
+storage_t cnt = 0;
+int ret = 0;
+storage_t maxcnt = 0;
 struct vlimits limits;
    storage_t susage = 0, cusage = 0;
 
@@ -144,7 +145,7 @@
         return 0;
 }
 
-int readdomainquota(const char *dir, long *sizep, int *cntp)
+int readdomainquota(const char *dir, storage_t *sizep, storage_t *cntp)
 {
 int tries;
 char   checkdir[256];
@@ -205,7 +206,7 @@
        return 0;
 }
 
-int wrapreaduserquota(const char* dir, off_t *sizep, int *cntp)
+int wrapreaduserquota(const char* dir, storage_t *sizep, storage_t *cntp)
 {
 time_t tm;
 time_t maxtime;
@@ -284,10 +285,10 @@
 
        return 0;
 }
-int readuserquota(const char* dir, long *sizep, int *cntp)
+int readuserquota(const char* dir, storage_t *sizep, storage_t *cntp)
 {
        int retval;
-       off_t s;
+       storage_t s;
        
        s = (off_t) *sizep;
        retval = wrapreaduserquota(dir, &s, cntp);
@@ -348,8 +349,8 @@
 
 static int maildirsize_read(const char *filename,      /* The filename */
        int *fdptr,     /* Keep the file descriptor open */
-       off_t *sizeptr, /* Grand total of maildir size */
-       int *cntptr, /* Grand total of message count */
+       storage_t *sizeptr, /* Grand total of maildir size */
+       storage_t *cntptr, /* Grand total of message count */
        unsigned *nlines, /* # of lines in maildirsize */
        struct stat *statptr)   /* The stats on maildirsize */
 {
@@ -357,8 +358,9 @@
  int f;
  char *p;
  unsigned l;
- int n;
+ storage_t n;
  int first;
+ int ret = 0;
 
    /*
          Old-style
@@ -371,6 +373,18 @@
        p=buf;
        l=sizeof(buf);
 
+       /*
+               Maildir++ specification says to rebuild the maildirsize file if 
the
+               file is 5120 or more bytes, or is more than 15 minutes old
+       */
+
+       ret = fstat(f, statptr);
+       if ((ret != -1) && ((statptr->st_size >= 5120) || (time(NULL) > 
statptr->st_mtime + (15*60)))) {
+          unlink(filename);
+          close(f);
+          return -1;
+       }
+
        while (l)
        {
                n=read(f, p, l);
@@ -383,7 +397,7 @@
                p += n;
                l -= n;
        }
-       if (l == 0 || fstat(f, statptr))        /* maildir too big */
+       if (l == 0 || ret)      /* maildir too big */
        {
                close(f);
                return (-1);
@@ -397,8 +411,8 @@
        first=1;
        while (*p)
        {
-       long n=0;
-       int c=0;
+       storage_t n=0;
+       storage_t c=0;
        char    *q=p;
 
                while (*p)
@@ -413,7 +427,7 @@
                        first=0;
                        continue;
                }
-               sscanf(q, "%ld %d", &n, &c);
+               sscanf(q, "%llu %llu", &n, &c);
                *sizeptr += n;
                *cntptr += c;
                ++ *nlines;
@@ -422,9 +436,9 @@
        return (0);
 }
 
-static int qcalc(off_t s, unsigned n, const char *quota, int *percentage)
+static int qcalc(storage_t s, storage_t n, const char *quota, int *percentage)
 {
-off_t i;
+storage_t i;
 int    spercentage=0;
 int    npercentage=0;
 
@@ -449,6 +463,7 @@
                                return (-1);
                        }
 
+#if 0
                        /*
                        ** For huge quotas, over 20mb,
                        ** divide numerator & denominator by 1024 to prevent
@@ -457,6 +472,7 @@
 
                        x=1;
                        if (i > 20000000) x=1024;
+#endif
 
                        spercentage = i ? (s/x) * 100 / (i/x):100;
                        break;
@@ -468,10 +484,12 @@
                                return (-1);
                        }
 
+#if 0
                        /* Ditto */
 
                        x=1;
                        if (i > 20000000) x=1024;
+#endif
 
                        npercentage = i ? ((off_t)n/x) * 100 / (i/x):100;
                        break;
@@ -484,8 +502,8 @@
 static int maildir_checkquota(const char *dir,
        int *maildirsize_fdptr,
        const char *quota_type,
-       long xtra_size,
-       int xtra_cnt)
+       storage_t xtra_size,
+       storage_t xtra_cnt)
 {
 int    dummy, ret = 0;
 
@@ -495,13 +513,21 @@
 
    fprintf(stderr, "warning: program using deprecated quota function at 
%s:%d\n", __FILE__, __LINE__);
 
+   if ((xtra_size == 0) || (xtra_cnt == 0))
+       return 0;
+
    /*
          Ping the daemon
    */
 
    ret = client_query_quick(" ", NULL, NULL);
-   if (ret)
-      return vmaildir_readquota(dir, quota_type);
+   if (ret) {
+      ret = vmaildir_readquota(dir, quota_type);
+      if (ret >= 100)
+          return -1;
+
+      return 0;
+   }
 
    /*
          Fall back
@@ -569,16 +595,16 @@
 static int docheckquota(const char *dir,
        int *maildirsize_fdptr,
        const char *quota_type,
-       long xtra_size,
-       int xtra_cnt,
+       storage_t xtra_size,
+       storage_t xtra_cnt,
        int *percentage)
 {
 char   *checkfolder=(char *)malloc(strlen(dir)+sizeof("/maildirfolder"));
 char   *newmaildirsizename;
 struct stat stat_buf;
 int    maildirsize_fd = -1;
-off_t  maildirsize_size;
-int     maildirsize_cnt;
+storage_t maildirsize_size;
+storage_t maildirsize_cnt;
 unsigned maildirsize_nlines;
 int    n;
 time_t tm;
@@ -746,7 +772,7 @@
 }
 
 int    maildir_addquota(const char *dir, int maildirsize_fd,
-       const char *quota_type, long maildirsize_size, int maildirsize_cnt)
+       const char *quota_type, storage_t maildirsize_size, storage_t 
maildirsize_cnt)
 {
    int ret = 0;
 
@@ -775,7 +801,7 @@
 }
 
 static int doaddquota(const char *dir, int maildirsize_fd,
-       const char *quota_type, long maildirsize_size, int maildirsize_cnt,
+       const char *quota_type, storage_t maildirsize_size, storage_t 
maildirsize_cnt,
        int isnew)
 {
 union  {
@@ -844,8 +870,7 @@
                niov=2;
        }
 
-
-       sprintf(u.buf, "%ld %d\n", maildirsize_size, maildirsize_cnt);
+       sprintf(u.buf, "%llu %lu\n", maildirsize_size, maildirsize_cnt);
        iov[niov].iov_base=u.buf;
        iov[niov].iov_len=strlen(u.buf);
 
@@ -973,7 +998,7 @@
        return (n);
 }
 
-static int countcurnew(const char *dir, time_t *maxtime, off_t *sizep, int 
*cntp)
+static int countcurnew(const char *dir, time_t *maxtime, storage_t *sizep, 
storage_t *cntp)
 {
 char   *p=(char *)malloc(strlen(dir)+5);
 int    n;
@@ -990,7 +1015,7 @@
        return (n);
 }
 
-static int countsubdir(const char *dir, const char *subdir, time_t *maxtime, 
off_t *sizep, int *cntp)
+static int countsubdir(const char *dir, const char *subdir, time_t *maxtime, 
storage_t *sizep, storage_t *cntp)
 {
 char   *p;
 int    n;
@@ -1007,13 +1032,13 @@
        return (n);
 }
 
-static int docount(const char *dir, time_t *dirstamp, off_t *sizep, int *cntp)
+static int docount(const char *dir, time_t *dirstamp, storage_t *sizep, 
storage_t *cntp)
 {
 struct stat    stat_buf;
 char   *p;
 DIR    *dirp;
 struct dirent *de;
-unsigned long  s;
+storage_t s;
 
        if (stat(dir, &stat_buf))       return (0);     /* Ignore */
        if (stat_buf.st_mtime > *dirstamp)      *dirstamp=stat_buf.st_mtime;
@@ -1043,7 +1068,7 @@
 
 
                if (maildir_parsequota(n, &s) == 0)
-                       stat_buf.st_size=s;
+                       *sizep += s;
                else
                {
                        p=(char *)malloc(strlen(dir)+strlen(n)+2);
@@ -1059,8 +1084,8 @@
                                continue;
                        }
                        free(p);
+                       *sizep += stat_buf.st_size;
                }
-               *sizep += stat_buf.st_size;
                ++*cntp;
        }
 
@@ -1131,7 +1156,7 @@
         return (strcpy(arg, p));
 }
 
-static int maildir_parsequota(const char *n, unsigned long *s)
+static int maildir_parsequota(const char *n, storage_t *s)
 {
 const char *o;
 int     yes;
@@ -1163,6 +1188,7 @@
                 *s=0;
                 while (*o >= '0' && *o <= '9')
                         *s= *s*10 + (*o++ - '0');
+
                 return (0);
         }
         return (-1);
diff -uPr vpopmail-code-1034-trunk.orig/maildirquota.h 
vpopmail-code-1034-trunk/maildirquota.h
--- vpopmail-code-1034-trunk.orig/maildirquota.h        2009-12-10 
16:04:45.000000000 +0000
+++ vpopmail-code-1034-trunk/maildirquota.h     2015-09-18 15:00:09.814096471 
+0100
@@ -8,6 +8,8 @@
    -Bill Shupp
  */
 
+#include "storage.h"
+
 #define QUOTA_WARN_PERCENT 90
 
 /* I've removed pretty much the whole file execept for
@@ -15,8 +17,8 @@
    I"ve made the courier functions static.
    - Brian Kolaci
 */
-int readdomainquota(const char *dir, long *sizep, int *cntp);
-int readuserquota(const char* dir, long *sizep, int *cntp);
+int readdomainquota(const char *dir, storage_t *sizep, storage_t *cntp);
+int readuserquota(const char* dir, storage_t *sizep, storage_t *cntp);
 int domain_over_maildirquota(const char *userdir);
 int user_over_maildirquota(const char *dir, const char *quota);
 int vmaildir_readquota(const char *dir,        const char *quota);
@@ -24,5 +26,5 @@
 int maildir_addquota(const char *,     /* Pointer to the maildir */
        int,    /* Must be the int pointed to by 2nd arg to checkquota */
        const char *,   /* The quota */
-       long,   /* +/- bytes */
-       int);   /* +/- files */
+       storage_t,      /* +/- bytes */
+       storage_t);     /* +/- files */
diff -uPr vpopmail-code-1034-trunk.orig/vadduser.c 
vpopmail-code-1034-trunk/vadduser.c
--- vpopmail-code-1034-trunk.orig/vadduser.c    2010-11-02 17:15:10.000000000 
+0000
+++ vpopmail-code-1034-trunk/vadduser.c 2015-09-18 15:00:09.815096423 +0100
@@ -30,6 +30,7 @@
 #include "vpopmail.h"
 #include "vauth.h"
 #include "vauthmodule.h"
+#include "pwstr.h"
 
 char Email[MAX_BUFF];
 char Passwd[MAX_BUFF];
diff -uPr vpopmail-code-1034-trunk.orig/vchkpw.c 
vpopmail-code-1034-trunk/vchkpw.c
--- vpopmail-code-1034-trunk.orig/vchkpw.c      2010-10-07 23:17:36.000000000 
+0100
+++ vpopmail-code-1034-trunk/vchkpw.c   2015-09-18 15:00:09.815096423 +0100
@@ -733,26 +733,26 @@
 
   if ( (verror == VLOG_ERROR_PASSWD) && ( ENABLE_LOGGING==1 || 
ENABLE_LOGGING==2 || ENABLE_LOGGING==3 || ENABLE_LOGGING==4 ) ) {
       if ( (logsql(verror, TheUser, TheDomain, ThePass, TheName, IpAddr, 
LogLine) ) != 0 ) {
-          syslog(LOG_NOTICE,"vchkpw: can't write SQL logs");
+          syslog(LOG_NOTICE,"%s","vchkpw: can't write SQL logs");
       }
       if ( (logsql(verror, TheUser, TheDomain, ThePass, TheName, IpAddr, 
LogLine) ) != 0 ) {
-          syslog(LOG_NOTICE,"vchkpw: can't write SQL logs");
+          syslog(LOG_NOTICE,"%s","vchkpw: can't write SQL logs");
       }
   } else if ( verror == VLOG_ERROR_INTERNAL ) {
       if ( (logsql(verror, TheUser, TheDomain, ThePass, TheName, IpAddr, 
LogLine) ) != 0 ) {
-        syslog(LOG_NOTICE,"vchkpw: can't write SQL logs");
+          syslog(LOG_NOTICE,"%s","vchkpw: can't write SQL logs");
       }
   } else if ( verror == VLOG_ERROR_LOGON ) {
       if ( (logsql(verror, TheUser, TheDomain, ThePass, TheName, IpAddr, 
LogLine) ) != 0 ) {
-        syslog(LOG_NOTICE,"vchkpw: can't write SQL logs");
+          syslog(LOG_NOTICE,"%s","vchkpw: can't write SQL logs");
       }
   } else if ( verror == VLOG_ERROR_ACCESS ) {
       if ( (logsql(verror, TheUser, TheDomain, ThePass, TheName, IpAddr, 
LogLine) ) != 0 ) {
-        syslog(LOG_NOTICE,"vchkpw: can't write SQL logs");
+          syslog(LOG_NOTICE,"%s","vchkpw: can't write SQL logs");
       }
   } else if ( verror == VLOG_AUTH && ( ENABLE_LOGGING == 1 || ENABLE_LOGGING 
== 4 ) ) {
       if ( (logsql(verror, TheUser, TheDomain, ThePass, TheName, IpAddr, 
LogLine) ) != 0 ) {
-        syslog(LOG_NOTICE,"vchkpw: can't write SQL logs");
+          syslog(LOG_NOTICE,"%s","vchkpw: can't write SQL logs");
       }
   }
 #endif
diff -uPr vpopmail-code-1034-trunk.orig/vlimits.c 
vpopmail-code-1034-trunk/vlimits.c
--- vpopmail-code-1034-trunk.orig/vlimits.c     2009-12-10 16:04:45.000000000 
+0000
+++ vpopmail-code-1034-trunk/vlimits.c  2015-09-18 15:00:27.726095659 +0100
@@ -187,22 +187,22 @@
 
                        else if (!strcmp(s1, "quota")) {
                 if (s2)
-                limits->diskquota = atoi(s2);
+                limits->diskquota = strtoll(s2, NULL, 10);
             }
 
                        else if (!strcmp(s1, "maxmsgcount")) {
                 if (s2)
-                limits->maxmsgcount = atoi(s2);
+                limits->maxmsgcount = strtoll(s2, NULL, 10);
             }
 
             if (!strcmp(s1, "default_quota")) {
                 if (s2)
-                limits->defaultquota = atoi(s2);
+                limits->defaultquota = strtoll(s2, NULL, 10);
             }
 
                        else if (!strcmp(s1, "default_maxmsgcount")) {
                 if (s2)
-                limits->defaultmaxmsgcount = atoi(s2);
+                limits->defaultmaxmsgcount = strtoll(s2, NULL, 10);
             }
 
                        else if (!strcmp(s1, "disable_pop")) {
@@ -480,10 +480,10 @@
         fprintf(fs, "maxforwards: %d\n", limits->maxforwards);
         fprintf(fs, "maxautoresponders: %d\n", limits->maxautoresponders);
         fprintf(fs, "maxmailinglists: %d\n", limits->maxmailinglists);
-        fprintf(fs, "quota: %d\n", limits->diskquota);
-        fprintf(fs, "maxmsgcount: %d\n", limits->maxmsgcount);
-        fprintf(fs, "default_quota: %d\n", limits->defaultquota);
-        fprintf(fs, "default_maxmsgcount: %d\n", limits->defaultmaxmsgcount);
+        fprintf(fs, "quota: %llu\n", limits->diskquota);
+        fprintf(fs, "maxmsgcount: %llu\n", limits->maxmsgcount);
+        fprintf(fs, "default_quota: %llu\n", limits->defaultquota);
+        fprintf(fs, "default_maxmsgcount: %llu\n", limits->defaultmaxmsgcount);
         if (limits->disable_pop) fprintf(fs, "disable_pop\n");
         if (limits->disable_imap) fprintf(fs, "disable_imap\n");
         if (limits->disable_dialup) fprintf(fs, "disable_dialup\n");
diff -uPr vpopmail-code-1034-trunk.orig/vlimits.h 
vpopmail-code-1034-trunk/vlimits.h
--- vpopmail-code-1034-trunk.orig/vlimits.h     2009-12-10 16:04:45.000000000 
+0000
+++ vpopmail-code-1034-trunk/vlimits.h  2015-09-18 15:00:27.727095617 +0100
@@ -20,6 +20,8 @@
 #define VLIMIT_DISABLE_ALL 
(VLIMIT_DISABLE_CREATE|VLIMIT_DISABLE_MODIFY|VLIMIT_DISABLE_DELETE)
 #define VLIMIT_DISABLE_BITS 3
 
+#include "storage.h"
+
 struct vlimits {
       /* max service limits */
       int       maxpopaccounts;
@@ -29,10 +31,10 @@
       int       maxmailinglists;
 
       /* quota & message count limits */
-      int       diskquota;
-      int       maxmsgcount;
-      int       defaultquota;
-      int       defaultmaxmsgcount;
+      storage_t diskquota;
+      storage_t maxmsgcount;
+      storage_t defaultquota;
+      storage_t defaultmaxmsgcount;
 
       /* the following are 0 (false) or 1 (true) */
       short     disable_pop;
diff -uPr vpopmail-code-1034-trunk.orig/vlistlib.c 
vpopmail-code-1034-trunk/vlistlib.c
--- vpopmail-code-1034-trunk.orig/vlistlib.c    2010-10-13 18:19:57.000000000 
+0100
+++ vpopmail-code-1034-trunk/vlistlib.c 2015-09-18 15:00:27.727095617 +0100
@@ -193,8 +193,8 @@
 
     if( DomainOnly ) {    //   Have domain
         if ( strstr( Address, "@") != NULL ) return(4);
-        snprintf( LI->Name,   MAX_FILE_NAME, "%s", "" );
-        snprintf( LI->Domain, MAX_FILE_NAME, "%s", Address );
+        snprintf( LI->Name,   sizeof(LI->Name), "%s", "" );
+        snprintf( LI->Domain, sizeof(LI->Domain), "%s", Address );
     }
 
     else {                //   Have mail list
@@ -206,13 +206,13 @@
 
     if(( LI->entry = get_domain_entries( LI->Domain )) == NULL ) return(3);
 
-    snprintf( LI->OwnerEmail,   MAX_FILE_NAME, "postmaster@%s", LI->Domain ); 
-    snprintf( LI->ReplyTo_Addr, MAX_FILE_NAME, "%s", "" );
-    snprintf( LI->SQLBase,      MAX_FILE_NAME, "ezmlm" );
-    snprintf( LI->SQLHost,      MAX_FILE_NAME, "localhost" );
-    snprintf( LI->SQLPass,      MAX_FILE_NAME, "dbpass" );
-    snprintf( LI->SQLTable,     MAX_FILE_NAME, "ezmlm" );
-    snprintf( LI->SQLUser,      MAX_FILE_NAME, "dbUser" );
+    snprintf( LI->OwnerEmail,   sizeof(LI->OwnerEmail), "postmaster@%s", 
LI->Domain ); 
+    snprintf( LI->ReplyTo_Addr, sizeof(LI->ReplyTo_Addr), "%s", "" );
+    snprintf( LI->SQLBase,      sizeof(LI->SQLBase), "ezmlm" );
+    snprintf( LI->SQLHost,      sizeof(LI->SQLHost), "localhost" );
+    snprintf( LI->SQLPass,      sizeof(LI->SQLPass), "dbpass" );
+    snprintf( LI->SQLTable,     sizeof(LI->SQLTable), "ezmlm" );
+    snprintf( LI->SQLUser,      sizeof(LI->SQLUser), "dbUser" );
 
 //    printf( "before make name\n" );
 
diff -uPr vpopmail-code-1034-trunk.orig/vmoddomlimits.c 
vpopmail-code-1034-trunk/vmoddomlimits.c
--- vpopmail-code-1034-trunk.orig/vmoddomlimits.c       2009-12-10 
16:04:45.000000000 +0000
+++ vpopmail-code-1034-trunk/vmoddomlimits.c    2015-09-18 15:00:27.728095577 
+0100
@@ -212,10 +212,10 @@
             printf ((limits.perm_defaultquota & VLIMIT_DISABLE_DELETE ? 
"DENY_DELETE  " :"ALLOW_DELETE ") );
             
             printf("\n");
-            printf("Domain Quota: %d MB\n", limits.diskquota);
-            printf("Default User Quota: %d bytes\n", limits.defaultquota);
-            printf("Max Domain Messages: %d\n", limits.maxmsgcount);
-            printf("Default Max Messages per User: %d\n", 
limits.defaultmaxmsgcount);
+            printf("Domain Quota: %llu MB\n", limits.diskquota);
+            printf("Default User Quota: %llu bytes\n", limits.defaultquota);
+            printf("Max Domain Messages: %llu\n", limits.maxmsgcount);
+            printf("Default Max Messages per User: %llu\n", 
limits.defaultmaxmsgcount);
             return(vexit(0));
         }
                 
@@ -237,16 +237,16 @@
         
         /* quota & message count limits */
         if (DomainQuota[0] != 0) {
-            limits.diskquota = atoi(DomainQuota);
+            limits.diskquota = strtoll(DomainQuota, NULL, 10);
         }
         if (DomainMaxMsgCount[0] != 0) {
-            limits.maxmsgcount = atoi(DomainMaxMsgCount);
+            limits.maxmsgcount = strtoll(DomainMaxMsgCount, NULL, 10);
         }
         if (DefaultUserQuota[0] != 0) {
-            limits.defaultquota = atoi(format_maildirquota(DefaultUserQuota));
+            limits.defaultquota = 
strtoll(format_maildirquota(DefaultUserQuota), NULL, 10);
         }
         if (DefaultUserMaxMsgCount[0] != 0) {
-            limits.defaultmaxmsgcount = atoi(DefaultUserMaxMsgCount);
+            limits.defaultmaxmsgcount = strtoll(DefaultUserMaxMsgCount, NULL, 
10);
         }
         
         if (GidFlag == 1) {
diff -uPr vpopmail-code-1034-trunk.orig/vpopmail.c 
vpopmail-code-1034-trunk/vpopmail.c
--- vpopmail-code-1034-trunk.orig/vpopmail.c    2011-02-03 21:32:27.000000000 
+0000
+++ vpopmail-code-1034-trunk/vpopmail.c 2015-09-18 15:14:22.695094931 +0100
@@ -42,6 +42,7 @@
 #include "vauth.h"
 #include "vlimits.h"
 #include "maildirquota.h"
+#include "storage.h"
 #include "vauthmodule.h"
 #include "pwstr.h"
 
@@ -2516,6 +2517,9 @@
     return(NULL);
   }
 
+  /* record the dir where the command was run from */
+  call_dir = open(".", O_RDONLY);
+
   /* go to the dir for our chosen domain */
   chdir(domain_dir); 
 
@@ -3330,6 +3334,12 @@
     return( VA_DOMAIN_DOES_NOT_EXIST );
   }
 
+  /* record which dir the command was launched from */
+  call_dir = open(".", O_RDONLY);
+
+  /* set the mask for file creation */
+  umask(VPOPMAIL_UMASK);
+ 
   /* so, we should have some variables like this now :
    *   dir:    /home/vpopmail/domains/[x]/somedomain.com/[x]/someuser
    *   tmpbuf: /home/vpopmail/domains/[x]/somedomain.com
@@ -3961,8 +3971,8 @@
 
 char *format_maildirquota(const char *q) {
 int     i;
-double quota_size;
-long   quota_count;
+storage_t quota_size;
+storage_t quota_count;
 char   *p;
 static char    tempquota[128];
 
@@ -3972,34 +3982,34 @@
     }
 
     /* translate the quota to a number, or leave it */
-    quota_size = -1.0;
-    quota_count = -1;
+    quota_size = 0;
+    quota_count = 0;
     snprintf (tempquota, sizeof(tempquota), "%s", q);
     p = strtok (tempquota, ",");
     while (p != NULL) {
       i = strlen(p) - 1;
       if (p[i] == 'C') { /* specify a limit on the number of messages (COUNT) 
*/
-        quota_count = atol(p);
+        quota_count = strtoll(p, NULL, 10);
       } else { /* specify a limit on the size */
         /* strip optional trailing S */
         if ((p[i] == 'S') || (p[i] == 's')) p[i--] = '\0';
         /* strip optional trailing B (for KB, MB) */
         if ((p[i] == 'B') || (p[i] == 'b')) p[i--] = '\0';
 
-        quota_size = atof(p);
+        quota_size = strtoll(p, NULL, 10);
         if ((p[i] == 'M') || (p[i] == 'm')) quota_size *= 1024 * 1024;
         if ((p[i] == 'K') || (p[i] == 'k')) quota_size *= 1024;
       }
       p = strtok (NULL, ",");
     }
 
-    if (quota_count == -1)
-      if (quota_size == -1.0) strcpy (tempquota, ""); /* invalid quota */
-      else sprintf (tempquota, "%.0fS", quota_size);
-    else if (quota_size == -1.0)
-      sprintf (tempquota, "%luC", quota_count);
+    if (quota_count == 0)
+      if (quota_size == 0) strcpy (tempquota, ""); /* invalid quota */
+      else sprintf (tempquota, "%lluS", quota_size);
+    else if (quota_size == 0)
+      sprintf (tempquota, "%lluC", quota_count);
     else
-      sprintf (tempquota, "%.0fS,%luC", quota_size, quota_count);
+      sprintf (tempquota, "%lluS,%lluC", quota_size, quota_count);
 
     return tempquota;
 }
@@ -4242,7 +4252,7 @@
        int printed;   /* number of characters printed */
        const char *f; /* current position in format string */
        char *b;       /* current position in output buffer */
-       char n[20];    /* buffer to hold string representation of number */
+       char n[60];    /* buffer to hold string representation of number */
        
         int argn = 0;  /* used for numbered arguments */
         char argstr[10];
@@ -4274,9 +4284,14 @@
                                case 'u':
                                        snprintf (n, sizeof(n), "%u", va_arg 
(ap, unsigned int));
                                        break;
+
+                               case 'S':
+                                       snprintf (n, sizeof(n), "%llu", va_arg 
(ap, storage_t));
+                                       break;
                                        
                                case 'l':
                                        f++;
+
                                        switch (*f) {
                                                case 'd':
                                                case 'i':
diff -uPr vpopmail-code-1034-trunk.orig/vpopmaild.c 
vpopmail-code-1034-trunk/vpopmaild.c
--- vpopmail-code-1034-trunk.orig/vpopmaild.c   2011-02-03 21:32:27.000000000 
+0000
+++ vpopmail-code-1034-trunk/vpopmaild.c        2015-09-18 15:00:27.747095095 
+0100
@@ -245,8 +245,8 @@
 
   memset(ReadBuf,0,sizeof(ReadBuf));
   if (select(2,&rfds,(fd_set *) 0,(fd_set *)0,&tv)>=1) {
-    fgets(ReadBuf,sizeof(ReadBuf),stdin);
-    return(1);
+    if (fgets(ReadBuf,sizeof(ReadBuf),stdin) != NULL)
+      return(1);
   }
   return(-1);
 }
@@ -301,7 +301,7 @@
     exit( -1 );
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   wait_write();
 
   /* authenticate first or drop connection */
@@ -1421,7 +1421,7 @@
     return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   return(0);
 }
 
@@ -1445,7 +1445,7 @@
       strerror(errno));
     return(-1);
   }
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   return(0);
 }
 
@@ -1477,7 +1477,7 @@
     return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK_MORE);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
 
   while((mydirent=readdir(mydir))!=NULL){
@@ -1515,7 +1515,7 @@
     /* oh well, at least we might die soon */
   }
 
-  snprintf(WriteBuf, sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf, sizeof(WriteBuf), "%s", "." RET_CRLF);
   return(0);
 }
 
@@ -1546,9 +1546,8 @@
     return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   return(0);
-
 }
 
 
@@ -1573,7 +1572,7 @@
     return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   return(0);
 }
 
@@ -1606,7 +1605,7 @@
   }
   fclose(fs);
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   return(0);
 }
 
@@ -1631,7 +1630,7 @@
     return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK_MORE);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
 
   while(fgets(tmpbuf,sizeof(tmpbuf),fs)!=NULL){
@@ -1646,7 +1645,7 @@
   fclose(fs);
 
   if ( tmpbuf[0] != 0 && tmpbuf[strlen(tmpbuf)-1] != '\n' ) {
-    snprintf(WriteBuf,sizeof(WriteBuf), RET_CRLF "." RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_CRLF "." RET_CRLF);
   } else {
     snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
   }
@@ -1673,11 +1672,11 @@
       strerror(errno));
     return(-1);
   }
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK_MORE);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
   snprintf(WriteBuf,sizeof(WriteBuf), "uid: %d\n", mystat.st_uid); 
   wait_write();
-  snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
   return(0);
 }
 
@@ -1742,7 +1741,7 @@
     entry=get_domain_entries(NULL);
     
   }
-  snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
   return(0);
 }
 
@@ -1779,7 +1778,7 @@
     return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK_MORE);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
 
   count = 0;
@@ -1797,7 +1796,7 @@
   }
 
   if( miss ) {
-    snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
     return(0);
   } else if( per_page > 0 ) {
     page = ( count / per_page ) + 1;
@@ -1808,7 +1807,7 @@
   snprintf(WriteBuf,sizeof(WriteBuf), "page %i" RET_CRLF, page );
   wait_write();
 
-  snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
   return(0);
 }
 
@@ -1829,7 +1828,7 @@
     return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK_MORE);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
 
   count = 0;
@@ -1841,7 +1840,7 @@
   snprintf(WriteBuf,sizeof(WriteBuf), "count %i" RET_CRLF, count);
   wait_write();
 
-  snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
   return(0);
 }
 
@@ -1874,7 +1873,7 @@
      return(-1);
    }
  
-   snprintf(WriteBuf, sizeof(WriteBuf), RET_OK_MORE);
+   snprintf(WriteBuf, sizeof(WriteBuf), "%s", RET_OK_MORE);
    wait_write();
  
    first=1;
@@ -1886,7 +1885,7 @@
 
    snprintf(WriteBuf,sizeof(WriteBuf), "count %i" RET_CRLF, count);
    wait_write();
-   snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+   snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
    return(0);
  }
         
@@ -1940,7 +1939,7 @@
     return(-1);
   }
 
-  snprintf(WriteBuf, sizeof(WriteBuf), RET_OK_MORE);
+  snprintf(WriteBuf, sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
 
   first=1;
@@ -1957,13 +1956,13 @@
       send_user_info(tmpvpw);
     }
 
-    snprintf(WriteBuf, sizeof(WriteBuf), RET_CRLF );
+    snprintf(WriteBuf, sizeof(WriteBuf), "%s", RET_CRLF );
     wait_write();
 
     ++count;
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
   return(0);
 }
 
@@ -2018,7 +2017,7 @@
   /*  print all aliases  */
   if (strstr(Email, "@") == NULL) {
     tmpalias = valias_select_all(Alias, Email);
-    snprintf(WriteBuf, sizeof(WriteBuf), RET_OK_MORE);
+    snprintf(WriteBuf, sizeof(WriteBuf), "%s", RET_OK_MORE);
     wait_write();
       
     while (tmpalias != NULL) {
@@ -2031,9 +2030,9 @@
   } else {
     tmpalias = valias_select(Alias, Domain);
     if (tmpalias == NULL) {
-      snprintf(WriteBuf, sizeof(WriteBuf), RET_OK);
+      snprintf(WriteBuf, sizeof(WriteBuf), "%s", RET_OK);
     } else {
-      snprintf(WriteBuf, sizeof(WriteBuf), RET_OK_MORE);
+      snprintf(WriteBuf, sizeof(WriteBuf), "%s", RET_OK_MORE);
       wait_write();
       
       while (tmpalias != NULL) {
@@ -2044,7 +2043,7 @@
     }
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
   return(0);
 }
 
@@ -2107,7 +2106,7 @@
     return(-1);
   }
 
-  snprintf(WriteBuf, sizeof(WriteBuf), RET_OK_MORE);
+  snprintf(WriteBuf, sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
 
   j = bkscandir(".", &namelist, 0, qa_sort);
@@ -2136,7 +2135,7 @@
     }
     ++count;
   }
-  snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
   return(0);
 }
 
@@ -2158,16 +2157,16 @@
 
   if (vauth_module_feature("IP_ALIAS_DOMAINS")) {
   if ( vget_ip_map(ip,tmpdomain,sizeof(tmpdomain)) < 0 ) {
-    snprintf(WriteBuf,sizeof(WriteBuf), RET_ERR "0.3003 error" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_ERR "0.3003 error" RET_CRLF);
     return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf),RET_OK_MORE);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
  
   snprintf(WriteBuf,sizeof(WriteBuf),"%s %s" RET_CRLF, ip, tmpdomain);
   wait_write();
-  snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
   }
 
   else
@@ -2203,11 +2202,11 @@
   }
 
   if ( vadd_ip_map(ip,domain) < 0 ) {
-    snprintf(WriteBuf,sizeof(WriteBuf), RET_ERR "0.3105 error" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_ERR "0.3105 error" RET_CRLF);
     return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf),RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
    }
 
    else
@@ -2242,7 +2241,7 @@
     return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf),RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   }
 
   else
@@ -2263,7 +2262,7 @@
   }
 
   if (vauth_module_feature("IP_ALIAS_DOMAINS")) {
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK_MORE);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
 
   first = 1;
@@ -2273,7 +2272,7 @@
     snprintf(WriteBuf, sizeof(WriteBuf), "%s %s" RET_CRLF, r_ip, r_domain);
     wait_write();
   }
-  snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
   }
 
   else
@@ -2303,7 +2302,7 @@
     return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK_MORE);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
 
   snprintf(WriteBuf,sizeof(WriteBuf), "max_popaccounts %d" RET_CRLF, 
@@ -2316,74 +2315,74 @@
     mylimits.maxautoresponders); wait_write();
   snprintf(WriteBuf,sizeof(WriteBuf), "max_mailinglists %d" RET_CRLF, 
     mylimits.maxmailinglists); wait_write();
-  snprintf(WriteBuf,sizeof(WriteBuf), "disk_quota %d" RET_CRLF, 
+  snprintf(WriteBuf,sizeof(WriteBuf), "disk_quota %llu" RET_CRLF, 
     mylimits.diskquota); wait_write();
-  snprintf(WriteBuf,sizeof(WriteBuf), "max_msgcount %d" RET_CRLF, 
+  snprintf(WriteBuf,sizeof(WriteBuf), "max_msgcount %llu" RET_CRLF, 
     mylimits.maxmsgcount); wait_write();
-  snprintf(WriteBuf,sizeof(WriteBuf), "default_quota %d" RET_CRLF, 
+  snprintf(WriteBuf,sizeof(WriteBuf), "default_quota %llu" RET_CRLF, 
     mylimits.defaultquota); wait_write();
-  snprintf(WriteBuf,sizeof(WriteBuf), "default_maxmsgcount %d" RET_CRLF, 
+  snprintf(WriteBuf,sizeof(WriteBuf), "default_maxmsgcount %llu" RET_CRLF, 
     mylimits.defaultmaxmsgcount); wait_write();
 
   if (mylimits.disable_pop) 
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_pop 1" RET_CRLF); 
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_pop 1" RET_CRLF); 
   else 
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_pop 0" RET_CRLF); 
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_pop 0" RET_CRLF); 
 
   wait_write();
 
   if (mylimits.disable_imap) 
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_imap 1" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_imap 1" RET_CRLF);
   else
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_imap 0" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_imap 0" RET_CRLF);
   wait_write();
 
   if (mylimits.disable_dialup) 
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_dialup 1" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_dialup 1" RET_CRLF);
   else 
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_dialup 0" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_dialup 0" RET_CRLF);
   wait_write();
 
   if (mylimits.disable_passwordchanging) 
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_password_changing 1" 
RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_password_changing 1" 
RET_CRLF);
   else 
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_password_changing 0" 
RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_password_changing 0" 
RET_CRLF);
   wait_write();
 
   if (mylimits.disable_webmail)
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_webmail 1" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_webmail 1" RET_CRLF);
   else
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_webmail 0" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_webmail 0" RET_CRLF);
   wait_write();
 
   if (mylimits.disable_relay)
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_external_relay 1" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_external_relay 1" 
RET_CRLF);
   else
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_external_relay 0" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_external_relay 0" 
RET_CRLF);
   wait_write();
 
   if (mylimits.disable_smtp)
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_smtp 1" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_smtp 1" RET_CRLF);
   else
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_smtp 0" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_smtp 0" RET_CRLF);
   wait_write();
 
   if (mylimits.disable_spamassassin) 
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_spamassassin 1" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_spamassassin 1" 
RET_CRLF);
   else 
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_spamassassin 0" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_spamassassin 0" 
RET_CRLF);
   wait_write();
 
   if (mylimits.delete_spam)
-    snprintf(WriteBuf,sizeof(WriteBuf), "delete_spam 1" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "delete_spam 1" RET_CRLF);
   else
-    snprintf(WriteBuf,sizeof(WriteBuf), "delete_spam 0" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "delete_spam 0" RET_CRLF);
   wait_write();
 
   if (mylimits.disable_maildrop) 
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_maildrop 1" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_maildrop 1" RET_CRLF);
   else 
-    snprintf(WriteBuf,sizeof(WriteBuf), "disable_maildrop 0" RET_CRLF);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", "disable_maildrop 0" RET_CRLF);
   wait_write();
 
   snprintf(WriteBuf,sizeof(WriteBuf), "perm_account %d" RET_CRLF, 
@@ -2406,7 +2405,7 @@
     mylimits.perm_defaultquota); wait_write();
   wait_write();
 
-  snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
   return(0);
 }
 
@@ -2435,7 +2434,7 @@
     return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   wait_write();
 
   while(fgets(ReadBuf,sizeof(ReadBuf),stdin)!=NULL ) {
@@ -2443,7 +2442,7 @@
 
     if ( (param = strtok(ReadBuf,PARAM_TOKENS)) == NULL ) continue;
     if ( (value = strtok(NULL,PARAM_TOKENS)) == NULL )  {
-      snprintf(WriteBuf,sizeof(WriteBuf), 
+      snprintf(WriteBuf,sizeof(WriteBuf), "%s",
         "  Warning: missing value" RET_CRLF);
       wait_write();
       continue;
@@ -2506,7 +2505,7 @@
     } else if ( strcmp(param,"perm_defaultquota") == 0 ) {
       mylimits.perm_defaultquota = atoi(value);
     } else {
-      snprintf(WriteBuf,sizeof(WriteBuf), 
+      snprintf(WriteBuf,sizeof(WriteBuf), "%s",
         "  Warning: invalid option" RET_CRLF);
       wait_write();
     }
@@ -2516,7 +2515,7 @@
   if ( vset_limits(domain,&mylimits) < 0 ) {
     show_error( ERR_NO_SET_LIMITS, 3504 );
   } else {
-    snprintf(WriteBuf,sizeof(WriteBuf),RET_OK);
+    snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   }
   return(0);
 }
@@ -2542,7 +2541,7 @@
     return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   return(0);
 }
 
@@ -2577,10 +2576,10 @@
   } 
 
   if (!(vauth_module_feature("AUTH_LOGGING")))
-         snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+         snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
 
   else {
-         snprintf(WriteBuf,sizeof(WriteBuf), RET_OK_MORE);
+         snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK_MORE);
          wait_write();
 
          snprintf(WriteBuf, sizeof(WriteBuf), "time %ld" RET_CRLF,
@@ -2591,7 +2590,7 @@
                 vget_lastauthip(tmpvpw, TmpDomain));
          wait_write();
 
-         snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+         snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
   }
 
   return(0);
@@ -2618,35 +2617,36 @@
 int get_user_size()
 {
   char *email_address;
-  int ret, cnt;
-  long bytes;
+  int ret;
+  storage_t cnt;
+  storage_t bytes;
 
   if (!(AuthVpw.pw_gid & QA_ADMIN) && !(AuthVpw.pw_gid & SA_ADMIN)) {
-    snprintf(WriteBuf, sizeof(WriteBuf), RET_ERR "3801 not authorized" 
RET_CRLF);
+    snprintf(WriteBuf, sizeof(WriteBuf), "%s", RET_ERR "3801 not authorized" 
RET_CRLF);
     return(-1);
   }
 
   if ((email_address = strtok(NULL, TOKENS)) == NULL) {
-    snprintf(WriteBuf, sizeof(WriteBuf), 
+    snprintf(WriteBuf, sizeof(WriteBuf), "%s",
       RET_ERR "3802 email_address required" RET_CRLF);
     return(-1);
   }
 
   if (parse_email(email_address, TmpUser, TmpDomain, AUTH_SIZE) != 0) {
-    snprintf(WriteBuf, sizeof(WriteBuf), 
+    snprintf(WriteBuf, sizeof(WriteBuf), "%s",
       RET_ERR "3803 invalid email address" RET_CRLF);
     return(-1);
   }
 
   if (!(AuthVpw.pw_gid & SA_ADMIN) && (AuthVpw.pw_gid & QA_ADMIN) 
     && (strcmp(TheDomain, TmpDomain) != 0)) {
-    snprintf(WriteBuf, sizeof(WriteBuf), 
+    snprintf(WriteBuf, sizeof(WriteBuf), "%s",
       RET_ERR "3804 not authorized for domain" RET_CRLF);
     return(-1);
   }
 
   if ((tmpvpw = vauth_getpw(TmpUser, TmpDomain)) == NULL) {
-    snprintf(WriteBuf, sizeof(WriteBuf), 
+    snprintf(WriteBuf, sizeof(WriteBuf), "%s",
       RET_ERR "3805 user does not exist" RET_CRLF);
     return(-1);
   }
@@ -2654,18 +2654,18 @@
   bytes = 0;
   cnt = 0;
   if ((ret = readuserquota(tmpvpw->pw_dir, &bytes, &cnt)) != 0) {
-    snprintf(WriteBuf, sizeof(WriteBuf), 
+    snprintf(WriteBuf, sizeof(WriteBuf), "%s",
       RET_ERR "3806 unable to fetch size of user account" RET_CRLF);
     return(-1);
   }
 
-  snprintf(WriteBuf, sizeof(WriteBuf), RET_OK_MORE);
+  snprintf(WriteBuf, sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
-  snprintf(WriteBuf, sizeof(WriteBuf), "size %ld" RET_CRLF, bytes);
+  snprintf(WriteBuf, sizeof(WriteBuf), "size %llu" RET_CRLF, bytes);
   wait_write();
-  snprintf(WriteBuf, sizeof(WriteBuf), "count %d" RET_CRLF, cnt);
+  snprintf(WriteBuf, sizeof(WriteBuf), "count %lu" RET_CRLF, cnt);
   wait_write();
-  snprintf(WriteBuf, sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf, sizeof(WriteBuf), "%s", "." RET_CRLF);
 
   return(0);
 }
@@ -2673,31 +2673,32 @@
 int get_domain_size()
 {
   char *domain, tmpdir[256];
-  int ret, cnt, first;
-  long bytes;
-  unsigned int totalcnt;
-  unsigned long long totalbytes;
+  int ret, first;
+  storage_t cnt;
+  storage_t bytes;
+  storage_t totalcnt;
+  storage_t totalbytes;
 
   if (!(AuthVpw.pw_gid & QA_ADMIN) && !(AuthVpw.pw_gid & SA_ADMIN)) {
-    snprintf(WriteBuf, sizeof(WriteBuf), 
+    snprintf(WriteBuf, sizeof(WriteBuf), "%s",
       RET_ERR "3901 not authorized" RET_CRLF);
     return(-1);
   }
 
   if ((domain = strtok(NULL, TOKENS)) == NULL) {
-    snprintf(WriteBuf, sizeof(WriteBuf), 
+    snprintf(WriteBuf, sizeof(WriteBuf), "%s",
       RET_ERR "3902 domain required" RET_CRLF);
     return(-1);
   }
 
   if (!(AuthVpw.pw_gid & SA_ADMIN) && (AuthVpw.pw_gid & QA_ADMIN) 
     && (strcmp(TheDomain, domain) != 0)) {
-    snprintf(WriteBuf, sizeof(WriteBuf),
+    snprintf(WriteBuf, sizeof(WriteBuf), "%s",
       RET_ERR "3903 not authorized for domain" RET_CRLF);
     return(-1);
   }
 
-  snprintf(WriteBuf, sizeof(WriteBuf), RET_OK_MORE);
+  snprintf(WriteBuf, sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
 
   totalbytes = 0;
@@ -2715,12 +2716,12 @@
     } else {
       snprintf(WriteBuf, sizeof(WriteBuf), "user %s@%s" RET_CRLF, 
tmpvpw->pw_name, domain);
       wait_write();
-      snprintf(WriteBuf, sizeof(WriteBuf), "size %ld" RET_CRLF, bytes);
+      snprintf(WriteBuf, sizeof(WriteBuf), "size %llu" RET_CRLF, bytes);
       wait_write();
-      snprintf(WriteBuf, sizeof(WriteBuf), "count %d" RET_CRLF, cnt);
+      snprintf(WriteBuf, sizeof(WriteBuf), "count %llu" RET_CRLF, cnt);
       wait_write();
-      totalbytes += (unsigned long)bytes;
-      totalcnt += (unsigned int)cnt;
+      totalbytes += bytes;
+      totalcnt += cnt;
     }
   }
 
@@ -2728,16 +2729,16 @@
   wait_write();
   snprintf(WriteBuf, sizeof(WriteBuf), "size %llu" RET_CRLF, totalbytes);
   wait_write();
-  snprintf(WriteBuf, sizeof(WriteBuf), "count %u" RET_CRLF, totalcnt);
+  snprintf(WriteBuf, sizeof(WriteBuf), "count %llu" RET_CRLF, totalcnt);
   wait_write();
-  snprintf(WriteBuf, sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf, sizeof(WriteBuf), "%s", "." RET_CRLF);
 
   return(0);
 }
 
 int quit()
 {
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   wait_write();
   vclose();
 
@@ -2748,7 +2749,7 @@
 {
  int i;
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK_MORE);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
 
   for(i=0;LoginFunctions[i].command!=NULL;++i ) {
@@ -2763,7 +2764,7 @@
     }
     wait_write();
   }
-  snprintf(WriteBuf,sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", "." RET_CRLF);
   
   return(1); 
 }
diff -uPr vpopmail-code-1034-trunk.orig/vpopmail.h 
vpopmail-code-1034-trunk/vpopmail.h
--- vpopmail-code-1034-trunk.orig/vpopmail.h    2011-02-03 21:32:27.000000000 
+0000
+++ vpopmail-code-1034-trunk/vpopmail.h 2015-09-18 15:13:04.243094269 +0100
@@ -21,6 +21,7 @@
 
 #include <stdio.h>
 #include <sys/types.h>         // for uid_t
+#include "storage.h"
 #include "vauth.h"
 
 /*  Enable expanded debug information.  Consider these for ./configure options 
 */
@@ -185,7 +186,6 @@
         char    *path;
 } domain_entry;
 
-
 /*   Structure for mailing list data  */
 typedef struct listInfoType {
    domain_entry *entry;
@@ -343,7 +343,7 @@
 char *format_maildirquota(const char *q);
 char *date_header();
 int qnprintf (char *buffer, size_t size, const char *format, ...);
-int readuserquota(const char* dir, long *sizep, int *cntp);
+int readuserquota(const char* dir, storage_t *sizep, storage_t *cntp);
 #ifndef HAVE_WARN
 #define warn(...) fprintf(stderr, __VA_ARGS__)
 #endif
diff -uPr vpopmail-code-1034-trunk.orig/vusaged/directory.c 
vpopmail-code-1034-trunk/vusaged/directory.c
--- vpopmail-code-1034-trunk.orig/vusaged/directory.c   2010-11-30 
20:33:11.000000000 +0000
+++ vpopmail-code-1034-trunk/vusaged/directory.c        2015-09-18 
15:00:27.748095080 +0100
@@ -32,7 +32,7 @@
    #include <assert.h>
 #endif
 #include <conf.h>
-#include <storage.h>
+#include "../storage.h"
 #include "path.h"
 #include "directory.h"
 
diff -uPr vpopmail-code-1034-trunk.orig/vusaged/directory.h 
vpopmail-code-1034-trunk/vusaged/directory.h
--- vpopmail-code-1034-trunk.orig/vusaged/directory.h   2009-12-10 
16:04:45.000000000 +0000
+++ vpopmail-code-1034-trunk/vusaged/directory.h        2015-09-18 
15:00:27.749095072 +0100
@@ -24,7 +24,7 @@
 #include <time.h>
 #include <sys/stat.h>
 #include "conf.h"
-#include "storage.h"
+#include "../storage.h"
 
 /*
    A single directory structure
diff -uPr vpopmail-code-1034-trunk.orig/vusaged/domain.c 
vpopmail-code-1034-trunk/vusaged/domain.c
--- vpopmail-code-1034-trunk.orig/vusaged/domain.c      2009-12-10 
16:04:45.000000000 +0000
+++ vpopmail-code-1034-trunk/vusaged/domain.c   2015-09-18 15:00:27.749095072 
+0100
@@ -25,7 +25,7 @@
    #include <assert.h>
 #endif
 #include <pthread.h>
-#include <storage.h>
+#include "../storage.h"
 #include "cache.h"
 #include "domain.h"
 
diff -uPr vpopmail-code-1034-trunk.orig/vusaged/domain.h 
vpopmail-code-1034-trunk/vusaged/domain.h
--- vpopmail-code-1034-trunk.orig/vusaged/domain.h      2009-12-10 
16:04:45.000000000 +0000
+++ vpopmail-code-1034-trunk/vusaged/domain.h   2015-09-18 15:00:27.750095056 
+0100
@@ -22,7 +22,7 @@
    #define __DOMAIN_H_
 
 #include <pthread.h>
-#include "storage.h"
+#include "../storage.h"
 
 /*
    Maximum length of a domain name
diff -uPr vpopmail-code-1034-trunk.orig/vusaged/quota.h 
vpopmail-code-1034-trunk/vusaged/quota.h
--- vpopmail-code-1034-trunk.orig/vusaged/quota.h       2009-03-10 
17:43:50.000000000 +0000
+++ vpopmail-code-1034-trunk/vusaged/quota.h    2015-09-18 15:00:27.750095056 
+0100
@@ -21,7 +21,7 @@
 #ifndef __QUOTA_H_
    #define __QUOTA_H_
 
-#include "storage.h"
+#include "../storage.h"
 
 /*
    Quota size in bytes
diff -uPr vpopmail-code-1034-trunk.orig/vusaged/user.c 
vpopmail-code-1034-trunk/vusaged/user.c
--- vpopmail-code-1034-trunk.orig/vusaged/user.c        2010-09-01 
20:24:43.000000000 +0100
+++ vpopmail-code-1034-trunk/vusaged/user.c     2015-09-18 15:00:27.751095039 
+0100
@@ -32,7 +32,7 @@
 #include <vauth.h>
 #include <vauthmodule.h>
 #include <conf.h>
-#include <storage.h>
+#include "../storage.h"
 #include "path.h"
 #include "cache.h"
 #include "userstore.h"
diff -uPr vpopmail-code-1034-trunk.orig/vusaged/user.h 
vpopmail-code-1034-trunk/vusaged/user.h
--- vpopmail-code-1034-trunk.orig/vusaged/user.h        2010-09-01 
20:24:43.000000000 +0100
+++ vpopmail-code-1034-trunk/vusaged/user.h     2015-09-18 15:00:27.751095039 
+0100
@@ -24,7 +24,7 @@
 #include <time.h>
 #include <pthread.h>
 #include "../conf.h"
-#include "storage.h"
+#include "../storage.h"
 #include "domain.h"
 #include "userstore.h"
 #include "../vauth.h"
diff -uPr vpopmail-code-1034-trunk.orig/vusaged/userstore.c 
vpopmail-code-1034-trunk/vusaged/userstore.c
--- vpopmail-code-1034-trunk.orig/vusaged/userstore.c   2009-12-10 
16:04:45.000000000 +0000
+++ vpopmail-code-1034-trunk/vusaged/userstore.c        2015-09-18 
15:00:27.752095027 +0100
@@ -29,7 +29,7 @@
 #ifdef ASSERT_DEBUG
    #include <assert.h>
 #endif
-#include <storage.h>
+#include "../storage.h"
 #include <conf.h>
 #include "path.h"
 #include "directory.h"
diff -uPr vpopmail-code-1034-trunk.orig/vusaged/userstore.h 
vpopmail-code-1034-trunk/vusaged/userstore.h
--- vpopmail-code-1034-trunk.orig/vusaged/userstore.h   2009-08-24 
16:40:15.000000000 +0100
+++ vpopmail-code-1034-trunk/vusaged/userstore.h        2015-09-18 
15:00:27.752095027 +0100
@@ -21,7 +21,7 @@
 #ifndef __USERSTORE_H_
    #define __USERSTORE_H_
 
-#include "storage.h"
+#include "../storage.h"
 #include "directory.h"
 #include "conf.h"
 #include <pthread.h>
diff -uPr vpopmail-code-1034-trunk.orig/vusaged/vdb.c 
vpopmail-code-1034-trunk/vusaged/vdb.c
--- vpopmail-code-1034-trunk.orig/vusaged/vdb.c 2010-09-01 20:54:40.000000000 
+0100
+++ vpopmail-code-1034-trunk/vusaged/vdb.c      2015-09-18 15:00:27.753095019 
+0100
@@ -13,7 +13,7 @@
 #ifdef ASSERT_DEBUG
    #include <assert.h>
 #endif
-#include <storage.h>
+#include "../storage.h"
 #include <conf.h>
 #include <vpopmail.h>
 #include "path.h"
diff -uPr vpopmail-code-1034-trunk.orig/vusaged/vdb.h 
vpopmail-code-1034-trunk/vusaged/vdb.h
--- vpopmail-code-1034-trunk.orig/vusaged/vdb.h 2009-12-10 16:04:45.000000000 
+0000
+++ vpopmail-code-1034-trunk/vusaged/vdb.h      2015-09-18 15:00:27.753095019 
+0100
@@ -5,7 +5,7 @@
 #ifndef __VDB_H_
    #define __VDB_H_
 
-#include <storage.h>
+#include "../storage.h"
 #include <conf.h>
 
 /*

Reply via email to