help-gnutls
[Top][All Lists]
Advanced

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

Re: [Help-gnutls] Problem building from git


From: Nikos Mavrogiannopoulos
Subject: Re: [Help-gnutls] Problem building from git
Date: Mon, 13 Jul 2009 10:50:01 +0300
User-agent: Thunderbird 2.0.0.22 (X11/20090608)

Brad Hards wrote:
> On Monday 13 July 2009 16:39:30 Nikos Mavrogiannopoulos wrote:
>> This is quite strange. In my copy x509.h:780
>> gnutls_x509_crq_get_extension_by_oid has argument 5 as unsigned int and
>> not size_t*. Is it the same in your system? 
> No, it isn't. I have:
>   int gnutls_x509_crq_get_extension_by_oid (gnutls_x509_crq_t crq,
>                                           const char *oid, int indx,
>                                           void *buf, size_t * sizeof_buf,
>                                           unsigned int *critical);

Sorry didn't check correctly. Does the following patch solve the issue
for you?

regards,
Nikos
diff --git a/lib/x509/crq.c b/lib/x509/crq.c
index 3fbd20f..d340d65 100644
--- a/lib/x509/crq.c
+++ b/lib/x509/crq.c
@@ -1633,6 +1633,7 @@ get_subject_alt_name (gnutls_x509_crq_t crq,
   ASN1_TYPE c2 = ASN1_TYPE_EMPTY;
   gnutls_x509_subject_alt_name_t type;
   gnutls_datum_t dnsname = { NULL, 0 };
+  size_t dns_size = 0;
 
   if (crq == NULL)
     {
@@ -1648,7 +1649,7 @@ get_subject_alt_name (gnutls_x509_crq_t crq,
   /* Extract extension.
    */
   result = gnutls_x509_crq_get_extension_by_oid (crq, "2.5.29.17", 0,
-                                                NULL, &dnsname.size,
+                                                NULL, &dns_size,
                                                 critical);
   if (result < 0)
     {
@@ -1656,6 +1657,7 @@ get_subject_alt_name (gnutls_x509_crq_t crq,
       return result;
     }
 
+  dnsname.size = dns_size;
   dnsname.data = gnutls_malloc (dnsname.size);
   if (dnsname.data == NULL)
     {
@@ -1664,7 +1666,7 @@ get_subject_alt_name (gnutls_x509_crq_t crq,
     }
 
   result = gnutls_x509_crq_get_extension_by_oid (crq, "2.5.29.17", 0,
-                                                dnsname.data, &dnsname.size,
+                                                dnsname.data, dns_size,
                                                 critical);
   if (result < 0)
     {
@@ -1876,6 +1878,7 @@ gnutls_x509_crq_set_subject_alt_name (gnutls_x509_crq_t 
crq,
   gnutls_datum_t der_data = { NULL, 0 };
   gnutls_datum_t prev_der_data = { NULL, 0 };
   unsigned int critical = 0;
+  size_t prev_data_size = 0;
 
   if (crq == NULL)
     {
@@ -1888,8 +1891,10 @@ gnutls_x509_crq_set_subject_alt_name (gnutls_x509_crq_t 
crq,
   if (flags == GNUTLS_FSAN_APPEND)
     {
       result = gnutls_x509_crq_get_extension_by_oid (crq, "2.5.29.17", 0,
-                                                    NULL, &prev_der_data.size,
+                                                    NULL, &prev_data_size,
                                                     &critical);
+      prev_der_data.size = prev_data_size;
+
       switch (result)
        {
        case GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE:
@@ -1906,7 +1911,7 @@ gnutls_x509_crq_set_subject_alt_name (gnutls_x509_crq_t 
crq,
 
          result = gnutls_x509_crq_get_extension_by_oid (crq, "2.5.29.17", 0,
                                                         prev_der_data.data,
-                                                        &prev_der_data.size,
+                                                        &prev_data_size,
                                                         &critical);
          if (result < 0)
            {
@@ -2075,6 +2080,7 @@ gnutls_x509_crq_get_key_purpose_oid (gnutls_x509_crq_t 
crq,
   int result, len;
   gnutls_datum_t prev = { NULL, 0 };
   ASN1_TYPE c2 = ASN1_TYPE_EMPTY;
+  size_t prev_size = 0;
 
   if (oid)
     memset (oid, 0, *sizeof_oid);
@@ -2084,8 +2090,10 @@ gnutls_x509_crq_get_key_purpose_oid (gnutls_x509_crq_t 
crq,
   /* Extract extension.
    */
   result = gnutls_x509_crq_get_extension_by_oid (crq, "2.5.29.37", 0,
-                                                NULL, &prev.size,
+                                                NULL, &prev_size,
                                                 critical);
+  prev.size = prev_size;
+
   if (result < 0)
     {
       gnutls_assert ();
@@ -2100,7 +2108,7 @@ gnutls_x509_crq_get_key_purpose_oid (gnutls_x509_crq_t 
crq,
     }
 
   result = gnutls_x509_crq_get_extension_by_oid (crq, "2.5.29.37", 0,
-                                                prev.data, &prev.size,
+                                                prev.data, &prev_size,
                                                 critical);
   if (result < 0)
     {
@@ -2177,12 +2185,15 @@ gnutls_x509_crq_set_key_purpose_oid (gnutls_x509_crq_t 
crq,
   int result;
   gnutls_datum_t prev = { NULL, 0 }, der_data;
   ASN1_TYPE c2 = ASN1_TYPE_EMPTY;
+  size_t prev_size = 0;
 
   /* Read existing extension, if there is one.
    */
   result = gnutls_x509_crq_get_extension_by_oid (crq, "2.5.29.37", 0,
-                                                NULL, &prev.size,
+                                                NULL, &prev_size,
                                                 &critical);
+  prev.size = prev_size;
+
   switch (result)
     {
     case GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE:
@@ -2198,7 +2209,7 @@ gnutls_x509_crq_set_key_purpose_oid (gnutls_x509_crq_t 
crq,
        }
 
       result = gnutls_x509_crq_get_extension_by_oid (crq, "2.5.29.37", 0,
-                                                    prev.data, &prev.size,
+                                                    prev.data, &prev_size,
                                                     &critical);
       if (result < 0)
        {

reply via email to

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