]> git.netwichtig.de Git - user/henk/code/exim.git/blobdiff - src/src/smtp_in.c
Fix json extract for strings carrying commas. Bug 3006
[user/henk/code/exim.git] / src / src / smtp_in.c
index 6f4ad94956c8ae707f6279161d7dfe4e1bf0003a..e6f9808ddf5a48199ed8949b7f758f65ba56288b 100644 (file)
@@ -2680,13 +2680,13 @@ if (!check_sync())
 /* Now output the banner */
 /*XXX the ehlo-resp code does its own tls/nontls bit.  Maybe subroutine that? */
 
-smtp_printf("%s",
+smtp_printf("%Y",
 #ifndef DISABLE_PIPE_CONNECT
   fl.pipe_connect_acceptable && pipeline_connect_sends(),
 #else
   FALSE,
 #endif
-  string_from_gstring(ss));
+  ss);
 
 /* Attempt to see if we sent the banner before the last ACK of the 3-way
 handshake arrived.  If so we must have managed a TFO. */
@@ -2735,9 +2735,9 @@ if (++synprot_error_count > smtp_max_synprot_errors)
   {
   yield = 1;
   log_write(0, LOG_MAIN|LOG_REJECT, "SMTP call from %s dropped: too many "
-    "syntax or protocol errors (last command was \"%s\", %s)",
+    "syntax or protocol errors (last command was \"%s\", %Y)",
     host_and_ident(FALSE), string_printing(smtp_cmd_buffer),
-    string_from_gstring(s_connhad_log(NULL))
+    s_connhad_log(NULL)
     );
   }
 
@@ -3195,7 +3195,7 @@ if (code && defaultrespond)
     va_start(ap, defaultrespond);
     g = string_vformat(NULL, SVFMT_EXTEND|SVFMT_REBUFFER, CS defaultrespond, ap);
     va_end(ap);
-    smtp_printf("%s %s\r\n", FALSE, code, string_from_gstring(g));
+    smtp_printf("%s %Y\r\n", FALSE, code, g);
     }
   mac_smtp_fflush();
   }
@@ -3872,9 +3872,9 @@ while (done <= 0)
        if (++synprot_error_count > smtp_max_synprot_errors)
          {
          log_write(0, LOG_MAIN|LOG_REJECT, "SMTP call from %s dropped: too many "
-           "syntax or protocol errors (last command was \"%s\", %s)",
+           "syntax or protocol errors (last command was \"%s\", %Y)",
            host_and_ident(FALSE), string_printing(smtp_cmd_buffer),
-           string_from_gstring(s_connhad_log(NULL))
+           s_connhad_log(NULL)
            );
          done = 1;
          }
@@ -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),