Skip to content

Commit b56961e

Browse files
committed
ftpd: Use implicit FTPS instead of explicit
Implementation found in giampaolo/pyftpdlib@edbc9cc Signed-off-by: Hendrik Wolff <[email protected]>
1 parent 52438bc commit b56961e

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

copyparty/ftpd.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,16 @@ def log_transfer(
552552
class SftpHandler(FtpHandler, TLS_FTPHandler):
553553
pass
554554

555+
class FtpsImplicitHandler(FtpHandler, TLS_FTPHandler):
556+
def handle(self):
557+
self.secure_connection(self.ssl_context)
558+
559+
def handle_ssl_established(self):
560+
FtpHandler.handle(self)
561+
562+
def ftp_AUTH(self, arg):
563+
self.respond("550 not supposed to be used with implicit SSL.")
564+
555565
except:
556566
pass
557567

@@ -566,7 +576,7 @@ def __init__(self, hub: "SvcHub") -> None:
566576
hs.append([FtpHandler, self.args.ftp])
567577
if self.args.ftps:
568578
try:
569-
h1 = SftpHandler
579+
h1 = FtpsImplicitHandler
570580
except:
571581
t = "\nftps requires pyopenssl;\nplease run the following:\n\n {} -m pip install --user pyopenssl\n"
572582
print(t.format(pybin))

0 commit comments

Comments
 (0)