Re: [Exim] problem with HELO and TLS

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Philip Hazel
Datum:  
To: Alexey Promokhov
CC: exim-users
Betreff: Re: [Exim] problem with HELO and TLS
On 20 Apr 2002, Alexey Promokhov wrote:

> helo_data=[${readfile{/var/run/local-ip}{}}]
>
> File /var/run/local-ip contains my current dynamic IP address.
>
> This works well, until Exim delivering mail with TLS.



Below is a patch for 4.04 that fixes this bug.


--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.




*** exim-4.04/src/transports/smtp.c Thu Apr 18 09:08:35 2002
--- transports/smtp.c    Fri Apr 26 15:21:48 2002
***************
*** 696,701 ****
--- 696,702 ----
  smtp_inblock inblock;
  smtp_outblock outblock;
  int max_rcpt = tblock->max_addresses;
+ uschar *helo_data;
  uschar *message = NULL;
  uschar new_message_id[MESSAGE_ID_LENGTH + 1];
  uschar *p;
***************
*** 723,745 ****
  outblock.ptr = outbuffer;
  outblock.cmd_count = 0;


/* Make a connection to the host if this isn't a continued delivery, and handle
the initial interaction and HELO/EHLO/LHLO. */

  if (continue_hostname == NULL)
    {
-   uschar *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);
-     return ERROR;
-     }
-
-   /* Connect ... */
-
    inblock.sock = outblock.sock =
      smtp_connect(host, host_af, port, interface, ob->connect_timeout,
        ob->keepalive);
--- 724,745 ----
  outblock.ptr = outbuffer;
  outblock.cmd_count = 0;


+ /* 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);
+   return ERROR;
+   }
+
  /* Make a connection to the host if this isn't a continued delivery, and handle
  the initial interaction and HELO/EHLO/LHLO. */


  if (continue_hostname == NULL)
    {
    inblock.sock = outblock.sock =
      smtp_connect(host, host_af, port, interface, ob->connect_timeout,
        ob->keepalive);
***************
*** 792,798 ****
         ob->command_timeout))
      {
      if (errno != 0 || buffer[0] == 0 || lmtp) goto RESPONSE_FAILED;
!     if (!smtp_write_command(&outblock, FALSE, "HELO %s\r\n", primary_hostname))
        goto SEND_FAILED;
      if (!smtp_read_response(&inblock, buffer, sizeof(buffer), '2',
        ob->command_timeout)) goto RESPONSE_FAILED;
--- 792,798 ----
         ob->command_timeout))
      {
      if (errno != 0 || buffer[0] == 0 || lmtp) goto RESPONSE_FAILED;
!     if (!smtp_write_command(&outblock, FALSE, "HELO %s\r\n", helo_data))
        goto SEND_FAILED;
      if (!smtp_read_response(&inblock, buffer, sizeof(buffer), '2',
        ob->command_timeout)) goto RESPONSE_FAILED;
***************
*** 882,888 ****


  if (tls_active >= 0)
    {
!   if (!smtp_write_command(&outblock, FALSE, "EHLO %s\r\n", primary_hostname))
      goto SEND_FAILED;
    if (!smtp_read_response(&inblock, buffer, sizeof(buffer), '2',
         ob->command_timeout))
--- 882,888 ----


  if (tls_active >= 0)
    {
!   if (!smtp_write_command(&outblock, FALSE, "EHLO %s\r\n", helo_data))
      goto SEND_FAILED;
    if (!smtp_read_response(&inblock, buffer, sizeof(buffer), '2',
         ob->command_timeout))