Fix crash for verify=helo when no IP address (-bs).
authorPhilip Hazel <ph10@hermes.cam.ac.uk>
Mon, 23 Oct 2006 10:55:10 +0000 (10:55 +0000)
committerPhilip Hazel <ph10@hermes.cam.ac.uk>
Mon, 23 Oct 2006 10:55:10 +0000 (10:55 +0000)
doc/doc-txt/ChangeLog
src/src/smtp_in.c
test/confs/0541 [new file with mode: 0644]
test/scripts/0000-Basic/0541 [new file with mode: 0644]
test/stdout/0541 [new file with mode: 0644]

index 6059f6b6f6b4c438ff99b4793b1627a2ca699f0c..06a18dc3f8a142d6476d7ad8ef0cc72df4d7d5c4 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.411 2006/10/18 08:55:37 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.412 2006/10/23 10:55:10 ph10 Exp $
 
 Change log file for Exim from version 4.21
 -------------------------------------------
@@ -158,6 +158,10 @@ PH/22 As suggested by Dennis Davis, added a server_condition option to *all*
 PH/23 Testing for tls_required and lost_connection in a retry rule didn't work
       if any retry times were supplied.
 
+PH/24 Exim crashed if verify=helo was activated during an incoming -bs
+      connection, where there is no client IP address to check. In this
+      situation, the verify now always succeeds.
+
 
 Exim version 4.63
 -----------------
index a87b65221bf1b355035a34ec4eec18624089f48e..c75b2b207ebd8bb876c41017c206a8b87e3130f4 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/smtp_in.c,v 1.45 2006/10/09 14:36:25 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,
@@ -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;
 }
 
diff --git a/test/confs/0541 b/test/confs/0541
new file mode 100644 (file)
index 0000000..0b3be92
--- /dev/null
@@ -0,0 +1,25 @@
+# Exim test configuration 0541
+
+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 -----
+
+acl_smtp_helo = check_helo
+
+
+# ----- ACLs -----
+
+begin acl
+
+check_helo:
+  require verify = helo
+  accept
+
+# End
diff --git a/test/scripts/0000-Basic/0541 b/test/scripts/0000-Basic/0541
new file mode 100644 (file)
index 0000000..0452c55
--- /dev/null
@@ -0,0 +1,5 @@
+# verify=helo with no IP address
+exim -bs
+helo a.b.c.d
+quit
+****
diff --git a/test/stdout/0541 b/test/stdout/0541
new file mode 100644 (file)
index 0000000..4037cb4
--- /dev/null
@@ -0,0 +1,3 @@
+220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250 myhost.test.ex Hello CALLER at a.b.c.d\r
+221 myhost.test.ex closing connection\r