Heres a patch for 5.4.17 - I've been running this for a while now.
Basically, run the deliver command after the tempfile is created (to
verify delivery and quota) then unlink the tempfile and return. I
tried to make it all fancy with build options, then figured I was the
only one who would do it this wacky way. :)
This version passes the home directory to deliver, so you don't need
to run the dovecot lookup service.
I also had to specify the timezone to get the correct timestamp for
some reason.
Rick
Quoting Alessio Cecchi <ales...@skye.it>:
As many users of vpopmail we switched to dovecot for POP and IMAP.
I would like to switch also from maildrop to dovecot-lda. Many
configuration are possibile but the best way is to patch
vdelivermail to use dovecot-lda directly.
Has anyone solved the problem?
If someone wants to write a patch for me, I am willing to make a bid.
Thanks
--
Alessio Cecchi is:
@ ILS -> http://www.linux.it/~alessice/
on LinkedIn -> http://www.linkedin.com/in/alessice
Assistenza Sistemi GNU/Linux -> http://www.cecchi.biz/
@ PLUG -> ex-Presidente, adesso senatore a vita, http://www.prato.linux.it
--- vdelivermail.c 2009-05-18 19:13:17.000000000 -0500
+++ vdelivermail.c.dovecot 2010-12-10 08:34:33.444212000 -0600
@@ -411,7 +411,8 @@
size_t headerlen;
int write_fd;
char quota[80];
-
+ char home[150];
+ //char *cmd[] = { "|/usr/local/libexec/dovecot/deliver", "", (char *)0 };
headerlen = strlen (extra_headers);
msgsize += headerlen;
@@ -426,7 +427,19 @@
maildir, tm, pid, hostname, (long unsigned) msgsize);
read_quota_from_maildir (maildir, quota, sizeof(quota));
+// #ifdef DELIVER_STDOUT
+ /* export HOME environment variable - strip /Maildir/ */
+ if ( putenv(home) == -1 ) {
+ printf(
+ "putenv(HOME) failed errno %d %s@%s",
+ errno, TheUser, TheDomain);
+ return -1;
+ }
+ sprintf(home,"|/usr/bin/env -i HOME=%s TZ=CST
/usr/local/libexec/dovecot/deliver",vpw->pw_dir);
+ // run_command(home);
+ // return 0;
+// #else
/* open the new email file */
if ((write_fd=open(local_file_tmp, O_CREAT|O_RDWR,
S_IRUSR|S_IWUSR)) == -1) {
if (errno == EDQUOT) return -1;
@@ -450,6 +463,12 @@
}
/* completed write to tmp directory, now move it into the new
directory */
+ // Scratch that - pipe to Dovecot deliver and remove tmp file
(quota check)
+
+ close(write_fd);
+ unlink (local_file_tmp);
+ run_command(home);
+ return 0;
/* sync the data to disk and close the file */
errno = 0;
@@ -487,6 +506,7 @@
/* return failure (sync/close failed, message NOT delivered) */
return -2;
+//#endif
}
/*
!DSPAM:5060615234212177865488!