Add tizen dlog for debugging 53/215753/4 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix accepted/tizen_6.0_unified_hotfix tizen_5.5 tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix tizen_6.0_hotfix accepted/tizen/5.5/unified/20191031.010047 accepted/tizen/5.5/unified/mobile/hotfix/20201027.062120 accepted/tizen/5.5/unified/wearable/hotfix/20201027.103330 accepted/tizen/6.0/unified/20201030.104521 accepted/tizen/6.0/unified/hotfix/20201102.235636 accepted/tizen/unified/20191017.105754 submit/tizen/20191016.084905 submit/tizen_5.5/20191031.000006 submit/tizen_5.5_mobile_hotfix/20201026.185106 submit/tizen_5.5_wearable_hotfix/20201026.184306 submit/tizen_6.0/20201029.205501 submit/tizen_6.0_hotfix/20201102.192901 submit/tizen_6.0_hotfix/20201103.115101 tizen_5.5.m2_release tizen_6.0.m2_release
authorSeonah Moon <seonah1.moon@samsung.com>
Tue, 15 Oct 2019 08:23:12 +0000 (17:23 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Wed, 16 Oct 2019 02:19:16 +0000 (11:19 +0900)
Change-Id: I08b9067f7f9189f8a912467b7064d01f303dd0fa

meson.build
meson_options.txt
packaging/glib-networking.spec
tls/gnutls/gtlsbackend-gnutls.c
tls/gnutls/gtlscertificate-gnutls.c
tls/gnutls/gtlsconnection-gnutls.c
tls/openssl/gtlscertificate-openssl.c
tls/openssl/gtlsclientconnection-openssl.c
tls/openssl/gtlsconnection-openssl.c
tls/openssl/meson.build
tls/openssl/openssl-include.h

index d3d5642..c5cab77 100644 (file)
@@ -41,6 +41,12 @@ common_flags = [
   '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_46'
 ]
 
+# TIZEN dlog
+if get_option('tizen_debug')
+  debug_dep = dependency('dlog')
+  config_h.set('TIZEN_DEBUG', get_option('tizen_debug'))
+endif
+
 add_project_arguments(common_flags, language: 'c')
 
 symbol_map = join_paths(meson.current_source_dir(), meson.project_name() + '.map')
@@ -206,4 +212,5 @@ 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'
 output += '  TIZEN extension:     ' + get_option('tizen_ext').to_string() + '\n'
+output += '  TIZEN debug:         ' + get_option('tizen_debug').to_string() + '\n'
 message(output)
index cab6d48..7064861 100644 (file)
@@ -6,3 +6,4 @@ option('installed_tests', type: 'boolean', value: false, description: 'enable in
 option('static_modules', type: 'boolean', value: false, description: 'build static modules')
 option('default_ca_file', type: 'string', value: '', description: 'set default CA file')
 option('tizen_ext', type: 'boolean', value: false, description: 'enable TIZEN extension')
+option('tizen_debug', type: 'boolean', value: false, description: 'enable TIZEN debug')
index 1c9ee9a..8ed408c 100755 (executable)
@@ -36,7 +36,13 @@ Currently, there is only a proxy module based on libproxy.
 cp %{SOURCE1001} .
 
 %build
-meson --prefix /usr/ --libdir %{_libdir} build -Dstatic_modules=false -Dgnutls=disabled -Dopenssl=enabled -Ddefault_ca_file=%{TZ_SYS_RO_CA_BUNDLE} -Dtizen_ext=true
+meson --prefix /usr/ --libdir %{_libdir} build \
+                 -Dstatic_modules=false \
+                 -Dgnutls=disabled \
+                 -Dopenssl=enabled \
+                 -Ddefault_ca_file=%{TZ_SYS_RO_CA_BUNDLE} \
+                 -Dtizen_ext=true \
+                 -Dtizen_debug=true
 ninja -C build all
 
 %install
index c22530e..d977e1b 100644 (file)
@@ -56,11 +56,7 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (GTlsBackendGnutls, g_tls_backend_gnutls, G_TYPE_
 static void
 gtls_log_func (int level, const char *msg)
 {
-#if ENABLE(TIZEN_DLOG)
-       TIZEN_LOGI("GTLS: %s", msg);
-#else
   g_print ("GTLS: %s", msg);
-#endif
 }
 #endif
 
index 62a774b..cc30936 100755 (executable)
@@ -644,10 +644,6 @@ g_tls_certificate_gnutls_verify_identity (GTlsCertificateGnutls *gnutls,
   /* FIXME: check sRVName and uniformResourceIdentifier
    * subjectAltNames, if appropriate for @identity.
    */
-#if ENABLE(TIZEN_DLOG)
-  TIZEN_LOGI("[Network] SSL HandShake - Bad Identity");
-#endif
-
   return G_TLS_CERTIFICATE_BAD_IDENTITY;
 }
 
index 729c66c..1163fb5 100755 (executable)
@@ -1822,11 +1822,6 @@ verify_peer_certificate (GTlsConnectionGnutls *gnutls,
   database = g_tls_connection_get_database (conn);
   if (database == NULL)
     {
-
-#if ENABLE(TIZEN_DLOG)
-      TIZEN_LOGI("[Network] SSL HandShake - Unknown CA");
-#endif
-
       errors |= G_TLS_CERTIFICATE_UNKNOWN_CA;
       errors |= g_tls_certificate_verify (peer_certificate, peer_identity, NULL);
     }
index 3472cd9..4bd9f80 100644 (file)
@@ -557,7 +557,7 @@ g_tls_certificate_openssl_verify_identity (GTlsCertificateOpenssl *openssl,
   /* FIXME: check sRVName and uniformResourceIdentifier
    * subjectAltNames, if appropriate for @identity.
    */
-
+  TIZEN_LOGE("SSL HandShake - Bad Identity");
   return G_TLS_CERTIFICATE_BAD_IDENTITY;
 }
 
index 70e26a0..3c189c1 100644 (file)
@@ -341,6 +341,9 @@ retrieve_certificate (SSL       *ssl,
 
   priv = g_tls_client_connection_openssl_get_instance_private (client);
 
+  TIZEN_LOGI("ssl[%p] client[%p] tls[%p] openssl[%p] priv[%p] data_index[%d]",
+        ssl, client, tls, openssl, priv, data_index);
+
   tls->certificate_requested = TRUE;
 
   priv->ca_list = SSL_get_client_CA_list (priv->ssl);
@@ -392,6 +395,9 @@ generate_session_id (SSL           *ssl,
   client = SSL_get_ex_data (ssl, data_index);
   priv = g_tls_client_connection_openssl_get_instance_private (client);
 
+  TIZEN_LOGI("ssl[%p] client[%p] priv[%p] data_index[%d]",
+                 ssl, client, priv, data_index);
+
   len = MIN (*id_len, g_bytes_get_size (priv->session_id));
   memcpy (id, g_bytes_get_data (priv->session_id, NULL), len);
 
@@ -540,8 +546,12 @@ g_tls_client_connection_openssl_initable_init (GInitable       *initable,
 
   if (data_index == -1) {
       data_index = SSL_get_ex_new_index (0, (void *)"gtlsclientconnection", NULL, NULL, NULL);
+         TIZEN_LOGI("new data_index[%d]", data_index);
+  } else {
+         TIZEN_LOGI("data_index[%d] is already exist", data_index);
   }
   SSL_set_ex_data (priv->ssl, data_index, client);
+  TIZEN_LOGI("[SSL] set extra data: priv->ssl[%p] data_index[%d] client[%p]", priv->ssl, data_index, client);
 
 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
   if (hostname)
index c6df559..8252516 100644 (file)
@@ -329,6 +329,7 @@ verify_peer_certificate (GTlsConnectionOpenssl *openssl,
   database = g_tls_connection_get_database (conn);
   if (database == NULL)
     {
+      TIZEN_LOGE("SSL HandShake - Unknown CA");
       errors |= G_TLS_CERTIFICATE_UNKNOWN_CA;
       errors |= g_tls_certificate_verify (peer_certificate, peer_identity, NULL);
     }
@@ -374,6 +375,8 @@ g_tls_connection_openssl_handshake (GTlsConnectionBase  *tls,
 
   ssl = g_tls_connection_openssl_get_ssl (openssl);
 
+  TIZEN_LOGI("tls[%p] openssl[%p] priv[%p] ssl[%p]", tls, openssl, priv, ssl);
+
   BEGIN_OPENSSL_IO (openssl, G_IO_IN | G_IO_OUT, TRUE, cancellable);
   ret = SSL_do_handshake (ssl);
   END_OPENSSL_IO (openssl, G_IO_IN | G_IO_OUT, ret, status,
@@ -406,6 +409,8 @@ g_tls_connection_openssl_complete_handshake (GTlsConnectionBase  *tls,
 
   priv = g_tls_connection_openssl_get_instance_private (openssl);
 
+  TIZEN_LOGI("tls[%p] openssl[%p] priv[%p]", tls, openssl, priv);
+
   peer_certificate = priv->peer_certificate_tmp;
   priv->peer_certificate_tmp = NULL;
   peer_certificate_errors = priv->peer_certificate_errors_tmp;
@@ -548,6 +553,8 @@ g_tls_connection_openssl_close (GTlsConnectionBase  *tls,
   ssl = g_tls_connection_openssl_get_ssl (openssl);
   priv = g_tls_connection_openssl_get_instance_private (openssl);
 
+  TIZEN_LOGI("tls[%p] openssl[%p] priv[%p] ssl[%p]", tls, openssl, priv, ssl);
+
   priv->shutting_down = TRUE;
 
   BEGIN_OPENSSL_IO (openssl, G_IO_IN | G_IO_OUT, TRUE, cancellable);
index 529b44b..6255f97 100644 (file)
@@ -22,6 +22,10 @@ deps = [
   openssl_dep,
 ]
 
+if get_option('tizen_debug')
+  deps += [debug_dep]
+endif
+
 module = shared_module(
   'gioopenssl',
   sources: sources,
index 7a6a460..38729f8 100644 (file)
 
 #include "glib.h"
 
+#ifdef TIZEN_DEBUG
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "glib-networking"
+#define TIZEN_LOGD(foramt, args...)    LOGD(format, ##args)
+#define TIZEN_LOGI(format, args...)    LOGI(format, ##args)
+#define TIZEN_LOGE(format, args...)    LOGE(format, ##args)
+#else
+#define TIZEN_LOGD(foramt, args...)
+#define TIZEN_LOGI(format, args...)
+#define TIZEN_LOGE(format, args...)
+#endif
+
 #ifdef G_OS_WIN32
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>