From 4af158c0cec3e1b74605dcbe428c1dde59e03699 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Fri, 10 Apr 2020 04:33:09 +0000
Subject: [PATCH] If we get a 125 response, ensure the socket is, in fact,
 connected.

---
 exec/load/ftp.js | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/exec/load/ftp.js b/exec/load/ftp.js
index decf16b923..dfec27b886 100644
--- a/exec/load/ftp.js
+++ b/exec/load/ftp.js
@@ -417,9 +417,16 @@ FTP.prototype.data_socket = function(cmd)
 	}
 
 	rstr = this.cmd(cmd, true);
-	if (parseInt(rstr, 10) !== 150) {
-		ds.close();
-		throw(cmd+" failed: " + rstr);
+	switch (parseInt(rstr, 10)) {
+		case 150:
+			break;
+		case 125:
+			if (ds.is_connected)
+				break;
+			// Fall-through
+		default:
+			ds.close();
+			throw(cmd+" failed: " + rstr);
 	}
 
 	if (!this.passive) {
-- 
GitLab