gnutls-commit
[Top][All Lists]
Advanced

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

[SCM] GNU gnutls branch, master, updated. gnutls_3_0_0-12-gf7545b3


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_0_0-12-gf7545b3
Date: Tue, 02 Aug 2011 18:49:41 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=f7545b3beb54c33f38b457d2e03c970777f235ba

The branch, master has been updated
       via  f7545b3beb54c33f38b457d2e03c970777f235ba (commit)
       via  fd2e6e3f249056c8caa00b109971727cd40e03a7 (commit)
       via  1e99a8efa7cc494e1f7b098183346bbe78716663 (commit)
      from  bb3071944a5cb27b72e19168d7c7630dcc9d3eb9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f7545b3beb54c33f38b457d2e03c970777f235ba
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Aug 1 22:16:09 2011 +0200

    detect premature termination of connection

commit fd2e6e3f249056c8caa00b109971727cd40e03a7
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Aug 1 20:39:18 2011 +0200

    the deprecated_config_file from 2.12.x was incorporated.

commit 1e99a8efa7cc494e1f7b098183346bbe78716663
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Aug 1 20:27:41 2011 +0200

    documentation update

-----------------------------------------------------------------------

Summary of changes:
 NEWS                         |    3 ++
 lib/gnutls_record.c          |    2 +-
 lib/includes/gnutls/pkcs11.h |    2 +-
 lib/pkcs11.c                 |   80 +++++++++++++++++++++++++-----------------
 4 files changed, 53 insertions(+), 34 deletions(-)

diff --git a/NEWS b/NEWS
index eddafc4..639fb20 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,9 @@ See the end for copying conditions.
 
 * Version 3.0.1 (unreleased)
 
+** libgnutls: The config file at gnutls_pkcs11_init()
+is being read if provided.
+
 ** libgnutls: Verify that a certificate liste specified
 using gnutls_certificate_set_x509_key*(), is sorted
 according to TLS specification (from subject to issuer).
diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c
index 771d6e4..7b6d05d 100644
--- a/lib/gnutls_record.c
+++ b/lib/gnutls_record.c
@@ -1108,7 +1108,7 @@ cleanup:
   return ret;
 
 recv_error:
-  if (gnutls_error_is_fatal (ret) == 0)
+  if (ret < 0 && gnutls_error_is_fatal (ret) == 0)
     return ret;
 
   if (IS_DTLS(session))
diff --git a/lib/includes/gnutls/pkcs11.h b/lib/includes/gnutls/pkcs11.h
index 4206749..b08d9bf 100644
--- a/lib/includes/gnutls/pkcs11.h
+++ b/lib/includes/gnutls/pkcs11.h
@@ -57,7 +57,7 @@ typedef struct gnutls_pkcs11_obj_st *gnutls_pkcs11_obj_t;
  * load = /lib/yyy-pkcs11.so
  */
 
-int gnutls_pkcs11_init (unsigned int flags, void *unused);
+int gnutls_pkcs11_init (unsigned int flags, const char 
*deprecated_config_file);
 void gnutls_pkcs11_deinit (void);
 void gnutls_pkcs11_set_token_function (gnutls_pkcs11_token_callback_t fn,
                                        void *userdata);
diff --git a/lib/pkcs11.c b/lib/pkcs11.c
index 017eb73..6e3df7d 100644
--- a/lib/pkcs11.c
+++ b/lib/pkcs11.c
@@ -417,13 +417,15 @@ static int init = 0;
 
 /* tries to load modules from /etc/gnutls/pkcs11.conf if it exists
  */
-static void _pkcs11_compat_init(void)
+static void _pkcs11_compat_init(const char* configfile)
 {
 FILE *fp;
 int ret;
 char line[512];
 const char *library;
-const char* configfile = "/etc/gnutls/pkcs11.conf";
+
+  if (configfile == NULL)
+    configfile = "/etc/gnutls/pkcs11.conf";
 
   fp = fopen (configfile, "r");
   if (fp == NULL)
@@ -461,10 +463,46 @@ const char* configfile = "/etc/gnutls/pkcs11.conf";
   return;
 }
 
+static int
+initialize_automatic_p11_kit (void)
+{
+  struct ck_function_list **modules;
+  const char *name;
+  ck_rv_t rv;
+  int i, ret;
+
+  rv = p11_kit_initialize_registered ();
+  if (rv != CKR_OK)
+    {
+      gnutls_assert ();
+      _gnutls_debug_log ("Cannot initialize registered module: %s\n",
+                         p11_kit_strerror (rv));
+      return GNUTLS_E_INTERNAL_ERROR;
+    }
+
+  initialized_registered = 1;
+
+  modules = p11_kit_registered_modules ();
+  for (i = 0; modules[i] != NULL; i++)
+    {
+      name = p11_kit_registered_module_to_name (modules[i]);
+      ret = pkcs11_add_module (name, modules[i]);
+      if (ret != 0)
+        {
+          gnutls_assert ();
+          _gnutls_debug_log ("Cannot add registered module: %s\n", name);
+        }
+    }
+
+  free (modules);
+  return 0;
+}
+
 /**
  * gnutls_pkcs11_init:
  * @flags: %GNUTLS_PKCS11_FLAG_MANUAL or %GNUTLS_PKCS11_FLAG_AUTO
- * @unused: unused, set to NULL
+ * @deprecated_config_file: either NULL or the location of a deprecated
+ *     configuration file
  *
  * This function will initialize the PKCS 11 subsystem in gnutls. It will
  * read configuration files if %GNUTLS_PKCS11_FLAG_AUTO is used or allow
@@ -479,12 +517,9 @@ const char* configfile = "/etc/gnutls/pkcs11.conf";
  *   negative error value.
  **/
 int
-gnutls_pkcs11_init (unsigned int flags, void *unused)
+gnutls_pkcs11_init (unsigned int flags, const char *deprecated_config_file)
 {
-  struct ck_function_list **modules;
-  const char *name;
-  ck_rv_t rv;
-  int i, ret;
+  int ret = 0;
 
   if (init != 0)
     {
@@ -497,33 +532,14 @@ gnutls_pkcs11_init (unsigned int flags, void *unused)
     return 0;
   else if (flags == GNUTLS_PKCS11_FLAG_AUTO)
     {
-      rv = p11_kit_initialize_registered ();
-      if (rv != CKR_OK)
-        {
-          gnutls_assert ();
-          _gnutls_debug_log ("Cannot initialize registered module: %s\n",
-                             p11_kit_strerror (rv));
-          return GNUTLS_E_INTERNAL_ERROR;
-        }
+      if (deprecated_config_file == NULL)
+        ret = initialize_automatic_p11_kit ();
 
-      initialized_registered = 1;
+      _pkcs11_compat_init(deprecated_config_file);
 
-      modules = p11_kit_registered_modules ();
-      for (i = 0; modules[i] != NULL; i++)
-        {
-          name = p11_kit_registered_module_to_name (modules[i]);
-          ret = pkcs11_add_module (name, modules[i]);
-          if (ret != 0)
-            {
-              gnutls_assert ();
-              _gnutls_debug_log ("Cannot add registered module: %s\n", name);
-            }
-        }
-      free (modules);
-
-      _pkcs11_compat_init();
+      return ret;
     }
-
+  
   return 0;
 }
 


hooks/post-receive
-- 
GNU gnutls



reply via email to

[Prev in Thread] Current Thread [Next in Thread]