File pure-ftpd-1.0.29-flush-cmd-after-tls.patch of Package pure-ftpd.import4353

Index: pure-ftpd-1.0.29/src/ftp_parser.c
===================================================================
--- pure-ftpd-1.0.29.orig/src/ftp_parser.c	2010-03-15 16:20:24.000000000 +0100
+++ pure-ftpd-1.0.29/src/ftp_parser.c	2011-04-11 14:58:58.189341827 +0200
@@ -56,6 +56,13 @@
  * 
  * -Frank.
  */
+static size_t scanned;
+static size_t readnbd;
+
+static void flush_cmd(void)
+{
+    scanned = readnbd = (size_t) 0U;
+}
 
 int sfgets(void)
 {
@@ -63,8 +70,6 @@
     int pollret;
     ssize_t readnb;
     signed char seen_r = 0;
-    static size_t scanned;
-    static size_t readnbd;
     
     if (scanned > (size_t) 0U) {       /* support pipelining */
         readnbd -= scanned;        
@@ -362,6 +367,7 @@
             addreply_noformat(234, "AUTH TLS OK.");
             doreply();
             if (tls_cnx == NULL) {
+                flush_cmd();
                 (void) tls_init_new_session();
             }
             goto wayout;