From 72937a56ee2beec1732797e1fc4cbe8ea057e4ca Mon Sep 17 00:00:00 2001 From: John Denker Date: Sat, 2 Jun 2012 17:54:47 -0700 Subject: Minor bugfix. If you use morercpthosts, after a failed authentication attempt, if the client attempts to send mail to a domain which is not listed in rcpthosts, qmail-smtpd is unable to read morercpthosts.cdb. Instead, it sends "421 unable to read controls (#4.3.0)" and drops the connection. This patch fixes this bug by closing file descriptor 3 (only if necessary) in the authentication child process rather than the parent process. Credit: Tom Clegg --- qmail-smtpd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qmail-smtpd.c b/qmail-smtpd.c index 7390eb4..dc029ae 100644 --- a/qmail-smtpd.c +++ b/qmail-smtpd.c @@ -459,14 +459,13 @@ int authenticate(void) if (!stralloc_0(&resp)) die_nomem(); if (fd_copy(2,1) == -1) return err_pipe(); - close(3); if (pipe(pi) == -1) return err_pipe(); - if (pi[0] != 3) return err_pipe(); switch(child = fork()) { case -1: return err_fork(); case 0: close(pi[1]); + if (0 > fd_copy(3,pi[0])) _exit(1); sig_pipedefault(); execvp(*childargs, childargs); _exit(1); -- cgit v1.2.3