python / cpython

The Python programming language
https://www.python.org
Other
63.74k stars 30.54k forks source link

ftplib passive ftp problem on multihomed clients #44590

Open eda02e01-ffd0-4438-902f-1ec00a7ac345 opened 17 years ago

eda02e01-ffd0-4438-902f-1ec00a7ac345 commented 17 years ago
BPO 1661754
Nosy @pitrou, @giampaolo
Superseder
  • bpo-8594: Add a "source_address" option to ftplib
  • Files
  • ftplib.patch: patch in unified forward diff format
  • ftplib.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = 'https://github.com/giampaolo' closed_at = None created_at = labels = ['type-bug', 'library'] title = 'ftplib passive ftp problem on multihomed clients' updated_at = user = 'https://bugs.python.org/timbaum' ``` bugs.python.org fields: ```python activity = actor = 'giampaolo.rodola' assignee = 'giampaolo.rodola' closed = False closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'timbaum' dependencies = [] files = ['7766', '20990'] hgrepos = [] issue_num = 1661754 keywords = ['patch'] message_count = 4.0 messages = ['51894', '104750', '130007', '130009'] nosy_count = 4.0 nosy_names = ['exarkun', 'pitrou', 'giampaolo.rodola', 'timbaum'] pr_nums = [] priority = 'normal' resolution = None stage = 'patch review' status = 'open' superseder = '8594' type = 'behavior' url = 'https://bugs.python.org/issue1661754' versions = ['Python 3.1', 'Python 2.7', 'Python 3.2', 'Python 3.3'] ```

    eda02e01-ffd0-4438-902f-1ec00a7ac345 commented 17 years ago

    When using passive FTP on a multihomed client, data connections should originate from the same address as the control connection. Otherwise, the connection can be blocked by stateful firewalls or rejected by the ftp server. The ftplib.py library allows the OS to choose the local address for each passive data connection, so connections fail intermittently if the operating system selects a different local address than used for the initial connection.

    The attached patch binds the passive-mode data connection to the same local address as the control connection.

    giampaolo commented 14 years ago

    bpo-8594 is related with this one.

    giampaolo commented 13 years ago

    Patch in attachment updates the previous one which no longer applies cleanly in py 3.3. The control connection address is used for *both* passive (PASV) and active (PORT) connections, which is the same approach I used in pyftpdlib.

    Removed test_source_address_passive_connection test because we do not want that the same (host, port) is used for both control and data connections.

    I think it makes sense to port this patch in previous python versions as well.

    giampaolo commented 13 years ago

    we do not want that the same (host, port) is used for both control and data connections.

    I meant *port*, not (host, port).