From: Philip Hazel Date: Tue, 2 Aug 2005 11:22:23 +0000 (+0000) Subject: Add support for the IGNOREQUOTA extension to LMTP, both to the lmtp X-Git-Tag: exim-4_53~70 X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/f15132938afa3813819da28497bcabedc551dcf2?ds=inline Add support for the IGNOREQUOTA extension to LMTP, both to the lmtp transport and to the smtp transport. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index b3748b053..7b4a2e314 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.192 2005/08/02 09:24:45 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.193 2005/08/02 11:22:23 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -40,6 +40,9 @@ PH/09 Installed latest Cygwin configuration files from the Cygwin maintainer. PH/10 Named domain lists were not working if used in a queue_smtp_domains setting. +PH/11 Added support for the IGNOREQUOTA extension to LMTP, both to the lmtp + transport and to the smtp transport in LMTP mode. + Exim version 4.52 ----------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index f358f7a48..5936f198b 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/NewStuff,v 1.59 2005/08/01 15:01:12 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/NewStuff,v 1.60 2005/08/02 11:22:23 ph10 Exp $ New Features in Exim -------------------- @@ -53,6 +53,15 @@ PH/02 The variable $message_id is now deprecated, to be replaced by PH/03 The use of forbid_filter_existstest now also locks out the use of the ${stat: expansion item. +PH/04 The IGNOREQUOTA extension to the LMTP protocol is now available in both + the lmtp transport and the smtp transport running in LMTP mode. In the + lmtp transport there is a new Boolean option called ignore_quota, and in + the smtp transport there is a new Boolean option called + lmtp_ignore_quota. If either of these options is set TRUE, the string + "IGNOREQUOTA" is added to RCPT commands when using the LMTP protocol, + provided that the server has advertised support for IGNOREQUOTA in its + response to the LHLO command. + Exim version 4.52 ----------------- diff --git a/src/ACKNOWLEDGMENTS b/src/ACKNOWLEDGMENTS index e8d3c7cf9..c8b4d505c 100644 --- a/src/ACKNOWLEDGMENTS +++ b/src/ACKNOWLEDGMENTS @@ -1,4 +1,4 @@ -$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.29 2005/08/01 13:20:28 ph10 Exp $ +$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.30 2005/08/02 11:22:23 ph10 Exp $ EXIM ACKNOWLEDGEMENTS @@ -210,6 +210,7 @@ Heiko Schlichting Diagnosis of intermittent daemon crash bug Stephan Schulz Patch for $host_data caching error Tony Sheen Log files with datestamped names and auto rollover Martin Sluka Patch for exigrep to include non-message lines +Adam Stephens Suggested patch for IGNOREQUOTA in LMTP Russell Stuart Diagnosis of obscure batch multiple delivery bug Tamas Tevesz Patch for crypt16() support Johan Thelmen Support for the F-Secure virus scanner diff --git a/src/src/deliver.c b/src/src/deliver.c index 23875d959..c166d2601 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/deliver.c,v 1.21 2005/06/28 10:23:35 ph10 Exp $ */ +/* $Cambridge: exim/src/src/deliver.c,v 1.22 2005/08/02 11:22:24 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -5856,6 +5856,15 @@ deliveries are done first, then remote ones. If ever the problems of how to handle fallback transports are figured out, this section can be put into a loop for handling fallbacks, though the uid switching will have to be revised. */ +/* Precompile a regex that is used to recognize a parameter in response +to an LHLO command, if is isn't already compiled. This may be used on both +local and remote LMTP deliveries. */ + +if (regex_IGNOREQUOTA == NULL) regex_IGNOREQUOTA = + regex_must_compile(US"\\n250[\\s\\-]IGNOREQUOTA(\\s|\\n|$)", FALSE, TRUE); + +/* Handle local deliveries */ + if (addr_local != NULL) { DEBUG(D_deliver|D_transport) diff --git a/src/src/globals.c b/src/src/globals.c index ff27aee71..698b2fc33 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.c,v 1.31 2005/08/01 14:00:35 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.c,v 1.32 2005/08/02 11:22:24 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -840,6 +840,7 @@ BOOL recipients_max_reject = FALSE; const pcre *regex_AUTH = NULL; const pcre *regex_check_dns_names = NULL; const pcre *regex_From = NULL; +const pcre *regex_IGNOREQUOTA = NULL; const pcre *regex_PIPELINING = NULL; const pcre *regex_SIZE = NULL; const pcre *regex_ismsgid = NULL; diff --git a/src/src/globals.h b/src/src/globals.h index 0c64224a2..5ef0d4e21 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.h,v 1.22 2005/06/21 14:14:55 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.h,v 1.23 2005/08/02 11:22:24 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -542,6 +542,7 @@ extern int recipients_max_reject; /* If TRUE, reject whole message */ extern const pcre *regex_AUTH; /* For recognizing AUTH settings */ extern const pcre *regex_check_dns_names; /* For DNS name checking */ extern const pcre *regex_From; /* For recognizing "From_" lines */ +extern const pcre *regex_IGNOREQUOTA; /* For recognizing IGNOREQUOTA (LMTP) */ extern const pcre *regex_PIPELINING; /* For recognizing PIPELINING */ extern const pcre *regex_SIZE; /* For recognizing SIZE settings */ extern const pcre *regex_ismsgid; /* Compiled r.e. for message it */ diff --git a/src/src/transports/lmtp.c b/src/src/transports/lmtp.c index af3b2589a..87b0c3da5 100644 --- a/src/src/transports/lmtp.c +++ b/src/src/transports/lmtp.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transports/lmtp.c,v 1.5 2005/06/27 14:29:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/lmtp.c,v 1.6 2005/08/02 11:22:24 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -28,6 +28,8 @@ optionlist lmtp_transport_options[] = { (void *)offsetof(transport_instance, batch_max) }, { "command", opt_stringptr, (void *)offsetof(lmtp_transport_options_block, cmd) }, + { "ignore_quota", opt_bool, + (void *)offsetof(lmtp_transport_options_block, ignore_quota) }, { "socket", opt_stringptr, (void *)offsetof(lmtp_transport_options_block, skt) }, { "timeout", opt_time, @@ -46,7 +48,8 @@ lmtp_transport_options_block lmtp_transport_option_defaults = { NULL, /* cmd */ NULL, /* skt */ 5*60, /* timeout */ - 0 /* options */ + 0, /* options */ + FALSE /* ignore_quota */ }; @@ -457,6 +460,7 @@ int code, save_errno; BOOL send_data; BOOL yield = FALSE; address_item *addr; +uschar *igquotstr = US""; uschar *sockname = NULL; uschar **argv; uschar buffer[256]; @@ -561,6 +565,13 @@ if (!lmtp_write_command(fd_in, "%s %s\r\n", "LHLO", if (!lmtp_read_response(out, buffer, sizeof(buffer), '2', timeout)) goto RESPONSE_FAILED; +/* If the ignore_quota option is set, note whether the server supports the +IGNOREQUOTA option, and if so, set an appropriate addition for RCPT. */ + +if (ob->ignore_quota) + igquotstr = (pcre_exec(regex_IGNOREQUOTA, NULL, CS buffer, + Ustrlen(CS buffer), 0, PCRE_EOPT, NULL, 0) >= 0)? US" IGNOREQUOTA" : US""; + /* Now the envelope sender */ if (!lmtp_write_command(fd_in, "MAIL FROM:<%s>\r\n", return_path)) @@ -575,8 +586,8 @@ temporarily rejected; others may be accepted, for now. */ send_data = FALSE; for (addr = addrlist; addr != NULL; addr = addr->next) { - if (!lmtp_write_command(fd_in, "RCPT TO:<%s>\r\n", - transport_rcpt_address(addr, tblock->rcpt_include_affixes))) + if (!lmtp_write_command(fd_in, "RCPT TO:<%s>%s\r\n", + transport_rcpt_address(addr, tblock->rcpt_include_affixes), igquotstr)) goto WRITE_FAILED; if (lmtp_read_response(out, buffer, sizeof(buffer), '2', timeout)) { diff --git a/src/src/transports/lmtp.h b/src/src/transports/lmtp.h index 3b8e26512..b81e91a8c 100644 --- a/src/src/transports/lmtp.h +++ b/src/src/transports/lmtp.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transports/lmtp.h,v 1.2 2005/01/04 10:00:45 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/lmtp.h,v 1.3 2005/08/02 11:22:24 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -14,6 +14,7 @@ typedef struct { uschar *skt; int timeout; int options; + BOOL ignore_quota; } lmtp_transport_options_block; /* Data for reading the private options. */ diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 5c7311071..42179898a 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transports/smtp.c,v 1.14 2005/08/02 09:24:45 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/smtp.c,v 1.15 2005/08/02 11:22:24 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -93,6 +93,8 @@ optionlist smtp_transport_options[] = { (void *)offsetof(smtp_transport_options_block, interface) }, { "keepalive", opt_bool, (void *)offsetof(smtp_transport_options_block, keepalive) }, + { "lmtp_ignore_quota", opt_bool, + (void *)offsetof(smtp_transport_options_block, lmtp_ignore_quota) }, { "max_rcpt", opt_int | opt_public, (void *)offsetof(transport_instance, max_addresses) }, { "multi_domain", opt_bool | opt_public, @@ -163,6 +165,7 @@ smtp_transport_options_block smtp_transport_option_defaults = { FALSE, /* hosts_override */ FALSE, /* hosts_randomize */ TRUE, /* keepalive */ + FALSE, /* lmtp_ignore_quota */ TRUE /* retry_include_ip_address */ #ifdef SUPPORT_TLS ,NULL, /* tls_certificate */ @@ -796,6 +799,7 @@ BOOL pass_message = FALSE; smtp_inblock inblock; smtp_outblock outblock; int max_rcpt = tblock->max_addresses; +uschar *igquotstr = US""; uschar *local_authenticated_sender = authenticated_sender; uschar *helo_data; uschar *message = NULL; @@ -947,6 +951,13 @@ goto SEND_QUIT; ob->command_timeout)) goto RESPONSE_FAILED; } + /* Set IGNOREQUOTA if the response to LHLO specifies support and the + lmtp_ignore_quota option was set. */ + + igquotstr = (lmtp && ob->lmtp_ignore_quota && + pcre_exec(regex_IGNOREQUOTA, NULL, CS buffer, Ustrlen(CS buffer), 0, + PCRE_EOPT, NULL, 0) >= 0)? US" IGNOREQUOTA" : US""; + /* Set tls_offered if the response to EHLO specifies support for STARTTLS. */ #ifdef SUPPORT_TLS @@ -1081,6 +1092,13 @@ if (continue_hostname == NULL int require_auth; uschar *fail_reason = US"server did not advertise AUTH support"; + /* Set for IGNOREQUOTA if the response to LHLO specifies support and the + lmtp_ignore_quota option was set. */ + + igquotstr = (lmtp && ob->lmtp_ignore_quota && + pcre_exec(regex_IGNOREQUOTA, NULL, CS buffer, Ustrlen(CS buffer), 0, + PCRE_EOPT, NULL, 0) >= 0)? US" IGNOREQUOTA" : US""; + /* If the response to EHLO specified support for the SIZE parameter, note this, provided size_addition is non-negative. */ @@ -1343,8 +1361,8 @@ for (addr = first_addr; yield as OK, because this error can often mean that there is a problem with just one address, so we don't want to delay the host. */ - count = smtp_write_command(&outblock, no_flush, "RCPT TO:<%s>\r\n", - transport_rcpt_address(addr, tblock->rcpt_include_affixes)); + count = smtp_write_command(&outblock, no_flush, "RCPT TO:<%s>%s\r\n", + transport_rcpt_address(addr, tblock->rcpt_include_affixes), igquotstr); if (count < 0) goto SEND_FAILED; if (count > 0) { diff --git a/src/src/transports/smtp.h b/src/src/transports/smtp.h index fe81267ec..66291514c 100644 --- a/src/src/transports/smtp.h +++ b/src/src/transports/smtp.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transports/smtp.h,v 1.5 2005/03/08 15:32:02 tom Exp $ */ +/* $Cambridge: exim/src/src/transports/smtp.h,v 1.6 2005/08/02 11:22:24 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -41,6 +41,7 @@ typedef struct { BOOL hosts_override; BOOL hosts_randomize; BOOL keepalive; + BOOL lmtp_ignore_quota; BOOL retry_include_ip_address; #ifdef SUPPORT_TLS uschar *tls_certificate;