Re: [vchkpw] chkuser on relay server , part II
On Mon, 15 Jan 2007, David Chaplin-Loebell wrote: Miki wrote: - so after spending weekend over google ;) I want kindly ask TONIX if he is willing to add smal feature into chkuser 2.0.8, I have idea something like CHECK_EXTERNAL_FILE = 0/1 EXTERNAL_FILE = /bla/bla/list.txt (or even cdb) I second this request-- having this functionality in chkuser would save me a world of trouble. David I have been off the list for a few days and missed this discussion. We have 3 E-Mail servers, 2 of which are backup MX's and 1 master, I wrote a small chkuser-style-server on the master server and a chkuser-style-client for both the MX's. This for us works perfectly and no files have to be migrated from the master to the backup's. The server is very simple (it does not actually use chkuser, but just chkuser style functionality), and the client communicates with this server to validate destination addresses. The client is called using a qmail-check-recipient patch (not sure where it came from, I might have even written it). It may be possible to write the server to use chkuser and have clients on the relay machines.
Re: [vchkpw] The future of valias other topics
On Mon, 8 Jan 2007, John Simpson wrote: On 2007-01-08, at 0602, [EMAIL PROTECTED] wrote: Attached is a patch for 5.4.18 to enable alias line removal from .qmail based aliases and the implementation of alias line removal using the valias command line program. Am I meant to be posting patches here (such as my previous double free problem in vpalias.c) or to another list ? vpopmail-5.4.18-valias.patch here is fine, but you should probably start a new thread instead of replying your message into the middle of an existing one. Ok, noted. I replied in the middle of the existing thread/message because of the mention of 'Complete alias handling' by Rick (not so complete without the ability to remove an alias line using vpalias.c), although I did take on board his comment about 'Full support is available in cdb and MySQL back ends', no harm intended.
Re: [vchkpw] The future of valias other topics
First a quick review of the new features added to the 5.4.18 release: o The option of running a script each time a user or domain is added, deleted or modified. This can be used for sending notification messages, maintaining a list of valid users and what ever else you may need to do. See README.onchange o Complete alias handling. With this version you can add an address to an alias, delete an address from an alias, delete an entire alias, or delete all aliases from a domain. That pretty much takes care of all the possibilities for unordered aliases. Full support is available in cdb and MySQL back ends. The MySQL code can be used as a template for other back ends. Attached is a patch for 5.4.18 to enable alias line removal from .qmail based aliases and the implementation of alias line removal using the valias command line program. Am I meant to be posting patches here (such as my previous double free problem in vpalias.c) or to another list ? diff -uPr vpopmail-5.4.18.orig/configure vpopmail-5.4.18/configure --- vpopmail-5.4.18.orig/configure 2006-12-31 04:41:21.0 + +++ vpopmail-5.4.18/configure 2007-01-05 09:21:29.0 + @@ -6620,19 +6620,19 @@ 1*|y*|Y*) echo $as_me:$LINENO: result: yes 5 echo ${ECHO_T}yes 6 -if test $USE_SQL != 1 -then -{ { echo $as_me:$LINENO: error: valias option is only supported in the SQL authentication modules 5 -echo $as_me: error: valias option is only supported in the SQL authentication modules 2;} - { (exit 1); exit 1; }; } -else +#if test $USE_SQL != 1 +#then +#{ { echo $as_me:$LINENO: error: valias option is only supported in the SQL authentication modules 5 +#echo $as_me: error: valias option is only supported in the SQL authentication modules 2;} +# { (exit 1); exit 1; }; } +#else VALIAS=1 cat confdefs.h _ACEOF #define VALIAS $VALIAS _ACEOF -fi +#fi ;; *) echo $as_me:$LINENO: result: no 5 diff -uPr vpopmail-5.4.18.orig/valias.c vpopmail-5.4.18/valias.c --- vpopmail-5.4.18.orig/valias.c 2006-12-19 21:02:47.0 + +++ vpopmail-5.4.18/valias.c2007-01-05 09:21:29.0 + @@ -37,8 +37,9 @@ #define VALIAS_SELECT 0 #define VALIAS_INSERT 1 -#define VALIAS_DELETE 2 -#define VALIAS_NAMES 3 +#define VALIAS_REMOVE 2 +#define VALIAS_DELETE 3 +#define VALIAS_NAMES 4 int AliasAction; int AliasExists; @@ -116,6 +117,23 @@ } break; + case VALIAS_REMOVE: + /* check to see if it already exists */ + AliasExists = 0; + tmpalias = valias_select( Alias, Domain ); + while (tmpalias != NULL ) { + if (strcmp (tmpalias, AliasLine) == 0) AliasExists = 1; + tmpalias = valias_select_next(); + } + if (AliasExists) { + valias_remove( Alias, Domain, AliasLine ); + } else { + fprintf (stderr, Error: alias %s - %s does not exist.\n, + Email, AliasLine); + vexit(-1); + } + break; + case VALIAS_DELETE: valias_delete( Alias, Domain ); break; @@ -136,6 +154,7 @@ printf( -s ( show aliases, can use just domain )\n); printf( -d ( delete alias )\n); printf( -i alias_line (insert alias line)\n); + printf( -r alias_line (remove alias line)\n); printf(\n); printf(Example: valias -i [EMAIL PROTECTED] [EMAIL PROTECTED]); printf( (adds alias from [EMAIL PROTECTED] to [EMAIL PROTECTED]); @@ -154,7 +173,7 @@ memset(AliasLine, 0, sizeof(AliasLine)); AliasAction = VALIAS_SELECT; - while( (c=getopt(argc,argv,vnsdi:)) != -1 ) { + while( (c=getopt(argc,argv,vnsr:di:)) != -1 ) { switch(c) { case 'v': printf(version: %s\n, VERSION); @@ -165,6 +184,10 @@ case 's': AliasAction = VALIAS_SELECT; break; + case 'r': + AliasAction = VALIAS_REMOVE; + snprintf(AliasLine, sizeof(AliasLine), %s, optarg); + break; case 'd': AliasAction = VALIAS_DELETE; break; diff -uPr vpopmail-5.4.18.orig/vpalias.c vpopmail-5.4.18/vpalias.c --- vpopmail-5.4.18.orig/vpalias.c 2006-12-19 21:02:47.0 + +++ vpopmail-5.4.18/vpalias.c 2007-01-05 09:23:09.0 + @@ -1,3 +1,4 @@ +#ifndef VALIAS /* * $Id: vpalias.c,v 1.6.2.14 2006/12/19 21:02:47 rwidmer Exp $ * Copyright (C) 2000-2004 Inter7 Internet Technologies, Inc. @@ -16,8 +17,6 @@ * along with this
[vchkpw] Vpopmail 5.4.18 bug
Hi, There is a bug in 5.4.18 of Vpopmail where if you (as a programmer) call valias_select_all() twice in the same program on a domain that has no aliases, the second one (for me) gets a glibc double free error and aborts. This occurs when using file based valias functions (vpalias.c). You can get it to break by using vpopmaild and using list_alias on a domain with no aliases. Patch attached. Regards Drew diff -uPr vpopmail-5.4.18.orig/vpalias.c vpopmail-5.4.18/vpalias.c --- vpopmail-5.4.18.orig/vpalias.c 2006-12-19 21:02:47.0 + +++ vpopmail-5.4.18/vpalias.c 2007-01-04 14:25:15.0 + @@ -305,10 +305,13 @@ } } } -if (num_names max_names) { +if (num_names max_names num_names 0) { new_names = realloc( names, num_names * sizeof(char *) ); if (new_names != NULL) names = new_names; +} else if (num_names == 0) { + free(names); + names = NULL; } if (mydir!=NULL) {
Re: [vchkpw] Custom Fields ?
The user directory and the corresponding Maildir is created by vdelivermail if it does not exist (make_user_dir(...) in vpopmail.c called from vdelivermail.c) and does not depend on the backend. On Wed, 13 Dec 2006, Joshua Megerman wrote: On Wednesday 13 December 2006 01:47, Rick Widmer wrote: Joshua Megerman wrote: In my experience, as long as you add new fields AFTER the existing vpopmail fields, you shouldn't have any problems. The order of the fields in the table should not matter. I believe vpopmail always uses explicit lists, so as long as you provide all of the required fields it should be happy. OK, I just looked at the MySQL code (the backend I use, and therefore am familiar with) and you're correct. I don't know if that changed since sometime in 5.3.x, when I first played with extending the DB, but at this point it looks like the columns are explicitly stated in order for all relevant SQL queries, so the order in the DB shouldn't matter. Just don't change the order in the query without changing the code - that I know for certain :) I believe vdelivermail has support for creating the Maildir for a user when the first email comes in. All you have to do is create the database entry and wait for a message. (Maybe the one sent by John's onchange patch.) disclamerI may be wrong, I use cdb./disclamer I believe you are correct - the user dir doesn't get created until the first attempt by vpopmail to either read or write to it (e.g., deliver a message, check via pop3, etc.). I don't think this depends on the backend, as every backend stores the location of the user dir effectively the same way. Josh
Re: [vchkpw] 5.4.17 patches
Tom, The first patch implements .qmail-extension files (and also the -default variations). This is useful for me because it means that any special delivery rules created for a user can all be put in the users own directory, when the user is deleted all the special rules go aswell. As far as the second patch goes, it just implements what I think is a missing feature from the commandline 'valias', and that is the ability to remove a line from an alias (either .qmail file or SQL backend). This patch also removes the SQL only restriction. I know most of the community only want to use SQL backends, I however do not, so I have been patching vpopmail for a while now so the file backend works. While scanning the vpopmaild.c code, I noticed a comment in there that the list_alias and list_lists commands needed re-writing to use the new valias code, this is what I have done. This removes the need for the bkscandir function (although that patch does not remove it). Also the output of these commands does not display the leading .qmail (as the old commands did), this is probably correct for both file and SQL backends. Patches attached :- 1) vpopmail-5.4.13-dot-qmail.patch - Implements .qmail-extension (etc) in the users directory. 2) vpopmail-5.4.13-deliveredto.patch - Some changes to how the Delivered-To: header line is inserted into an E-Mail, this patch is needed to handle E-Mails delivered using the above patch (maildir_to_email can return a blank result). 3) vpopmail-5.4.17-valias.patch - Changes to valias to remove SQL only restriction and implement alias line removal. 4) vpopmail-5.4.17-vpopmaild.patch - Implements list_alias and list_lists commands using the new valias code. Note: I also have a patch which is the same as 1) but does not call the files in the users .qmail, instead calls them .vpopmail files. I personaly prefer .qmail files so vpopmail looks like a qmail installation as far as users are concerned. If there are any bugs in these patches, please let me know. On Mon, 11 Dec 2006, Tom Collins wrote: On Dec 11, 2006, at 3:25 AM, [EMAIL PROTECTED] wrote: I have a patch for implementing personal .qmail files (.qmail files inside the user directory and not just in the domain directory), I also have a variation on this patch to name these .vpopmail files. I also have a patch which implements alias line removal in valias.c (-r flag), removal of SQL aliases only and adding alias line removal in vpalias.c (function valias_remove()). I also have a patch which changes vpopmaild.c to use the new valias code (as requested in vpopmaild.c - as a comment). Does anyone want these patches - I did not want to litter the list with them. I had sent the first one to the list before which while it provoked a discussion got forgotten. I find them all VERY useful. We're definitely interested. I maintain the 5.4 releases, and have 5.4.18 waiting to be released. It includes a lot of changes by Rick Widmer, and patches by Peter Pentchev. I'm not sure I understand the first one though -- vdelivermail and qmailadmin already support a .qmail file in the user's directory. Are you talking about .qmail-extension files? -- Tom Collins - [EMAIL PROTECTED] Vpopmail - virtual domains for qmail: http://vpopmail.sf.net/ QmailAdmin - web interface for Vpopmail: http://qmailadmin.sf.net/ diff -uPr vpopmail-5.4.13.orig/vdelivermail.c vpopmail-5.4.13/vdelivermail.c --- vpopmail-5.4.13.orig/vdelivermail.c 2005-09-02 19:47:29.0 +0100 +++ vpopmail-5.4.13/vdelivermail.c 2005-12-16 15:53:29.0 + @@ -62,6 +62,7 @@ #ifdef QMAIL_EXT /* the User with '-' and following chars out if any */ char TheUserExt[AUTH_SIZE]; +char TheExt[AUTH_SIZE]; #endif #define FILE_SIZE 156 @@ -217,6 +218,11 @@ vexit(EXIT_BOUNCE); } +strncpy(TheExt, TheUser[i+1], AUTH_SIZE); +for (i = 0; (TheExt[i] != 0); i++) { + if (TheExt[i] == '.') TheExt[i] = ':'; +} + #endif vget_assign(TheDomain, TheDomainDir, sizeof(TheDomainDir), TheDomainUid, TheDomainGid); @@ -697,16 +703,36 @@ chdir(dir); +#ifdef QMAIL_EXT /* format the file name */ -if ( (fs = fopen(.qmail,r)) == NULL ) { +if (strlen(TheExt)) { +strcpy(tmpbuf,.qmail-); +strcat(tmpbuf,TheExt); +if ( (fs = fopen(tmpbuf,r)) == NULL ) { +for (i=strlen(TheExt);i=0;--i) { +if (!i || TheExt[i-1]=='-') { +strcpy(tmpbuf,.qmail-); +strncat(tmpbuf,TheExt,i); +strcat(tmpbuf,default); +if ( (fs = fopen(tmpbuf,r)) != NULL) { +break; +} +} +} +} +} else { +fs = fopen(.qmail,r); +} +#else +fs = fopen(.qmail,r); +#endif +/* no .qmail file at all */ +if (fs == NULL ) { /* no file, so
Re: [vchkpw] 5.4.17 patches
Rick, As requested I have attached the .qmail and .vpopmail files in the user directory patch. I do not use this patch but created it a little while ago incase I did want to migrate to using .vpopmail files. As far as I can remember the order of name resolution is as follows :- 1) .qmail-{extension} - Open if exists 2) .vpopmail-{extension} - Open if exists 3) Chop the end off the extension (back to the last '-') 4) .qmail-{extension}-default - Open if exists 5) .vpopmail-{extension}-default - Open if exists 6) Loop back to 3 until the extension is empty 7) If no file got opened from 1-6 then just bail, otherwise follow the instructions in the opened file. You do still need to combine this patch with the deleiveredto patch (from my previous email) to get it all to work properly. As far as maintaining the order in .qmail file using valias, I am pretty sure that they are maintained in .qmail files. As far as the SQL is concerned I am not sure (I don't use SQL), do you want me to look into this ? On Tue, 12 Dec 2006, Rick Widmer wrote: [EMAIL PROTECTED] wrote: Patches attached :- 1) vpopmail-5.4.13-dot-qmail.patch - Implements .qmail-extension (etc) in the users directory. Nice. 3) vpopmail-5.4.17-valias.patch - Changes to valias to remove SQL only restriction and implement alias line removal. Very nice! 4) vpopmail-5.4.17-vpopmaild.patch - Implements list_alias and list_lists commands using the new valias code. Very nice! As far as the second patch goes, it just implements what I think is a missing feature from the commandline 'valias', and that is the ability to remove a line from an alias (either .qmail file or SQL backend). This patch also removes the SQL only restriction. Next we need the ability to guarantee the order of the lines in both .qmail and SQL back ends... I know most of the community only want to use SQL backends, I however do not, so I have been patching vpopmail for a while now so the file backend works. I'm not so sure about most. I use cdb, and so does everyone else that uses the Shupp toaster as written. While scanning the vpopmaild.c code, I noticed a comment in there that the list_alias and list_lists commands needed re-writing to use the new valias code, this is what I have done. This removes the need for the bkscandir function (although that patch does not remove it). Also the output of these commands does not display the leading .qmail (as the old commands did), this is probably correct for both file and SQL backends. THANKS! Note: I also have a patch which is the same as 1) but does not call the files in the users .qmail, instead calls them .vpopmail files. I personaly prefer .qmail files so vpopmail looks like a qmail installation as far as users are concerned. I have mixed feelings about this. I'm sure Charles Cazabon on the qmail list would rejoice if we did this. On the other hand we seem to be moving towards having all the functionality of .qmail files built into vdelivermail, which would also take care of his objections. The best solution would probably be to read both .vpopmail and .qmail files in the user directories, and start naming files executed by vdelivermail .vpopmail. I'd like to see this patch... If there are any bugs in these patches, please let me know. I hope to find some time this weekend. There are a number of features I've wished for for quite some time... THANKS! Rick diff -uPr vpopmail-5.4.13.orig/vdelivermail.c vpopmail-5.4.13/vdelivermail.c --- vpopmail-5.4.13.orig/vdelivermail.c 2005-09-02 19:47:29.0 +0100 +++ vpopmail-5.4.13/vdelivermail.c 2005-12-16 21:39:15.0 + @@ -62,6 +62,7 @@ #ifdef QMAIL_EXT /* the User with '-' and following chars out if any */ char TheUserExt[AUTH_SIZE]; +char TheExt[AUTH_SIZE]; #endif #define FILE_SIZE 156 @@ -217,6 +218,11 @@ vexit(EXIT_BOUNCE); } +strncpy(TheExt, TheUser[i+1], AUTH_SIZE); +for (i = 0; (TheExt[i] != 0); i++) { + if (TheExt[i] == '.') TheExt[i] = ':'; +} + #endif vget_assign(TheDomain, TheDomainDir, sizeof(TheDomainDir), TheDomainUid, TheDomainGid); @@ -697,16 +703,48 @@ chdir(dir); +#ifdef QMAIL_EXT /* format the file name */ -if ( (fs = fopen(.qmail,r)) == NULL ) { +if (strlen(TheExt)) { +strcpy(tmpbuf,.qmail-); +strcat(tmpbuf,TheExt); +if ( (fs = fopen(tmpbuf,r)) == NULL ) { +strcpy(tmpbuf,.vpopmail-); +strcat(tmpbuf,TheExt); +if ( (fs = fopen(tmpbuf,r)) == NULL ) { +for (i=strlen(TheExt);i=0;--i) { +if (!i || TheExt[i-1]=='-') { +strcpy(tmpbuf,.qmail-); +strncat(tmpbuf,TheExt,i); +strcat(tmpbuf,default); +if ( (fs = fopen(tmpbuf,r)) != NULL) { +
[vchkpw] 5.4.17 patches
I have a patch for implementing personal .qmail files (.qmail files inside the user directory and not just in the domain directory), I also have a variation on this patch to name these .vpopmail files. I also have a patch which implements alias line removal in valias.c (-r flag), removal of SQL aliases only and adding alias line removal in vpalias.c (function valias_remove()). I also have a patch which changes vpopmaild.c to use the new valias code (as requested in vpopmaild.c - as a comment). Does anyone want these patches - I did not want to litter the list with them. I had sent the first one to the list before which while it provoked a discussion got forgotten. I find them all VERY useful.
[vchkpw] Per user .qmail files patch for 5.4.15
Just in case anyone was using them attached are the patches for 5.4.15 to enable per-user .qmail files. I use per user .qmail files in a live environment so have to do these patch files anyway. diff -uPr vpopmail-5.4.15.orig/vdelivermail.c vpopmail-5.4.15/vdelivermail.c --- vpopmail-5.4.15.orig/vdelivermail.c 2005-11-19 16:24:22.0 + +++ vpopmail-5.4.15/vdelivermail.c 2006-03-14 15:51:31.0 + @@ -62,6 +62,7 @@ #ifdef QMAIL_EXT /* the User with '-' and following chars out if any */ char TheUserExt[AUTH_SIZE]; +char TheExt[AUTH_SIZE]; #endif #define FILE_SIZE 156 @@ -217,6 +218,11 @@ vexit(EXIT_BOUNCE); } +strncpy(TheExt, TheUser[i+1], AUTH_SIZE); +for (i = 0; (TheExt[i] != 0); i++) { + if (TheExt[i] == '.') TheExt[i] = ':'; +} + #endif vget_assign(TheDomain, TheDomainDir, sizeof(TheDomainDir), TheDomainUid, TheDomainGid); @@ -698,14 +704,34 @@ chdir(dir); /* format the file name */ -if ( (fs = fopen(.qmail,r)) == NULL ) { - -/* no file, so just return */ -return(-1); +#ifdef QMAIL_EXT +if (strlen(TheExt)) { + strcpy(tmpbuf,.qmail-); + strcat(tmpbuf,TheExt); + if ( (fs = fopen(tmpbuf,r)) == NULL ) { + for (i = strlen(TheExt);i=0;i--) { + if (!i || TheExt[i-1]=='-') { + strcpy(tmpbuf,.qmail-); + strncat(tmpbuf,TheExt,i); + strcat(tmpbuf,default); + if ( (fs = fopen(tmpbuf,r)) != NULL ) { + break; + } + } + } + } +} else { + fs = fopen(.qmail,r); } +#else +fs = fopen(.qmail,r); +#endif -/* format a simple loop checker name */ -snprintf(tmpbuf, sizeof(tmpbuf), [EMAIL PROTECTED], TheUser, TheDomain); +/* no .qmail file at all */ +if (fs == NULL) { + /* no file, so just return */ + return(-1); +} /* read the file, line by line */ while ( fgets(qmail_line, sizeof(qmail_line), fs ) != NULL ) { @@ -719,14 +745,6 @@ if (qmail_line[i] == '\n') qmail_line[i] = 0; } -/* simple loop check, if they are sending it to themselves - * then skip this line - */ -if ( strcmp( qmail_line, tmpbuf) == 0 ) continue; -/* check for [EMAIL PROTECTED] as well */ -if ((*qmail_line == '') (strcmp (qmail_line + 1, tmpbuf) == 0)) -continue; - deliver_mail(qmail_line, ); return_value = 1; diff -uPr vpopmail-5.4.15.orig/vdelivermail.c vpopmail-5.4.15/vdelivermail.c --- vpopmail-5.4.15.orig/vdelivermail.c 2006-03-14 15:51:31.0 + +++ vpopmail-5.4.15/vdelivermail.c 2006-03-14 15:59:07.0 + @@ -505,6 +505,7 @@ FILE *fs; char tmp_file[256]; char maildirquota[80]; + char *email; /* This is a comment, ignore it */ if ( *address == '#' ) return; @@ -603,15 +604,19 @@ } #endif + /* Get the email address from the maildir */ + email = maildir_to_email(address); + /* Set the Delivered-To: header */ -if ( strcmp( address, bounce) == 0 ) { +if ( strcmp( address, bounce ) == 0 || +strcmp( email, ) == 0 ) { snprintf(DeliveredTo, sizeof(DeliveredTo), %sDelivered-To: [EMAIL PROTECTED], getenv(RPLINE), TheUser, TheDomain); } else { snprintf(DeliveredTo, sizeof(DeliveredTo), %sDelivered-To: %s\n, getenv(RPLINE), -maildir_to_email(address)); +email); } switch (deliver_to_maildir (address, DeliveredTo, 0, message_size)) {
[vchkpw] Re: vpopmail-5.4.13
I could not figure out why only MySQL can now be used for valias only, so I just created a patch to 5.4.13 to remove this check (I still use valias in the form of .qmail files). Patch attached. diff -uPr vpopmail-5.4.13.orig/configure vpopmail-5.4.13/configure --- vpopmail-5.4.13.orig/configure 2005-09-17 00:37:34.0 +0100 +++ vpopmail-5.4.13/configure 2005-10-21 13:45:43.0 +0100 @@ -6584,19 +6584,19 @@ 1*|y*|Y*) echo $as_me:$LINENO: result: yes 5 echo ${ECHO_T}yes 6 -if test $USE_MYSQL != 1 -then -{ { echo $as_me:$LINENO: error: valias is only supported in the MySQL authentication module 5 -echo $as_me: error: valias is only supported in the MySQL authentication module 2;} - { (exit 1); exit 1; }; } -else +#if test $USE_MYSQL != 1 +#then +#{ { echo $as_me:$LINENO: error: valias is only supported in the MySQL authentication module 5 +#echo $as_me: error: valias is only supported in the MySQL authentication module 2;} +# { (exit 1); exit 1; }; } +#else VALIAS=1 cat confdefs.h _ACEOF #define VALIAS $VALIAS _ACEOF -fi +#fi ;; *) echo $as_me:$LINENO: result: no 5