This was emailed directly to me, but I think it is of importance to the list. I don't have time to look into it further, but we definitely need a change. vdelivermail() calls qmail-inject when processing forwards in a .qmail file, but does not wait for qmail-inject to finish before exiting.

On Mar 26, 2004, at 9:01 AM, Salvatore Lazzari wrote:
I've a question for you.

State of art:
- maildrop filter mail delivery
- i have some forwards sett'up via qmailadmin

Problem:

Vdelivermail doesn't process ".qmail" fw file created by qmailadmin when
called by maildrop
Vdelivermail processes it well when called directly.



I solved it modifing the code in vdelivermail.c:


=    if ( inject == 1 ) {
=        close(write_fd);
+        sleep(2);
=        return(0);
=    }


Question:


Is there a kind of security/performance related issue to add the sleep()
call?

Instead of the sleep, vdelivermail should wait for the qmail-inject process to finish.


Thanks for catching this, it will require a bit of extra coding and testing to be sure that we're doing things correctly. It should work something like this (I think).

pid_t pid;
int childstatus;

pid = qmail_inject_open(address);

...

if ( inject == 1 ) {
close(write_fd);
waitpid (pid, &childstatus, 0);
/* we should check childstatus here and fail accordingly if qmail-inject failed */
return (0);
}


Perhaps someone with more experience with forked processes can take a closer look at this.

--
Tom Collins  -  [EMAIL PROTECTED]
QmailAdmin: http://qmailadmin.sf.net/  Vpopmail: http://vpopmail.sf.net/
Info on the Sniffter hand-held Network Tester: http://sniffter.com/



Reply via email to