-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.464 2007/01/30 11:45:20 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.465 2007/01/30 15:10:58 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
PH/11 Added control=no_pipelining.
+PH/12 Added $sending_ip_address and $sending_port (mostly Magnus Holmgren's
+ patch, slightly modified), and move the expansion of helo_data till after
+ the connection is made in the smtp transport (so it can use these
+ values).
+
Exim version 4.66
-----------------
-$Cambridge: exim/doc/doc-txt/NewStuff,v 1.131 2007/01/30 11:45:20 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/NewStuff,v 1.132 2007/01/30 15:10:58 ph10 Exp $
New Features in Exim
--------------------
an EHLO command. Therefore, it should normally appear in an ACL controlled
by acl_smtp_connect or acl_smtp_helo.
+ 7. There are two new variables called $sending_ip_address and $sending_port.
+ These are set whenever an SMTP connection to another host has been set up,
+ and they contain the IP address and port of the local interface that is
+ being used. They are of interest only on hosts that have more than on IP
+ address that want to take on different personalities depending on which one
+ is being used.
+
+ 8. The expansion of the helo_data option in the smtp transport now happens
+ after the connection to the server has been made. This means that it can
+ use the value of $sending_ip_address (see 7 above) to vary the text of the
+ message. For example, if you want the string that is used for helo_data to
+ be obtained by a DNS lookup of the interface address, you could use this:
+
+ helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
+ {$primary_hostname}}
+
+ The use of helo_data applies both to sending messages and when doing
+ callouts.
+
Version 4.66
------------
-$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.68 2007/01/17 11:17:58 ph10 Exp $
+$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.69 2007/01/30 15:10:59 ph10 Exp $
EXIM ACKNOWLEDGEMENTS
Philip Hazel
Lists created: 20 November 2002
-Last updated: 17 January 2007
+Last updated: 30 January 2007
THE OLD LIST
Patch for arbitrarily named ACL variables
Magnus Holmgren Patch for filter_prepend_home
Patch for "h" flag in Domain Keys
+ Patch for $sending_ip_address/$sending_port
+ Lots of other support
Kjetil Torgrim Homme Patch for require_files problem on NFS file systems
Tom Hughes Suggested patch for $n bug in pipe command from filter
Pierre Humblet Continued Cygwin support
-/* $Cambridge: exim/src/src/exim.c,v 1.54 2007/01/25 15:51:28 ph10 Exp $ */
+/* $Cambridge: exim/src/src/exim.c,v 1.55 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
if (Ustrcmp(argrest, "C") == 0)
{
+ union sockaddr_46 interface_sock;
+ EXIM_SOCKLEN_T size = sizeof(interface_sock);
+
if (argc != i + 6)
{
fprintf(stderr, "exim: too many or too few arguments after -MC\n");
return EXIT_FAILURE;
}
+ /* Set up $sending_ip_address and $sending_port */
+
+ if (getsockname(fileno(stdin), (struct sockaddr *)(&interface_sock),
+ &size) == 0)
+ sending_ip_address = host_ntoa(-1, &interface_sock, NULL,
+ &sending_port);
+ else
+ {
+ fprintf(stderr, "exim: getsockname() failed after -MC option: %s\n",
+ strerror(errno));
+ return EXIT_FAILURE;
+ }
+
if (running_in_test_harness) millisleep(500);
break;
}
-/* $Cambridge: exim/src/src/expand.c,v 1.77 2007/01/23 14:34:02 ph10 Exp $ */
+/* $Cambridge: exim/src/src/expand.c,v 1.78 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
{ "sender_rate_period", vtype_stringptr, &sender_rate_period },
{ "sender_rcvhost", vtype_stringptr, &sender_rcvhost },
{ "sender_verify_failure",vtype_stringptr, &sender_verify_failure },
+ { "sending_ip_address", vtype_stringptr, &sending_ip_address },
+ { "sending_port", vtype_int, &sending_port },
{ "smtp_active_hostname", vtype_stringptr, &smtp_active_hostname },
{ "smtp_command", vtype_stringptr, &smtp_cmd_buffer },
{ "smtp_command_argument", vtype_stringptr, &smtp_cmd_argument },
-/* $Cambridge: exim/src/src/globals.c,v 1.65 2007/01/30 11:45:20 ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.c,v 1.66 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
address_item *sender_verified_failed = NULL;
int sender_verified_rc = -1;
BOOL sender_verified_responded = FALSE;
+uschar *sending_ip_address = NULL;
+int sending_port = -1;
volatile BOOL sigalrm_seen = FALSE;
uschar **sighup_argv = NULL;
int smtp_accept_count = 0;
-/* $Cambridge: exim/src/src/globals.h,v 1.46 2007/01/30 11:45:20 ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.h,v 1.47 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
extern uschar *sender_verify_failure; /* What went wrong */
extern address_item *sender_verified_list; /* Saved chain of sender verifies */
extern address_item *sender_verified_failed; /* The one that caused denial */
+extern uschar *sending_ip_address; /* Address of outgoing (SMTP) interface */
+extern int sending_port; /* Port of outgoing interface */
extern volatile BOOL sigalrm_seen; /* Flag for sigalrm_handler */
extern uschar **sighup_argv; /* Args for re-execing after SIGHUP */
extern int smtp_accept_count; /* Count of connections */
-/* $Cambridge: exim/src/src/smtp_out.c,v 1.8 2007/01/08 10:50:18 ph10 Exp $ */
+/* $Cambridge: exim/src/src/smtp_out.c,v 1.9 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
else
{
+ union sockaddr_46 interface_sock;
+ EXIM_SOCKLEN_T size = sizeof(interface_sock);
HDEBUG(D_transport|D_acl|D_v) debug_printf("connected\n");
+ if (getsockname(sock, (struct sockaddr *)(&interface_sock), &size) == 0)
+ sending_ip_address = host_ntoa(-1, &interface_sock, NULL, &sending_port);
+ else
+ {
+ log_write(0, LOG_MAIN | ((errno == ECONNRESET)? 0 : LOG_PANIC),
+ "getsockname() failed: %s", strerror(errno));
+ close(sock);
+ return -1;
+ }
if (keepalive) ip_keepalive(sock, host->address, TRUE);
return sock;
}
-/* $Cambridge: exim/src/src/transports/smtp.c,v 1.32 2007/01/22 16:29:55 ph10 Exp $ */
+/* $Cambridge: exim/src/src/transports/smtp.c,v 1.33 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
int max_rcpt = tblock->max_addresses;
uschar *igquotstr = US"";
uschar *local_authenticated_sender = authenticated_sender;
-uschar *helo_data;
+uschar *helo_data = NULL;
uschar *message = NULL;
uschar new_message_id[MESSAGE_ID_LENGTH + 1];
uschar *p;
outblock.cmd_count = 0;
outblock.authenticating = FALSE;
-/* Expand the greeting message */
-
-helo_data = expand_string(ob->helo_data);
-if (helo_data == NULL)
- {
- uschar *message = string_sprintf("failed to expand helo_data: %s",
- expand_string_message);
- set_errno(addrlist, 0, message, DEFER, FALSE);
- return ERROR;
- }
-
/* If an authenticated_sender override has been specified for this transport
instance, expand it. If the expansion is forced to fail, and there was already
an authenticated_sender for this message, the original value will be used.
return DEFER;
}
+ /* Expand the greeting message while waiting for the initial response. (Makes
+ sense if helo_data contains ${lookup dnsdb ...} stuff). The expansion is
+ delayed till here so that $sending_interface and $sending_port are set. */
+
+ helo_data = expand_string(ob->helo_data);
+
/* The first thing is to wait for an initial OK response. The dreaded "goto"
is nevertheless a reasonably clean way of programming this kind of logic,
where you want to escape on any error. */
if (!smtp_read_response(&inblock, buffer, sizeof(buffer), '2',
ob->command_timeout)) goto RESPONSE_FAILED;
+ /* Now check if the helo_data expansion went well, and sign off cleanly if it
+ didn't. */
+
+ if (helo_data == NULL)
+ {
+ uschar *message = string_sprintf("failed to expand helo_data: %s",
+ expand_string_message);
+ set_errno(addrlist, 0, message, DEFER, FALSE);
+ yield = DEFER;
+ goto SEND_QUIT;
+ }
+
/** Debugging without sending a message
addrlist->transport_return = DEFER;
goto SEND_QUIT;
}
}
-/* If we started TLS, redo the EHLO/LHLO exchange over the secure channel. */
+/* If we started TLS, redo the EHLO/LHLO exchange over the secure channel. If
+helo_data is null, we are dealing with a connection that was passed from
+another process, and so we won't have expanded helo_data above. We have to
+expand it here. $sending_ip_address and $sending_port are set up right at the
+start of the Exim process (in exim.c). */
if (tls_active >= 0)
{
+ if (helo_data == NULL)
+ {
+ helo_data = expand_string(ob->helo_data);
+ if (helo_data == NULL)
+ {
+ uschar *message = string_sprintf("failed to expand helo_data: %s",
+ expand_string_message);
+ set_errno(addrlist, 0, message, DEFER, FALSE);
+ yield = DEFER;
+ goto SEND_QUIT;
+ }
+ }
+
if (smtp_write_command(&outblock, FALSE, "%s %s\r\n", lmtp? "LHLO" : "EHLO",
helo_data) < 0)
goto SEND_FAILED;
-/* $Cambridge: exim/src/src/verify.c,v 1.46 2007/01/17 11:17:58 ph10 Exp $ */
+/* $Cambridge: exim/src/src/verify.c,v 1.47 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
log_write(0, LOG_MAIN|LOG_PANIC, "<%s>: %s", addr->address,
addr->message);
- /* Expand the helo_data string to find the host name to use. */
-
- if (tf->helo_data != NULL)
- {
- uschar *s = expand_string(tf->helo_data);
- if (s == NULL)
- log_write(0, LOG_MAIN|LOG_PANIC, "<%s>: failed to expand transport's "
- "helo_data value for callout: %s", addr->address,
- expand_string_message);
- else active_hostname = s;
- }
-
- deliver_host = deliver_host_address = NULL;
- deliver_domain = save_deliver_domain;
-
/* Set HELO string according to the protocol */
if (Ustrcmp(tf->protocol, "lmtp") == 0) helo = US"LHLO";
{
addr->message = string_sprintf("could not connect to %s [%s]: %s",
host->name, host->address, strerror(errno));
+ deliver_host = deliver_host_address = NULL;
+ deliver_domain = save_deliver_domain;
continue;
}
+ /* Expand the helo_data string to find the host name to use. */
+
+ if (tf->helo_data != NULL)
+ {
+ uschar *s = expand_string(tf->helo_data);
+ if (s == NULL)
+ log_write(0, LOG_MAIN|LOG_PANIC, "<%s>: failed to expand transport's "
+ "helo_data value for callout: %s", addr->address,
+ expand_string_message);
+ else active_hostname = s;
+ }
+
+ deliver_host = deliver_host_address = NULL;
+ deliver_domain = save_deliver_domain;
+
/* Wait for initial response, and send HELO. The smtp_write_command()
function leaves its command in big_buffer. This is used in error responses.
Initialize it in case the connection is rejected. */
--- /dev/null
+# Exim test configuration 0550
+
+exim_path = EXIM_PATH
+host_lookup_order = bydns
+primary_hostname = myhost.test.ex
+rfc1413_query_timeout = 0s
+spool_directory = DIR/spool
+log_file_path = DIR/spool/log/%slog
+gecos_pattern = ""
+gecos_name = CALLER_NAME
+
+# ----- Main settings -----
+
+
+# ----- Routers -----
+
+begin routers
+
+r1:
+ driver = accept
+ transport = t1
+
+
+# ----- Transports -----
+
+begin transports
+
+t1:
+ driver = smtp
+ hosts = 127.0.0.1 : HOSTIPV4
+ port = PORT_S
+ allow_localhost
+ helo_data = \
+ ${if eq{$sending_ip_address}{127.0.0.1}{Tweedledum}{Tweedledee}} \
+ to $host [$host_address]
+
+
+# ------ Retry ------
+
+begin retry
+
+* * F,1d,1d
+
+# End
--- /dev/null
+1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 10HmaX-0005vi-00 SMTP error from remote mail server after MAIL FROM:<CALLER@myhost.test.ex>: host 127.0.0.1 [127.0.0.1]: 450 Defer
+1999-03-02 09:44:33 10HmaX-0005vi-00 == userx@test.ex R=r1 T=t1 defer (-45): SMTP error from remote mail server after MAIL FROM:<CALLER@myhost.test.ex>: host ipv4.ipv4.ipv4.ipv4 [ipv4.ipv4.ipv4.ipv4]: 450 Defer
--- /dev/null
+# $sending_ip_address
+need_ipv4
+#
+server PORT_S 2
+220 ESMTP
+EHLO
+250-OK
+250 HELP
+MAIL FROM
+450 Defer
+QUIT
+221 OK
+*EOF
+220 ESMTP
+EHLO
+250-OK
+250 HELP
+MAIL FROM
+450 Defer
+QUIT
+221 OK
+****
+exim -odi userx@test.ex
+****
+no_msglog_check
exim userx@test.ex
Test message 2
****
-exim -qqf
+exim -qqf -d-all+acl
****
killdaemon
exim -DSERVER=server -DNOTDAEMON -qf
exim userx@test.ex
Test message 2
****
-exim -qqf
+exim -qqf -d-all+acl
****
killdaemon
exim -DSERVER=server -DNOTDAEMON -qf
--- /dev/null
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+admin user
+LOG: queue_run MAIN
+ Start queue run: pid=pppp -qqf
+Connecting to 127.0.0.1 [127.0.0.1]:1225 ... connected
+ SMTP<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250-STARTTLS
+ 250 HELP
+ SMTP>> STARTTLS
+ SMTP<< 220 TLS go ahead
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250 HELP
+ SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+ SMTP>> RCPT TO:<userx@test.ex>
+ SMTP>> DATA
+ SMTP<< 250 OK
+ SMTP<< 250 Accepted
+ SMTP<< 354 Enter message, ending with "." on a line by itself
+ SMTP<< 250 OK id=10HmaZ-0005vi-00
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250-STARTTLS
+ 250 HELP
+LOG: MAIN
+ => userx@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] X=TLS-1.0:RSA_AES_256_CBC_SHA1:32 DN="C=UK,L=Cambridge,O=University of Cambridge,OU=Computing Service,CN=Philip Hazel"
+LOG: MAIN
+ Completed
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+trusted user
+admin user
+ SMTP>> STARTTLS
+ SMTP<< 220 TLS go ahead
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250 HELP
+ SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+ SMTP>> RCPT TO:<userx@test.ex>
+ SMTP>> DATA
+ SMTP<< 250 OK
+ SMTP<< 250 Accepted
+ SMTP<< 354 Enter message, ending with "." on a line by itself
+ SMTP<< 250 OK id=10HmbA-0005vi-00
+ SMTP>> QUIT
+LOG: MAIN
+ => userx@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1]* X=TLS-1.0:RSA_AES_256_CBC_SHA1:32 DN="C=UK,L=Cambridge,O=University of Cambridge,OU=Computing Service,CN=Philip Hazel"
+LOG: MAIN
+ Completed
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+LOG: queue_run MAIN
+ End queue run: pid=pppp -qqf
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+
+******** SERVER ********
--- /dev/null
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+admin user
+LOG: queue_run MAIN
+ Start queue run: pid=pppp -qqf
+Connecting to 127.0.0.1 [127.0.0.1]:1225 ... connected
+ SMTP<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250-STARTTLS
+ 250 HELP
+ SMTP>> STARTTLS
+ SMTP<< 220 TLS go ahead
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250 HELP
+ SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+ SMTP>> RCPT TO:<userx@test.ex>
+ SMTP>> DATA
+ SMTP<< 250 OK
+ SMTP<< 250 Accepted
+ SMTP<< 354 Enter message, ending with "." on a line by itself
+ SMTP<< 250 OK id=10HmaZ-0005vi-00
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250-STARTTLS
+ 250 HELP
+LOG: MAIN
+ => userx@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] X=TLSv1:AES256-SHA:256 DN="/C=UK/L=Cambridge/O=University of Cambridge/OU=Computing Service/CN=Philip Hazel"
+LOG: MAIN
+ Completed
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+trusted user
+admin user
+ SMTP>> STARTTLS
+ SMTP<< 220 TLS go ahead
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250 HELP
+ SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+ SMTP>> RCPT TO:<userx@test.ex>
+ SMTP>> DATA
+ SMTP<< 250 OK
+ SMTP<< 250 Accepted
+ SMTP<< 354 Enter message, ending with "." on a line by itself
+ SMTP<< 250 OK id=10HmbA-0005vi-00
+ SMTP>> QUIT
+LOG: MAIN
+ => userx@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1]* X=TLSv1:AES256-SHA:256 DN="/C=UK/L=Cambridge/O=University of Cambridge/OU=Computing Service/CN=Philip Hazel"
+LOG: MAIN
+ Completed
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+LOG: queue_run MAIN
+ End queue run: pid=pppp -qqf
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+
+******** SERVER ********
--- /dev/null
+
+******** SERVER ********
+Listening on port 1224 ...
+Connection request from [127.0.0.1]
+220 ESMTP
+EHLO Tweedledum to 127.0.0.1 [127.0.0.1]
+250-OK
+250 HELP
+MAIL FROM:<CALLER@myhost.test.ex>
+450 Defer
+QUIT
+221 OK
+Unexpected EOF read from client
+Listening on port 1224 ...
+Connection request from [ip4.ip4.ip4.ip4]
+220 ESMTP
+EHLO Tweedledee to ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]
+250-OK
+250 HELP
+MAIL FROM:<CALLER@myhost.test.ex>
+450 Defer
+QUIT
+221 OK
+End of script