From: oleg.hoefling Date: Mon, 28 Oct 2024 08:23:59 +0000 (+0100) Subject: Adjust naming authority formatting when printing out admission extension X-Git-Tag: openssl-3.1.8~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bae01d7e1dade9557425c3d09c31a24c883ef4c9;p=thirdparty%2Fopenssl.git Adjust naming authority formatting when printing out admission extension Indent namingAuthority section with two spaces to match the parent node. Signed-off-by: oleg.hoefling Reviewed-by: Richard Levitte Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/25814) (cherry picked from commit 85a52f7292cb57662f823e4ac1a303f56d0531bf) --- diff --git a/crypto/x509/v3_admis.c b/crypto/x509/v3_admis.c index 3bce232ed2f..53259c29f56 100644 --- a/crypto/x509/v3_admis.c +++ b/crypto/x509/v3_admis.c @@ -67,11 +67,10 @@ const X509V3_EXT_METHOD ossl_v3_ext_admission = { NULL /* extension-specific data */ }; - static int i2r_NAMING_AUTHORITY(const struct v3_ext_method *method, void *in, BIO *bp, int ind) { - NAMING_AUTHORITY * namingAuthority = (NAMING_AUTHORITY*) in; + NAMING_AUTHORITY *namingAuthority = (NAMING_AUTHORITY *) in; if (namingAuthority == NULL) return 0; @@ -81,14 +80,14 @@ static int i2r_NAMING_AUTHORITY(const struct v3_ext_method *method, void *in, && namingAuthority->namingAuthorityUrl == NULL) return 0; - if (BIO_printf(bp, "%*snamingAuthority: ", ind, "") <= 0) + if (BIO_printf(bp, "%*snamingAuthority:\n", ind, "") <= 0) goto err; if (namingAuthority->namingAuthorityId != NULL) { char objbuf[128]; const char *ln = OBJ_nid2ln(OBJ_obj2nid(namingAuthority->namingAuthorityId)); - if (BIO_printf(bp, "%*s admissionAuthorityId: ", ind, "") <= 0) + if (BIO_printf(bp, "%*s namingAuthorityId: ", ind, "") <= 0) goto err; OBJ_obj2txt(objbuf, sizeof(objbuf), namingAuthority->namingAuthorityId, 1); @@ -130,9 +129,10 @@ static int i2r_ADMISSION_SYNTAX(const struct v3_ext_method *method, void *in, } for (i = 0; i < sk_ADMISSIONS_num(admission->contentsOfAdmissions); i++) { - ADMISSIONS* entry = sk_ADMISSIONS_value(admission->contentsOfAdmissions, i); + ADMISSIONS *entry = sk_ADMISSIONS_value(admission->contentsOfAdmissions, i); - if (BIO_printf(bp, "%*sEntry %0d:\n", ind, "", 1 + i) <= 0) goto err; + if (BIO_printf(bp, "%*sEntry %0d:\n", ind, "", 1 + i) <= 0) + goto err; if (entry->admissionAuthority != NULL) { if (BIO_printf(bp, "%*s admissionAuthority:\n", ind, "") <= 0 @@ -143,12 +143,12 @@ static int i2r_ADMISSION_SYNTAX(const struct v3_ext_method *method, void *in, } if (entry->namingAuthority != NULL) { - if (i2r_NAMING_AUTHORITY(method, entry->namingAuthority, bp, ind) <= 0) + if (i2r_NAMING_AUTHORITY(method, entry->namingAuthority, bp, ind + 2) <= 0) goto err; } for (j = 0; j < sk_PROFESSION_INFO_num(entry->professionInfos); j++) { - PROFESSION_INFO* pinfo = sk_PROFESSION_INFO_value(entry->professionInfos, j); + PROFESSION_INFO *pinfo = sk_PROFESSION_INFO_value(entry->professionInfos, j); if (BIO_printf(bp, "%*s Profession Info Entry %0d:\n", ind, "", 1 + j) <= 0) goto err; @@ -161,7 +161,7 @@ static int i2r_ADMISSION_SYNTAX(const struct v3_ext_method *method, void *in, } if (pinfo->namingAuthority != NULL) { - if (i2r_NAMING_AUTHORITY(method, pinfo->namingAuthority, bp, ind + 2) <= 0) + if (i2r_NAMING_AUTHORITY(method, pinfo->namingAuthority, bp, ind + 4) <= 0) goto err; } @@ -170,7 +170,7 @@ static int i2r_ADMISSION_SYNTAX(const struct v3_ext_method *method, void *in, if (BIO_printf(bp, "%*s Info Entries:\n", ind, "") <= 0) goto err; for (k = 0; k < sk_ASN1_STRING_num(pinfo->professionItems); k++) { - ASN1_STRING* val = sk_ASN1_STRING_value(pinfo->professionItems, k); + ASN1_STRING *val = sk_ASN1_STRING_value(pinfo->professionItems, k); if (BIO_printf(bp, "%*s ", ind, "") <= 0 || ASN1_STRING_print(bp, val) <= 0 @@ -183,7 +183,7 @@ static int i2r_ADMISSION_SYNTAX(const struct v3_ext_method *method, void *in, if (BIO_printf(bp, "%*s Profession OIDs:\n", ind, "") <= 0) goto err; for (k = 0; k < sk_ASN1_OBJECT_num(pinfo->professionOIDs); k++) { - ASN1_OBJECT* obj = sk_ASN1_OBJECT_value(pinfo->professionOIDs, k); + ASN1_OBJECT *obj = sk_ASN1_OBJECT_value(pinfo->professionOIDs, k); const char *ln = OBJ_nid2ln(OBJ_obj2nid(obj)); char objbuf[128]; @@ -207,31 +207,29 @@ const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId(const NAMING_AUTHORITY *n) return n->namingAuthorityId; } -void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, ASN1_OBJECT* id) +void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, ASN1_OBJECT *id) { ASN1_OBJECT_free(n->namingAuthorityId); n->namingAuthorityId = id; } -const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL( - const NAMING_AUTHORITY *n) +const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL(const NAMING_AUTHORITY *n) { return n->namingAuthorityUrl; } -void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, ASN1_IA5STRING* u) +void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, ASN1_IA5STRING *u) { ASN1_IA5STRING_free(n->namingAuthorityUrl); n->namingAuthorityUrl = u; } -const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText( - const NAMING_AUTHORITY *n) +const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText(const NAMING_AUTHORITY *n) { return n->namingAuthorityText; } -void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, ASN1_STRING* t) +void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, ASN1_STRING *t) { ASN1_IA5STRING_free(n->namingAuthorityText); n->namingAuthorityText = t;