Re: [vchkpw] [SPAM] valias remove alias

2015-09-18 Thread Drew Wells

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!

I've just noticed a tiny problem with the previous patch I sent, so here 
is an updated version, this version also includes the missing '#include 
"pwstr.h"' in vadduser.c which causes a segfault on my dev environment 
so thought I should just include it.
The tiny problem was "string_list *aliases" instead of "string_list 
aliases" in vadddomain() in vpopmail.c.



!DSPAM:55fbf97841551215118515!
diff -uPr vpopmail-5.5.0.orig/backends/mysql/vmysql.c 
vpopmail-5.5.0/backends/mysql/vmysql.c
--- vpopmail-5.5.0.orig/backends/mysql/vmysql.c 2010-11-05 18:37:23.0 
+
+++ vpopmail-5.5.0/backends/mysql/vmysql.c  2015-09-18 12:36:07.561092988 
+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-5.5.0.orig/backends/mysql/vmysql.h.in 
vpopmail-5.5.0/backends/mysql/vmysql.h.in
--- vpopmail-5.5.0.orig/backends/mysql/vmysql.h.in  2010-11-05 
18:37:23.0 +
+++ vpopmail-5.5.0/backends/mysql/vmysql.h.in   2015-09-18 12:36:07.561092988 
+0100
@@ -268,10 +268,10 @@
   maxforwards  INT(10) NOT NULL DEFAULT -1, \
   maxautorespondersINT(10) NOT NULL DEFAULT -1, \
   maxmailinglists  INT(10) NOT NULL DEFAULT -1, \
-  diskquotaINT(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, \
+  diskquotaBIGINT UNSIGNED NOT NULL DEFAULT 0, \
+  maxmsgcount  BIGINT UNSIGNED NOT NULL DEFAULT 0, \
+  defaultquota BIGINT UNSIGNED NOT NULL DEFAULT 0, \
+  

Re: [vchkpw] [SPAM] valias remove alias

2015-09-18 Thread Matt Brookings
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 09/18/2015 09:30 AM, Drew Wells wrote:
> On 09/18/2015 03:23 PM, Matt Brookings wrote:
>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1
>> 
>> Applies perfectly!  Thanks!
>> 
>> On 09/18/2015 09:21 AM, Drew Wells wrote:
>>> 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.
>> 
> Not a problem do excuse my use of the 5.5.0 tar, I'll use SVN trunk from now 
> on.  Here is the 
> snprintf() patch for vpopmail-code-1034.zip.

No problem.  Thanks for your work!
- -- 
/*
Matt Brookings    GnuPG Key 62817373
Software developer Systems technician
Inter7 Internet Technologies, Inc. (815)776-9465
*/
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.22 (GNU/Linux)

iQEcBAEBAgAGBQJV/CJIAAoJEOjQVexigXNzUEQH+wV4Si57TawcIHdnggKhZpav
6Swf4CUPZIfLrM6chNkIrTnR2seb0W3qCIqmMdbo3nzUIfLzMw3ZOikCBKF6hoWq
zQUij+eXwTLWe8JbT4/c3fACBmq4BspJj7q4kIAeypu4hqdjDpxAxVvNmoYh3FCQ
CC3LX0E3PbPHp7mKgzXRQtVrnB9ePxTgu9ZR529BUpI4dwz2FXx+FgmcC/hvBFad
mOBh5vYgVfql0rGWmw/TkWLRNxJzR4ffHIYg7h1jJ6QSMrn/Px4pdGNmOzGIf+tV
asoUPWUIKLL1MlPeV/jviTw0Or7es6ZGbsd+pZl6TEkhowySGB72oexrVTDQXF4=
=ZHVf
-END PGP SIGNATURE-


Re: [vchkpw] [SPAM] valias remove alias

2015-09-18 Thread Matt Brookings
-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.
> 
> 


- -- 
/*
Matt Brookings    GnuPG Key 62817373
Software developer Systems technician
Inter7 Internet Technologies, Inc. (815)776-9465
*/
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.22 (GNU/Linux)

iQEcBAEBAgAGBQJV/BXnAAoJEOjQVexigXNzPxkH/jKWMcIwdkpN9xy8OhYHQGuF
+FwowoDJSsEpkJU6flSSWjYvpC0/NJeejzWLWHW0bq7m0ulobpq4z4x4Q7lUlxId
nu7a4+v29qgDw3ccuyIpx+DmgF2DEqi7t/QZlTNeCJ4YzsMBkcUrJI8twoF+RTX/
/8aifV4/+J69V5GrKAMePRIRIaZicVd0NNgLrnaG096r8r7n02jH5G2PTPF0s6Vh
AVaSehh7sxTCBlm8sH08orxLRqRsLakvy3zlxogeLnipJxWLxgQQdkAL8GcfvPIz
LPlXovqegvNtEGrmsAwIP6mXansd0qqC0vTDpUz4ikHXso7ntKHRieHrT4lrevE=
=tzfn
-END PGP SIGNATURE-


Re: [vchkpw] [SPAM] valias remove alias

2015-09-18 Thread Drew Wells

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.



!DSPAM:55fc0d7341552094314991!
diff -uPr vpopmail-5.5.0.orig/vpopmaild.c vpopmail-5.5.0/vpopmaild.c
--- vpopmail-5.5.0.orig/vpopmaild.c 2015-09-18 13:58:22.048093642 +0100
+++ vpopmail-5.5.0/vpopmaild.c  2015-09-18 14:08:11.117095122 +0100
@@ -429,7 +429,7 @@
 return(-2);
   } 
 
-//  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK_MORE);
+//  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK_MORE);
 //  wait_write();
 
   AuthVpw.pw_name = strdup(tmpvpw->pw_name);
@@ -460,7 +460,7 @@
 logged_in = 1;
 
   if(output_type < 2 ) {
-snprintf(WriteBuf,sizeof(WriteBuf), RET_OK_MORE);
+snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK_MORE);
 wait_write();
 
 snprintf(WriteBuf,sizeof(WriteBuf), "vpopmail_dir_bin %s" RET_CRLF, 
VPOPMAIL_DIR_BIN);
@@ -485,10 +485,10 @@
 
 send_user_info();
 
-snprintf(WriteBuf, sizeof(WriteBuf), "." RET_CRLF);
+snprintf(WriteBuf, sizeof(WriteBuf), "%s", "." RET_CRLF);
   }
   else
-snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
 
   return(0);
 }
@@ -525,7 +525,7 @@
 return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   if ((ret=vadduser(TmpUser, TmpDomain, password, TmpUser, USE_POP )) < 0 ) {
 snprintf(WriteBuf,sizeof(WriteBuf),RET_ERR "0.305 %s" RET_CRLF, 
verror(ret));
 return(-1);
@@ -564,7 +564,7 @@
 return(-1);
   }
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   return(0);
 }
 
@@ -626,7 +626,7 @@
   }
   
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   wait_write();
 
   while(fgets(ReadBuf,sizeof(ReadBuf),stdin)!=NULL ) {
@@ -751,7 +751,7 @@
   if ( (ret=vauth_setpw( tmpvpw, TmpDomain )) != 0 ) {
 snprintf(WriteBuf,sizeof(WriteBuf),RET_ERR "0.507 %s" RET_CRLF, 
verror(ret)); 
   } else {
-snprintf(WriteBuf,sizeof(WriteBuf), RET_OK);
+snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK);
   }
 
   return(0);
@@ -787,11 +787,11 @@
 return(-1);
   } 
 
-  snprintf(WriteBuf,sizeof(WriteBuf), RET_OK_MORE);
+  snprintf(WriteBuf,sizeof(WriteBuf), "%s", RET_OK_MORE);
   wait_write();
 
   send_user_info(tmpvpw);
-  snprintf(WriteBuf, sizeof(WriteBuf), "." RET_CRLF);
+  snprintf(WriteBuf, sizeof(WriteBuf), "%s", "." RET_CRLF);
   return(0);
 
 }
@@ -826,120 +826,79 @@
 
   } else {
 
-if ( tmpvpw->pw_gid & NO_PASSWD_CHNG ) {
-  snprintf(WriteBuf, sizeof(WriteBuf), "no_password_change 1" RET_CRLF);
-} else {
-  snprintf(WriteBuf, sizeof(WriteBuf), "no_password_change 0" RET_CRLF);
-}
+snprintf(WriteBuf, sizeof(WriteBuf), "no_password_change %d" RET_CRLF,
+  tmpvpw->pw_gid & NO_PASSWD_CHNG ? 1 : 0);
 wait_write();
 
-if ( tmpvpw->pw_gid & NO_POP ) {
-  snprintf(WriteBuf, sizeof(WriteBuf), "no_pop 1" RET_CRLF);
-} else {
-  snprintf(WriteBuf, sizeof(WriteBuf), "no_pop 0" RET_CRLF);
-}
+snprintf(WriteBuf, sizeof(WriteBuf), "no_pop %d" RET_CRLF,
+  tmpvpw->pw_gid & NO_POP ? 1 : 0);
 wait_write();
 
-if ( tmpvpw->pw_gid & NO_WEBMAIL ) {
-  snprintf(WriteBuf, sizeof(WriteBuf), "no_webmail 1" RET_CRLF);
-} else {
-  snprintf(WriteBuf, sizeof(WriteBuf), "no_webmail 0" RET_CRLF);
-}
+snprintf(WriteBuf, sizeof(WriteBuf), "no_webmail %d" RET_CRLF,
+  tmpvpw->pw_gid & NO_WEBMAIL ? 1 : 0);
 wait_write();
 
-if ( tmpvpw->pw_gid & NO_IMAP ) {
-  snprintf(WriteBuf, sizeof(WriteBuf), "no_imap 1" RET_CRLF);
-} else {
-  snprintf(WriteBuf, sizeof(WriteBuf), "no_imap 0" RET_CRLF);
-}
+snprintf(WriteBuf, sizeof(WriteBuf), "no_imap %d" RET_CRLF,
+  tmpvpw->pw_gid & NO_IMAP ? 1 : 0);
 wait_write();
 
-if ( tmpvpw->pw_gid & BOUNCE_MAIL ) {
-  snprintf(WriteBuf, sizeof(WriteBuf), "bounce_mail 1" RET_CRLF);
-} else {
-  snprintf(WriteBuf, sizeof(WriteBuf), "bounce_mail