Add new config option for GNUTLS log function 39/122539/2 accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable accepted/tizen/common/20170404.142734 accepted/tizen/ivi/20170404.060819 accepted/tizen/mobile/20170404.060643 accepted/tizen/tv/20170404.060738 accepted/tizen/unified/20170404.060845 accepted/tizen/wearable/20170404.060801 submit/tizen/20170404.011910
authorSeonah Moon <seonah1.moon@samsung.com>
Mon, 3 Apr 2017 02:35:03 +0000 (11:35 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Mon, 3 Apr 2017 05:27:47 +0000 (14:27 +0900)
Change-Id: I2c245836981f1655f1f376656a74754999aed9cb

configure.ac
packaging/glib-networking.spec
tls/gnutls/TIZEN.h
tls/gnutls/gtlsbackend-gnutls.c
tls/gnutls/gtlscertificate-gnutls.c
tls/gnutls/gtlsconnection-gnutls.c
tls/gnutls/gtlsdatabase-gnutls.c

index f67f97a..72f4f81 100755 (executable)
@@ -183,11 +183,29 @@ AC_ARG_ENABLE(tizen-dlog,
 
 AC_MSG_CHECKING([for Tizen dlog])
 if test $enable_tizen_dlog != no;then
-        AC_DEFINE(ENABLE_TIZEN_TV_DLOG, 1, [Add new feature, support to add tizen dlog in glib-networking])
+        AC_DEFINE(ENABLE_TIZEN_DLOG, 1, [Add new feature, support to add tizen dlog in glib-networking])
 fi
 AC_MSG_RESULT($enable_tizen_dlog)
 
-AM_CONDITIONAL(TIZEN_TV_DLOG, [test $enable_tizen_dlog = yes])
+AM_CONDITIONAL(TIZEN_DLOG, [test $enable_tizen_dlog = yes])
+
+dnl ****************************
+dnl *** GNUTLS debug support ***
+dnl ****************************
+
+AC_ARG_ENABLE(tizen-gnutls-debug,
+               AS_HELP_STRING([--enable-tizen-gnutls-debug], [Enable Tizen GNUTLS debug support ]),        ,
+               enable_tizen_gnutls_debug=no)
+
+AC_MSG_CHECKING([for Tizen GNUTLS debug])
+if test $enable_tizen_gnutls_debug != no;then
+               AC_DEFINE(ENABLE_TIZEN_GNUTLS_DEBUG, 1,
+                               [Add new feature, support to enable GNUTLS debug function in glib-networking])
+fi
+AC_MSG_RESULT($enable_tizen_gnutls_debug)
+
+AM_CONDITIONAL(TIZEN_GNUTLS_DEBUG, [test $enable_tizen_gnutls_debug = yes])
+
 
 dnl *****************************************************
 dnl *** Tizen update gnutls default priority support  ***
index d071c5f..25c0441 100755 (executable)
@@ -41,16 +41,19 @@ export CFLAGS='-Wformat-nonliteral'
 %if %{with libproxy}
     --with-libproxy  \
 %endif
+    --enable-tizen-dlog \
+%if 0
+    --enable-tizen-gnutls-debug \
+%endif
 %if "%{TIZEN_PROFILE_TV}" == "1"
     --enable-tizen-multiple-certificate=yes \
     --enable-tizen-tv-update-default-priority \
-    --enable-tizen-dlog \
     --enable-tizen-performance-test-log \
 %endif
 %if "%{TIZEN_PROFILE_TV}" == "1"
-    --with-ca-certificates=%{TZ_SYS_RO_CA_CERTS}
+    --with-ca-certificates=%{TZ_SYS_RO_CA_CERTS} \
 %else
-    --with-ca-certificates=%{TZ_SYS_RO_CA_BUNDLE}
+    --with-ca-certificates=%{TZ_SYS_RO_CA_BUNDLE} \
 %endif
 
 %__make %{?_smp_mflags} V=1
index a158b6d..fdbe652 100755 (executable)
@@ -8,7 +8,7 @@
 #define ENABLE_TIZEN_NPN 1
 #define ENABLE_TIZEN_EXT 1
 
-#if ENABLE(TIZEN_TV_DLOG)
+#if ENABLE(TIZEN_DLOG)
 
 #ifndef LOG_TAG
 #define LOG_TAG "glib-networking" /* This LOG_TAG should be defined before including dlog.h. Because dlog.h is using it. */
@@ -24,4 +24,8 @@
 
 #endif
 
+#if ENABLE(TIZEN_GNUTLS_DEBUG)
+#define GTLS_GNUTLS_DEBUG 1
+#endif
+
 #endif
index 55ec1a5..c193c22 100644 (file)
@@ -31,6 +31,8 @@
 #include "gtlsfiledatabase-gnutls.h"
 #include "gtlsserverconnection-gnutls.h"
 
+#include "TIZEN.h"
+
 struct _GTlsBackendGnutlsPrivate
 {
   GMutex mutex;
@@ -47,7 +49,11 @@ 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 e47dcdd..29ae9fb 100755 (executable)
@@ -324,7 +324,7 @@ g_tls_certificate_gnutls_verify (GTlsCertificate     *cert,
   gnutls_x509_crt_t *chain;
   GTlsCertificateFlags gtls_flags;
   time_t t, now;
-#if ENABLE(TIZEN_TV_DLOG)
+#if ENABLE(TIZEN_TV_ADJUST_TIME) && ENABLE(TIZEN_DLOG)
   char timebuf[256];
 #endif
 
@@ -371,15 +371,15 @@ g_tls_certificate_gnutls_verify (GTlsCertificate     *cert,
     {
       t = gnutls_x509_crt_get_activation_time (chain[i]);
 
-#if ENABLE(TIZEN_TV_DLOG)
-      ctime_r(&now, timebuf);
-      TIZEN_LOGI("[Certificate] TV borad time is: %s", timebuf);
-      if (t != (time_t) -1) {
-       ctime_r(&t, timebuf);
-        TIZEN_LOGI("[Certificate] CA activation time is: %s", timebuf);
-      }
-      else
-        TIZEN_LOGI("[Certificate] gnutls_x509_crt_get_activation_time ERROR");
+#if ENABLE(TIZEN_TV_ADJUST_TIME) && ENABLE(TIZEN_DLOG)
+         ctime_r(&now, timebuf);
+         TIZEN_LOGI("[Certificate] TV borad time is: %s", timebuf);
+         if (t != (time_t) -1) {
+                 ctime_r(&t, timebuf);
+                 TIZEN_LOGI("[Certificate] CA activation time is: %s", timebuf);
+         }
+         else
+                 TIZEN_LOGI("[Certificate] gnutls_x509_crt_get_activation_time ERROR");
 #endif
 
       if (t == (time_t) -1 || t > now)
@@ -387,7 +387,7 @@ g_tls_certificate_gnutls_verify (GTlsCertificate     *cert,
 
       t = gnutls_x509_crt_get_expiration_time (chain[i]);
 
-#if ENABLE(TIZEN_TV_DLOG)
+#if ENABLE(TIZEN_TV_ADJUST_TIME) && ENABLE(TIZEN_DLOG)
       if (t != (time_t) -1) {
        ctime_r(&t, timebuf);
         TIZEN_LOGI("[Certificate] CA expiration time is: %s", timebuf);
@@ -605,7 +605,7 @@ g_tls_certificate_gnutls_verify_identity (GTlsCertificateGnutls *gnutls,
   /* FIXME: check sRVName and uniformResourceIdentifier
    * subjectAltNames, if appropriate for @identity.
    */
-#if ENABLE(TIZEN_TV_DLOG)
+#if ENABLE(TIZEN_DLOG)
   TIZEN_LOGI("[Network] SSL HandShake - Bad Identity");
 #endif
 
index e98bc7e..d4b1ea9 100755 (executable)
@@ -1117,7 +1117,7 @@ verify_peer_certificate (GTlsConnectionGnutls *gnutls,
   if (database == NULL)
     {
 
-#if ENABLE(TIZEN_TV_DLOG)
+#if ENABLE(TIZEN_DLOG)
       TIZEN_LOGI("[Network] SSL HandShake - Unknown CA");
 #endif
 
index 018639f..448ddb8 100755 (executable)
@@ -175,7 +175,7 @@ double_check_before_after_dates (GTlsCertificateGnutls *chain)
   GTlsCertificateFlags gtls_flags = 0;
   gnutls_x509_crt_t cert;
   time_t t, now;
-#if ENABLE(TIZEN_TV_DLOG)
+#if ENABLE(TIZEN_TV_ADJUST_TIME) && ENABLE(TIZEN_DLOG)
   char timebuf[256];
 #endif
 
@@ -190,7 +190,7 @@ double_check_before_after_dates (GTlsCertificateGnutls *chain)
       cert = g_tls_certificate_gnutls_get_cert (chain);
       t = gnutls_x509_crt_get_activation_time (cert);
 
-#if ENABLE(TIZEN_TV_DLOG)
+#if ENABLE(TIZEN_TV_ADJUST_TIME) && ENABLE(TIZEN_DLOG)
       ctime_r(&now, timebuf);
       TIZEN_LOGI("[Certificate] TV borad time is: %s", timebuf);
       if (t != (time_t) -1) {
@@ -206,7 +206,7 @@ double_check_before_after_dates (GTlsCertificateGnutls *chain)
 
       t = gnutls_x509_crt_get_expiration_time (cert);
 
-#if ENABLE(TIZEN_TV_DLOG)
+#if ENABLE(TIZEN_TV_ADJUST_TIME) && ENABLE(TIZEN_DLOG)
       if (t != (time_t) -1) {
        ctime_r(&t, timebuf);
         TIZEN_LOGI("[Certificate] CA expiration time is: %s", timebuf);