[syslog-ng] Openssl SSL3_WRITE_PENDING error correction

Juhasz Viktor jviktor at balabit.hu
Fri Apr 1 14:28:53 CEST 2011


Hi All!

We've found a bug in the log_proto_framed_client.
The bug is the following:
- using ssl communication between the server and client.
- using syslog protocol
- If client send messages faster than the server can process messages, 
then the client go into the SSL3_WRITE_PENDING openssl error and close 
the connection.


partial message handling correction:
   
    the flush is called only if proto have partially sent message
    after flush is called log_proto_text_client_post have to return 
because the post send one message per call
    it is important in case of framed messages

diff --git a/lib/logproto.c b/lib/logproto.c
index d821275..7f2f897 100644
--- a/lib/logproto.c
+++ b/lib/logproto.c
@@ -145,9 +145,13 @@ log_proto_text_client_post(LogProto *s, guchar 
*msg, gsize msg_len, gboolean *co
   g_assert(self->super.convert == (GIConv) -1);
 
   *consumed = FALSE;
-  rc = log_proto_flush(s);
-  if (rc == LPS_ERROR)
-    goto write_error;
+  if(self->partial)
+    {
+      rc = log_proto_flush(s);
+      if (rc == LPS_ERROR)
+        goto write_error;
+      return rc;
+    }
 
   /* OK, partial buffer empty, now flush msg that we just got */
  
@@ -1774,6 +1778,7 @@ log_proto_framed_client_new(LogTransport *transport)
 
   self->super.super.prepare = log_proto_text_client_prepare;
   self->super.super.post = log_proto_framed_client_post;
+  self->super.super.flush = log_proto_text_client_flush;
   self->super.super.transport = transport;
   self->super.super.convert = (GIConv) -1;
   return &self->super.super;

Best Regards,
Viktor



More information about the syslog-ng mailing list