Qmail-home and qmail-queue configuration (was Re: Next steps for ezmlm-idx)
Tullio Andreatta ML <[email protected]> Mon, 15 Sep 2008 10:08:46 +0200
| Newsgroups | gmane.mail.ezmlm |
|---|---|
| Organization | Wave Technologies S.r.l. |
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--------------080607040900040406040101
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Bruce Guenter wrote:
> On Fri, Sep 12, 2008 at 02:13:10AM -0500, Kyle Wheeler wrote:
>> For example, in one of my .qmail-listname-default files, I have lines for
>> ezmlm-get, ezmlm-request, ezmlm-manage, and ezmlm-warn, each of which needs
>> to have QMAILQUEUE defined. It would be nicer if I could just put the
>> QMAILQUEUE value into, say listfolder/qmailqueue or something like that.
>
> That would be easy enough. Just modify qmail.c to do
> getconf("qmailqueue"...) before forking, and use it if $QMAILQUEUE isn't
> set later (hint: patches are welcome).
>
Patch attached (sorry, no heavily tested ...)
Usage:
echo >DIR/qmailqueue bin/my-customized-qmail-queue
and/or
echo >DIR/qmailhome /var/qmail-for-ezmlm
--
Tullio Andreatta
09:f9:11:02:9d:74:e3:5b:d8:41:56:c5:63:56:88:c0
45:5f:e1:04:22:ca:29:c4:93:3f:95:05:2b:79:2a:b2
Disclaimer: "Please treat this email message in a reasonable way, or we
might get angry" ( http://www.goldmark.org/jeff/stupid-disclaimers )
--------------080607040900040406040101
Content-Type: text/plain;
name="ezmlm-idx-7.0.0-qmail.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="ezmlm-idx-7.0.0-qmail.patch"
diff -urN -x tags ezmlm-idx-7.0.0.orig/Makefile ezmlm-idx-7.0.0/Makefile
--- ezmlm-idx-7.0.0.orig/Makefile 2008-06-16 18:03:51.000000000 +0200
+++ ezmlm-idx-7.0.0/Makefile 2008-09-15 10:41:00.000000000 +0200
@@ -158,7 +158,7 @@
./libcompile concatHDR.c
config.lo: \
-libcompile config.c byte.h config.h stralloc.h gen_alloc.h die.h hasattribute.h messages.h getconf.h idx.h slurp.h strerr.h hasattribute.h wrap.h
+libcompile config.c byte.h config.h stralloc.h gen_alloc.h die.h hasattribute.h messages.h getconf.h idx.h slurp.h strerr.h hasattribute.h wrap.h auto_qmail.h
./libcompile config.c
constmap.lo: \
@@ -1153,7 +1153,7 @@
./libcompile qmail_copy.c
qmail.lo: \
-libcompile qmail.c substdio.h readwrite.h wait.h env.h str.h exit.h fork.h fd.h qmail.h substdio.h stralloc.h gen_alloc.h auto_qmail.h alloc.h stralloc.h gen_alloc.h idx.h
+libcompile qmail.c substdio.h readwrite.h wait.h env.h str.h exit.h fork.h fd.h qmail.h substdio.h stralloc.h gen_alloc.h config.h alloc.h stralloc.h gen_alloc.h idx.h
./libcompile qmail.c
quote.lo: \
diff -urN -x tags ezmlm-idx-7.0.0.orig/config.c ezmlm-idx-7.0.0/config.c
--- ezmlm-idx-7.0.0.orig/config.c 2008-06-16 18:03:49.000000000 +0200
+++ ezmlm-idx-7.0.0/config.c 2008-09-15 10:51:16.000000000 +0200
@@ -1,6 +1,7 @@
#include <unistd.h>
#include "byte.h"
#include "config.h"
+#include "auto_qmail.h"
#include "die.h"
#include "messages.h"
#include "getconf.h"
@@ -25,6 +26,8 @@
stralloc local = {0};
stralloc outhost = {0};
stralloc outlocal = {0};
+stralloc qmailhome = {0};
+stralloc qmailqueue = {0};
char flagcd = '\0'; /* No transfer encoding by default */
static struct flag flags[NO_FLAGS] = {
{ 1, "archived" }, /* a By default, list is archived */
@@ -111,6 +114,20 @@
if (!stralloc_0(&charset)) die_nomem();
}
+void startup_qmail(void) {
+ if (!qmailhome.s)
+ if (!getconf_line(&qmailhome,"qmailhome",0)) {
+ if (!stralloc_copys(&qmailhome, auto_qmail)) die_nomem();
+ if (!stralloc_0(&qmailhome)) die_nomem();
+ }
+
+ if (!qmailqueue.s)
+ if (!getconf_line(&qmailqueue,"qmailqueue",0)) {
+ if (!stralloc_copys(&qmailqueue, PROG_QMAIL_QUEUE)) die_nomem();
+ if (!stralloc_0(&qmailqueue)) die_nomem();
+ }
+}
+
void startup(const char *dir)
{
if (dir == 0)
diff -urN -x tags ezmlm-idx-7.0.0.orig/config.h ezmlm-idx-7.0.0/config.h
--- ezmlm-idx-7.0.0.orig/config.h 2008-06-16 18:03:49.000000000 +0200
+++ ezmlm-idx-7.0.0/config.h 2008-09-15 10:47:32.000000000 +0200
@@ -11,9 +11,12 @@
extern stralloc local;
extern stralloc outhost;
extern stralloc outlocal;
+extern stralloc qmailhome;
+extern stralloc qmailqueue;
extern char flagcd;
extern int flag_isset(char flag);
extern void startup(const char *dir);
+extern void startup_qmail(void);
#endif
diff -urN -x tags ezmlm-idx-7.0.0.orig/qmail.c ezmlm-idx-7.0.0/qmail.c
--- ezmlm-idx-7.0.0.orig/qmail.c 2008-06-16 18:03:51.000000000 +0200
+++ ezmlm-idx-7.0.0/qmail.c 2008-09-15 10:47:36.000000000 +0200
@@ -8,7 +8,7 @@
#include "fork.h"
#include "fd.h"
#include "qmail.h"
-#include "auto_qmail.h"
+#include "config.h"
#include "alloc.h"
#include "stralloc.h"
#include "idx.h"
@@ -26,6 +26,7 @@
qq->msgbytes = 0L;
if (pipe(pim) == -1) return -1;
if (pipe(pie) == -1) { close(pim[0]); close(pim[1]); return -1; }
+ startup_qmail();
switch(qq->pid = fork()) {
case -1:
@@ -38,7 +39,7 @@
if (fd_move(0,pim[0]) == -1) _exit(120);
if (fd_move(1,pie[0]) == -1) _exit(120);
if ((cp = env_get("QMAILHOME")) == 0)
- cp = auto_qmail;
+ cp = qmailhome.s;
if (chdir(cp) == -1) _exit(61);
if ((cp = env_get("QMAILQUEUE")) != 0)
binqqargs[0] = cp;
@@ -59,7 +60,8 @@
cpp[j] = (char *) 0;
execv(*cpp,(char**)cpp);
_exit(120);
- }
+ } else
+ binqqargs[0] = qmailqueue.s;
execv(*binqqargs,(char**)binqqargs);
_exit(120);
}
--------------080607040900040406040101--