Print out previously unsupported fields in CRLDP by i2r instead of i2v.
authorDr. Stephen Henson <steve@openssl.org>
Sun, 24 Jul 2005 00:23:57 +0000 (00:23 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 24 Jul 2005 00:23:57 +0000 (00:23 +0000)
Cosmetic changes to IDP printout.

CHANGES
crypto/x509v3/v3_crld.c

diff --git a/CHANGES b/CHANGES
index f828606009ebee4e0f31ef810d93272fdde169ae..206c0dca52c4ea1e99e1861485465dba754c482c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,10 @@
 
  Changes between 0.9.8 and 0.9.9  [xx XXX xxxx]
 
+  *) Modify CRL distribution points extension code to print out previously
+     unsupported fields.
+     [Steve Henson]
+
   *) Add print only support for Issuing Distribution Point CRL extension.
      [Steve Henson]
 
index 28a38c16f42f205eb9ecd829e3b056535d087aee..2dd69327b7e2c36b097d5044fcffcc893c61659a 100644 (file)
 #include <openssl/asn1t.h>
 #include <openssl/x509v3.h>
 
-static STACK_OF(CONF_VALUE) *i2v_crld(X509V3_EXT_METHOD *method,
-               STACK_OF(DIST_POINT) *crld, STACK_OF(CONF_VALUE) *extlist);
 static STACK_OF(DIST_POINT) *v2i_crld(X509V3_EXT_METHOD *method,
                                X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
+static int i2r_crldp(X509V3_EXT_METHOD *method, void *pcrldp, BIO *out,
+                                                               int indent);
 
 X509V3_EXT_METHOD v3_crld = {
 NID_crl_distribution_points, X509V3_EXT_MULTILINE, ASN1_ITEM_ref(CRL_DIST_POINTS),
 0,0,0,0,
 0,0,
-(X509V3_EXT_I2V)i2v_crld,
+0,
 (X509V3_EXT_V2I)v2i_crld,
-0,0,
+i2r_crldp,0,
 NULL
 };
 
-static STACK_OF(CONF_VALUE) *i2v_crld(X509V3_EXT_METHOD *method,
-                       STACK_OF(DIST_POINT) *crld, STACK_OF(CONF_VALUE) *exts)
-{
-       DIST_POINT *point;
-       int i;
-       for(i = 0; i < sk_DIST_POINT_num(crld); i++) {
-               point = sk_DIST_POINT_value(crld, i);
-               if(point->distpoint) {
-                       if(point->distpoint->type == 0)
-                               exts = i2v_GENERAL_NAMES(NULL,
-                                        point->distpoint->name.fullname, exts);
-                       else X509V3_add_value("RelativeName","<UNSUPPORTED>", &exts);
-               }
-               if(point->reasons) 
-                       X509V3_add_value("reasons","<UNSUPPORTED>", &exts);
-               if(point->CRLissuer)
-                       X509V3_add_value("CRLissuer","<UNSUPPORTED>", &exts);
-       }
-       return exts;
-}
-
 static STACK_OF(DIST_POINT) *v2i_crld(X509V3_EXT_METHOD *method,
                                X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
 {
@@ -209,7 +188,7 @@ static int print_reasons(BIO *out, const char *rname,
                        if (first)
                                first = 0;
                        else
-                               BIO_puts(out, ",");
+                               BIO_puts(out, ", ");
                        BIO_puts(out, pbn->lname);
                        }
                }
@@ -220,19 +199,24 @@ static int print_reasons(BIO *out, const char *rname,
        return 1;
        }
 
-static int print_distpoint(BIO *out, DIST_POINT_NAME *dpn, int indent)
+static int print_gens(BIO *out, STACK_OF(GENERAL_NAME) *gens, int indent)
        {
        int i;
+       for (i = 0; i < sk_GENERAL_NAME_num(gens); i++)
+               {
+               BIO_printf(out, "%*s", indent + 2, "");
+               GENERAL_NAME_print(out, sk_GENERAL_NAME_value(gens, i));
+               BIO_puts(out, "\n");
+               }
+       return 1;
+       }
+
+static int print_distpoint(BIO *out, DIST_POINT_NAME *dpn, int indent)
+       {
        if (dpn->type == 0)
                {
-               STACK_OF(GENERAL_NAME) *gens;
                BIO_printf(out, "%*sFull Name:\n", indent, "");
-               gens = dpn->name.fullname;
-               for (i = 0; i < sk_GENERAL_NAME_num(gens); i++)
-                       {
-                       BIO_printf(out, "%*s", indent + 2, "");
-                       GENERAL_NAME_print(out, sk_GENERAL_NAME_value(gens, i));
-                       }
+               print_gens(out, dpn->name.fullname, indent + 2);
                }
        else
                {
@@ -269,3 +253,26 @@ static int i2r_idp(X509V3_EXT_METHOD *method, void *pidp, BIO *out, int indent)
                
        return 1;
        }
+
+static int i2r_crldp(X509V3_EXT_METHOD *method, void *pcrldp, BIO *out,
+                                                               int indent)
+       {
+       STACK_OF(DIST_POINT) *crld = pcrldp;
+       DIST_POINT *point;
+       int i;
+       for(i = 0; i < sk_DIST_POINT_num(crld); i++)
+               {
+               point = sk_DIST_POINT_value(crld, i);
+               if(point->distpoint)
+                       print_distpoint(out, point->distpoint, indent + 2);
+               if(point->reasons) 
+                       print_reasons(out, "Reasons", point->reasons,
+                                                               indent + 2);
+               if(point->CRLissuer)
+                       {
+                       BIO_printf(out, "%*sCRL Issuer:\n", indent, "");
+                       print_gens(out, point->CRLissuer, indent + 2);
+                       }
+               }
+       return 1;
+       }