Bugzilla #1006: Keep EHLO attributes in case STARTTLS errors are ignored
[exim.git] / src / src / transports / smtp.c
index d57b67429c3bfbb04a7f6206b987b07b7a6ee4a8..41796a4d9d5d9d869a23748ea81afc189ac416cd 100644 (file)
@@ -1,10 +1,10 @@
-/* $Cambridge: exim/src/src/transports/smtp.c,v 1.43 2009/10/20 13:10:15 nm4 Exp $ */
+/* $Cambridge: exim/src/src/transports/smtp.c,v 1.44 2009/11/16 19:56:54 nm4 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2007 */
+/* Copyright (c) University of Cambridge 1995 - 2009 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 #include "../exim.h"
@@ -1078,10 +1078,12 @@ if (tls_offered && !suppress_tls &&
   if (!smtp_read_response(&inblock, buffer2, sizeof(buffer2), '2',
       ob->command_timeout))
     {
-    Ustrncpy(buffer, buffer2, sizeof(buffer));
     if (errno != 0 || buffer2[0] == 0 ||
          (buffer2[0] == '4' && !ob->tls_tempfail_tryclear))
+      {
+      Ustrncpy(buffer, buffer2, sizeof(buffer));
       goto RESPONSE_FAILED;
+      }
     }
 
   /* STARTTLS accepted: try to negotiate a TLS session. */