]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Patch TODO: Stop accessing GENERAL_NAME attributes directly
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Thu, 9 May 2024 23:49:10 +0000 (17:49 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Thu, 9 May 2024 23:49:10 +0000 (17:49 -0600)
src/libcrypto_util.c
src/object/certificate.c

index 61d665d0059403bcb21475027ca455ce31744cd9..eb0d4054201e891efa06cd722d8c1541f0f7e3af 100644 (file)
@@ -164,7 +164,7 @@ gn2json(GENERAL_NAME const *gn)
        if (gn == NULL)
                return json_null();
 
-       str = GENERAL_NAME_get0_value(gn, &type); // FIXME open call hierarchy FIXME getter review
+       str = GENERAL_NAME_get0_value(gn, &type);
        return (type == GEN_URI)
            ? json_stringn((char const *)str->data, str->length)
            : json_string("<Not implemented for now>");
index 46ab21004aa5f2c04c3ca768c96b962cdbccd667..360b7e4ebb54c00595c2e0ba393beb3971bd9c90 100644 (file)
@@ -34,9 +34,6 @@
 #include "object/signed_object.h"
 #include "cache/local_cache.h"
 
-/* Just to prevent some line breaking. */
-#define GN_URI uniformResourceIdentifier
-
 /*
  * The X509V3_EXT_METHOD that references NID_sinfo_access uses the AIA item.
  * The SIA's d2i function, therefore, returns AIAs.
@@ -1186,12 +1183,6 @@ is_rsync(ASN1_IA5STRING *uri)
            : false;
 }
 
-static bool
-is_rsync_uri(GENERAL_NAME *name)
-{
-       return name->type == GEN_URI && is_rsync(name->d.GN_URI);
-}
-
 static int
 handle_rpkiManifest(struct rpki_uri *uri, void *arg)
 {
@@ -1400,8 +1391,10 @@ handle_cdp(X509_EXTENSION *ext, void *arg)
        DIST_POINT *dp;
        GENERAL_NAMES *names;
        GENERAL_NAME *name;
+       ASN1_IA5STRING *str;
        int i;
-       int error = 0;
+       int type;
+       int error;
        char const *error_msg;
 
        crldp = X509V3_EXT_d2i(ext);
@@ -1445,7 +1438,8 @@ handle_cdp(X509_EXTENSION *ext, void *arg)
        names = dp->distpoint->name.fullname;
        for (i = 0; i < sk_GENERAL_NAME_num(names); i++) {
                name = sk_GENERAL_NAME_value(names, i);
-               if (is_rsync_uri(name)) {
+               str = GENERAL_NAME_get0_value(name, &type);
+               if (type == GEN_URI && is_rsync(str)) {
                        /*
                         * Since we're parsing and validating the manifest's CRL
                         * at some point, I think that all we need to do now is
@@ -1460,7 +1454,7 @@ handle_cdp(X509_EXTENSION *ext, void *arg)
                         * So we will store the URI in @refs, and validate it
                         * later.
                         */
-                       error = ia5s2string(name->d.GN_URI, &refs->crldp);
+                       error = ia5s2string(str, &refs->crldp);
                        goto end;
                }
        }