Tumbleweed TLS compatibility patch

[email protected] ("Jared Johnson")
Newsgroups perl.qpsmtpd
Message-ID <[email protected]>
Hi,

We've been chasing issues with Tumbleweed (now Axway) MailGate appliances
sending messages using TLS through us.  Finally Tumbleweed told one of our
clients that this was probably due to a bug in their software when the
receipient MTA "makes multiple writes to the socket".  On a guess, we
patched QP to send multi-line EHLO reponses in a single string rather than
multiple strings.  This seems to have cleared up the issue!

I'm attaching the patch, in hopes that (1) it is useful to you guys; and
(2) if there's anything stupid about it that we haven't been able to
catch, someone will notice and help us improve it, since we're about to
include it in our forthcoming point release :)

-Jared
tumbleweed.diff (text/x-patch, 697 B)
--- Prefork.pm.orig	2011-02-22 17:35:39.809587002 -0600
+++ Prefork.pm	2011-02-22 17:34:58.849587003 -0600
@@ -59,10 +59,12 @@ sub respond {
     return(0);
   }
 
-  while (my $msg = shift @messages) {
-    my $line = $code . (@messages?"-":" ").$msg;
-    $self->log(LOGINFO, $line);
-    print "$line\r\n" or ($self->log(LOGERROR, "Could not print [$line]: $!"), return 0);
+  $messages[$_] = "$code-$messages[$_]" for 0..$#messages-1;
+  $messages[-1] = "$code $messages[-1]";
+  $self->log(LOGINFO, $_) for @messages;
+  unless (print join '', map { "$_\r\n" } @messages) {
+    $self->log(LOGERROR, "Could not print [" . join(' | ', @messages) . "]: $!");
+    return 0;
   }
   return 1;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.