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

Index: pure-ftpd-1.0.22/src/ftp_parser.c
===================================================================
--- pure-ftpd-1.0.22.orig/src/ftp_parser.c	2009-04-30 07:51:04.000000000 +0200
+++ pure-ftpd-1.0.22/src/ftp_parser.c	2011-04-11 14:45:40.701995388 +0200
@@ -57,14 +57,20 @@
  * -Frank.
  */
 
+static size_t scanned;
+static size_t readend;
+
+static void flush_cmd(void)
+{
+    scanned = readend = (size_t) 0U;
+}
+
 int sfgets(void)
 {
     fd_set rs;
     struct timeval tv;
     ssize_t readen;
     signed char seen_r = 0;
-    static size_t scanned;
-    static size_t readend;
     
     if (scanned > (size_t) 0U) {       /* support pipelining */
         readend -= scanned;        
@@ -346,6 +352,7 @@
             addreply_noformat(234, "AUTH TLS OK.");
             doreply();
             if (tls_cnx == NULL) {
+                flush_cmd();
                 (void) tls_init_new_session();
             }
             goto wayout;
openSUSE Build Service is sponsored by