From de8861a7e3100053542ec020aadd3f4fc88b7a02 Mon Sep 17 00:00:00 2001 From: Mathis Marion Date: Thu, 1 Aug 2024 09:59:49 +0200 Subject: [PATCH] Remove duplicate colon in otherName display The colon is already added in X509V3_EXT_val_prn(). In fact, the other branches from i2v_GENERAL_NAME() do not include a trailing colon. Reviewed-by: Tom Cosgrove Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/23428) --- crypto/x509/v3_san.c | 14 +++++++------- test/recipes/25-test_eai_data/san.ascii | 2 +- test/recipes/25-test_eai_data/san.utf8 | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crypto/x509/v3_san.c b/crypto/x509/v3_san.c index 5eea2c011e2..4b75bca8860 100644 --- a/crypto/x509/v3_san.c +++ b/crypto/x509/v3_san.c @@ -88,7 +88,7 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, switch (OBJ_obj2nid(gen->d.otherName->type_id)) { case NID_id_on_SmtpUTF8Mailbox: if (gen->d.otherName->value->type != V_ASN1_UTF8STRING - || !x509v3_add_len_value_uchar("othername: SmtpUTF8Mailbox:", + || !x509v3_add_len_value_uchar("othername: SmtpUTF8Mailbox", gen->d.otherName->value->value.utf8string->data, gen->d.otherName->value->value.utf8string->length, &ret)) @@ -96,7 +96,7 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, break; case NID_XmppAddr: if (gen->d.otherName->value->type != V_ASN1_UTF8STRING - || !x509v3_add_len_value_uchar("othername: XmppAddr:", + || !x509v3_add_len_value_uchar("othername: XmppAddr", gen->d.otherName->value->value.utf8string->data, gen->d.otherName->value->value.utf8string->length, &ret)) @@ -104,7 +104,7 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, break; case NID_SRVName: if (gen->d.otherName->value->type != V_ASN1_IA5STRING - || !x509v3_add_len_value_uchar("othername: SRVName:", + || !x509v3_add_len_value_uchar("othername: SRVName", gen->d.otherName->value->value.ia5string->data, gen->d.otherName->value->value.ia5string->length, &ret)) @@ -112,7 +112,7 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, break; case NID_ms_upn: if (gen->d.otherName->value->type != V_ASN1_UTF8STRING - || !x509v3_add_len_value_uchar("othername: UPN:", + || !x509v3_add_len_value_uchar("othername: UPN", gen->d.otherName->value->value.utf8string->data, gen->d.otherName->value->value.utf8string->length, &ret)) @@ -120,7 +120,7 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, break; case NID_NAIRealm: if (gen->d.otherName->value->type != V_ASN1_UTF8STRING - || !x509v3_add_len_value_uchar("othername: NAIRealm:", + || !x509v3_add_len_value_uchar("othername: NAIRealm", gen->d.otherName->value->value.utf8string->data, gen->d.otherName->value->value.utf8string->length, &ret)) @@ -128,10 +128,10 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, break; default: if (OBJ_obj2txt(oline, sizeof(oline), gen->d.otherName->type_id, 0) > 0) - BIO_snprintf(othername, sizeof(othername), "othername: %s:", + BIO_snprintf(othername, sizeof(othername), "othername: %s", oline); else - OPENSSL_strlcpy(othername, "othername:", sizeof(othername)); + OPENSSL_strlcpy(othername, "othername", sizeof(othername)); /* check if the value is something printable */ if (gen->d.otherName->value->type == V_ASN1_IA5STRING) { diff --git a/test/recipes/25-test_eai_data/san.ascii b/test/recipes/25-test_eai_data/san.ascii index e719e2660f0..15043655049 100644 --- a/test/recipes/25-test_eai_data/san.ascii +++ b/test/recipes/25-test_eai_data/san.ascii @@ -1,2 +1,2 @@ X509v3 Subject Alternative Name: - othername: SmtpUTF8Mailbox::学生@elementary.school.example.com + othername: SmtpUTF8Mailbox:学生@elementary.school.example.com diff --git a/test/recipes/25-test_eai_data/san.utf8 b/test/recipes/25-test_eai_data/san.utf8 index cf62d9dfbe6..063ccc02e4c 100644 --- a/test/recipes/25-test_eai_data/san.utf8 +++ b/test/recipes/25-test_eai_data/san.utf8 @@ -1,2 +1,2 @@ X509v3 Subject Alternative Name: - othername: SmtpUTF8Mailbox::医生@大学.example.com + othername: SmtpUTF8Mailbox:医生@大学.example.com -- 2.47.2