[glib-networking] Improve the script that finds the certificate store



commit c9b7402a017fa86d9fd6953f652ac1d6343c52e1
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sat Oct 21 10:16:18 2017 -0500

    Improve the script that finds the certificate store

 check_certs.py       |   12 ------------
 find-ca-certificates |   20 ++++++++++++++++++++
 meson.build          |   11 ++---------
 3 files changed, 22 insertions(+), 21 deletions(-)
---
diff --git a/find-ca-certificates b/find-ca-certificates
new file mode 100755
index 0000000..4c5fd8f
--- /dev/null
+++ b/find-ca-certificates
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+
+import errno
+import os
+import sys
+
+locations = [ '/etc/pki/tls/certs/ca-bundle.crt',
+    '/etc/ssl/certs/ca-certificates.crt',
+    '/etc/ssl/ca-bundle.pem'
+]
+
+if len(sys.argv) > 1:
+    locations.insert(0, sys.argv[1])
+
+for location in locations:
+  if os.path.isfile(location):
+    sys.stdout.write(location)
+    sys.exit(0)
+
+sys.exit(errno.ENOENT)
diff --git a/meson.build b/meson.build
index 1c1a155..28b496c 100644
--- a/meson.build
+++ b/meson.build
@@ -76,15 +76,8 @@ if enable_tls_support
   pkcs_support = []
 
   msg = 'location of system Certificate Authority list: '
-  cert_locations = [
-    get_option('ca_certificates_path'),
-    '/etc/pki/tls/certs/ca-bundle.crt',
-    '/etc/ssl/certs/ca-certificates.crt',
-    '/etc/ssl/ca-bundle.pem'
-  ]
-
-  res = run_command(find_program('check_certs.py'), cert_locations)
-  assert(res.returncode() == 0, msg + ' could not find any TLS certificate. Use -Dca_certificates_path=PATH 
to set, or -Dtls_support=no to disable')
+  res = run_command(find_program('find-ca-certificates'), get_option('ca_certificates_path'))
+  assert(res.returncode() == 0, msg + ' could not find any CA certificate store. Use 
-Dca_certificates_path=PATH to set, or -Dtls_support=no to disable')
   ca_certificates_path = res.stdout().strip()
   message(msg + ca_certificates_path)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]