From 033b7e763dcfde3fc1022178b657eba66d635702 Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Mon, 8 Apr 2019 17:48:58 +0900 Subject: [PATCH] Add new build option to use tizen default CA file Change-Id: Ibaae24649b67bf19f3481b2339f8224d377e729e --- meson.build | 6 ++++++ meson_options.txt | 1 + packaging/glib-networking.spec | 2 +- tls/openssl/gtlsbackend-openssl.c | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 4feb280..705b30d 100644 --- a/meson.build +++ b/meson.build @@ -22,6 +22,11 @@ config_h = configuration_data() config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name()) +# Update default CA file +if get_option('default_ca_file') != '' + config_h.set_quoted('TIZEN_DEFAULT_CA_FILE', get_option('default_ca_file')) +endif + # compiler flags common_flags = [ '-DHAVE_CONFIG_H', @@ -194,4 +199,5 @@ output += ' gnutls support: ' + backends.contains('gnutls').to_string() + output += ' openssl support: ' + backends.contains('openssl').to_string() + '\n' output += ' libproxy support: ' + libproxy_dep.found().to_string() + '\n' output += ' GNOME proxy support: ' + gsettings_desktop_schemas_dep.found().to_string() + '\n' +output += ' TIZEN default CA file: ' + get_option('default_ca_file') + '\n' message(output) diff --git a/meson_options.txt b/meson_options.txt index 3a525dd..dab9617 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -4,3 +4,4 @@ option('libproxy', type: 'feature', value: 'auto', description: 'support for lib option('gnome_proxy', type: 'feature', value: 'auto', description: 'support for GNOME desktop proxy configuration') option('installed_tests', type: 'boolean', value: false, description: 'enable installed tests') option('static_modules', type: 'boolean', value: false, description: 'build static modules') +option('default_ca_file', type: 'string', value: '', description: 'set default CA file') diff --git a/packaging/glib-networking.spec b/packaging/glib-networking.spec index b4239fe..606d5c3 100755 --- a/packaging/glib-networking.spec +++ b/packaging/glib-networking.spec @@ -36,7 +36,7 @@ Currently, there is only a proxy module based on libproxy. cp %{SOURCE1001} . %build -meson --prefix /usr/ build -Dstatic_modules=false -Dgnutls=disabled -Dopenssl=enabled +meson --prefix /usr/ build -Dstatic_modules=false -Dgnutls=disabled -Dopenssl=enabled -Ddefault_ca_file=%{TZ_SYS_RO_CA_BUNDLE} ninja -C build all %install diff --git a/tls/openssl/gtlsbackend-openssl.c b/tls/openssl/gtlsbackend-openssl.c index abff7bb..b97c653 100644 --- a/tls/openssl/gtlsbackend-openssl.c +++ b/tls/openssl/gtlsbackend-openssl.c @@ -211,7 +211,11 @@ g_tls_backend_openssl_real_create_database (GTlsBackendOpenssl *self, { const gchar *openssl_cert_file; +#ifdef TIZEN_DEFAULT_CA_FILE + openssl_cert_file = TIZEN_DEFAULT_CA_FILE; +#else openssl_cert_file = g_getenv (X509_get_default_cert_file_env ()); +#endif if (openssl_cert_file == NULL) openssl_cert_file = X509_get_default_cert_file (); -- 2.7.4