[exim-cvs] TLS: log input for pipelining violation

Inizio della pagina
Delete this message
Reply to this message
Autore: Exim Git Commits Mailing List
Data:  
To: exim-cvs
Oggetto: [exim-cvs] TLS: log input for pipelining violation
Gitweb: https://git.exim.org/exim.git/commitdiff/3531d1a756c5a72dfc825fbfdc7184cd017a7f39
Commit:     3531d1a756c5a72dfc825fbfdc7184cd017a7f39
Parent:     39962749f6b1aea979e5b44381411e9b1d63ddc2
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Tue Jun 20 19:38:58 2023 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Jun 20 20:57:29 2023 +0100


    TLS: log input for pipelining violation
---
 src/src/smtp_in.c   | 34 +++++++++++++++++-----------------
 test/log/0556       |  6 +++---
 test/rejectlog/0556 |  6 +++---
 3 files changed, 23 insertions(+), 23 deletions(-)


diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index 6f4ad9495..cd759df7b 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -5630,27 +5630,27 @@ while (done <= 0)

     case BADSYN_CMD:
     SYNC_FAILURE:
-      if (smtp_inend >= smtp_inbuffer + IN_BUFFER_SIZE)
-    smtp_inend = smtp_inbuffer + IN_BUFFER_SIZE - 1;
-      c = smtp_inend - smtp_inptr;
-      if (c > 150) c = 150;    /* limit logged amount */
-      smtp_inptr[c] = 0;
-      incomplete_transaction_log(US"sync failure");
-      log_write(0, LOG_MAIN|LOG_REJECT, "SMTP protocol synchronization error "
-    "(next input sent too soon: pipelining was%s advertised): "
-    "rejected \"%s\" %s next input=\"%s\"",
-    f.smtp_in_pipelining_advertised ? "" : " not",
-    smtp_cmd_buffer, host_and_ident(TRUE),
-    string_printing(smtp_inptr));
-      smtp_notquit_exit(US"synchronization-error", US"554",
-    US"SMTP synchronization error");
-      done = 1;   /* Pretend eof - drops connection */
-      break;
+      {
+    unsigned nchars = 150;
+    uschar * buf = receive_getbuf(&nchars);        /* destructive read */
+    buf[nchars] = '\0';
+    incomplete_transaction_log(US"sync failure");
+    log_write(0, LOG_MAIN|LOG_REJECT, "SMTP protocol synchronization error "
+      "(next input sent too soon: pipelining was%s advertised): "
+      "rejected \"%s\" %s next input=\"%s\" (%u bytes)",
+      f.smtp_in_pipelining_advertised ? "" : " not",
+      smtp_cmd_buffer, host_and_ident(TRUE),
+      string_printing(buf), nchars);
+    smtp_notquit_exit(US"synchronization-error", US"554",
+      US"SMTP synchronization error");
+    done = 1;   /* Pretend eof - drops connection */
+    break;
+      }



     case TOO_MANY_NONMAIL_CMD:
       s = smtp_cmd_buffer;
-      while (*s != 0 && !isspace(*s)) s++;
+      while (*s && !isspace(*s)) s++;
       incomplete_transaction_log(US"too many non-mail commands");
       log_write(0, LOG_MAIN|LOG_REJECT, "SMTP call from %s dropped: too many "
     "nonmail commands (last was \"%.*s\")",  host_and_ident(FALSE),
diff --git a/test/log/0556 b/test/log/0556
index afffb9096..52ab9a952 100644
--- a/test/log/0556
+++ b/test/log/0556
@@ -1,7 +1,7 @@


******** SERVER ********
1999-03-02 09:44:33 exim x.yz daemon started: pid=p1234, no queue runs, listening for SMTP on port PORT_D
-1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was advertised): rejected "data" H=(abcd) [127.0.0.1] next input="Start: sent early ...\r\n"
+1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was advertised): rejected "data" H=(abcd) [127.0.0.1] next input="Start: sent early ...\r\n" (23 bytes)
1999-03-02 09:44:33 exim x.yz daemon started: pid=p1235, no queue runs, listening for SMTP on port PORT_D
-1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised): rejected "mail from:<userx@???>" H=(abcd) [127.0.0.1] next input="rcpt to:<userx@???>\r\n"
-1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised): rejected "rcpt to:<userx@???>" H=(abcd) [127.0.0.1] next input="data\r\n"
+1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised): rejected "mail from:<userx@???>" H=(abcd) [127.0.0.1] next input="rcpt to:<userx@???>\r\n" (25 bytes)
+1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised): rejected "rcpt to:<userx@???>" H=(abcd) [127.0.0.1] next input="data\r\n" (6 bytes)
diff --git a/test/rejectlog/0556 b/test/rejectlog/0556
index 29c59daf8..bf50aabc6 100644
--- a/test/rejectlog/0556
+++ b/test/rejectlog/0556
@@ -1,5 +1,5 @@

******** SERVER ********
-1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was advertised): rejected "data" H=(abcd) [127.0.0.1] next input="Start: sent early ...\r\n"
-1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised): rejected "mail from:<userx@???>" H=(abcd) [127.0.0.1] next input="rcpt to:<userx@???>\r\n"
-1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised): rejected "rcpt to:<userx@???>" H=(abcd) [127.0.0.1] next input="data\r\n"
+1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was advertised): rejected "data" H=(abcd) [127.0.0.1] next input="Start: sent early ...\r\n" (23 bytes)
+1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised): rejected "mail from:<userx@???>" H=(abcd) [127.0.0.1] next input="rcpt to:<userx@???>\r\n" (25 bytes)
+1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised): rejected "rcpt to:<userx@???>" H=(abcd) [127.0.0.1] next input="data\r\n" (6 bytes)

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-cvs.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-cvs-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/