Show More
@@ -498,7 +498,11 b' def _verifycert(cert, hostname):' | |||||
498 | for s in cert.get('subject', []): |
|
498 | for s in cert.get('subject', []): | |
499 | key, value = s[0] |
|
499 | key, value = s[0] | |
500 | if key == 'commonName': |
|
500 | if key == 'commonName': | |
501 | certname = value.lower() |
|
501 | try: | |
|
502 | # 'subject' entries are unicode | |||
|
503 | certname = value.lower().encode('ascii') | |||
|
504 | except UnicodeEncodeError: | |||
|
505 | return _('IDN in certificate not supported') | |||
502 | if (certname == dnsname or |
|
506 | if (certname == dnsname or | |
503 | '.' in dnsname and certname == '*.' + dnsname.split('.', 1)[1]): |
|
507 | '.' in dnsname and certname == '*.' + dnsname.split('.', 1)[1]): | |
504 | return None |
|
508 | return None |
@@ -36,3 +36,7 b" check(_verifycert({'subject': ()}," | |||||
36 | 'no commonName found in certificate') |
|
36 | 'no commonName found in certificate') | |
37 | check(_verifycert(None, 'example.com'), |
|
37 | check(_verifycert(None, 'example.com'), | |
38 | 'no certificate received') |
|
38 | 'no certificate received') | |
|
39 | ||||
|
40 | # Unicode (IDN) certname isn't supported | |||
|
41 | check(_verifycert(cert(u'\u4f8b.jp'), 'example.jp'), | |||
|
42 | 'IDN in certificate not supported') |
General Comments 0
You need to be logged in to leave comments.
Login now