I modified vdelivermail.c and added an IFDEF.

The below needs help - it works on FreeBSD, but is not dyanmic. There needs to be ifdefs around specific variable declarations, a location variable for the deliver and env binaries, and configure support for both the defines and the binary locations.. just to start.


--- ../vpopmail-5.4.17/vdelivermail.c   Thu Jun 29 14:36:43 2006
+++ vdelivermail.c      Mon May 18 19:55:58 2009
@@ -409,9 +409,10 @@
   char local_file_tmp[FILE_SIZE];
   char local_file_new[FILE_SIZE];
   size_t headerlen;
-  int write_fd;
+  //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,40 @@
         maildir, tm, pid, hostname, (long unsigned) msgsize);

     read_quota_from_maildir (maildir, quota, sizeof(quota));
+    /* export HOME environment variable - strip /Maildir/ */

+  /* Now HOME */
+//  snprintf (envbuf2, sizeof(envbuf2), "%s%s", VCHKPW_HOME, pw_dir);
+//    putenv(home);
+  sprintf(home, "HOME=%s", vpw->pw_dir);
+//  if ( putenv(envbuf2) == -1 ) {
+  if ( putenv(home) == -1 ) {
+    printf(
+      "putenv(HOME) failed errno %d %...@%s",
+      errno, TheUser, TheDomain);
+    return -1;
+  }
+ sprintf(home,"|/usr/bin/env -i HOME=%s /usr/local/libexec/dovecot/deliver",vpw->pw_dir);
+    //execv(*dovecotargs,dovecotargs);
+    //run_command("|/usr/local/libexec/dovecot/deliver");
+    run_command(home);
+    //run_command(cmd);
+    return 0;
+   /*
+    // echo email
+    if (fdcopy (0, read_fd, extra_headers, headerlen) != 0) {
+       printf("echo to stdout failed\n");
+       return -2;
+    }else{
+       // Email sent to STDOUT
+       execv(*cmd,cmd);
+        //run_command('/usr/local/libexec/dovecot/deliver');
+       return 0;
+    }
+   */
     /* 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;
@@ -487,6 +521,7 @@

     /* return failure (sync/close failed, message NOT delivered) */
     return -2;


Quoting "Tren Blackburn" <t...@eotnetworks.com>:

I'd recommend looking into the "onchange" functionality of vpopmail rather than hacking vpopmail (modifying vadduser.c isn't sufficient. You'd have to dig out the library function that everything else uses...I did something similar to write a modified .qmail-default when a domain was added from any method available). It's been a while since I looked at the onchange stuff, but it's been there for quite a while and is well documented.



----- Original Message -----
From: news <n...@ger.gmane.org>
To: vchkpw@inter7.com <vchkpw@inter7.com>
Sent: Fri Aug 14 03:42:21 2009
Subject: [vchkpw] Re: dovecot LDA with vpopmail

Martin Kos wrote:

i am using on my qmail/vpopmail installation dovecot as IMAP/POP3
server. at the moment i have only some of the users having their mail
filtered through sieve/delivered to the mailbox by dovecot LDA. for this
users i have added a line to their .qmail-default file file as written
on http://wiki.dovecot.org/LDA/Qmail
-->   |/var/qmail/bin/preline -f /usr/lib/dovecot/deliver -d $...@$user

this works like a charm. but i would like to have dovecots LDA used for
ALL my users and i haven't found a way to activate it for EACH user
without changing/creating every users .qmail-default file.

as i understand, vdelivermail is delivering the mails to the users
mailboxes? so i would have to "say" to vdelivermail that it should use
dovecots deliver, or what is the right way to do that? or is it just not

greets & thanks for help

It seems to me that it would be pretty simple to write a bash script
that would change the appropriate .qmail-default files for you in one
fell swoop. I suppose the problem then would be doing this for new
users. I would think that it'd be easy enough to change vadduser.c (or
whatever file/program contains the 'stock' file code) to use deliver

Let me know if you need a little help with this, and how you make out.
I'm presently using dovecot imap, and would like migrate to dovecot's
LDA at some point.

-Eric 'shubes'


Reply via email to