Skip to contentSkip to conversation

qmail+vpopmail support

PATCH Applied Fabio Busatto 3 participants 10 messages May 3, 2006 – Sep 26, 2006

lore
Share & tools
lore
#0 lore raw

Hi, I've tested patch-mlmmj-listcontrol_env with qmail, and I wrote a supplementary patch for it.

The problem is that the patch works with the qmail standard installation, but quite all installations use vpopmail as virtual domain manager, and the patch doesn't work with it.

The EXT environment variable infact contains the username section after the first delimiter, but with vpopmail we have a rewrite of the address like this:

[email protected] -> [email protected]

So, EXT contains the username (and not the extension). The real extension is stored in the DEFAULT environment variable, in both qmail and vpopmail scenarios. But the problem is that DEFAULT is too common name to be sure that it contains really an extension, so the solution is to check for the value in DEFAULT, and to compare it with the value in the EXT environment variabile (qmail), or in the EXT2 environment variable (qmail+vpopmail). If it matches, we can assume that it contains an extension.

The patch also includes README.qmail, with explaination of how mlmmj should be configured with qmail and a short configuration example for vpopmail users.

This code has been tested in production environment (so I can say that it works for me), but should not to be marked stable until it will be applied in the mlmmj official release.

Bye
Fabio

README.qmail +64 -0
diff -uNr mlmmj-1.2.11-orig/README.qmail mlmmj-1.2.11/README.qmail
@@ -0,0 +1,64 @@
+|------------------------------------------------------------------------------|
+|                     Using mlmmj with qmail (and vpopmail)                    |
+|------------------------------------------------------------------------------|
+|--------------- Fabio Busatto <[email protected]> --------------|
+|------------------------------------------------------------------------------|
+
+This mini-HOWTO is a step-by-step guide for using mlmmj with qmail MTA
+(http://www.qmail.org/), and it has been successfully tested also with vpopmail
+virtual domains (http://www.inter7.com/vpopmail/).
+
+Prerequisites:
+- qmail (and vpopmail) correctly installed
+- mlmmj correctly installed
+
+Conventions:
+- ${BINDIR}: directory with mlmmj binary files (/usr/local/bin/)
+- ${LISTDIR}: directory with list configuration files
+              (/var/spool/mlmmj/listname)
+- ${DQFILE}: dot-qmail file (see below)
+
+Configuration:
+- the first thing you've to do is to create the list, using the
+  mlmmj-make-ml.sh script (follow the classic procedure to do this step)
+- enter the control directory for the list (${LISTDIR}/control/), and execute
+  the following command:
+   # cd ${LISTDIR}/control/; echo '-' > delimiter
+- chown and chmod the file according to the mlmmj configuration
+- create dot-qmail files for the list to handle direct requests and extensions:
+   # echo -e "|${BINDIR}/mlmmj-recieve -L ${LISTDIR}" > ${DQFILE}
+- chown and chmod the files according to the qmail (and vpopmail) configuration
+
+WARNING: REMEMBER that the delimiter is -, so do not use + when composing mail
+addresses for extensions!!!
+
+WARNING: DO NOT USE 'preline' command in dot-qmail files, it will result in
+mlmmj to not work properly!!!
+
+|------------------------------------------------------------------------------|
+
+Example:
+
+- Configuring mlmmj to handle [email protected] mailing list using qmail as
+  MTA and vpopmail for virtual domain support:
+
+# mlmmj-make-ml.sh -c vpopmail:vchkpw -L ml
+Creating Directorys below /var/spool/mlmmj. Use '-s spooldir' to change
+The Domain for the List? [] : programmazione.it
+The emailaddress of the list owner? [postmaster] : [email protected]
+The path to texts for the list? [/usr/local/share/mlmmj/text.skel] :
+chown -R vpopmail:vchkpw /var/spool/mlmmj/ml? [y/n]: y
+
+# cd /var/spool/mlmmj/ml/control/
+# echo '-' > delimiter
+# chown vpopmail:vchkpw delimiter
+# cd /home/vpopmail/domains/programmazione.it/
+# echo -e "|/usr/local/bin/mlmmj-recieve -L /var/spool/mlmmj/ml/" > .qmail-ml
+# cp -a .qmail-ml .qmail-ml-default
+# cat *-default
+# chown vpopmail:vchkpw .qmail-ml .qmail-ml-default
+# chmod 600 .qmail-ml .qmail-ml-default
+
+|------------------------------------------------------------------------------|
+|--------------- Fabio Busatto <[email protected]> --------------|
+|------------------------------------------------------------------------------|
src/mlmmj-process.c +4 -1
diff -uNr mlmmj-1.2.11-orig/src/mlmmj-process.c mlmmj-1.2.11/src/mlmmj-process.c
@@ -542,7 +542,10 @@
 	}
 
 	/* address extension (the "foo" part of "[email protected]") */
-	if((envstr = getenv("EXT")) != NULL) {
+	if(((envstr = getenv("DEFAULT")) != NULL) && (getenv("EXT2") != NULL) && (strcmp(envstr, getenv("EXT2")) == 0)) {
+		/* qmail+vpopmail */
+		recipextra = mystrdup(envstr);
+	} else if(((envstr = getenv("DEFAULT")) != NULL) && (getenv("EXT") != NULL) && (strcmp(envstr, getenv("EXT")) == 0)) {
 		/* qmail */
 		recipextra = mystrdup(envstr);
 	} else if((envstr = getenv("EXTENSION")) != NULL) {
#1 lore raw

Hi Fabio,

Quoted 2 lines · Fabio Busatto

Hi, I've tested patch-mlmmj-listcontrol_env with qmail, and I wrote a supplementary patch for it.

Your patch looks good.

I have applied it, and the new listcontrol_env patch (with your changes) is attached to this mail.

So everybody... please test the patch, and give me a Go/NoGo on the following platforms:
- sendmail, vanilla
- sendmail, with the patch in mlmmj/README.sendmail
- postfix 1.x
- postfix 2.x
- exim3 (does mlmmj work here at all?)
- exim4, as described in mlmmj/README.exim4
- exim4, without headers_add and return_path_add

Morten

Signature · 2 lines
Morten K. Poulsen <[email protected]>
http://www.afdelingp.dk/
include/listcontrol.h +1 -1
diff -urN orig-mlmmj-1.2.11/include/listcontrol.h mlmmj-1.2.11/include/listcontrol.h
@@ -27,7 +27,7 @@
 #include "find_email_adr.h"
 
 int listcontrol(struct email_container *fromemails, const char *listdir,
-		const char *controladdr, const char *mlmmjsub,
+		const char *controlstr, const char *mlmmjsub,
 		const char *mlmmjunsub, const char *mlmmjsend,
 		const char *mlmmjbounce, const char *mailname);
 
src/listcontrol.c +3 -17
diff -urN orig-mlmmj-1.2.11/src/listcontrol.c mlmmj-1.2.11/src/listcontrol.c
@@ -98,15 +98,14 @@
 
 
 int listcontrol(struct email_container *fromemails, const char *listdir,
-		const char *controladdr, const char *mlmmjsub,
+		const char *controlstr, const char *mlmmjsub,
 		const char *mlmmjunsub, const char *mlmmjsend,
 		const char *mlmmjbounce, const char *mailname)
 {
-	char *atsign, *recipdelimsign, *listdelim, *bouncenr, *tmpstr;
-	char *controlstr, *param = NULL, *conffilename, *moderatefilename;
+	char *bouncenr, *tmpstr;
+	char *param = NULL, *conffilename, *moderatefilename;
 	char *c, *archivefilename, *sendfilename;
 	const char *subswitch;
-	size_t len;
 	struct stat stbuf;
 	int closedlist, nosubconfirm, tmpfd, noget, i, closedlistsub,
 	    subonlyget = 0;
@@ -126,18 +125,6 @@
 	else
 		subswitch = "-C";
 	
-	listdelim = getlistdelim(listdir);
-	recipdelimsign = strstr(controladdr, listdelim);
-	MY_ASSERT(recipdelimsign);
-	atsign = index(controladdr, '@');
-	MY_ASSERT(atsign);
-	len = atsign - recipdelimsign;
-
-	controlstr = mymalloc(len);
-	MY_ASSERT(controlstr);
-	snprintf(controlstr, len, "%s", recipdelimsign + strlen(listdelim));
-	myfree(listdelim);
-
 #if 0
 	log_error(LOG_ARGS, "controlstr = [%s]\n", controlstr);
 	log_error(LOG_ARGS, "fromemails->emaillist[0] = [%s]\n",
@@ -168,7 +155,6 @@
 				exit(EXIT_SUCCESS);
 			}
 
-			myfree(controlstr);
 			break;
 
 		}
src/mlmmj-process.c +114 -58

228 lines not on this page · raw message

README.qmail +64 -0

64 lines not on this page · raw message

#2 lore raw
In reply to Fabio Busatto
Quoted 7 lines · Fabio Busatto

Hi, I've tested patch-mlmmj-listcontrol_env with qmail, and I wrote a supplementary patch for it.

The problem is that the patch works with the qmail standard installation, but quite all installations use vpopmail as virtual domain manager, and the patch doesn't work with it.

Could you explain exactly WHY you need vpopmail? It's a very common mistake to think that Qmail don't handle virtual domains without it, but in fact IT DOES. Vpopmail does 2 things: 1/ doing that stupid virtual domain stuff which is not needed, and 2/ an alternative auth thing that is not needed as well when you see the number of alternative checkpassword binaries available. I really think that vpopmail survives only because many think it's needed, because of the bad advertising Inter7 is doing, which I think is a very silly stuff. I just hope that no MLMMJ patch will break my vpopmail-free configuration.

Quoted 6 lines

The EXT environment variable infact contains the username section after the first delimiter, but with vpopmail we have a rewrite of the address like this:

[email protected] -> [email protected]

Under my configuration it's:
[email protected] -> [email protected]

In fact, it could be:
[email protected] -> [email protected]

as Qmail permit it using the virtualdomains configuration file.

Quoted 11 lines

So, EXT contains the username (and not the extension). The real extension is stored in the DEFAULT environment variable, in both qmail and vpopmail scenarios. But the problem is that DEFAULT is too common name to be sure that it contains really an extension, so the solution is to check for the value in DEFAULT, and to compare it with the value in the EXT environment variabile (qmail), or in the EXT2 environment variable (qmail+vpopmail). If it matches, we can assume that it contains an extension.

I'm happy to learn that.

Quoted 4 lines

+Prerequisites:

+- qmail (and vpopmail) correctly installed
+- mlmmj correctly installed

Can it be used WITHOUT vpopmail? IMHO it shouldn't be REQUIRED.

README.qmail line 36

Quoted 3 lines
README.qmail +2 -0
+WARNING: DO NOT USE 'preline' command in dot-qmail files, it will result in
+mlmmj to not work properly!!!

I DO use the preline in the binary I use, and it works !!! Here is my .qmail-default file content:

|preline -f /usr/bin/mlmmj-recieve -L /var/www/sites/dtc/gplhost.sg/lists/gplhost.sg_dtcdev

Kind regards,

Thomas

#3 lore raw
In reply to Fabio Busatto
Quoted 5 lines · Thomas Goirand

Under my configuration it's:
[email protected] -> [email protected]

In fact, it could be:
[email protected] -> [email protected]

Right, I only consider the vpopmail virtualdomains configuration, but there are other scenarios (like yours).

Quoted 5 lines
Quoted 4 lines

+Prerequisites:

+- qmail (and vpopmail) correctly installed
+- mlmmj correctly installed

Can it be used WITHOUT vpopmail? IMHO it shouldn't be REQUIRED.

vpopmail in brackets means that it's optional. I wrote the patch to support both bare qmail (without virtualdomains) and qmail+vpopmail.

Quoted 9 lines
Quoted 4 lines

+WARNING: DO NOT USE 'preline' command in dot-qmail files, it will result in
+mlmmj to not work properly!!!

I DO use the preline in the binary I use, and it works !!! Here is my .qmail-default file content:

|preline -f /usr/bin/mlmmj-recieve -L /var/www/sites/dtc/gplhost.sg/lists/gplhost.sg_dtcdev

Good :) I found that preline breaks mlmmj under my configuration, but I didn't investigate too much. To be analyzed.

Maybe the final solution to support qmail is to consider the DEFAULT environment variable, without care if this is not a real extension value.

I'll be back on code and try to include more scenarios to better support virtualdomains.

Thank you for your feedback!

-fabio

Signature · 1 line
Fabio Busatto <[email protected]>
#4 lore raw
In reply to Fabio Busatto

I finally reached the conclusion that DEFAULT is the right place to look for real extension commands.
Every configuration i found uses .qmail files to manage the mlmmj list.
By the way, DEFAULT is too common and can create a collision with other MTA (really?).

So, two ways:
- use DEFAULT instead of EXT when looking for extension
- set another environment variabile using .qmail file, and then check it

The first solution is clean, but maybe lacks of protection that can do mlmmj thinking to qmail even if it's not. The second is safer, but more complex to configure (each list must have variable setting in the .qmail file.

Any ideas? Which one do you think is better?
Waiting for comments.

-fabio

Signature · 1 line
Fabio Busatto <[email protected]>
#5 lore raw
In reply to Fabio Busatto

Hi,

Quoted 4 lines · Fabio Busatto

So, two ways:
- use DEFAULT instead of EXT when looking for extension
- set another environment variabile using .qmail file, and then check it

The idea of adding qmail support was to get it working out of the box. I think it is safe, if we check for DEFAULT as the last thing before falling back to reading headers.

Morten

Signature · 2 lines
Morten K. Poulsen <[email protected]>
http://www.afdelingp.dk/
#6 lore raw
In reply to Fabio Busatto
Quoted 1 line · Morten K. Poulsen

I think it is safe, if we check for DEFAULT as the last thing before falling back to reading headers.

I agree, can you merge your new patch with README.qmail and sumbit when ready? Thanks for your work :)

-fabio

#7 lore raw
In reply to Fabio Busatto
Quoted 2 lines · Morten K. Poulsen

The idea of adding qmail support was to get it working out of the box. I think it is safe, if we check for DEFAULT as the last thing before falling back to reading headers.

I just downloaded the last mlmmj release, and I noticed that it still checks for EXT environment variable instead of DEFAULT (needed to support virtual domains in qmail).

Patch missed?

Bye
-fabio

#8 lore raw
In reply to Fabio Busatto

Hi Fabio,

Quoted 5 lines · Fabio Busatto

I just downloaded the last mlmmj release, and I noticed that it still checks for EXT environment variable instead of DEFAULT (needed to support virtual domains in qmail).

Patch missed?

Yes, I forgot all about that. I have just committed the following to CVS. That should fix the issue, right?

- if((envstr = getenv("EXT")) != NULL) {
+ if((envstr = getenv("DEFAULT")) != NULL) {

Morten

Signature · 2 lines
Morten K. Poulsen <[email protected]>
http://www.afdelingp.dk/
#9 lore raw
In reply to Fabio Busatto

Review

Quoted 5 lines · Morten K. Poulsen

Yes, I forgot all about that. I have just committed the following to CVS. That should fix the issue, right?

(quoted diff) +1 -1
-       if((envstr = getenv("EXT")) != NULL) {
+       if((envstr = getenv("DEFAULT")) != NULL) {

Right :)

-fabio