diff --git a/indimail-mta-x/autoresponder.c b/indimail-mta-x/autoresponder.c index 023da39c6..30e94e2f5 100644 --- a/indimail-mta-x/autoresponder.c +++ b/indimail-mta-x/autoresponder.c @@ -46,6 +46,7 @@ #include #include #include +#include #include "hassrs.h" #ifdef HAVESRS #include "srs.h" @@ -934,59 +935,6 @@ count_history(char *sender, unsigned max) return 0; } -int -mkTempFile(int seekfd) -{ - char inbuf[2048], outbuf[2048]; - char *tmpdir; - static stralloc tmpFile = {0}; - struct substdio ssin_t; - struct substdio ssout_t; - int fd; - - if (lseek(seekfd, 0, SEEK_SET) == 0) - return (0); - if(errno == EBADF) - strerr_die2sys(111, FATAL, "unable to lseek: "); - if (!(tmpdir = env_get("TMPDIR"))) - tmpdir = "/tmp"; - if (!stralloc_copys(&tmpFile, tmpdir) || - !stralloc_cats(&tmpFile, "/qmailFilterXXX") || - !stralloc_catb(&tmpFile, strnum, fmt_ulong(strnum, (unsigned long) getpid())) || - !stralloc_0(&tmpFile)) - strerr_die2x(111, FATAL, "out of memory"); - if ((fd = open(tmpFile.s, O_RDWR | O_EXCL | O_CREAT, 0600)) == -1) - strerr_die3sys(111, FATAL, "unable to open: ", tmpFile.s); - unlink(tmpFile.s); - substdio_fdbuf(&ssout_t, write, fd, outbuf, sizeof(outbuf)); - substdio_fdbuf(&ssin_t, read, seekfd, inbuf, sizeof(inbuf)); - switch (substdio_copy(&ssout_t, &ssin_t)) - { - case -2: /*- read error */ - close(fd); - strerr_die2sys(111, FATAL, "unable to read input: "); - case -3: /*- write error */ - close(fd); - strerr_die2sys(111, FATAL, "unable to write output: "); - } - if (substdio_flush(&ssout_t) == -1) { - close(fd); - strerr_die2sys(111, FATAL, "unable to write: "); - } - if(fd != seekfd) { - if (dup2(fd, seekfd) == -1) { - close(fd); - strerr_die2sys(111, FATAL, "unable to dup: "); - } - close(fd); - } - if (lseek(seekfd, 0, SEEK_SET) != 0) { - close(seekfd); - strerr_die2sys(111, FATAL, "unable to lseek: "); - } - return (0); -} - /* * qmail-autoresponder -c -N -n 3 /tmp/test.msg /tmp/abcd < ../scripts/mail.msg |less */ @@ -1031,8 +979,8 @@ main(int argc, char *argv[]) if (srs_domain.len && !stralloc_0(&srs_domain)) strerr_die2x(111, FATAL, "out of memory"); srs_domain.len--; /*- substract length due to stralloc_0 */ - if (env_get("MAKE_SEEKABLE") && mkTempFile(0)) - strerr_die2sys(111, FATAL, "makeseekable: "); + if (mktempfile(0)) + strerr_die2sys(111, FATAL, "mktempfile: "); get_arguments(argc, argv); /*- Fail if SENDER or DTLINE are not set */ if (!(sender = env_get("SENDER"))) @@ -1302,6 +1250,8 @@ getversion_qmail_autoresponder_c() static char *x = "$Id: autoresponder.c,v 1.39 2023-10-02 17:40:58+05:30 Cprogrammer Exp mbhangui $"; x++; + x = sccsidmktempfileh; + x++; } /* diff --git a/indimail-mta-x/doc/ChangeLog b/indimail-mta-x/doc/ChangeLog index 54e6502c4..fd8dc9fe9 100644 --- a/indimail-mta-x/doc/ChangeLog +++ b/indimail-mta-x/doc/ChangeLog @@ -103,6 +103,9 @@ o Updated test-indimail-mta with additional tests (SPF, SRS, CHECKSENDER, 62. qmail-queue.c: added feature to negate regexp match 63. create_services.in: added --secureauth option for smtp port 587 64. create_services.in: added --setuser-priv option for slowq service +- 25/10/2023 +65. autoresponder.c, indimail-spamfilter.c: rewind descriptor 0 regardless of + MAKE_SEEKABLE setting * Fri Sep 08 2023 11:58:03 +0000 Manvendra Bhangui 3.0.4-1.1%{?dist} Release 3.0.4-1.1 Start 24/04/2023 End 08/09/2023 diff --git a/indimail-mta-x/qmail-spamfilter.c b/indimail-mta-x/qmail-spamfilter.c index 741556aec..a64b2c721 100644 --- a/indimail-mta-x/qmail-spamfilter.c +++ b/indimail-mta-x/qmail-spamfilter.c @@ -60,7 +60,7 @@ main(int argc, char **argv) struct substdio ssin, ssout; stralloc spamfilterargs = { 0 }, q = { 0 }; char inbuf[2048], outbuf[2048]; - char *ptr, *makeseekable, *spamf; + char *ptr, *spamf; char **Argv; if (chdir("/") == -1) @@ -99,8 +99,7 @@ main(int argc, char **argv) if (!(Argv = makeargs(spamfilterargs.s))) _exit(QQ_OUT_OF_MEMORY); /*- Mail content read from fd 0 */ - makeseekable = env_get("MAKE_SEEKABLE"); - if (makeseekable && mktempfile(0)) + if (mktempfile(0)) _exit(QQ_TMP_FILES); if (dup2(pipefd[1], 1) == -1) _exit(QQ_DUP_ERR);