git.iko.soy/typeable/nixpkgs
on master help sign in
cacert: really fix utf-8 certname blacklists

See #27576.

commit2d5c1226c65192a2f8c503e23f6d9738f47be206 authorFranz Pletz <fpletz@fnordicwalking.de> dateWed 9 Aug 2017, 19:51 (9 years ago) parent1ed7862
2 files changed+24−3
pkgs/data/misc/cacert/default.nix+4−3 pkgs/data/misc/cacert/fix-unicode-ca-names.patch+20
pkgs/data/misc/cacert/default.nix+4−3
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, writeText, nss, python3
1+{ stdenv, fetchurl, writeText, nss, python
22, blacklist ? []
33, includeEmail ? false
44}:
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
2020
2121 src = nss.src;
2222
23− nativeBuildInputs = [ python3 ];
23+ nativeBuildInputs = [ python ];
2424
2525 configurePhase = ''
2626 ln -s nss/lib/ckfw/builtins/certdata.txt
@@ -29,7 +29,8 @@ stdenv.mkDerivation rec {
2929 ${concatStringsSep "\n" (map (c: ''"${c}"'') blacklist)}
3030 EOF
3131
32− cp ${certdata2pem} certdata2pem.py
32+ cat ${certdata2pem} > certdata2pem.py
33+ patch -p1 < ${./fix-unicode-ca-names.patch}
3334 ${optionalString includeEmail ''
3435 # Disable CAs used for mail signing
3536 substituteInPlace certdata2pem.py --replace \[\'CKA_TRUST_EMAIL_PROTECTION\'\] '''
pkgs/data/misc/cacert/fix-unicode-ca-names.patchnew file+20
@@ -0,0 +1,20 @@
1+--- a/certdata2pem.py 2017-08-01 23:10:00.000000000 +0300
2++++ b/certdata2pem.py 2017-08-01 23:08:21.131297636 +0300
3+@@ -88,7 +88,7 @@
4+ \# Read blacklist.
5+ blacklist = []
6+ if os.path.exists('blacklist.txt'):
7+- for line in open('blacklist.txt', 'r'):
8++ for line in io.open('blacklist.txt', 'r', encoding='utf-8'):
9+ line = line.strip()
10+ if line.startswith('#') or len(line) == 0:
11+ continue
12+@@ -101,7 +101,7 @@
13+ if obj['CKA_CLASS'] != 'CKO_NSS_TRUST':
14+ continue
15+ if obj['CKA_LABEL'] in blacklist:
16+- print("Certificate %s blacklisted, ignoring." % obj['CKA_LABEL'])
17++ print("Certificate %s blacklisted, ignoring." % unicode(obj['CKA_LABEL']).encode('utf-8'))
18+ elif obj['CKA_TRUST_SERVER_AUTH'] == 'CKT_NSS_TRUSTED_DELEGATOR':
19+ trust[obj['CKA_LABEL']] = True
20+ elif obj['CKA_TRUST_EMAIL_PROTECTION'] == 'CKT_NSS_TRUSTED_DELEGATOR':