]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Make gnutls_x509_crq_sign2 set certificate request version if not set.
authorSimon Josefsson <simon@josefsson.org>
Tue, 15 Apr 2008 04:29:17 +0000 (06:29 +0200)
committerSimon Josefsson <simon@josefsson.org>
Tue, 15 Apr 2008 04:29:17 +0000 (06:29 +0200)
NEWS
lib/x509/crq.c
src/certtool.c

diff --git a/NEWS b/NEWS
index c007690883f7171e70c8d98b4b6747a88747ce0a..728046a4eff5e5b05dd184c7a5cba782d5616390 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ See the end for copying conditions.
 
 * Version 2.3.6 (unreleased)
 
+** Make gnutls_x509_crq_sign2 set certificate request version if not set.
 ** Improve documentation for gnutls_x509_crq_sign2.
 Based on report from "John Brooks" <aspecialj@gmail.com> in
 <http://permalink.gmane.org/gmane.network.gnutls.general/1154>.
index 8ad9963daf5a24e2669c62dcd2ca71d0d05ff889..9201709ca49d352af34ce682dbb0d7228dfcd6e1 100644 (file)
@@ -750,6 +750,17 @@ gnutls_x509_crq_sign2 (gnutls_x509_crq_t crq, gnutls_x509_privkey_t key,
       return GNUTLS_E_INVALID_REQUEST;
     }
 
+  /* Make sure version field is set. */
+  if (gnutls_x509_crq_get_version (crq) == GNUTLS_E_ASN1_VALUE_NOT_FOUND)
+    {
+      result = gnutls_x509_crq_set_version (crq, 1);
+      if (result < 0)
+       {
+         gnutls_assert ();
+         return result;
+       }
+    }
+
   /* Step 1. Self sign the request.
    */
   result =
index a6d0c9d5788cb39e4faac21e7bf21ab6220eb0ca..e8a96c9db397fd15d79cbaf9064c73284dba2b22 100644 (file)
@@ -1752,10 +1752,6 @@ generate_request (void)
   get_uid_crq_set (crq);
   get_oid_crq_set (crq);
 
-  ret = gnutls_x509_crq_set_version (crq, 1);
-  if (ret < 0)
-    error (EXIT_FAILURE, 0, "set_version: %s", gnutls_strerror (ret));
-
   pass = get_challenge_pass ();
 
   if (pass != NULL)