-/* $Cambridge: exim/src/src/exim.c,v 1.49 2006/11/13 11:56:41 ph10 Exp $ */
+/* $Cambridge: exim/src/src/exim.c,v 1.50 2006/11/20 11:43:40 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
regex_must_compile(US"^(?:[^\\W_]{6}-){2}[^\\W_]{2}$", FALSE, TRUE);
/* Precompile the regular expression that is used for matching an SMTP error
-code, possibly extended, at the start of an error message. */
+code, possibly extended, at the start of an error message. Note that the
+terminating whitespace character is included. */
regex_smtp_code =
regex_must_compile(US"^\\d\\d\\d\\s(?:\\d\\.\\d\\d?\\d?\\.\\d\\d?\\d?\\s)?",
-/* $Cambridge: exim/src/src/routers/redirect.c,v 1.17 2006/07/13 13:53:33 ph10 Exp $ */
+/* $Cambridge: exim/src/src/routers/redirect.c,v 1.18 2006/11/20 11:43:40 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
int ovector[3];
if (ob->forbid_smtp_code &&
pcre_exec(regex_smtp_code, NULL, CS addr->message,
- Ustrlen(addr->message), 0, PCRE_EOPT,
- ovector, sizeof(ovector)/sizeof(int)) >= 0)
+ Ustrlen(addr->message), 0, PCRE_EOPT,
+ ovector, sizeof(ovector)/sizeof(int)) >= 0)
{
DEBUG(D_route) debug_printf("SMTP code at start of error message "
"is ignored because forbid_smtp_code is set\n");
-/* $Cambridge: exim/src/src/smtp_in.c,v 1.47 2006/11/14 16:40:36 ph10 Exp $ */
+/* $Cambridge: exim/src/src/smtp_in.c,v 1.48 2006/11/20 11:43:40 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
int codelen = 3;
s = user_msg;
smtp_message_code(&code, &codelen, &s, NULL);
- if (codelen > 3)
+ if (codelen > 4)
{
esc = code + 4;
esclen = codelen - 4;
Arguments:
code SMTP code, may involve extended status codes
- codelen length of smtp code; if > 3 there's an ESC
+ codelen length of smtp code; if > 4 there's an ESC
final FALSE if the last line isn't the final line
msg message text, possibly containing newlines
if (!final && no_multiline_responses) return;
-if (codelen > 3)
+if (codelen > 4)
{
esc = code + 4;
esclen = codelen - 4;
This function is global because it is called from receive.c as well as within
this module.
+Note that the code length returned includes the terminating whitespace
+character, which is always included in the regex match.
+
Arguments:
code SMTP code, may involve extended status codes
- codelen length of smtp code; if > 3 there's an ESC
+ codelen length of smtp code; if > 4 there's an ESC
msg message text
log_msg optional log message, to be adjusted with the new SMTP code
tls_advertised = FALSE;
#endif
- smtp_code = US"250"; /* Default response code */
+ smtp_code = US"250 "; /* Default response code plus space*/
if (user_msg == NULL)
{
s = string_sprintf("%.3s %s Hello %s%s%s",
}
}
- /* A user-supplied EHLO greeting may not contain more than one line */
+ /* A user-supplied EHLO greeting may not contain more than one line. Note
+ that the code returned by smtp_message_code() includes the terminating
+ whitespace character. */
else
{
char *ss;
- int codelen = 3;
+ int codelen = 4;
smtp_message_code(&smtp_code, &codelen, &user_msg, NULL);
- s = string_sprintf("%.*s %s", codelen, smtp_code, user_msg);
+ s = string_sprintf("%.*s%s", codelen, smtp_code, user_msg);
if ((ss = strpbrk(CS s, "\r\n")) != NULL)
{
log_write(0, LOG_MAIN|LOG_PANIC, "EHLO/HELO response must not contain "