Download | Plain Text | No Line Numbers


  1. --- qmail-smtpd.c.orig Mon Jan 23 13:22:14 2006
  2. +++ qmail-smtpd.c Mon Jan 23 13:17:32 2006
  3. @@ -827,20 +827,22 @@
  4. int child;
  5. int wstat;
  6. int pi[2];
  7. + int stderrcopy;
  8.  
  9. if (!stralloc_0(&user)) die_nomem();
  10. if (!stralloc_0(&pass)) die_nomem();
  11. if (!stralloc_0(&resp)) die_nomem();
  12.  
  13. + stderrcopy = dup(2);
  14. + if (stderrcopy == -1) return err_pipe();
  15. if (fd_copy(2,1) == -1) return err_pipe();
  16. - close(3);
  17. if (pipe(pi) == -1) return err_pipe();
  18. - if (pi[0] != 3) return err_pipe();
  19. switch(child = fork()) {
  20. case -1:
  21. return err_fork();
  22. case 0:
  23. close(pi[1]);
  24. + if (0 > fd_copy(3,pi[0])) _exit(1);
  25. sig_pipedefault();
  26. execvp(*childargs, childargs);
  27. _exit(1);
  28. @@ -854,6 +856,8 @@
  29. if (substdio_flush(&ssup) == -1) return err_write();
  30.  
  31. close(pi[1]);
  32. + dup2(stderrcopy, 2);
  33. + close(stderrcopy);
  34. byte_zero(pass.s,pass.len);
  35. byte_zero(upbuf,sizeof upbuf);
  36. if (wait_pid(&wstat,child) == -1) return err_child();
  37.