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

ssl.SSLcontext.load_dh_params() does not handle unicode filenames properly #69590

Closed
schlenk mannequin opened this issue Oct 14, 2015 · 5 comments
Closed

ssl.SSLcontext.load_dh_params() does not handle unicode filenames properly #69590

schlenk mannequin opened this issue Oct 14, 2015 · 5 comments
Assignees
Labels
easy extension-modules C modules in the Modules dir OS-windows topic-SSL topic-unicode type-bug An unexpected behavior, bug, or error

Comments

@schlenk
Copy link
Mannequin

schlenk mannequin commented Oct 14, 2015

BPO 25404
Nosy @pfmoore, @vstinner, @tiran, @tjguk, @ezio-melotti, @zware, @zooba
PRs
  • bpo-25404: SSLContext.load_dh_params() non-ASCII path #3459
  • 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/tiran'
    closed_at = <Date 2018-02-25.08:48:17.258>
    created_at = <Date 2015-10-14.12:36:27.316>
    labels = ['easy', 'expert-SSL', 'type-bug', 'OS-windows', 'extension-modules', 'expert-unicode']
    title = 'ssl.SSLcontext.load_dh_params() does not handle unicode filenames properly'
    updated_at = <Date 2018-02-25.08:48:17.257>
    user = 'https://bugs.python.org/schlenk'

    bugs.python.org fields:

    activity = <Date 2018-02-25.08:48:17.257>
    actor = 'christian.heimes'
    assignee = 'christian.heimes'
    closed = True
    closed_date = <Date 2018-02-25.08:48:17.258>
    closer = 'christian.heimes'
    components = ['Extension Modules', 'Unicode', 'Windows', 'SSL']
    creation = <Date 2015-10-14.12:36:27.316>
    creator = 'schlenk'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 25404
    keywords = ['easy (C)']
    message_count = 5.0
    messages = ['252987', '252988', '252992', '301488', '312784']
    nosy_count = 8.0
    nosy_names = ['paul.moore', 'vstinner', 'christian.heimes', 'tim.golden', 'ezio.melotti', 'zach.ware', 'steve.dower', 'schlenk']
    pr_nums = ['3459']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue25404'
    versions = ['Python 2.7']

    @schlenk
    Copy link
    Mannequin Author

    schlenk mannequin commented Oct 14, 2015

    The load_dh_params() method of SSLContext does not properly handle unicode filenames on Windows (like load_verify_location() does).

    It should convert any passed unicode path to the filesystem encoding.

    This is already fixed in the 3.x head revision, by loading the file via python instead of the OpenSSL BIO functions, but is broken in 2.7.10.

    Currently it silently works for most files due to an implicit conversion to string, but with the wrong default encoding instead of filesystem encoding.

    @schlenk schlenk mannequin added extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Oct 14, 2015
    @vstinner
    Copy link
    Member

    Right. The workaround is to encode manually the filename:

    filename = filename.encode(sys.getfilesystemencoding())

    @schlenk
    Copy link
    Mannequin Author

    schlenk mannequin commented Oct 14, 2015

    Yes, the workaround works.

    Would be nice if this could be fixed in a 2.7.11...

    @tiran tiran self-assigned this Sep 15, 2016
    @tiran
    Copy link
    Member

    tiran commented Sep 6, 2017

    Patch welcome :)

    @tiran tiran added the easy label Sep 6, 2017
    @tiran tiran assigned tiran and unassigned tiran Sep 6, 2017
    @tiran
    Copy link
    Member

    tiran commented Feb 25, 2018

    New changeset 6e8f395 by Christian Heimes in branch '2.7':
    bpo-25404: SSLContext.load_dh_params() non-ASCII path (GH-3459)
    6e8f395

    @tiran tiran closed this as completed Feb 25, 2018
    @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 extension-modules C modules in the Modules dir OS-windows topic-SSL topic-unicode type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants