Skip to content

smtplib does not fully support IPv6 in EHLO #47711

Open

Description

@dmorr
mannequin
BPO 3461
Nosy @warsaw, @giampaolo, @bitdancer
Files
  • python_smtplib.patch
  • smtplib.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:

    assignee = None
    closed_at = None
    created_at = <Date 2008-07-28.22:08:43.930>
    labels = ['type-bug', '3.8', 'expert-email', '3.10', 'library', '3.9']
    title = 'smtplib does not fully support IPv6 in EHLO'
    updated_at = <Date 2020-11-11.00:41:13.914>
    user = 'https://bugs.python.org/dmorr'

    bugs.python.org fields:

    activity = <Date 2020-11-11.00:41:13.914>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)', 'email']
    creation = <Date 2008-07-28.22:08:43.930>
    creator = 'dmorr'
    dependencies = []
    files = ['11000', '17863']
    hgrepos = []
    issue_num = 3461
    keywords = ['patch']
    message_count = 7.0
    messages = ['70372', '109271', '109288', '109414', '109422', '110133', '110137']
    nosy_count = 4.0
    nosy_names = ['barry', 'giampaolo.rodola', 'dmorr', 'r.david.murray']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'test needed'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue3461'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    Linked PRs

    Activity

    1. dmorr commented on Jul 28, 2008

      dmorrmannequin
      MannequinAuthor

      On an IPv6-only machine, smtplib does not send an IPv6 address in the
      EHLO. It sends "EHLO [0.0.0.0]" instead. For example, on a v6-only
      network with stateless autoconfiguration enabled (a common
      configuration), smtplib will show this error.

      Further, SMTP's __init__() method tries to determine the value of EHLO
      parameter before the socket is established. But it can't know what
      value to use before the socket is setup (e.g., should it use a
      hostname, a v4 address literal, or a v6 address literal).

      The attached patch moves the self.local_hostname processing into the
      connect() method, and updates it to use IPv6-aware resolver interfaces.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Jul 28, 2008
    3. BreamoreBoy commented on Jul 4, 2010

      BreamoreBoymannequin
      Mannequin

      I intended testing this but the patch file appears to have a dangling else at the bottom, or am I missing something?

    4. dmorr commented on Jul 5, 2010

      dmorrmannequin
      MannequinAuthor

      You're right. My mistake when I made the patch. I've attached a new one without the trailing else

    5. BreamoreBoy commented on Jul 6, 2010

      BreamoreBoymannequin
      Mannequin

      Ran test_smtplib.py for Python 2.7 and 3.1.2 on Windows Vista all tests passed.

    6. bitdancer commented on Jul 6, 2010

      @bitdancer
      Member

      The patch still needs unit tests.

    7. dmorr commented on Jul 12, 2010

      dmorrmannequin
      MannequinAuthor

      I'm not sure how to best write a unit test for this. The patch should only be invoked if the client doesn't have a name-served hostname and has IPv6 enabled. Also, there are several IPv4-isms in the smtplib tests.

    8. giampaolo commented on Jul 12, 2010

      @giampaolo
      Contributor

      You might want to take a look at Lib/test/test_ftplib.py which contains IPv6 tests including the necessary logic to decide whether or not running them.

    9. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)end of life3.8 (EOL)end of life3.9 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions