Skip to content

Conversation

reaperhulk
Copy link
Member

fixes #2054

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason not to just write this as idna.decode(parts[2:])

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason other than that it totally didn't occur to me. I assume you mean parts[1:] and drop the pop right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, drop the split as well.

On Fri, Jun 26, 2015 at 11:25 PM, Paul Kehrer notifications@github.com
wrote:

In src/cryptography/hazmat/backends/openssl/x509.py
#2071 (comment):

@@ -82,7 +82,20 @@ def _decode_general_names(backend, gns):
def _decode_general_name(backend, gn):
if gn.type == backend._lib.GEN_DNS:
data = backend._ffi.buffer(gn.d.dNSName.data, gn.d.dNSName.length)[:]

  •    return x509.DNSName(idna.decode(data))
    
  •    if data.startswith(b"*."):
    
  •        # This is a wildcard name. We need to split on period, remove the
    
  •        # leading wildcard, IDNA decode, then re-add the wildcard
    
  •        # Wildcard characters should always be left-most (RFC 2595
    
  •        # section 2.4).
    
  •        parts = data.split(b".")
    
  •        parts.pop(0)
    
  •        data = u"*." + idna.decode(b".".join(parts))
    

No reason other than that it totally didn't occur to me. I assume you mean
parts[1:] and drop the pop right?


Reply to this email directly or view it on GitHub
https://github.com/pyca/cryptography/pull/2071/files#r33409091.

"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have been idna.decode(data[2:])

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a better way to do it.

alex added a commit that referenced this pull request Jun 27, 2015
handle wildcard DNSNames with IDNA.
@alex alex merged commit 7d85341 into pyca:master Jun 27, 2015
@reaperhulk reaperhulk deleted the wildcard-oh-no branch July 2, 2015 01:49
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

* not allowed in general names
2 participants