Fix crash for verify=helo when no IP address (-bs).
[exim.git] / src / src / smtp_in.c
index 36c4c3021d921a7f8540ab3ded2f898d45d8bada..c75b2b207ebd8bb876c41017c206a8b87e3130f4 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/smtp_in.c,v 1.44 2006/09/25 10:14:20 ph10 Exp $ */
+/* $Cambridge: exim/src/src/smtp_in.c,v 1.46 2006/10/23 10:55:10 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -2054,6 +2054,16 @@ if (sender_helo_name == NULL)
   HDEBUG(D_receive) debug_printf("no EHLO/HELO command was issued\n");
   }
 
+/* Deal with the case of -bs without an IP address */
+
+else if (sender_host_address == NULL)
+  {
+  HDEBUG(D_receive) debug_printf("no client IP address: assume success\n");
+  helo_verified = TRUE;
+  }
+
+/* Deal with the more common case when there is a sending IP address */
+
 else if (sender_helo_name[0] == '[')
   {
   helo_verified = Ustrncmp(sender_helo_name+1, sender_host_address,
@@ -2119,7 +2129,7 @@ else
     h.next = NULL;
     HDEBUG(D_receive) debug_printf("getting IP address for %s\n",
       sender_helo_name);
-    rc = host_find_byname(&h, NULL, NULL, TRUE);
+    rc = host_find_byname(&h, NULL, 0, NULL, TRUE);
     if (rc == HOST_FOUND || rc == HOST_FOUND_LOCAL)
       {
       host_item *hh = &h;
@@ -2139,7 +2149,7 @@ else
     }
   }
 
-if (!helo_verified) helo_verify_failed = FALSE;  /* We've tried ... */
+if (!helo_verified) helo_verify_failed = TRUE;  /* We've tried ... */
 return yield;
 }