$smtp_command and $smtp_command_argument were incomplete for MAIL
authorPhilip Hazel <ph10@hermes.cam.ac.uk>
Tue, 20 Feb 2007 11:37:16 +0000 (11:37 +0000)
committerPhilip Hazel <ph10@hermes.cam.ac.uk>
Tue, 20 Feb 2007 11:37:16 +0000 (11:37 +0000)
commands with extra options such as SIZE.

doc/doc-txt/ChangeLog
src/src/smtp_in.c
test/confs/0021
test/log/0021
test/mail/0021.x
test/paniclog/0021
test/rejectlog/0021
test/scripts/0000-Basic/0021
test/stderr/0021
test/stdout/0021

index 33ecda9d389c28317d63c2214976c8271a6ceb8d..96832f60430c6aacf2fa7451b6b38d6da2247b9f 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.482 2007/02/20 09:53:41 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.483 2007/02/20 11:37:16 ph10 Exp $
 
 Change log file for Exim from version 4.21
 -------------------------------------------
 
 Change log file for Exim from version 4.21
 -------------------------------------------
@@ -118,6 +118,11 @@ MH/03 Made $recipients available in local_scan(). local_scan() already has
       better access to the recipient list through recipients_list[], but
       $recipients can be useful in postmaster-provided expansion strings.
 
       better access to the recipient list through recipients_list[], but
       $recipients can be useful in postmaster-provided expansion strings.
 
+PH/28 The $smtp_command and $smtp_command_argument variables were not correct
+      in the case of a MAIL command with additional options following the
+      address, for example: MAIL FROM:<foo@bar> SIZE=1234. The option settings
+      were accidentally chopped off.
+
 
 Exim version 4.66
 -----------------
 
 Exim version 4.66
 -----------------
index d0ac959675a5f981f4a450bf56fa9354da2a3f4c..c9c5842b10ee0e861bca19b10974bac4998af7f3 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/smtp_in.c,v 1.53 2007/01/30 11:45:20 ph10 Exp $ */
+/* $Cambridge: exim/src/src/smtp_in.c,v 1.54 2007/02/20 11:37:16 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -126,6 +126,9 @@ static int  unknown_command_count;
 static int  sync_cmd_limit;
 static int  smtp_write_error = 0;
 
 static int  sync_cmd_limit;
 static int  smtp_write_error = 0;
 
+static uschar *smtp_data_buffer;
+static uschar *smtp_cmd_data;
+
 /* We need to know the position of RSET, HELO, EHLO, AUTH, and STARTTLS. Their
 final fields of all except AUTH are forced TRUE at the start of a new message
 setup, to allow one of each between messages that is not counted as a nonmail
 /* We need to know the position of RSET, HELO, EHLO, AUTH, and STARTTLS. Their
 final fields of all except AUTH are forced TRUE at the start of a new message
 setup, to allow one of each between messages that is not counted as a nonmail
@@ -552,11 +555,16 @@ for (p = cmd_list; p < cmd_list_end; p++)
         !sender_host_notsocket)                        /* Really is a socket */
       return BADSYN_CMD;
 
         !sender_host_notsocket)                        /* Really is a socket */
       return BADSYN_CMD;
 
-    /* Point after the command, but don't skip over leading spaces till after
-    the following test, so that if it fails, the command name can easily be
-    logged. */
+    /* The variables $smtp_command and $smtp_command_argument point into the
+    unmodified input buffer. A copy of the latter is taken for actual
+    processing, so that it can be chopped up into separate parts if necessary,
+    for example, when processing a MAIL command options such as SIZE that can
+    follow the sender address. */
 
     smtp_cmd_argument = smtp_cmd_buffer + p->len;
 
     smtp_cmd_argument = smtp_cmd_buffer + p->len;
+    while (isspace(*smtp_cmd_argument)) smtp_cmd_argument++;
+    Ustrcpy(smtp_data_buffer, smtp_cmd_argument);
+    smtp_cmd_data = smtp_data_buffer;
 
     /* Count non-mail commands from those hosts that are controlled in this
     way. The default is all hosts. We don't waste effort checking the list
 
     /* Count non-mail commands from those hosts that are controlled in this
     way. The default is all hosts. We don't waste effort checking the list
@@ -574,11 +582,10 @@ for (p = cmd_list; p < cmd_list_end; p++)
         return TOO_MANY_NONMAIL_CMD;
       }
 
         return TOO_MANY_NONMAIL_CMD;
       }
 
-    /* Get the data pointer over leading spaces and return; if there is data
-    for a command that does not expect it, give the error centrally here. */
+    /* If there is data for a command that does not expect it, generate the
+    error here. */
 
 
-    while (isspace(*smtp_cmd_argument)) smtp_cmd_argument++;
-    return (p->has_arg || *smtp_cmd_argument == 0)? p->cmd : BADARG_CMD;
+    return (p->has_arg || *smtp_cmd_data == 0)? p->cmd : BADARG_CMD;
     }
   }
 
     }
   }
 
@@ -839,7 +846,7 @@ return yield;
 *         Extract SMTP command option            *
 *************************************************/
 
 *         Extract SMTP command option            *
 *************************************************/
 
-/* This function picks the next option setting off the end of smtp_cmd_argument. It
+/* This function picks the next option setting off the end of smtp_cmd_data. It
 is called for MAIL FROM and RCPT TO commands, to pick off the optional ESMTP
 things that can appear there.
 
 is called for MAIL FROM and RCPT TO commands, to pick off the optional ESMTP
 things that can appear there.
 
@@ -854,11 +861,11 @@ static BOOL
 extract_option(uschar **name, uschar **value)
 {
 uschar *n;
 extract_option(uschar **name, uschar **value)
 {
 uschar *n;
-uschar *v = smtp_cmd_argument + Ustrlen(smtp_cmd_argument) -1;
+uschar *v = smtp_cmd_data + Ustrlen(smtp_cmd_data) - 1;
 while (isspace(*v)) v--;
 v[1] = 0;
 
 while (isspace(*v)) v--;
 v[1] = 0;
 
-while (v > smtp_cmd_argument && *v != '=' && !isspace(*v)) v--;
+while (v > smtp_cmd_data && *v != '=' && !isspace(*v)) v--;
 if (*v != '=') return FALSE;
 
 n = v;
 if (*v != '=') return FALSE;
 
 n = v;
@@ -1022,7 +1029,7 @@ while (done <= 0)
     case HELO_CMD:
     case EHLO_CMD:
 
     case HELO_CMD:
     case EHLO_CMD:
 
-    check_helo(smtp_cmd_argument);
+    check_helo(smtp_cmd_data);
     /* Fall through */
 
     case RSET_CMD:
     /* Fall through */
 
     case RSET_CMD:
@@ -1042,7 +1049,7 @@ while (done <= 0)
       /* The function moan_smtp_batch() does not return. */
       moan_smtp_batch(smtp_cmd_buffer, "503 Sender already given");
 
       /* The function moan_smtp_batch() does not return. */
       moan_smtp_batch(smtp_cmd_buffer, "503 Sender already given");
 
-    if (smtp_cmd_argument[0] == 0)
+    if (smtp_cmd_data[0] == 0)
       /* The function moan_smtp_batch() does not return. */
       moan_smtp_batch(smtp_cmd_buffer, "501 MAIL FROM must have an address operand");
 
       /* The function moan_smtp_batch() does not return. */
       moan_smtp_batch(smtp_cmd_buffer, "501 MAIL FROM must have an address operand");
 
@@ -1053,8 +1060,8 @@ while (done <= 0)
     /* Apply SMTP rewrite */
 
     raw_sender = ((rewrite_existflags & rewrite_smtp) != 0)?
     /* Apply SMTP rewrite */
 
     raw_sender = ((rewrite_existflags & rewrite_smtp) != 0)?
-      rewrite_one(smtp_cmd_argument, rewrite_smtp|rewrite_smtp_sender, NULL, FALSE,
-        US"", global_rewrite_rules) : smtp_cmd_argument;
+      rewrite_one(smtp_cmd_data, rewrite_smtp|rewrite_smtp_sender, NULL, FALSE,
+        US"", global_rewrite_rules) : smtp_cmd_data;
 
     /* Extract the address; the TRUE flag allows <> as valid */
 
 
     /* Extract the address; the TRUE flag allows <> as valid */
 
@@ -1097,7 +1104,7 @@ while (done <= 0)
       /* The function moan_smtp_batch() does not return. */
       moan_smtp_batch(smtp_cmd_buffer, "503 No sender yet given");
 
       /* The function moan_smtp_batch() does not return. */
       moan_smtp_batch(smtp_cmd_buffer, "503 No sender yet given");
 
-    if (smtp_cmd_argument[0] == 0)
+    if (smtp_cmd_data[0] == 0)
       /* The function moan_smtp_batch() does not return. */
       moan_smtp_batch(smtp_cmd_buffer, "501 RCPT TO must have an address operand");
 
       /* The function moan_smtp_batch() does not return. */
       moan_smtp_batch(smtp_cmd_buffer, "501 RCPT TO must have an address operand");
 
@@ -1112,8 +1119,8 @@ while (done <= 0)
     recipient address */
 
     recipient = ((rewrite_existflags & rewrite_smtp) != 0)?
     recipient address */
 
     recipient = ((rewrite_existflags & rewrite_smtp) != 0)?
-      rewrite_one(smtp_cmd_argument, rewrite_smtp, NULL, FALSE, US"",
-        global_rewrite_rules) : smtp_cmd_argument;
+      rewrite_one(smtp_cmd_data, rewrite_smtp, NULL, FALSE, US"",
+        global_rewrite_rules) : smtp_cmd_data;
 
     /* rfc821_domains = TRUE; << no longer needed */
     recipient = parse_extract_address(recipient, &errmess, &start, &end,
 
     /* rfc821_domains = TRUE; << no longer needed */
     recipient = parse_extract_address(recipient, &errmess, &start, &end,
@@ -1264,12 +1271,13 @@ tls_advertised = FALSE;
 
 acl_var_c = NULL;
 
 
 acl_var_c = NULL;
 
-/* Allow for trailing 0 in the command buffer. */
+/* Allow for trailing 0 in the command and data buffers. */
 
 
-smtp_cmd_buffer = (uschar *)malloc(smtp_cmd_buffer_size + 1);
+smtp_cmd_buffer = (uschar *)malloc(2*smtp_cmd_buffer_size + 2);
 if (smtp_cmd_buffer == NULL)
   log_write(0, LOG_MAIN|LOG_PANIC_DIE,
     "malloc() failed for SMTP command buffer");
 if (smtp_cmd_buffer == NULL)
   log_write(0, LOG_MAIN|LOG_PANIC_DIE,
     "malloc() failed for SMTP command buffer");
+smtp_data_buffer = smtp_cmd_buffer + smtp_cmd_buffer_size + 1;
 
 /* For batched input, the protocol setting can be overridden from the
 command line by a trusted caller. */
 
 /* For batched input, the protocol setting can be overridden from the
 command line by a trusted caller. */
@@ -2041,9 +2049,9 @@ uschar *what =
 #endif
   (where == ACL_WHERE_PREDATA)? US"DATA" :
   (where == ACL_WHERE_DATA)? US"after DATA" :
 #endif
   (where == ACL_WHERE_PREDATA)? US"DATA" :
   (where == ACL_WHERE_DATA)? US"after DATA" :
-  (smtp_cmd_argument == NULL)?
+  (smtp_cmd_data == NULL)?
     string_sprintf("%s in \"connect\" ACL", acl_wherenames[where]) :
     string_sprintf("%s in \"connect\" ACL", acl_wherenames[where]) :
-    string_sprintf("%s %s", acl_wherenames[where], smtp_cmd_argument);
+    string_sprintf("%s %s", acl_wherenames[where], smtp_cmd_data);
 
 if (drop) rc = FAIL;
 
 
 if (drop) rc = FAIL;
 
@@ -2465,8 +2473,8 @@ while (done <= 0)
 
     /* Find the name of the requested authentication mechanism. */
 
 
     /* Find the name of the requested authentication mechanism. */
 
-    s = smtp_cmd_argument;
-    while ((c = *smtp_cmd_argument) != 0 && !isspace(c))
+    s = smtp_cmd_data;
+    while ((c = *smtp_cmd_data) != 0 && !isspace(c))
       {
       if (!isalnum(c) && c != '-' && c != '_')
         {
       {
       if (!isalnum(c) && c != '-' && c != '_')
         {
@@ -2474,16 +2482,16 @@ while (done <= 0)
           US"invalid character in authentication mechanism name");
         goto COMMAND_LOOP;
         }
           US"invalid character in authentication mechanism name");
         goto COMMAND_LOOP;
         }
-      smtp_cmd_argument++;
+      smtp_cmd_data++;
       }
 
     /* If not at the end of the line, we must be at white space. Terminate the
     name and move the pointer on to any data that may be present. */
 
       }
 
     /* If not at the end of the line, we must be at white space. Terminate the
     name and move the pointer on to any data that may be present. */
 
-    if (*smtp_cmd_argument != 0)
+    if (*smtp_cmd_data != 0)
       {
       {
-      *smtp_cmd_argument++ = 0;
-      while (isspace(*smtp_cmd_argument)) smtp_cmd_argument++;
+      *smtp_cmd_data++ = 0;
+      while (isspace(*smtp_cmd_data)) smtp_cmd_data++;
       }
 
     /* Search for an authentication mechanism which is configured for use
       }
 
     /* Search for an authentication mechanism which is configured for use
@@ -2519,7 +2527,7 @@ while (done <= 0)
     expand_nmax = 0;
     expand_nlength[0] = 0;   /* $0 contains nothing */
 
     expand_nmax = 0;
     expand_nlength[0] = 0;   /* $0 contains nothing */
 
-    c = (au->info->servercode)(au, smtp_cmd_argument);
+    c = (au->info->servercode)(au, smtp_cmd_data);
     if (au->set_id != NULL) set_id = expand_string(au->set_id);
     expand_nmax = -1;        /* Reset numeric variables */
     for (i = 0; i < AUTH_VARS; i++) auth_vars[i] = NULL;   /* Reset $auth<n> */
     if (au->set_id != NULL) set_id = expand_string(au->set_id);
     expand_nmax = -1;        /* Reset numeric variables */
     for (i = 0; i < AUTH_VARS; i++) auth_vars[i] = NULL;   /* Reset $auth<n> */
@@ -2638,7 +2646,7 @@ while (done <= 0)
     /* Reject the HELO if its argument was invalid or non-existent. A
     successful check causes the argument to be saved in malloc store. */
 
     /* Reject the HELO if its argument was invalid or non-existent. A
     successful check causes the argument to be saved in malloc store. */
 
-    if (!check_helo(smtp_cmd_argument))
+    if (!check_helo(smtp_cmd_data))
       {
       smtp_printf("501 Syntactically invalid %s argument(s)\r\n", hello);
 
       {
       smtp_printf("501 Syntactically invalid %s argument(s)\r\n", hello);
 
@@ -2668,7 +2676,7 @@ while (done <= 0)
     if (!sender_host_unknown)
       {
       BOOL old_helo_verified = helo_verified;
     if (!sender_host_unknown)
       {
       BOOL old_helo_verified = helo_verified;
-      uschar *p = smtp_cmd_argument;
+      uschar *p = smtp_cmd_data;
 
       while (*p != 0 && !isspace(*p)) { *p = tolower(*p); p++; }
       *p = 0;
 
       while (*p != 0 && !isspace(*p)) { *p = tolower(*p); p++; }
       *p = 0;
@@ -2986,7 +2994,7 @@ while (done <= 0)
       break;
       }
 
       break;
       }
 
-    if (smtp_cmd_argument[0] == 0)
+    if (smtp_cmd_data[0] == 0)
       {
       done = synprot_error(L_smtp_protocol_error, 501, NULL,
         US"MAIL must have an address operand");
       {
       done = synprot_error(L_smtp_protocol_error, 501, NULL,
         US"MAIL must have an address operand");
@@ -3145,8 +3153,8 @@ while (done <= 0)
     TRUE flag allows "<>" as a sender address. */
 
     raw_sender = ((rewrite_existflags & rewrite_smtp) != 0)?
     TRUE flag allows "<>" as a sender address. */
 
     raw_sender = ((rewrite_existflags & rewrite_smtp) != 0)?
-      rewrite_one(smtp_cmd_argument, rewrite_smtp, NULL, FALSE, US"",
-        global_rewrite_rules) : smtp_cmd_argument;
+      rewrite_one(smtp_cmd_data, rewrite_smtp, NULL, FALSE, US"",
+        global_rewrite_rules) : smtp_cmd_data;
 
     /* rfc821_domains = TRUE; << no longer needed */
     raw_sender =
 
     /* rfc821_domains = TRUE; << no longer needed */
     raw_sender =
@@ -3156,7 +3164,7 @@ while (done <= 0)
 
     if (raw_sender == NULL)
       {
 
     if (raw_sender == NULL)
       {
-      done = synprot_error(L_smtp_syntax_error, 501, smtp_cmd_argument, errmess);
+      done = synprot_error(L_smtp_syntax_error, 501, smtp_cmd_data, errmess);
       break;
       }
 
       break;
       }
 
@@ -3216,7 +3224,7 @@ while (done <= 0)
       else
         {
         smtp_printf("501 %s: sender address must contain a domain\r\n",
       else
         {
         smtp_printf("501 %s: sender address must contain a domain\r\n",
-          smtp_cmd_argument);
+          smtp_cmd_data);
         log_write(L_smtp_syntax_error,
           LOG_MAIN|LOG_REJECT,
           "unqualified sender rejected: <%s> %s%s",
         log_write(L_smtp_syntax_error,
           LOG_MAIN|LOG_REJECT,
           "unqualified sender rejected: <%s> %s%s",
@@ -3285,7 +3293,7 @@ while (done <= 0)
 
     /* Check for an operand */
 
 
     /* Check for an operand */
 
-    if (smtp_cmd_argument[0] == 0)
+    if (smtp_cmd_data[0] == 0)
       {
       done = synprot_error(L_smtp_syntax_error, 501, NULL,
         US"RCPT must have an address operand");
       {
       done = synprot_error(L_smtp_syntax_error, 501, NULL,
         US"RCPT must have an address operand");
@@ -3297,8 +3305,8 @@ while (done <= 0)
     as a recipient address */
 
     recipient = ((rewrite_existflags & rewrite_smtp) != 0)?
     as a recipient address */
 
     recipient = ((rewrite_existflags & rewrite_smtp) != 0)?
-      rewrite_one(smtp_cmd_argument, rewrite_smtp, NULL, FALSE, US"",
-        global_rewrite_rules) : smtp_cmd_argument;
+      rewrite_one(smtp_cmd_data, rewrite_smtp, NULL, FALSE, US"",
+        global_rewrite_rules) : smtp_cmd_data;
 
     /* rfc821_domains = TRUE; << no longer needed */
     recipient = parse_extract_address(recipient, &errmess, &start, &end,
 
     /* rfc821_domains = TRUE; << no longer needed */
     recipient = parse_extract_address(recipient, &errmess, &start, &end,
@@ -3307,7 +3315,7 @@ while (done <= 0)
 
     if (recipient == NULL)
       {
 
     if (recipient == NULL)
       {
-      done = synprot_error(L_smtp_syntax_error, 501, smtp_cmd_argument, errmess);
+      done = synprot_error(L_smtp_syntax_error, 501, smtp_cmd_data, errmess);
       rcpt_fail_count++;
       break;
       }
       rcpt_fail_count++;
       break;
       }
@@ -3337,7 +3345,7 @@ while (done <= 0)
         {
         rcpt_fail_count++;
         smtp_printf("501 %s: recipient address must contain a domain\r\n",
         {
         rcpt_fail_count++;
         smtp_printf("501 %s: recipient address must contain a domain\r\n",
-          smtp_cmd_argument);
+          smtp_cmd_data);
         log_write(L_smtp_syntax_error,
           LOG_MAIN|LOG_REJECT, "unqualified recipient rejected: "
           "<%s> %s%s", recipient, host_and_ident(TRUE),
         log_write(L_smtp_syntax_error,
           LOG_MAIN|LOG_REJECT, "unqualified recipient rejected: "
           "<%s> %s%s", recipient, host_and_ident(TRUE),
@@ -3500,7 +3508,7 @@ while (done <= 0)
       uschar *s = NULL;
 
       /* rfc821_domains = TRUE; << no longer needed */
       uschar *s = NULL;
 
       /* rfc821_domains = TRUE; << no longer needed */
-      address = parse_extract_address(smtp_cmd_argument, &errmess, &start, &end,
+      address = parse_extract_address(smtp_cmd_data, &errmess, &start, &end,
         &recipient_domain, FALSE);
       /* rfc821_domains = FALSE; << no longer needed */
 
         &recipient_domain, FALSE);
       /* rfc821_domains = FALSE; << no longer needed */
 
@@ -3546,7 +3554,7 @@ while (done <= 0)
       {
       BOOL save_log_testing_mode = log_testing_mode;
       address_test_mode = log_testing_mode = TRUE;
       {
       BOOL save_log_testing_mode = log_testing_mode;
       address_test_mode = log_testing_mode = TRUE;
-      (void) verify_address(deliver_make_addr(smtp_cmd_argument, FALSE),
+      (void) verify_address(deliver_make_addr(smtp_cmd_data, FALSE),
         smtp_out, vopt_is_recipient | vopt_qualify | vopt_expn, -1, -1, -1,
         NULL, NULL, NULL);
       address_test_mode = FALSE;
         smtp_out, vopt_is_recipient | vopt_qualify | vopt_expn, -1, -1, -1,
         NULL, NULL, NULL);
       address_test_mode = FALSE;
@@ -3782,7 +3790,7 @@ while (done <= 0)
 
     /* Compute the serialization key for this command. */
 
 
     /* Compute the serialization key for this command. */
 
-    etrn_serialize_key = string_sprintf("etrn-%s\n", smtp_cmd_argument);
+    etrn_serialize_key = string_sprintf("etrn-%s\n", smtp_cmd_data);
 
     /* If a command has been specified for running as a result of ETRN, we
     permit any argument to ETRN. If not, only the # standard form is permitted,
 
     /* If a command has been specified for running as a result of ETRN, we
     permit any argument to ETRN. If not, only the # standard form is permitted,
@@ -3794,7 +3802,7 @@ while (done <= 0)
       uschar *error;
       BOOL rc;
       etrn_command = smtp_etrn_command;
       uschar *error;
       BOOL rc;
       etrn_command = smtp_etrn_command;
-      deliver_domain = smtp_cmd_argument;
+      deliver_domain = smtp_cmd_data;
       rc = transport_set_up_command(&argv, smtp_etrn_command, TRUE, 0, NULL,
         US"ETRN processing", &error);
       deliver_domain = NULL;
       rc = transport_set_up_command(&argv, smtp_etrn_command, TRUE, 0, NULL,
         US"ETRN processing", &error);
       deliver_domain = NULL;
@@ -3811,7 +3819,7 @@ while (done <= 0)
 
     else
       {
 
     else
       {
-      if (*smtp_cmd_argument++ != '#')
+      if (*smtp_cmd_data++ != '#')
         {
         done = synprot_error(L_smtp_syntax_error, 501, NULL,
           US"argument must begin with #");
         {
         done = synprot_error(L_smtp_syntax_error, 501, NULL,
           US"argument must begin with #");
@@ -3819,7 +3827,7 @@ while (done <= 0)
         }
       etrn_command = US"exim -R";
       argv = child_exec_exim(CEE_RETURN_ARGV, TRUE, NULL, TRUE, 2, US"-R",
         }
       etrn_command = US"exim -R";
       argv = child_exec_exim(CEE_RETURN_ARGV, TRUE, NULL, TRUE, 2, US"-R",
-        smtp_cmd_argument);
+        smtp_cmd_data);
       }
 
     /* If we are host-testing, don't actually do anything. */
       }
 
     /* If we are host-testing, don't actually do anything. */
@@ -3842,7 +3850,7 @@ while (done <= 0)
 
     if (smtp_etrn_serialize && !enq_start(etrn_serialize_key))
       {
 
     if (smtp_etrn_serialize && !enq_start(etrn_serialize_key))
       {
-      smtp_printf("458 Already processing %s\r\n", smtp_cmd_argument);
+      smtp_printf("458 Already processing %s\r\n", smtp_cmd_data);
       break;
       }
 
       break;
       }
 
@@ -3952,10 +3960,12 @@ while (done <= 0)
 
 
     case TOO_MANY_NONMAIL_CMD:
 
 
     case TOO_MANY_NONMAIL_CMD:
+    s = smtp_cmd_buffer;
+    while (*s != 0 && !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),
     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),
-      smtp_cmd_argument - smtp_cmd_buffer, smtp_cmd_buffer);
+      s - smtp_cmd_buffer, smtp_cmd_buffer);
     smtp_printf("554 Too many nonmail commands\r\n");
     done = 1;   /* Pretend eof - drops connection */
     break;
     smtp_printf("554 Too many nonmail commands\r\n");
     done = 1;   /* Pretend eof - drops connection */
     break;
index 5ff787e283bb1eaf1b0d7845e5c6e716fccd6720..da92933120ad37f43b1ba88d7b04d79ac137e8c0 100644 (file)
@@ -65,7 +65,7 @@ mail:
          senders = ok@test3
   accept senders = ok@test1 : ok@test3
          verify  = sender
          senders = ok@test3
   accept senders = ok@test1 : ok@test3
          verify  = sender
-         logwrite = :main,reject: mail accepted
+         logwrite = :main,reject: mail accepted "$smtp_command" "$smtp_command_argument"
 
 rcpt:
   accept senders = +ok_senders
 
 rcpt:
   accept senders = +ok_senders
index 77ae6a64fd2aec24b492c953dbbdf2e1076662df..39eb9610d15b1385750ab93307ad3b4576d0c4ca 100644 (file)
@@ -19,7 +19,7 @@
 1999-03-02 09:44:33 H=[10.9.8.7] U=CALLER rejected connection in "connect" ACL
 1999-03-02 09:44:33 10.9.8.8 accepted by connect ACL
 1999-03-02 09:44:33 H=[10.9.8.8] U=CALLER rejected MAIL <bad@test1>
 1999-03-02 09:44:33 H=[10.9.8.7] U=CALLER rejected connection in "connect" ACL
 1999-03-02 09:44:33 10.9.8.8 accepted by connect ACL
 1999-03-02 09:44:33 H=[10.9.8.8] U=CALLER rejected MAIL <bad@test1>
-1999-03-02 09:44:33 mail accepted
+1999-03-02 09:44:33 mail accepted "mail from:<ok@test1>" "<ok@test1>"
 1999-03-02 09:44:33 H=[10.9.8.9] U=CALLER rejected connection in "connect" ACL: forcibly dropped
 1999-03-02 09:44:33 U=CALLER rejected connection in "connect" ACL
 1999-03-02 09:44:33 10.9.8.10 accepted by connect ACL
 1999-03-02 09:44:33 H=[10.9.8.9] U=CALLER rejected connection in "connect" ACL: forcibly dropped
 1999-03-02 09:44:33 U=CALLER rejected connection in "connect" ACL
 1999-03-02 09:44:33 10.9.8.10 accepted by connect ACL
@@ -27,7 +27,7 @@
 1999-03-02 09:44:33 ACL "warn" with "message" setting found in a non-message (EHLO or HELO) ACL: cannot specify header lines here: message ignored
 1999-03-02 09:44:33 H=(x.y.z) [10.9.8.10] U=CALLER rejected EHLO or HELO x.y.z
 1999-03-02 09:44:33 10.9.8.8 accepted by connect ACL
 1999-03-02 09:44:33 ACL "warn" with "message" setting found in a non-message (EHLO or HELO) ACL: cannot specify header lines here: message ignored
 1999-03-02 09:44:33 H=(x.y.z) [10.9.8.10] U=CALLER rejected EHLO or HELO x.y.z
 1999-03-02 09:44:33 10.9.8.8 accepted by connect ACL
-1999-03-02 09:44:33 mail accepted
+1999-03-02 09:44:33 mail accepted "mail from:<ok@test3>" "<ok@test3>"
 1999-03-02 09:44:33 10HmbH-0005vi-00 <= ok@test3 H=[10.9.8.8] U=CALLER P=smtp S=sss
 1999-03-02 09:44:33 10HmbH-0005vi-00 => x <x@y> R=accept T=appendfile
 1999-03-02 09:44:33 10HmbH-0005vi-00 Completed
 1999-03-02 09:44:33 10HmbH-0005vi-00 <= ok@test3 H=[10.9.8.8] U=CALLER P=smtp S=sss
 1999-03-02 09:44:33 10HmbH-0005vi-00 => x <x@y> R=accept T=appendfile
 1999-03-02 09:44:33 10HmbH-0005vi-00 Completed
 1999-03-02 09:44:33 10HmbJ-0005vi-00 <= <> R=10HmbB-0005vi-00 U=EXIMUSER P=local S=sss
 1999-03-02 09:44:33 10HmbJ-0005vi-00 => userx <userx@test1> R=accept T=appendfile
 1999-03-02 09:44:33 10HmbJ-0005vi-00 Completed
 1999-03-02 09:44:33 10HmbJ-0005vi-00 <= <> R=10HmbB-0005vi-00 U=EXIMUSER P=local S=sss
 1999-03-02 09:44:33 10HmbJ-0005vi-00 => userx <userx@test1> R=accept T=appendfile
 1999-03-02 09:44:33 10HmbJ-0005vi-00 Completed
+1999-03-02 09:44:33 10.9.8.8 accepted by connect ACL
+1999-03-02 09:44:33 H=(test.ex) [10.9.8.8] U=CALLER Warning: This warning is from a HELO ACL (command ehlo test.ex)
+1999-03-02 09:44:33 ACL "warn" with "message" setting found in a non-message (EHLO or HELO) ACL: cannot specify header lines here: message ignored
+1999-03-02 09:44:33 H=(test.ex) [10.9.8.8] U=CALLER rejected EHLO or HELO test.ex
+1999-03-02 09:44:33 mail accepted "mail from: <ok@test3> SIZE=1234" "<ok@test3> SIZE=1234"
+1999-03-02 09:44:33 10HmbK-0005vi-00 <= ok@test3 H=[10.9.8.8] U=CALLER P=smtp S=sss
+1999-03-02 09:44:33 10HmbK-0005vi-00 => x <x@y> R=accept T=appendfile
+1999-03-02 09:44:33 10HmbK-0005vi-00 Completed
index 9dd43af384faae75c89a7d2fa3ebb00a741958d4..12fcf69e8eee0d4cd9363e6cc8971b6dd059311b 100644 (file)
@@ -8,3 +8,13 @@ X-ACL-Warn: added header line
 
 Some message
 
 
 Some message
 
+From ok@test3 Tue Mar 02 09:44:33 1999
+Received: from [10.9.8.8] (ident=CALLER)
+       by myhost.test.ex with smtp (Exim x.yz)
+       (envelope-from <ok@test3>)
+       id 10HmbK-0005vi-00
+       for x@y; Tue, 2 Mar 1999 09:44:33 +0000
+X-ACL-Warn: added header line
+
+Some message
+
index 3a0cd7fb86359ad36808cc09d42a4b90518a732c..dae415203d3ea35e0b1dae5228f667dddb18448a 100644 (file)
@@ -2,3 +2,5 @@
 1999-03-02 09:44:33 rcpt accepted
 1999-03-02 09:44:33 ACL "warn" with "message" setting found in a non-message (EHLO or HELO) ACL: cannot specify header lines here: message ignored
 1999-03-02 09:44:33 rcpt accepted
 1999-03-02 09:44:33 rcpt accepted
 1999-03-02 09:44:33 ACL "warn" with "message" setting found in a non-message (EHLO or HELO) ACL: cannot specify header lines here: message ignored
 1999-03-02 09:44:33 rcpt accepted
+1999-03-02 09:44:33 ACL "warn" with "message" setting found in a non-message (EHLO or HELO) ACL: cannot specify header lines here: message ignored
+1999-03-02 09:44:33 rcpt accepted
index a2e943557ea507a0a50e6a6de53ba6840c0a4ea7..8fdad8e45284cff1a011cc0c56ebe80f3709c43b 100644 (file)
@@ -30,11 +30,11 @@ F From: ok@test4
   Date: Tue, 2 Mar 1999 09:44:33 +0000
 1999-03-02 09:44:33 H=[10.9.8.7] U=CALLER rejected connection in "connect" ACL
 1999-03-02 09:44:33 H=[10.9.8.8] U=CALLER rejected MAIL <bad@test1>
   Date: Tue, 2 Mar 1999 09:44:33 +0000
 1999-03-02 09:44:33 H=[10.9.8.7] U=CALLER rejected connection in "connect" ACL
 1999-03-02 09:44:33 H=[10.9.8.8] U=CALLER rejected MAIL <bad@test1>
-1999-03-02 09:44:33 mail accepted
+1999-03-02 09:44:33 mail accepted "mail from:<ok@test1>" "<ok@test1>"
 1999-03-02 09:44:33 H=[10.9.8.9] U=CALLER rejected connection in "connect" ACL: forcibly dropped
 1999-03-02 09:44:33 U=CALLER rejected connection in "connect" ACL
 1999-03-02 09:44:33 H=(x.y.z) [10.9.8.10] U=CALLER rejected EHLO or HELO x.y.z
 1999-03-02 09:44:33 H=[10.9.8.9] U=CALLER rejected connection in "connect" ACL: forcibly dropped
 1999-03-02 09:44:33 U=CALLER rejected connection in "connect" ACL
 1999-03-02 09:44:33 H=(x.y.z) [10.9.8.10] U=CALLER rejected EHLO or HELO x.y.z
-1999-03-02 09:44:33 mail accepted
+1999-03-02 09:44:33 mail accepted "mail from:<ok@test3>" "<ok@test3>"
 1999-03-02 09:44:33 10HmbA-0005vi-00 F=<userx@test1> rejected by non-SMTP ACL: don't like sender userx@test1
 Envelope-from: <userx@test1>
 Envelope-to: <userx@test.ex>
 1999-03-02 09:44:33 10HmbA-0005vi-00 F=<userx@test1> rejected by non-SMTP ACL: don't like sender userx@test1
 Envelope-from: <userx@test1>
 Envelope-to: <userx@test.ex>
@@ -55,3 +55,5 @@ P Received: from CALLER by myhost.test.ex with local (Exim x.yz)
 I Message-Id: <E10HmbB-0005vi-00@myhost.test.ex>
 F From: userx@test1
   Date: Tue, 2 Mar 1999 09:44:33 +0000
 I Message-Id: <E10HmbB-0005vi-00@myhost.test.ex>
 F From: userx@test1
   Date: Tue, 2 Mar 1999 09:44:33 +0000
+1999-03-02 09:44:33 H=(test.ex) [10.9.8.8] U=CALLER rejected EHLO or HELO test.ex
+1999-03-02 09:44:33 mail accepted "mail from: <ok@test3> SIZE=1234" "<ok@test3> SIZE=1234"
index 71b334130a9a3fbf507f2bc312a5aab3db8a0136..8fbf948373404c9f9ff581804111933653504709 100644 (file)
@@ -60,3 +60,12 @@ exim -DBR=no_bounce_return_body -odi -f userx@test1 userx
 Test message 1.
 .
 ****
 Test message 1.
 .
 ****
+exim -odi -bs -oMa 10.9.8.8
+ehlo test.ex
+mail from: <ok@test3> SIZE=1234
+rcpt to:<x@y>
+data
+Some message
+.
+quit
+****
index c1ebc4d0cb4997d5337d8f6232a1fa0555c6f85b..70391fd128ed03bde709ab6f7ee31a908091f429 100644 (file)
@@ -58,9 +58,10 @@ check verify = sender
 ok in "!bad"? yes (end of list)
 ----------- end verify ------------
 sender ok@test1 verified ok
 ok in "!bad"? yes (end of list)
 ----------- end verify ------------
 sender ok@test1 verified ok
-check logwrite = :main,reject: mail accepted
+check logwrite = :main,reject: mail accepted "$smtp_command" "$smtp_command_argument"
+               = :main,reject: mail accepted "mail from:<ok@test1>" "<ok@test1>"
 LOG: MAIN REJECT
 LOG: MAIN REJECT
-  mail accepted
+  mail accepted "mail from:<ok@test1>" "<ok@test1>"
 accept: condition test succeeded
 using ACL "rcpt"
 processing "accept"
 accept: condition test succeeded
 using ACL "rcpt"
 processing "accept"
@@ -142,9 +143,10 @@ check verify = sender
 ok in "!bad"? yes (end of list)
 ----------- end verify ------------
 sender ok@test3 verified ok
 ok in "!bad"? yes (end of list)
 ----------- end verify ------------
 sender ok@test3 verified ok
-check logwrite = :main,reject: mail accepted
+check logwrite = :main,reject: mail accepted "$smtp_command" "$smtp_command_argument"
+               = :main,reject: mail accepted "mail from:<ok@test3>" "<ok@test3>"
 LOG: MAIN REJECT
 LOG: MAIN REJECT
-  mail accepted
+  mail accepted "mail from:<ok@test3>" "<ok@test3>"
 accept: condition test succeeded
 using ACL "rcpt"
 processing "accept"
 accept: condition test succeeded
 using ACL "rcpt"
 processing "accept"
@@ -184,3 +186,5 @@ LOG: MAIN
 LOG: smtp_connection MAIN
   SMTP connection from CALLER closed by QUIT
 >>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
 LOG: smtp_connection MAIN
   SMTP connection from CALLER closed by QUIT
 >>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+1999-03-02 09:44:33 ACL "warn" with "message" setting found in a non-message (EHLO or HELO) ACL: cannot specify header lines here: message ignored
+1999-03-02 09:44:33 rcpt accepted
index 490d13fadd18999b665f46ff79918645da7344f8..5fff92b0a891d85ec2cfb1c53551f091bc16c670 100644 (file)
 354 Enter message, ending with "." on a line by itself\r
 250 OK id=10HmbH-0005vi-00\r
 221 myhost.test.ex closing connection\r
 354 Enter message, ending with "." on a line by itself\r
 250 OK id=10HmbH-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
+550 Administrative prohibition\r
+250 OK\r
+250 Accepted\r
+354 Enter message, ending with "." on a line by itself\r
+250 OK id=10HmbK-0005vi-00\r
+221 myhost.test.ex closing connection\r