Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smtplib starttls() should ehlo() if it needs to #45680

Closed
fenner mannequin opened this issue Oct 26, 2007 · 6 comments
Closed

smtplib starttls() should ehlo() if it needs to #45680

fenner mannequin opened this issue Oct 26, 2007 · 6 comments
Assignees
Labels
easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@fenner
Copy link
Mannequin

fenner mannequin commented Oct 26, 2007

BPO 1339
Nosy @gvanrossum, @gpshead, @jcea
Files
  • smtplib-startls-ehlo.diff
  • 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 = 'https://github.com/gpshead'
    closed_at = <Date 2008-01-17.08:37:34.855>
    created_at = <Date 2007-10-26.23:26:14.364>
    labels = ['easy', 'type-feature', 'library']
    title = 'smtplib starttls() should ehlo() if it needs to'
    updated_at = <Date 2008-01-17.08:37:34.853>
    user = 'https://bugs.python.org/fenner'

    bugs.python.org fields:

    activity = <Date 2008-01-17.08:37:34.853>
    actor = 'gregory.p.smith'
    assignee = 'gregory.p.smith'
    closed = True
    closed_date = <Date 2008-01-17.08:37:34.855>
    closer = 'gregory.p.smith'
    components = ['Library (Lib)']
    creation = <Date 2007-10-26.23:26:14.364>
    creator = 'fenner'
    dependencies = []
    files = ['8665']
    hgrepos = []
    issue_num = 1339
    keywords = ['easy']
    message_count = 6.0
    messages = ['56829', '56914', '56965', '59817', '60012', '60022']
    nosy_count = 5.0
    nosy_names = ['gvanrossum', 'gregory.p.smith', 'jcea', 'jamesh', 'fenner']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1339'
    versions = ['Python 2.6', 'Python 2.5', 'Python 2.4']

    @fenner
    Copy link
    Mannequin Author

    fenner mannequin commented Oct 26, 2007

    smtplib's "complex" methods, login and sendmail, try to EHLO or HELO if
    it hasn't been done yet. login also checks to see if the EHLO response
    included the ability to do authorization.

    starttls seems to me to be similar in nature: why should it not try to
    EHLO or HELO, and check that self.has_extn("starttls")?

    @fenner fenner mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Oct 26, 2007
    @gvanrossum
    Copy link
    Member

    You'll get more traction on this if you submit a patch.

    @fenner
    Copy link
    Mannequin Author

    fenner mannequin commented Oct 30, 2007

    I've attached a patch against 2.4.3.

    The patch does the following:

    • Factor out the duplication of EHLO/HELO in login() and sendmail() to a
      new function, ehlo_or_helo_if_needed().
    • Use ehlo_or_helo_if_needed() in starttls()
    • Check for the starttls exception in starttls() in the same way as
      login() checks for the auth extension.

    @akuchling akuchling added the easy label Jan 12, 2008
    @jamesh
    Copy link
    Mannequin

    jamesh mannequin commented Jan 12, 2008

    From RFC 2487 section 5.2: "The client MUST discard any knowledge
    obtained from the server, such as the list of SMTP service extensions,
    which was not obtained from the TLS negotiation itself. The client
    SHOULD send an EHLO command as the first command after a successful TLS
    negotiation."

    So the starttls() method should probably also be clearing helo_resp and
    ehlo_resp (and maybe anything else discovered by ehlo()).

    There are servers in the wild that will (a) refuse to talk to you unless
    you issue another EHLO after TLS is negotiated and (b) offer a different
    set of ESMTP features (such as only supporting SMTP AUTH after TLS).
    This patch isn't enough to talk to such servers.

    @fenner
    Copy link
    Mannequin Author

    fenner mannequin commented Jan 17, 2008

    jamesh, I attached the patch for that to the already-existing bug, filed
    in 2003: http://bugs.python.org/issue829951

    @gpshead gpshead self-assigned this Jan 17, 2008
    @gpshead
    Copy link
    Member

    gpshead commented Jan 17, 2008

    Accepted and applied, with appropriate documentation updates.

    In svn trunk r60020 for 2.6.

    @gpshead gpshead closed this as completed Jan 17, 2008
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants