]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3515: crash in FtpStateData::ftpTimeout
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 9 Feb 2013 06:38:09 +0000 (23:38 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 9 Feb 2013 06:38:09 +0000 (23:38 -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 e0c1d37ec89ce356e8743907613dc718c0169344..29ea45a4162d43beb5f2f0e85cbee10a5672ad31 100644 (file)
@@ -673,10 +673,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);