Bugzilla #1067 - DKIM: Fix relaxed header canon for headers ending with whitespace.
authorTom Kistner <tom@tahini.csx.cam.ac.uk>
Wed, 12 Jan 2011 20:48:22 +0000 (20:48 +0000)
committerTom Kistner <tom@tahini.csx.cam.ac.uk>
Wed, 12 Jan 2011 20:48:22 +0000 (20:48 +0000)
src/src/pdkim/pdkim.c
src/src/transports/smtp.c

index fa5d88d599927fd11a41f78b90587c94ae804475..0147f5f05ce0923cb487a8dbfd6c809436bfa72b 100644 (file)
@@ -420,6 +420,7 @@ char *pdkim_relax_header (char *header, int crlf) {
     p++;
     q++;
   }
+  if (seen_wsp) q--;
   *q = '\0';
   if (crlf) strcat(relaxed,"\r\n");
   return relaxed;
index 41796a4d9d5d9d869a23748ea81afc189ac416cd..fb55ae01bbd7210962e5be0f5ed778faa1329779 100644 (file)
@@ -1078,12 +1078,10 @@ 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. */