Transform string_append_listele{,_n}() to proper expanding-string triplet interface
[exim.git] / src / src / tlscert-openssl.c
index 690f9508148609b4572c587c02388c9ca4509215..2e6ee8b3ccd0ee3e1d5eab047068abbdfc24db67 100644 (file)
@@ -344,6 +344,7 @@ uschar *
 tls_cert_subject_altname(void * cert, uschar * mod)
 {
 uschar * list = NULL;
+int lsize = 0, llen = 0;
 STACK_OF(GENERAL_NAME) * san = (STACK_OF(GENERAL_NAME) *)
   X509_get_ext_d2i((X509 *)cert, NID_subject_alt_name, NULL, NULL);
 uschar osep = '\n';
@@ -394,7 +395,7 @@ while (sk_GENERAL_NAME_num(san) > 0)
     ele = string_copyn(ele, len);
 
   if (Ustrlen(ele) == len)     /* ignore any with embedded nul */
-    list = string_append_listele(list, osep,
+    list = string_append_listele(list, &lsize, &llen, osep,
          match == -1 ? string_sprintf("%s=%s", tag, ele) : ele);
   }
 
@@ -411,6 +412,7 @@ int adsnum = sk_ACCESS_DESCRIPTION_num(ads);
 int i;
 uschar sep = '\n';
 uschar * list = NULL;
+int size = 0, len = 0;
 
 if (mod)
   if (*mod == '>' && *++mod) sep = *mod++;
@@ -420,11 +422,9 @@ for (i = 0; i < adsnum; i++)
   ACCESS_DESCRIPTION * ad = sk_ACCESS_DESCRIPTION_value(ads, i);
 
   if (ad && OBJ_obj2nid(ad->method) == NID_ad_OCSP)
-    {
-    uschar * ele = ASN1_STRING_data(ad->location->d.ia5);
-    int len =  ASN1_STRING_length(ad->location->d.ia5);
-    list = string_append_listele_n(list, sep, ele, len);
-    }
+    list = string_append_listele_n(list, &size, &len, sep,
+      ASN1_STRING_data(ad->location->d.ia5),
+      ASN1_STRING_length(ad->location->d.ia5));
   }
 sk_ACCESS_DESCRIPTION_free(ads);
 return list;
@@ -441,6 +441,7 @@ int dpsnum = sk_DIST_POINT_num(dps);
 int i;
 uschar sep = '\n';
 uschar * list = NULL;
+int size = 0, len = 0;
 
 if (mod)
   if (*mod == '>' && *++mod) sep = *mod++;
@@ -457,11 +458,9 @@ if (dps) for (i = 0; i < dpsnum; i++)
       if (  (np = sk_GENERAL_NAME_value(names, j))
         && np->type == GEN_URI
         )
-       {
-       uschar * ele = ASN1_STRING_data(np->d.uniformResourceIdentifier);
-       int len =  ASN1_STRING_length(np->d.uniformResourceIdentifier);
-       list = string_append_listele_n(list, sep, ele, len);
-       }
+       list = string_append_listele_n(list, &size, &len,  sep,
+         ASN1_STRING_data(np->d.uniformResourceIdentifier),
+         ASN1_STRING_length(np->d.uniformResourceIdentifier));
     }
 sk_DIST_POINT_free(dps);
 return list;