X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/533244aff041c5fd9d193947f533a4c0150a9c9e..fb2274d4a2c4398a497fbec5cacebaab7d20a127:/src/src/transports/smtp.c diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 738fd1cc2..be8b15029 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.4 2005/01/04 16:36:28 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/smtp.c,v 1.7 2005/03/08 15:32:02 tom Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -35,6 +35,20 @@ optionlist smtp_transport_options[] = { (void *)offsetof(smtp_transport_options_block, data_timeout) }, { "delay_after_cutoff", opt_bool, (void *)offsetof(smtp_transport_options_block, delay_after_cutoff) }, +#ifdef EXPERIMENTAL_DOMAINKEYS + { "dk_canon", opt_stringptr, + (void *)offsetof(smtp_transport_options_block, dk_canon) }, + { "dk_domain", opt_stringptr, + (void *)offsetof(smtp_transport_options_block, dk_domain) }, + { "dk_headers", opt_stringptr, + (void *)offsetof(smtp_transport_options_block, dk_headers) }, + { "dk_private_key", opt_stringptr, + (void *)offsetof(smtp_transport_options_block, dk_private_key) }, + { "dk_selector", opt_stringptr, + (void *)offsetof(smtp_transport_options_block, dk_selector) }, + { "dk_strict", opt_stringptr, + (void *)offsetof(smtp_transport_options_block, dk_strict) }, +#endif { "dns_qualify_single", opt_bool, (void *)offsetof(smtp_transport_options_block, dns_qualify_single) }, { "dns_search_parents", opt_bool, @@ -140,7 +154,7 @@ smtp_transport_options_block smtp_transport_option_defaults = { 10*60, /* final timeout */ 1024, /* size_addition */ 5, /* hosts_max_try */ - 50, /* hosts_max_try_hardlimit */ + 50, /* hosts_max_try_hardlimit */ FALSE, /* allow_localhost */ FALSE, /* gethostbyname */ TRUE, /* dns_qualify_single */ @@ -158,6 +172,14 @@ smtp_transport_options_block smtp_transport_option_defaults = { NULL, /* tls_verify_certificates */ TRUE /* tls_tempfail_tryclear */ #endif + #ifdef EXPERIMENTAL_DOMAINKEYS + ,NULL, /* dk_canon */ + NULL, /* dk_domain */ + NULL, /* dk_headers */ + NULL, /* dk_private_key */ + NULL, /* dk_selector */ + NULL /* dk_strict */ + #endif }; @@ -393,7 +415,7 @@ end the DATA. */ if (*errno_value == ERRNO_FILTER_FAIL) { *message = US string_sprintf("transport filter process failed (%d)%s", - more_errno, + more_errno, (more_errno == EX_EXECFAILED)? ": unable to execute command" : ""); return FALSE; } @@ -1394,6 +1416,23 @@ if (!ok) ok = TRUE; else DEBUG(D_transport|D_v) debug_printf(" SMTP>> writing message and terminating \".\"\n"); transport_count = 0; +#ifdef EXPERIMENTAL_DOMAINKEYS + if ( (ob->dk_private_key != NULL) && (ob->dk_selector != NULL) ) + ok = dk_transport_write_message(addrlist, inblock.sock, + topt_use_crlf | topt_end_dot | topt_escape_headers | + (tblock->body_only? topt_no_headers : 0) | + (tblock->headers_only? topt_no_body : 0) | + (tblock->return_path_add? topt_add_return_path : 0) | + (tblock->delivery_date_add? topt_add_delivery_date : 0) | + (tblock->envelope_to_add? topt_add_envelope_to : 0), + 0, /* No size limit */ + tblock->add_headers, tblock->remove_headers, + US".", US"..", /* Escaping strings */ + tblock->rewrite_rules, tblock->rewrite_existflags, + ob->dk_private_key, ob->dk_domain, ob->dk_selector, + ob->dk_canon, ob->dk_headers, ob->dk_strict); + else +#endif ok = transport_write_message(addrlist, inblock.sock, topt_use_crlf | topt_end_dot | topt_escape_headers | (tblock->body_only? topt_no_headers : 0) | @@ -1929,7 +1968,7 @@ int hosts_looked_up = 0; int hosts_retry = 0; int hosts_serial = 0; int hosts_total = 0; -int total_hosts_tried = 0; +int total_hosts_tried = 0; address_item *addr; BOOL expired = TRUE; BOOL continuing = continue_hostname != NULL; @@ -2096,8 +2135,8 @@ if (Ustrcmp(pistring, ":25") == 0) pistring = US""; . If there are any addresses whose status is still DEFER, carry on to the next host/IPaddress, unless we have tried the number of hosts given by hosts_max_try or hosts_max_try_hardlimit; otherwise return. Note that - there is some fancy logic for hosts_max_try that means its limit can be - overstepped in some circumstances. + there is some fancy logic for hosts_max_try that means its limit can be + overstepped in some circumstances. If we get to the end of the list, all hosts have deferred at least one address, or not reached their retry times. If delay_after_cutoff is unset, it requests a @@ -2114,7 +2153,7 @@ for (cutoff_retry = 0; expired && int unexpired_hosts_tried = 0; for (host = hostlist; - host != NULL && + host != NULL && unexpired_hosts_tried < ob->hosts_max_try && total_hosts_tried < ob->hosts_max_try_hardlimit; host = nexthost) @@ -2177,7 +2216,7 @@ for (cutoff_retry = 0; expired && /* Find by name if so configured, or if it's an IP address. We don't just copy the IP address, because we need the test-for-local to happen. */ - if (ob->gethostbyname || string_is_ip_address(host->name, NULL)) + if (ob->gethostbyname || string_is_ip_address(host->name, NULL) > 0) rc = host_find_byname(host, NULL, &canonical_name, TRUE); else { @@ -2421,9 +2460,9 @@ for (cutoff_retry = 0; expired && /* This is for real. If the host is expired, we don't count it for hosts_max_retry. This ensures that all hosts must expire before an address - is timed out, unless hosts_max_try_hardlimit (which protects against + is timed out, unless hosts_max_try_hardlimit (which protects against lunatic DNS configurations) is reached. - + If the host is not expired and we are about to hit the hosts_max_retry limit, check to see if there is a subsequent hosts with a different MX value. If so, make that the next host, and don't count this one. This is a @@ -2686,7 +2725,7 @@ for (addr = addrlist; addr != NULL; addr = addr->next) because of hosts_max_try or hosts_max_try_hardlimit. In the former case, this means we need to behave as if some hosts were skipped because their retry time had not come. Specifically, this prevents the address from timing out. - However, if we have hit hosts_max_try_hardlimit, we want to behave as if all + However, if we have hit hosts_max_try_hardlimit, we want to behave as if all hosts were tried. */ if (host != NULL) @@ -2698,11 +2737,11 @@ for (addr = addrlist; addr != NULL; addr = addr->next) "hosts were tried\n"); } else - { + { DEBUG(D_transport) debug_printf("hosts_max_try limit caused some hosts to be skipped\n"); setflag(addr, af_retry_skipped); - } + } } if (queue_smtp) /* no deliveries attempted */