]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3515: crash in FtpStateData::ftpTimeout
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 3 Feb 2013 14:05:11 +0000 (07:05 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 3 Feb 2013 14:05:11 +0000 (07:05 -0700)
Since revision squid-3.2-11174 restructured teh TCO connection handling
in FTP the data connection has had separate 'opener' connection.
Meaning the conn->fd state is always NULL when the setup times out.

This cleans up the data connection opener state and allows the error
message generation to take place.

src/ftp.cc

index 878cb7e4d9d2bd902bd803d7177cf306094c38fa..25d4da099346142ab918d4f5003f205d27a84e6b 100644 (file)
@@ -681,10 +681,17 @@ FtpStateData::ftpTimeout(const CommTimeoutCbParams &io)
     if (abortOnBadEntry("entry went bad while waiting for a timeout"))
         return;
 
-    if (SENT_PASV == state && io.conn->fd == data.conn->fd) {
-        /* stupid ftp.netscape.com */
+    if (SENT_PASV == state) {
+        /* stupid ftp.netscape.com, of FTP server behind stupid firewall rules */
         flags.pasv_supported = false;
         debugs(9, DBG_IMPORTANT, "ftpTimeout: timeout in SENT_PASV state" );
+
+        // cancel the data connection setup.
+        if (data.opener != NULL) {
+            data.opener->cancel("timeout");
+            data.opener = NULL;
+        }
+        data.close();
     }
 
     failed(ERR_READ_TIMEOUT, 0);