queue the message. Spotted by Lena with Yahoo, probably involving
round-robin DNS.
+JH/07 Bug 2214: Fix SMTP responses resulting from non-accept result of MIME ACL.
+ Previously a spurious "250 OK id=" response was appended to the proper
+ failure response.
+
Exim version 4.90
-----------------
uschar **blackholed_by_ptr)
{
FILE *mbox_file;
-uschar rfc822_file_path[2048];
+uschar * rfc822_file_path = NULL;
unsigned long mbox_size;
header_line *my_headerlist;
uschar *user_msg, *log_msg;
uschar * mbox_filename;
int rc = OK;
-memset(CS rfc822_file_path,0,2048);
-
/* check if it is a MIME message */
for (my_headerlist = header_list; my_headerlist; my_headerlist = my_headerlist->next)
rc = mime_acl_check(acl, mbox_file, NULL, &user_msg, &log_msg);
(void)fclose(mbox_file);
-if (Ustrlen(rfc822_file_path) > 0)
+if (rfc822_file_path)
{
mime_part_count = mime_part_count_buffer;
{
log_write(0, LOG_PANIC,
"acl_smtp_mime: can't unlink RFC822 spool file, skipping.");
- goto END_MIME_ACL;
+ goto END_MIME_ACL;
}
+ rfc822_file_path = NULL;
}
/* check if we must check any message/rfc822 attachments */
if (rc == OK)
{
- uschar * scandir;
+ uschar * scandir = string_copyn(mbox_filename,
+ Ustrrchr(mbox_filename, '/') - mbox_filename);
struct dirent * entry;
DIR * tempdir;
- scandir = string_copyn(mbox_filename, Ustrrchr(mbox_filename, '/') - mbox_filename);
-
- tempdir = opendir(CS scandir);
- for (;;)
- {
- if (!(entry = readdir(tempdir)))
- break;
+ for (tempdir = opendir(CS scandir); entry = readdir(tempdir); )
if (strncmpic(US entry->d_name, US"__rfc822_", 9) == 0)
{
- (void) string_format(rfc822_file_path, sizeof(rfc822_file_path),
- "%s/%s", scandir, entry->d_name);
- DEBUG(D_receive) debug_printf("RFC822 attachment detected: running MIME ACL for '%s'\n",
- rfc822_file_path);
+ rfc822_file_path = string_sprintf("%s/%s", scandir, entry->d_name);
+ DEBUG(D_receive)
+ debug_printf("RFC822 attachment detected: running MIME ACL for '%s'\n",
+ rfc822_file_path);
break;
}
- }
closedir(tempdir);
- if (entry)
+ if (rfc822_file_path)
{
if ((mbox_file = Ufopen(rfc822_file_path, "rb")))
{
#ifdef EXPERIMENTAL_DCC
dcc_ok = 0;
#endif
- if ( smtp_input
- && smtp_handle_acl_fail(ACL_WHERE_MIME, rc, user_msg, log_msg) != 0)
+ if (smtp_input)
{
- *smtp_yield_ptr = FALSE; /* No more messages after dropped connection */
+ if (smtp_handle_acl_fail(ACL_WHERE_MIME, rc, user_msg, log_msg) != 0)
+ *smtp_yield_ptr = FALSE; /* No more messages after dropped connection */
*smtp_reply_ptr = US""; /* Indicate reply already sent */
}
message_id[0] = 0; /* Indicate no message accepted */
#endif /* DISABLE_DKIM */
#ifdef WITH_CONTENT_SCAN
- if (recipients_count > 0 &&
- acl_smtp_mime != NULL &&
- !run_mime_acl(acl_smtp_mime, &smtp_yield, &smtp_reply, &blackholed_by))
+ if ( recipients_count > 0
+ && acl_smtp_mime
+ && !run_mime_acl(acl_smtp_mime, &smtp_yield, &smtp_reply, &blackholed_by)
+ )
goto TIDYUP;
#endif /* WITH_CONTENT_SCAN */
{
#ifdef WITH_CONTENT_SCAN
- if (acl_not_smtp_mime != NULL &&
- !run_mime_acl(acl_not_smtp_mime, &smtp_yield, &smtp_reply,
- &blackholed_by))
+ if ( acl_not_smtp_mime
+ && !run_mime_acl(acl_not_smtp_mime, &smtp_yield, &smtp_reply,
+ &blackholed_by)
+ )
goto TIDYUP;
#endif /* WITH_CONTENT_SCAN */
/* This function is called when acl_check() fails. As well as calls from within
this module, it is called from receive.c for an ACL after DATA. It sorts out
-logging the incident, and sets up the error response. A message containing
+logging the incident, and sends the error response. A message containing
newlines is turned into a multiline SMTP response, but for logging, only the
first line is used.
begin acl
check_mime:
+.ifdef BAD
+ deny message = this is a deny from the mime acl
+.endif
+
warn decode = default
add_header = X-$mime_part_count-content-type: $mime_content_type\n\
X-$mime_part_count-filename: $mime_filename\n\
-1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133501.GA3058@test.ex T="[exim] Re: Bug#286074: eximstats: uses message count as data for\n the \"volume\" charts"
-1999-03-02 09:44:33 10HmaX-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
-1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
-1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133501.GA3058@test.ex T="Nasty"
+1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133501.GA3058@test.ex T="[exim] Re: Bug#286074: eximstats: uses message count as data for\n the \"volume\" charts"
1999-03-02 09:44:33 10HmaY-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
-1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133501.GA3059@test.ex T="Nasty"
+1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133501.GA3058@test.ex T="Nasty"
1999-03-02 09:44:33 10HmaZ-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed
-1999-03-02 09:44:33 10HmbA-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133501.GA3059@test.ex T="Nasty3"
+1999-03-02 09:44:33 10HmbA-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133501.GA3059@test.ex T="Nasty"
1999-03-02 09:44:33 10HmbA-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
1999-03-02 09:44:33 10HmbA-0005vi-00 Completed
-1999-03-02 09:44:33 10HmbB-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133501.GA3059@test.ex T="Nasty4"
+1999-03-02 09:44:33 10HmbB-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133501.GA3059@test.ex T="Nasty3"
1999-03-02 09:44:33 10HmbB-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
1999-03-02 09:44:33 10HmbB-0005vi-00 Completed
-1999-03-02 09:44:33 10HmbC-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133501.GA3058@test.ex T="Nasty5"
+1999-03-02 09:44:33 10HmbC-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133501.GA3059@test.ex T="Nasty4"
1999-03-02 09:44:33 10HmbC-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
1999-03-02 09:44:33 10HmbC-0005vi-00 Completed
-1999-03-02 09:44:33 10HmbD-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133502.GA3059@test.ex T="Nasty6"
+1999-03-02 09:44:33 10HmbD-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133501.GA3058@test.ex T="Nasty5"
1999-03-02 09:44:33 10HmbD-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
1999-03-02 09:44:33 10HmbD-0005vi-00 Completed
+1999-03-02 09:44:33 10HmbE-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss id=20041217133502.GA3059@test.ex T="Nasty6"
+1999-03-02 09:44:33 10HmbE-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 10HmbE-0005vi-00 Completed
+1999-03-02 09:44:33 10HmaX-0005vi-00 U=CALLER F=<CALLER@myhost.test.ex> rejected during MIME ACL checks: this is a deny from the mime acl
Received: from CALLER (helo=test.ex)
by myhost.test.ex with local-esmtp (Exim x.yz)
(envelope-from <CALLER@myhost.test.ex>)
- id 10HmaX-0005vi-00
+ id 10HmaY-0005vi-00
for userx@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
Date: Tue, 2 Mar 1999 09:44:33 +0000
From: J Caesar <jcaesar@test.ex>
X-0-is-multipart: 1
X-0-is-coverletter: 1
X-0-is-rfc822: 0
-X-0-decode-filename: TESTSUITE/spool/scan/10HmaX-0005vi-00/10HmaX-0005vi-00-00000
+X-0-decode-filename: TESTSUITE/spool/scan/10HmaY-0005vi-00/10HmaY-0005vi-00-00000
X-0-content-size: 2
X-1-content-type: text/plain
X-1-filename:
X-1-is-multipart: 0
X-1-is-coverletter: 1
X-1-is-rfc822: 0
-X-1-decode-filename: TESTSUITE/spool/scan/10HmaX-0005vi-00/10HmaX-0005vi-00-00001
+X-1-decode-filename: TESTSUITE/spool/scan/10HmaY-0005vi-00/10HmaY-0005vi-00-00001
X-1-content-size: 1
X-2-content-type: text/plain
X-2-filename:
X-2-is-multipart: 0
X-2-is-coverletter: 0
X-2-is-rfc822: 0
-X-2-decode-filename: TESTSUITE/spool/scan/10HmaX-0005vi-00/10HmaX-0005vi-00-00002
+X-2-decode-filename: TESTSUITE/spool/scan/10HmaY-0005vi-00/10HmaY-0005vi-00-00002
X-2-content-size: 1
X-3-content-type: text/plain
X-3-filename: working-patch
X-3-is-multipart: 0
X-3-is-coverletter: 0
X-3-is-rfc822: 0
-X-3-decode-filename: TESTSUITE/spool/scan/10HmaX-0005vi-00/10HmaX-0005vi-00-00003
+X-3-decode-filename: TESTSUITE/spool/scan/10HmaY-0005vi-00/10HmaY-0005vi-00-00003
X-3-content-size: 1
X-4-content-type: text/plain
X-4-filename:
X-4-is-multipart: 0
X-4-is-coverletter: 0
X-4-is-rfc822: 0
-X-4-decode-filename: TESTSUITE/spool/scan/10HmaX-0005vi-00/10HmaX-0005vi-00-00004
+X-4-decode-filename: TESTSUITE/spool/scan/10HmaY-0005vi-00/10HmaY-0005vi-00-00004
X-4-content-size: 1
--T4sUOijqQbZv57TR
Received: from CALLER (helo=test.ex)
by myhost.test.ex with local-esmtp (Exim x.yz)
(envelope-from <CALLER@myhost.test.ex>)
- id 10HmaY-0005vi-00
+ id 10HmaZ-0005vi-00
for userx@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
Date: Tue, 2 Mar 1999 09:44:33 +0000
From: J Caesar <jcaesar@test.ex>
X-0-is-multipart: 1
X-0-is-coverletter: 1
X-0-is-rfc822: 0
-X-0-decode-filename: TESTSUITE/spool/scan/10HmaY-0005vi-00/10HmaY-0005vi-00-00000
+X-0-decode-filename: TESTSUITE/spool/scan/10HmaZ-0005vi-00/10HmaZ-0005vi-00-00000
X-0-content-size: 1
X-1-content-type: text/plain
X-1-filename:
X-1-is-multipart: 0
X-1-is-coverletter: 1
X-1-is-rfc822: 0
-X-1-decode-filename: TESTSUITE/spool/scan/10HmaY-0005vi-00/10HmaY-0005vi-00-00001
+X-1-decode-filename: TESTSUITE/spool/scan/10HmaZ-0005vi-00/10HmaZ-0005vi-00-00001
X-1-content-size: 1
--T4sUOijqQbZv57TR
Received: from CALLER (helo=test.ex)
by myhost.test.ex with local-esmtp (Exim x.yz)
(envelope-from <CALLER@myhost.test.ex>)
- id 10HmaZ-0005vi-00
+ id 10HmbA-0005vi-00
for userx@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
Date: Tue, 2 Mar 1999 09:44:33 +0000
From: J Caesar <jcaesar@test.ex>
X-0-is-multipart: 0
X-0-is-coverletter: 1
X-0-is-rfc822: 0
-X-0-decode-filename: TESTSUITE/spool/scan/10HmaZ-0005vi-00/10HmaZ-0005vi-00-00000
+X-0-decode-filename: TESTSUITE/spool/scan/10HmbA-0005vi-00/10HmbA-0005vi-00-00000
X-0-content-size: 1
--T4sUOijqQbZv57TR
Received: from CALLER (helo=test.ex)
by myhost.test.ex with local-esmtp (Exim x.yz)
(envelope-from <CALLER@myhost.test.ex>)
- id 10HmbA-0005vi-00
+ id 10HmbB-0005vi-00
for userx@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
Date: Tue, 2 Mar 1999 09:44:33 +0000
From: J Caesar <jcaesar@test.ex>
X-0-is-multipart: 0
X-0-is-coverletter: 1
X-0-is-rfc822: 0
-X-0-decode-filename: TESTSUITE/spool/scan/10HmbA-0005vi-00/10HmbA-0005vi-00-00000
+X-0-decode-filename: TESTSUITE/spool/scan/10HmbB-0005vi-00/10HmbB-0005vi-00-00000
X-0-content-size: 1
--T4sUOijqQbZv57TR
Received: from CALLER (helo=test.ex)
by myhost.test.ex with local-esmtp (Exim x.yz)
(envelope-from <CALLER@myhost.test.ex>)
- id 10HmbB-0005vi-00
+ id 10HmbC-0005vi-00
for userx@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
Date: Tue, 2 Mar 1999 09:44:33 +0000
From: J Caesar <jcaesar@test.ex>
X-0-is-multipart: 0
X-0-is-coverletter: 1
X-0-is-rfc822: 0
-X-0-decode-filename: TESTSUITE/spool/scan/10HmbB-0005vi-00/10HmbB-0005vi-00-00000
+X-0-decode-filename: TESTSUITE/spool/scan/10HmbC-0005vi-00/10HmbC-0005vi-00-00000
X-0-content-size: 1
--T4sUOijqQbZv57TR
Received: from CALLER (helo=test.ex)
by myhost.test.ex with local-esmtp (Exim x.yz)
(envelope-from <CALLER@myhost.test.ex>)
- id 10HmbC-0005vi-00
+ id 10HmbD-0005vi-00
for userx@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
Date: Tue, 2 Mar 1999 09:44:33 +0000
Message-ID: <20041217133501.GA3058@test.ex>
X-0-is-multipart: 1
X-0-is-coverletter: 1
X-0-is-rfc822: 0
-X-0-decode-filename: TESTSUITE/spool/scan/10HmbC-0005vi-00/10HmbC-0005vi-00-00000
+X-0-decode-filename: TESTSUITE/spool/scan/10HmbD-0005vi-00/10HmbD-0005vi-00-00000
X-0-content-size: 1
X-1-content-type: text/plain
X-1-filename: test ä test1
X-1-is-multipart: 0
X-1-is-coverletter: 1
X-1-is-rfc822: 0
-X-1-decode-filename: TESTSUITE/spool/scan/10HmbC-0005vi-00/10HmbC-0005vi-00-00001
+X-1-decode-filename: TESTSUITE/spool/scan/10HmbD-0005vi-00/10HmbD-0005vi-00-00001
X-1-content-size: 1
X-2-content-type: text/plain
X-2-filename: test ä test2
X-2-is-multipart: 0
X-2-is-coverletter: 0
X-2-is-rfc822: 0
-X-2-decode-filename: TESTSUITE/spool/scan/10HmbC-0005vi-00/10HmbC-0005vi-00-00002
+X-2-decode-filename: TESTSUITE/spool/scan/10HmbD-0005vi-00/10HmbD-0005vi-00-00002
X-2-content-size: 1
--T4sUOijqQbZv57TR
Received: from CALLER (helo=test.ex)
by myhost.test.ex with local-esmtp (Exim x.yz)
(envelope-from <CALLER@myhost.test.ex>)
- id 10HmbD-0005vi-00
+ id 10HmbE-0005vi-00
for userx@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
Date: Tue, 2 Mar 1999 09:44:33 +0000
From: J Caesar <jcaesar@test.ex>
X-0-is-multipart: 0
X-0-is-coverletter: 1
X-0-is-rfc822: 0
-X-0-decode-filename: TESTSUITE/spool/scan/10HmbD-0005vi-00/10HmbD-0005vi-00-00000
+X-0-decode-filename: TESTSUITE/spool/scan/10HmbE-0005vi-00/10HmbE-0005vi-00-00000
X-0-content-size: 1
--T4sUOijqQbZv57TR
--- /dev/null
+1999-03-02 09:44:33 10HmaX-0005vi-00 U=CALLER F=<CALLER@myhost.test.ex> rejected during MIME ACL checks: this is a deny from the mime acl
+Envelope-from: <CALLER@myhost.test.ex>
+Envelope-to: <userx@test.ex>
+P Received: from CALLER (helo=test.ex)
+ by myhost.test.ex with local-esmtp (Exim x.yz)
+ (envelope-from <CALLER@myhost.test.ex>)
+ id 10HmaX-0005vi-00
+ for userx@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
+ Date: Tue, 2 Mar 1999 09:44:33 +0000
+F From: J Caesar <jcaesar@test.ex>
+T To: a-list00@exim.org
+I Message-ID: <20041217133502.GA3059@test.ex>
+ Mime-Version: 1.0
+ Content-Type: application/pdf;
+ name*=''2015.11.13%20-%20Pr%C3%A4sentation%20GI%20-%20LK.PDF
+ Content-Disposition: attachment;
+ filename*=''2015.11.13%20-%20Pr%C3%A4sentation%20GI%20-%20LK.PDF
+ Subject: Nasty6
+S Sender: CALLER_NAME <CALLER@myhost.test.ex>
.
quit
****
+#
+#
+# As above, but with a deny from the mime acl
+#
+exim -DBAD=bad -odi -bs
+ehlo test.ex
+mail from:<>
+rcpt to:<userx@test.ex>
+data
+Date: Fri, 17 Dec 2004 14:35:01 +0100
+From: J Caesar <jcaesar@test.ex>
+To: a-list00@exim.org
+Message-ID: <20041217133502.GA3059@test.ex>
+Mime-Version: 1.0
+Content-Type: application/pdf;
+ name*=''2015.11.13%20-%20Pr%C3%A4sentation%20GI%20-%20LK.PDF
+Content-Disposition: attachment;
+ filename*=''2015.11.13%20-%20Pr%C3%A4sentation%20GI%20-%20LK.PDF
+Subject: Nasty6
+
+--T4sUOijqQbZv57TR
+Content-Type: text/plain;
+
+foobar
+
+--T4sUOijqQbZv57TR--
+.
+quit
+****
250 OK\r
250 Accepted\r
354 Enter message, ending with "." on a line by itself\r
-250 OK id=10HmaX-0005vi-00\r
+250 OK id=10HmaY-0005vi-00\r
221 myhost.test.ex closing connection\r
220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
250-myhost.test.ex Hello CALLER at test.ex\r
250 OK\r
250 Accepted\r
354 Enter message, ending with "." on a line by itself\r
-250 OK id=10HmaY-0005vi-00\r
+250 OK id=10HmaZ-0005vi-00\r
221 myhost.test.ex closing connection\r
220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
250-myhost.test.ex Hello CALLER at test.ex\r
250 OK\r
250 Accepted\r
354 Enter message, ending with "." on a line by itself\r
-250 OK id=10HmaZ-0005vi-00\r
+250 OK id=10HmbA-0005vi-00\r
221 myhost.test.ex closing connection\r
220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
250-myhost.test.ex Hello CALLER at test.ex\r
250 OK\r
250 Accepted\r
354 Enter message, ending with "." on a line by itself\r
-250 OK id=10HmbA-0005vi-00\r
+250 OK id=10HmbB-0005vi-00\r
221 myhost.test.ex closing connection\r
220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
250-myhost.test.ex Hello CALLER at test.ex\r
250 OK\r
250 Accepted\r
354 Enter message, ending with "." on a line by itself\r
-250 OK id=10HmbB-0005vi-00\r
+250 OK id=10HmbC-0005vi-00\r
221 myhost.test.ex closing connection\r
220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
250-myhost.test.ex Hello CALLER at test.ex\r
250 OK\r
250 Accepted\r
354 Enter message, ending with "." on a line by itself\r
-250 OK id=10HmbC-0005vi-00\r
+250 OK id=10HmbD-0005vi-00\r
221 myhost.test.ex closing connection\r
220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
250-myhost.test.ex Hello CALLER at test.ex\r
250 OK\r
250 Accepted\r
354 Enter message, ending with "." on a line by itself\r
-250 OK id=10HmbD-0005vi-00\r
+250 OK id=10HmbE-0005vi-00\r
+221 myhost.test.ex closing connection\r
+220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250-myhost.test.ex Hello CALLER at test.ex\r
+250-SIZE 52428800\r
+250-8BITMIME\r
+250-PIPELINING\r
+250 HELP\r
+250 OK\r
+250 Accepted\r
+354 Enter message, ending with "." on a line by itself\r
+550 this is a deny from the mime acl\r
221 myhost.test.ex closing connection\r