]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
libgnutls: Allow CA importing of 0 certificates to succeed.
authorSimon Josefsson <simon@josefsson.org>
Tue, 6 Sep 2011 10:09:03 +0000 (12:09 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 6 Sep 2011 13:47:57 +0000 (15:47 +0200)
Reported by Jonathan Nieder <jrnieder@gmail.com> in
<http://bugs.debian.org/640639>.

NEWS
lib/x509/x509.c
tests/parse_ca.c

diff --git a/NEWS b/NEWS
index 15917849f49974e982968aa3527273f684942492..0fd87e30d61ad5fc271c28c2e6a663ba4e369ab1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,16 @@ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005,
               2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 See the end for copying conditions.
 
+Version 2.12.11 (unreleased)
+
+** libgnutls: Allow CA importing of 0 certificates to succeed.
+Reported by Jonathan Nieder <jrnieder@gmail.com> in
+<http://bugs.debian.org/640639>.
+
+** API and ABI modifications:
+No changes since last version.
+
+
 * Version 2.12.10 (released 2011-09-01)
 
 ** libgnutls: OpenPGP certificate type is not enabled
index 3e2948de2912561369b828ce16b5f59f72eca9c9..31514b52b3e6e2df411e958f9b72d45ba803b18a 100644 (file)
@@ -3183,7 +3183,9 @@ gnutls_x509_crt_list_import (gnutls_x509_crt_t * certs,
   if (ptr == NULL)
     {
       gnutls_assert ();
-      return GNUTLS_E_BASE64_DECODING_ERROR;
+      *cert_max = 0;
+      /* no certificate found, likely empty file or garbage input */
+      return 0;
     }
 
   count = 0;
index 9f81887e27c87931965f76a8cb1c9602402b1d42..42d9eb38ee30b38f44bdc353718629889b181856 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007, 2010 Free Software Foundation, Inc.
+ * Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
  *
  * Author: Simon Josefsson
  *
@@ -72,6 +72,13 @@ doit (void)
   if (rc != 2)
     fail ("import ca failed: %d\n", rc);
 
+  ca.data = (unsigned char*) "";
+  ca.size = 0;
+
+  rc = gnutls_certificate_set_x509_trust_mem (cred, &ca, GNUTLS_X509_FMT_PEM);
+  if (rc != 0)
+    fail ("import ca failed: %d\n", rc);
+
   gnutls_certificate_free_credentials (cred);
 
   gnutls_global_deinit ();