[issue32572] Add the ftplib option, overrides the IP address.

Giampaolo Rodola' report at bugs.python.org
Thu Feb 1 12:19:30 EST 2018


Giampaolo Rodola' <g.rodola at gmail.com> added the comment:

Considering the security implications and the fact that it's a corner case I don't think this is worth adding as a new, public API, sorry. I think ftplib should expose and promote APIs reflecting common scenarios and good practices, yet be flexible enough in order to allow "breaking the rules". FWIW, you may get away with something like this, which IMO is not too bad (not tested): 


class FTP(ftplib.FTP):
    externalip = None

    def sendport(self, host, port):
        return super().sendport(self.externalip or host, port)

    def sendeprt(self, host, port):
        return super().sendeprt(self.externalip or host, port)

----------
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32572>
_______________________________________


More information about the Python-bugs-list mailing list