git://git.exim.org
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
58de37c
)
Add $smtp_command.
author
Philip Hazel
<ph10@hermes.cam.ac.uk>
Tue, 13 Sep 2005 11:13:27 +0000
(11:13 +0000)
committer
Philip Hazel
<ph10@hermes.cam.ac.uk>
Tue, 13 Sep 2005 11:13:27 +0000
(11:13 +0000)
doc/doc-txt/ChangeLog
patch
|
blob
|
history
doc/doc-txt/NewStuff
patch
|
blob
|
history
src/src/expand.c
patch
|
blob
|
history
src/src/globals.c
patch
|
blob
|
history
src/src/globals.h
patch
|
blob
|
history
src/src/smtp_in.c
patch
|
blob
|
history
diff --git
a/doc/doc-txt/ChangeLog
b/doc/doc-txt/ChangeLog
index 7e8392eae9848471ea019d67d7054c38e044d0d8..6444b330e63aacdec86a93176f091c62cd733aab 100644
(file)
--- a/
doc/doc-txt/ChangeLog
+++ b/
doc/doc-txt/ChangeLog
@@
-1,4
+1,4
@@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.22
6 2005/09/13 10:35:52
ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.22
7 2005/09/13 11:13:27
ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
Change log file for Exim from version 4.21
-------------------------------------------
@@
-179,6
+179,8
@@
PH/44 Wrote a long comment about why errors_to addresses are verified as
TF/01 Add missing LIBS=-lm to OS/Makefile-OpenBSD which was overlooked when
the ratelimit ACL was added.
TF/01 Add missing LIBS=-lm to OS/Makefile-OpenBSD which was overlooked when
the ratelimit ACL was added.
+PH/45 Added $smtp_command for the full command (cf $smtp_command_argument).
+
Exim version 4.52
-----------------
Exim version 4.52
-----------------
diff --git
a/doc/doc-txt/NewStuff
b/doc/doc-txt/NewStuff
index 85be6dc06bff708b59cb79855200f979a82d2ecf..3d3c1d8e15184a5473ca07cdd30b5c4ad6c4fc45 100644
(file)
--- a/
doc/doc-txt/NewStuff
+++ b/
doc/doc-txt/NewStuff
@@
-1,4
+1,4
@@
-$Cambridge: exim/doc/doc-txt/NewStuff,v 1.6
8 2005/09/12 13:39:31
ph10 Exp $
+$Cambridge: exim/doc/doc-txt/NewStuff,v 1.6
9 2005/09/13 11:13:27
ph10 Exp $
New Features in Exim
--------------------
New Features in Exim
--------------------
@@
-104,7
+104,7
@@
PH/06 It is now possible to specify a port number along with a host name or
PH/07 $smtp_command_argument is now set for all SMTP commands, not just the
non-message ones. This makes it possible to inspect the complete command
PH/07 $smtp_command_argument is now set for all SMTP commands, not just the
non-message ones. This makes it possible to inspect the complete command
- for RCPT commands, for example.
+ for RCPT commands, for example.
But see also PH/45 below.
PH/08 The ${eval expansion now supports % as a "remainder" operator.
PH/08 The ${eval expansion now supports % as a "remainder" operator.
@@
-146,6
+146,11
@@
PH/11 There is a new log selector, "unknown_in_list", which provokes a log
entry when the result of a list match is failure because a DNS lookup
failed.
entry when the result of a list match is failure because a DNS lookup
failed.
+PH/12 There is a new variable called $smtp_command which contains the full SMTP
+ command (compare $smtp_command_argument - see PH/07 above). This makes it
+ possible to distinguish between HELO and EHLO, and also between things
+ like "MAIL FROM:<>" and "MAIL FROM: <>".
+
Exim version 4.52
-----------------
Exim version 4.52
-----------------
diff --git
a/src/src/expand.c
b/src/src/expand.c
index 273f2a507fdbc5111e5ba51bcdc56fe2772288c2..aa1398e8a7e348f388985a10b3eb884ee4fef6bd 100644
(file)
--- a/
src/src/expand.c
+++ b/
src/src/expand.c
@@
-1,4
+1,4
@@
-/* $Cambridge: exim/src/src/expand.c,v 1.4
1 2005/08/23 08:46:33
ph10 Exp $ */
+/* $Cambridge: exim/src/src/expand.c,v 1.4
2 2005/09/13 11:13:27
ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
/*************************************************
* Exim - an Internet mail transport agent *
@@
-482,7
+482,8
@@
static var_entry var_table[] = {
{ "sender_rcvhost", vtype_stringptr, &sender_rcvhost },
{ "sender_verify_failure",vtype_stringptr, &sender_verify_failure },
{ "smtp_active_hostname", vtype_stringptr, &smtp_active_hostname },
{ "sender_rcvhost", vtype_stringptr, &sender_rcvhost },
{ "sender_verify_failure",vtype_stringptr, &sender_verify_failure },
{ "smtp_active_hostname", vtype_stringptr, &smtp_active_hostname },
- { "smtp_command_argument", vtype_stringptr, &smtp_command_argument },
+ { "smtp_command", vtype_stringptr, &smtp_cmd_buffer },
+ { "smtp_command_argument", vtype_stringptr, &smtp_cmd_argument },
{ "sn0", vtype_filter_int, &filter_sn[0] },
{ "sn1", vtype_filter_int, &filter_sn[1] },
{ "sn2", vtype_filter_int, &filter_sn[2] },
{ "sn0", vtype_filter_int, &filter_sn[0] },
{ "sn1", vtype_filter_int, &filter_sn[1] },
{ "sn2", vtype_filter_int, &filter_sn[2] },
diff --git
a/src/src/globals.c
b/src/src/globals.c
index 78ba196541520157e565eb14a50083112f89ec93..eed5a97041ee0da0af0f7eccd6ce83fc796ad21f 100644
(file)
--- a/
src/src/globals.c
+++ b/
src/src/globals.c
@@
-1,4
+1,4
@@
-/* $Cambridge: exim/src/src/globals.c,v 1.3
7 2005/09/12 13:39:31
ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.c,v 1.3
8 2005/09/13 11:13:27
ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
/*************************************************
* Exim - an Internet mail transport agent *
@@
-1014,7
+1014,8
@@
uschar *smtp_banner = US"$smtp_active_hostname ESMTP "
"\0<---------------Space to patch smtp_banner->";
BOOL smtp_batched_input = FALSE;
BOOL smtp_check_spool_space = TRUE;
"\0<---------------Space to patch smtp_banner->";
BOOL smtp_batched_input = FALSE;
BOOL smtp_check_spool_space = TRUE;
-uschar *smtp_command_argument = NULL;
+uschar *smtp_cmd_argument = NULL;
+uschar *smtp_cmd_buffer = NULL;
int smtp_connect_backlog = 20;
double smtp_delay_mail = 0.0;
double smtp_delay_rcpt = 0.0;
int smtp_connect_backlog = 20;
double smtp_delay_mail = 0.0;
double smtp_delay_rcpt = 0.0;
diff --git
a/src/src/globals.h
b/src/src/globals.h
index 359fd92bda6c28baf2bc31ccc271db282c3db06d..3d8a45be5f12479f7bfd214de06ccd50645f5c37 100644
(file)
--- a/
src/src/globals.h
+++ b/
src/src/globals.h
@@
-1,4
+1,4
@@
-/* $Cambridge: exim/src/src/globals.h,v 1.2
8 2005/09/12 10:08:54
ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.h,v 1.2
9 2005/09/13 11:13:27
ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
/*************************************************
* Exim - an Internet mail transport agent *
@@
-619,7
+619,8
@@
extern uschar *smtp_active_hostname; /* Hostname for this message */
extern BOOL smtp_authenticated; /* Sending client has authenticated */
extern uschar *smtp_banner; /* Banner string (to be expanded) */
extern BOOL smtp_check_spool_space; /* TRUE to check SMTP SIZE value */
extern BOOL smtp_authenticated; /* Sending client has authenticated */
extern uschar *smtp_banner; /* Banner string (to be expanded) */
extern BOOL smtp_check_spool_space; /* TRUE to check SMTP SIZE value */
-extern uschar *smtp_command_argument; /* For all SMTP commands */
+extern uschar *smtp_cmd_argument; /* For all SMTP commands */
+extern uschar *smtp_cmd_buffer; /* SMTP command buffer */
extern int smtp_connect_backlog; /* Max backlog permitted */
extern double smtp_delay_mail; /* Current MAIL delay */
extern double smtp_delay_rcpt; /* Current RCPT delay */
extern int smtp_connect_backlog; /* Max backlog permitted */
extern double smtp_delay_mail; /* Current MAIL delay */
extern double smtp_delay_rcpt; /* Current RCPT delay */
diff --git
a/src/src/smtp_in.c
b/src/src/smtp_in.c
index c08d17972a292dd952b96e1fce68337ba0904f14..01f4a09ef57410e3e69bac7a335281364f42c82d 100644
(file)
--- a/
src/src/smtp_in.c
+++ b/
src/src/smtp_in.c
@@
-1,4
+1,4
@@
-/* $Cambridge: exim/src/src/smtp_in.c,v 1.2
5 2005/09/12 10:08:54
ph10 Exp $ */
+/* $Cambridge: exim/src/src/smtp_in.c,v 1.2
6 2005/09/13 11:13:27
ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
/*************************************************
* Exim - an Internet mail transport agent *
@@
-39,7
+39,7
@@
by RFC 821. However, RFC 1869 specifies that this must be increased for SMTP
commands that accept arguments, and this in particular applies to AUTH, where
the data can be quite long. */
commands that accept arguments, and this in particular applies to AUTH, where
the data can be quite long. */
-#define cmd_buffer_size 2048
+#define
smtp_
cmd_buffer_size 2048
/* Size of buffer for reading SMTP incoming packets */
/* Size of buffer for reading SMTP incoming packets */
@@
-119,8
+119,6
@@
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 *cmd_buffer;
-
/* 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
@@
-455,7
+453,8
@@
exim_exit(EXIT_FAILURE);
There are sites that don't do this, and in any case internal SMTP probably
should check only for LF. Consequently, we check here for LF only. The line
ends up with [CR]LF removed from its end. If we get an overlong line, treat as
There are sites that don't do this, and in any case internal SMTP probably
should check only for LF. Consequently, we check here for LF only. The line
ends up with [CR]LF removed from its end. If we get an overlong line, treat as
-an unknown command. The command is read into the static cmd_buffer.
+an unknown command. The command is read into the global smtp_cmd_buffer so that
+it is available via $smtp_command.
The character reading routine sets up a timeout for each block actually read
from the input (which may contain more than one command). We set up a special
The character reading routine sets up a timeout for each block actually read
from the input (which may contain more than one command). We set up a special
@@
-480,7
+479,7
@@
os_non_restarting_signal(SIGALRM, command_timeout_handler);
while ((c = (receive_getc)()) != '\n' && c != EOF)
{
while ((c = (receive_getc)()) != '\n' && c != EOF)
{
- if (ptr >= cmd_buffer_size)
+ if (ptr >=
smtp_
cmd_buffer_size)
{
os_non_restarting_signal(SIGALRM, sigalrm_handler);
return OTHER_CMD;
{
os_non_restarting_signal(SIGALRM, sigalrm_handler);
return OTHER_CMD;
@@
-490,7
+489,7
@@
while ((c = (receive_getc)()) != '\n' && c != EOF)
hadnull = TRUE;
c = '?';
}
hadnull = TRUE;
c = '?';
}
- cmd_buffer[ptr++] = c;
+
smtp_
cmd_buffer[ptr++] = c;
}
receive_linecount++; /* For BSMTP errors */
}
receive_linecount++; /* For BSMTP errors */
@@
-504,10
+503,10
@@
if (c == EOF) return EOF_CMD;
/* Remove any CR and white space at the end of the line, and terminate the
string. */
/* Remove any CR and white space at the end of the line, and terminate the
string. */
-while (ptr > 0 && isspace(cmd_buffer[ptr-1])) ptr--;
-cmd_buffer[ptr] = 0;
+while (ptr > 0 && isspace(
smtp_
cmd_buffer[ptr-1])) ptr--;
+
smtp_
cmd_buffer[ptr] = 0;
-DEBUG(D_receive) debug_printf("SMTP<< %s\n", cmd_buffer);
+DEBUG(D_receive) debug_printf("SMTP<< %s\n",
smtp_
cmd_buffer);
/* NULLs are not allowed in SMTP commands */
/* NULLs are not allowed in SMTP commands */
@@
-519,7
+518,7
@@
if required. */
for (p = cmd_list; p < cmd_list_end; p++)
{
for (p = cmd_list; p < cmd_list_end; p++)
{
- if (strncmpic(cmd_buffer, US p->name, p->len) == 0)
+ if (strncmpic(
smtp_
cmd_buffer, US p->name, p->len) == 0)
{
if (smtp_inptr < smtp_inend && /* Outstanding input */
p->cmd < sync_cmd_limit && /* Command should sync */
{
if (smtp_inptr < smtp_inend && /* Outstanding input */
p->cmd < sync_cmd_limit && /* Command should sync */
@@
-533,7
+532,7
@@
for (p = cmd_list; p < cmd_list_end; p++)
the following test, so that if it fails, the command name can easily be
logged. */
the following test, so that if it fails, the command name can easily be
logged. */
- smtp_c
ommand_argument =
cmd_buffer + p->len;
+ smtp_c
md_argument = smtp_
cmd_buffer + p->len;
/* 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
@@
-554,8
+553,8
@@
for (p = cmd_list; p < cmd_list_end; p++)
/* 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. */
/* 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. */
- while (isspace(*smtp_c
ommand_argument)) smtp_comman
d_argument++;
- return (p->has_arg || *smtp_c
omman
d_argument == 0)? p->cmd : BADARG_CMD;
+ while (isspace(*smtp_c
md_argument)) smtp_cm
d_argument++;
+ return (p->has_arg || *smtp_c
m
d_argument == 0)? p->cmd : BADARG_CMD;
}
}
}
}
@@
-743,7
+742,7
@@
return yield;
* Extract SMTP command option *
*************************************************/
* Extract SMTP command option *
*************************************************/
-/* This function picks the next option setting off the end of smtp_c
omman
d_argument. It
+/* This function picks the next option setting off the end of smtp_c
m
d_argument. 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.
@@
-758,11
+757,11
@@
static BOOL
extract_option(uschar **name, uschar **value)
{
uschar *n;
extract_option(uschar **name, uschar **value)
{
uschar *n;
-uschar *v = smtp_c
ommand_argument + Ustrlen(smtp_comman
d_argument) -1;
+uschar *v = smtp_c
md_argument + Ustrlen(smtp_cm
d_argument) -1;
while (isspace(*v)) v--;
v[1] = 0;
while (isspace(*v)) v--;
v[1] = 0;
-while (v > smtp_c
omman
d_argument && *v != '=' && !isspace(*v)) v--;
+while (v > smtp_c
m
d_argument && *v != '=' && !isspace(*v)) v--;
if (*v != '=') return FALSE;
n = v;
if (*v != '=') return FALSE;
n = v;
@@
-926,7
+925,7
@@
while (done <= 0)
case HELO_CMD:
case EHLO_CMD:
case HELO_CMD:
case EHLO_CMD:
- check_helo(smtp_c
omman
d_argument);
+ check_helo(smtp_c
m
d_argument);
/* Fall through */
case RSET_CMD:
/* Fall through */
case RSET_CMD:
@@
-944,11
+943,11
@@
while (done <= 0)
case MAIL_CMD:
if (sender_address != NULL)
/* The function moan_smtp_batch() does not return. */
case MAIL_CMD:
if (sender_address != NULL)
/* The function moan_smtp_batch() does not return. */
- moan_smtp_batch(cmd_buffer, "503 Sender already given");
+ moan_smtp_batch(
smtp_
cmd_buffer, "503 Sender already given");
- if (smtp_c
omman
d_argument[0] == 0)
+ if (smtp_c
m
d_argument[0] == 0)
/* The function moan_smtp_batch() does not return. */
/* The function moan_smtp_batch() does not return. */
- moan_smtp_batch(cmd_buffer, "501 MAIL FROM must have an address operand");
+ moan_smtp_batch(
smtp_
cmd_buffer, "501 MAIL FROM must have an address operand");
/* Reset to start of message */
/* Reset to start of message */
@@
-957,8
+956,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_c
omman
d_argument, rewrite_smtp|rewrite_smtp_sender, NULL, FALSE,
- US"", global_rewrite_rules) : smtp_c
omman
d_argument;
+ rewrite_one(smtp_c
m
d_argument, rewrite_smtp|rewrite_smtp_sender, NULL, FALSE,
+ US"", global_rewrite_rules) : smtp_c
m
d_argument;
/* Extract the address; the TRUE flag allows <> as valid */
/* Extract the address; the TRUE flag allows <> as valid */
@@
-968,7
+967,7
@@
while (done <= 0)
if (raw_sender == NULL)
/* The function moan_smtp_batch() does not return. */
if (raw_sender == NULL)
/* The function moan_smtp_batch() does not return. */
- moan_smtp_batch(cmd_buffer, "501 %s", errmess);
+ moan_smtp_batch(
smtp_
cmd_buffer, "501 %s", errmess);
sender_address = string_copy(raw_sender);
sender_address = string_copy(raw_sender);
@@
-983,7
+982,7
@@
while (done <= 0)
"and rewritten\n", raw_sender);
}
/* The function moan_smtp_batch() does not return. */
"and rewritten\n", raw_sender);
}
/* The function moan_smtp_batch() does not return. */
- else moan_smtp_batch(cmd_buffer, "501 sender address must contain "
+ else moan_smtp_batch(
smtp_
cmd_buffer, "501 sender address must contain "
"a domain");
}
break;
"a domain");
}
break;
@@
-999,25
+998,25
@@
while (done <= 0)
case RCPT_CMD:
if (sender_address == NULL)
/* The function moan_smtp_batch() does not return. */
case RCPT_CMD:
if (sender_address == NULL)
/* The function moan_smtp_batch() does not return. */
- moan_smtp_batch(cmd_buffer, "503 No sender yet given");
+ moan_smtp_batch(
smtp_
cmd_buffer, "503 No sender yet given");
- if (smtp_c
omman
d_argument[0] == 0)
+ if (smtp_c
m
d_argument[0] == 0)
/* The function moan_smtp_batch() does not return. */
/* The function moan_smtp_batch() does not return. */
- moan_smtp_batch(cmd_buffer, "501 RCPT TO must have an address operand");
+ moan_smtp_batch(
smtp_
cmd_buffer, "501 RCPT TO must have an address operand");
/* Check maximum number allowed */
if (recipients_max > 0 && recipients_count + 1 > recipients_max)
/* The function moan_smtp_batch() does not return. */
/* Check maximum number allowed */
if (recipients_max > 0 && recipients_count + 1 > recipients_max)
/* The function moan_smtp_batch() does not return. */
- moan_smtp_batch(cmd_buffer, "%s too many recipients",
+ moan_smtp_batch(
smtp_
cmd_buffer, "%s too many recipients",
recipients_max_reject? "552": "452");
/* Apply SMTP rewrite, then extract address. Don't allow "<>" as a
recipient address */
recipient = ((rewrite_existflags & rewrite_smtp) != 0)?
recipients_max_reject? "552": "452");
/* Apply SMTP rewrite, then extract address. Don't allow "<>" as a
recipient address */
recipient = ((rewrite_existflags & rewrite_smtp) != 0)?
- rewrite_one(smtp_c
omman
d_argument, rewrite_smtp, NULL, FALSE, US"",
- global_rewrite_rules) : smtp_c
omman
d_argument;
+ rewrite_one(smtp_c
m
d_argument, rewrite_smtp, NULL, FALSE, US"",
+ global_rewrite_rules) : smtp_c
m
d_argument;
/* 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,
@@
-1026,7
+1025,7
@@
while (done <= 0)
if (recipient == NULL)
/* The function moan_smtp_batch() does not return. */
if (recipient == NULL)
/* The function moan_smtp_batch() does not return. */
- moan_smtp_batch(cmd_buffer, "501 %s", errmess);
+ moan_smtp_batch(
smtp_
cmd_buffer, "501 %s", errmess);
/* If the recipient address is unqualified, qualify it if permitted. Then
add it to the list of recipients. */
/* If the recipient address is unqualified, qualify it if permitted. Then
add it to the list of recipients. */
@@
-1040,7
+1039,7
@@
while (done <= 0)
recipient = rewrite_address_qualify(recipient, TRUE);
}
/* The function moan_smtp_batch() does not return. */
recipient = rewrite_address_qualify(recipient, TRUE);
}
/* The function moan_smtp_batch() does not return. */
- else moan_smtp_batch(cmd_buffer, "501 recipient address must contain "
+ else moan_smtp_batch(
smtp_
cmd_buffer, "501 recipient address must contain "
"a domain");
}
receive_add_recipient(recipient, -1);
"a domain");
}
receive_add_recipient(recipient, -1);
@@
-1056,10
+1055,10
@@
while (done <= 0)
{
/* The function moan_smtp_batch() does not return. */
if (sender_address == NULL)
{
/* The function moan_smtp_batch() does not return. */
if (sender_address == NULL)
- moan_smtp_batch(cmd_buffer,
+ moan_smtp_batch(
smtp_
cmd_buffer,
"503 MAIL FROM:<sender> command must precede DATA");
else
"503 MAIL FROM:<sender> command must precede DATA");
else
- moan_smtp_batch(cmd_buffer,
+ moan_smtp_batch(
smtp_
cmd_buffer,
"503 RCPT TO:<recipient> must precede DATA");
}
else
"503 RCPT TO:<recipient> must precede DATA");
}
else
@@
-1089,19
+1088,19
@@
while (done <= 0)
case BADARG_CMD:
/* The function moan_smtp_batch() does not return. */
case BADARG_CMD:
/* The function moan_smtp_batch() does not return. */
- moan_smtp_batch(cmd_buffer, "501 Unexpected argument data");
+ moan_smtp_batch(
smtp_
cmd_buffer, "501 Unexpected argument data");
break;
case BADCHAR_CMD:
/* The function moan_smtp_batch() does not return. */
break;
case BADCHAR_CMD:
/* The function moan_smtp_batch() does not return. */
- moan_smtp_batch(cmd_buffer, "501 Unexpected NULL in SMTP command");
+ moan_smtp_batch(
smtp_
cmd_buffer, "501 Unexpected NULL in SMTP command");
break;
default:
/* The function moan_smtp_batch() does not return. */
break;
default:
/* The function moan_smtp_batch() does not return. */
- moan_smtp_batch(cmd_buffer, "500 Command unrecognized");
+ moan_smtp_batch(
smtp_
cmd_buffer, "500 Command unrecognized");
break;
}
}
break;
}
}
@@
-1165,8
+1164,10
@@
tls_advertised = FALSE;
for (i = 0; i < ACL_C_MAX; i++) acl_var[i] = NULL;
for (i = 0; i < ACL_C_MAX; i++) acl_var[i] = NULL;
-cmd_buffer = (uschar *)malloc(cmd_buffer_size + 1); /* allow for trailing 0 */
-if (cmd_buffer == NULL)
+/* Allow for trailing 0 in the command buffer. */
+
+smtp_cmd_buffer = (uschar *)malloc(smtp_cmd_buffer_size + 1);
+if (smtp_cmd_buffer == NULL)
log_write(0, LOG_MAIN|LOG_PANIC_DIE,
"malloc() failed for SMTP command buffer");
log_write(0, LOG_MAIN|LOG_PANIC_DIE,
"malloc() failed for SMTP command buffer");
@@
-1671,14
+1672,14
@@
int yield = -1;
log_write(type, LOG_MAIN, "SMTP %s error in \"%s\" %s %s",
(type == L_smtp_syntax_error)? "syntax" : "protocol",
log_write(type, LOG_MAIN, "SMTP %s error in \"%s\" %s %s",
(type == L_smtp_syntax_error)? "syntax" : "protocol",
- string_printing(cmd_buffer), host_and_ident(TRUE), errmess);
+ string_printing(
smtp_
cmd_buffer), host_and_ident(TRUE), errmess);
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\")",
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\")",
- host_and_ident(FALSE), cmd_buffer);
+ host_and_ident(FALSE),
smtp_
cmd_buffer);
}
if (code > 0)
}
if (code > 0)
@@
-1821,9
+1822,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_c
omman
d_argument == NULL)?
+ (smtp_c
m
d_argument == 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_c
omman
d_argument);
+ string_sprintf("%s %s", acl_wherenames[where], smtp_c
m
d_argument);
if (drop) rc = FAIL;
if (drop) rc = FAIL;
@@
-2191,8
+2192,8
@@
while (done <= 0)
/* Find the name of the requested authentication mechanism. */
/* Find the name of the requested authentication mechanism. */
- s = smtp_c
omman
d_argument;
- while ((c = *smtp_c
omman
d_argument) != 0 && !isspace(c))
+ s = smtp_c
m
d_argument;
+ while ((c = *smtp_c
m
d_argument) != 0 && !isspace(c))
{
if (!isalnum(c) && c != '-' && c != '_')
{
{
if (!isalnum(c) && c != '-' && c != '_')
{
@@
-2200,16
+2201,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_c
omman
d_argument++;
+ smtp_c
m
d_argument++;
}
/* 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_c
omman
d_argument != 0)
+ if (*smtp_c
m
d_argument != 0)
{
{
- *smtp_c
omman
d_argument++ = 0;
- while (isspace(*smtp_c
ommand_argument)) smtp_comman
d_argument++;
+ *smtp_c
m
d_argument++ = 0;
+ while (isspace(*smtp_c
md_argument)) smtp_cm
d_argument++;
}
/* Search for an authentication mechanism which is configured for use
}
/* Search for an authentication mechanism which is configured for use
@@
-2239,7
+2240,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_c
omman
d_argument);
+ c = (au->info->servercode)(au, smtp_c
m
d_argument);
if (au->set_id != NULL) set_id = expand_string(au->set_id);
expand_nmax = -1; /* Reset numeric variables */
if (au->set_id != NULL) set_id = expand_string(au->set_id);
expand_nmax = -1; /* Reset numeric variables */
@@
-2355,20
+2356,20
@@
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_c
omman
d_argument))
+ if (!check_helo(smtp_c
m
d_argument))
{
smtp_printf("501 Syntactically invalid %s argument(s)\r\n", hello);
log_write(0, LOG_MAIN|LOG_REJECT, "rejected %s from %s: syntactically "
"invalid argument(s): %s", hello, host_and_ident(FALSE),
{
smtp_printf("501 Syntactically invalid %s argument(s)\r\n", hello);
log_write(0, LOG_MAIN|LOG_REJECT, "rejected %s from %s: syntactically "
"invalid argument(s): %s", hello, host_and_ident(FALSE),
- (*smtp_c
omman
d_argument == 0)? US"(no argument given)" :
- string_printing(smtp_c
omman
d_argument));
+ (*smtp_c
m
d_argument == 0)? US"(no argument given)" :
+ string_printing(smtp_c
m
d_argument));
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\")",
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\")",
- host_and_ident(FALSE), cmd_buffer);
+ host_and_ident(FALSE),
smtp_
cmd_buffer);
done = 1;
}
done = 1;
}
@@
-2385,7
+2386,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_c
omman
d_argument;
+ uschar *p = smtp_c
m
d_argument;
while (*p != 0 && !isspace(*p)) { *p = tolower(*p); p++; }
*p = 0;
while (*p != 0 && !isspace(*p)) { *p = tolower(*p); p++; }
*p = 0;
@@
-2660,7
+2661,7
@@
while (done <= 0)
break;
}
break;
}
- if (smtp_c
omman
d_argument[0] == 0)
+ if (smtp_c
m
d_argument[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");
@@
-2819,8
+2820,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_c
omman
d_argument, rewrite_smtp, NULL, FALSE, US"",
- global_rewrite_rules) : smtp_c
omman
d_argument;
+ rewrite_one(smtp_c
m
d_argument, rewrite_smtp, NULL, FALSE, US"",
+ global_rewrite_rules) : smtp_c
m
d_argument;
/* rfc821_domains = TRUE; << no longer needed */
raw_sender =
/* rfc821_domains = TRUE; << no longer needed */
raw_sender =
@@
-2830,7
+2831,7
@@
while (done <= 0)
if (raw_sender == NULL)
{
if (raw_sender == NULL)
{
- done = synprot_error(L_smtp_syntax_error, 501, smtp_c
omman
d_argument, errmess);
+ done = synprot_error(L_smtp_syntax_error, 501, smtp_c
m
d_argument, errmess);
break;
}
break;
}
@@
-2890,7
+2891,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_c
omman
d_argument);
+ smtp_c
m
d_argument);
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",
@@
-2958,7
+2959,7
@@
while (done <= 0)
/* Check for an operand */
/* Check for an operand */
- if (smtp_c
omman
d_argument[0] == 0)
+ if (smtp_c
m
d_argument[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");
@@
-2970,8
+2971,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_c
omman
d_argument, rewrite_smtp, NULL, FALSE, US"",
- global_rewrite_rules) : smtp_c
omman
d_argument;
+ rewrite_one(smtp_c
m
d_argument, rewrite_smtp, NULL, FALSE, US"",
+ global_rewrite_rules) : smtp_c
m
d_argument;
/* 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,
@@
-2980,7
+2981,7
@@
while (done <= 0)
if (recipient == NULL)
{
if (recipient == NULL)
{
- done = synprot_error(L_smtp_syntax_error, 501, smtp_c
omman
d_argument, errmess);
+ done = synprot_error(L_smtp_syntax_error, 501, smtp_c
m
d_argument, errmess);
rcpt_fail_count++;
break;
}
rcpt_fail_count++;
break;
}
@@
-3010,7
+3011,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_c
omman
d_argument);
+ smtp_c
m
d_argument);
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),
@@
-3084,7
+3085,7
@@
while (done <= 0)
"discarded by %s ACL%s%s", host_and_ident(TRUE),
(sender_address_unrewritten != NULL)?
sender_address_unrewritten : sender_address,
"discarded by %s ACL%s%s", host_and_ident(TRUE),
(sender_address_unrewritten != NULL)?
sender_address_unrewritten : sender_address,
- smtp_c
omman
d_argument, recipients_discarded? "MAIL" : "RCPT",
+ smtp_c
m
d_argument, recipients_discarded? "MAIL" : "RCPT",
(log_msg == NULL)? US"" : US": ",
(log_msg == NULL)? US"" : log_msg);
}
(log_msg == NULL)? US"" : US": ",
(log_msg == NULL)? US"" : log_msg);
}
@@
-3167,7
+3168,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_c
omman
d_argument, &errmess, &start, &end,
+ address = parse_extract_address(smtp_c
m
d_argument, &errmess, &start, &end,
&recipient_domain, FALSE);
/* rfc821_domains = FALSE; << no longer needed */
&recipient_domain, FALSE);
/* rfc821_domains = FALSE; << no longer needed */
@@
-3194,7
+3195,7
@@
while (done <= 0)
string_sprintf("550 <%s> %s", address, addr->message) :
string_sprintf("550 <%s> is not deliverable", address);
log_write(0, LOG_MAIN, "VRFY failed for %s %s",
string_sprintf("550 <%s> %s", address, addr->message) :
string_sprintf("550 <%s> is not deliverable", address);
log_write(0, LOG_MAIN, "VRFY failed for %s %s",
- smtp_c
omman
d_argument, host_and_ident(TRUE));
+ smtp_c
m
d_argument, host_and_ident(TRUE));
break;
}
}
break;
}
}
@@
-3212,7
+3213,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_c
omman
d_argument, FALSE),
+ (void) verify_address(deliver_make_addr(smtp_c
m
d_argument, 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;
@@
-3430,7
+3431,7
@@
while (done <= 0)
break;
}
break;
}
- log_write(L_etrn, LOG_MAIN, "ETRN %s received from %s", smtp_c
omman
d_argument,
+ log_write(L_etrn, LOG_MAIN, "ETRN %s received from %s", smtp_c
m
d_argument,
host_and_ident(FALSE));
rc = acl_check(ACL_WHERE_ETRN, NULL, acl_smtp_etrn, &user_msg, &log_msg);
host_and_ident(FALSE));
rc = acl_check(ACL_WHERE_ETRN, NULL, acl_smtp_etrn, &user_msg, &log_msg);
@@
-3442,7
+3443,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_c
omman
d_argument);
+ etrn_serialize_key = string_sprintf("etrn-%s\n", smtp_c
m
d_argument);
/* 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,
@@
-3454,7
+3455,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_c
omman
d_argument;
+ deliver_domain = smtp_c
m
d_argument;
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;
@@
-3471,7
+3472,7
@@
while (done <= 0)
else
{
else
{
- if (*smtp_c
omman
d_argument++ != '#')
+ if (*smtp_c
m
d_argument++ != '#')
{
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 #");
@@
-3479,7
+3480,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_c
omman
d_argument);
+ smtp_c
m
d_argument);
}
/* If we are host-testing, don't actually do anything. */
}
/* If we are host-testing, don't actually do anything. */
@@
-3501,7
+3502,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_c
omman
d_argument);
+ smtp_printf("458 Already processing %s\r\n", smtp_c
m
d_argument);
break;
}
break;
}
@@
-3599,7
+3600,7
@@
while (done <= 0)
"(next input sent too soon: pipelining was%s advertised): "
"rejected \"%s\" %s next input=\"%s\"",
pipelining_advertised? "" : " not",
"(next input sent too soon: pipelining was%s advertised): "
"rejected \"%s\" %s next input=\"%s\"",
pipelining_advertised? "" : " not",
- cmd_buffer, host_and_ident(TRUE),
+
smtp_
cmd_buffer, host_and_ident(TRUE),
string_printing(smtp_inptr));
smtp_printf("554 SMTP synchronization error\r\n");
done = 1; /* Pretend eof - drops connection */
string_printing(smtp_inptr));
smtp_printf("554 SMTP synchronization error\r\n");
done = 1; /* Pretend eof - drops connection */
@@
-3610,7
+3611,7
@@
while (done <= 0)
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_c
ommand_argument - cmd_buffer,
cmd_buffer);
+ smtp_c
md_argument - 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;
@@
-3621,14
+3622,14
@@
while (done <= 0)
{
log_write(L_smtp_syntax_error, LOG_MAIN,
"SMTP syntax error in \"%s\" %s %s",
{
log_write(L_smtp_syntax_error, LOG_MAIN,
"SMTP syntax error in \"%s\" %s %s",
- string_printing(cmd_buffer), host_and_ident(TRUE),
+ string_printing(
smtp_
cmd_buffer), host_and_ident(TRUE),
US"unrecognized command");
incomplete_transaction_log(US"unrecognized command");
smtp_printf("500 Too many unrecognized commands\r\n");
done = 2;
log_write(0, LOG_MAIN|LOG_REJECT, "SMTP call from %s dropped: too many "
"unrecognized commands (last was \"%s\")", host_and_ident(FALSE),
US"unrecognized command");
incomplete_transaction_log(US"unrecognized command");
smtp_printf("500 Too many unrecognized commands\r\n");
done = 2;
log_write(0, LOG_MAIN|LOG_REJECT, "SMTP call from %s dropped: too many "
"unrecognized commands (last was \"%s\")", host_and_ident(FALSE),
- cmd_buffer);
+
smtp_
cmd_buffer);
}
else
done = synprot_error(L_smtp_syntax_error, 500, NULL,
}
else
done = synprot_error(L_smtp_syntax_error, 500, NULL,