From 1fc2cb4e1bfa8300b532650ce1d899a836a6a813 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Mon, 14 Nov 2016 13:31:34 +0100 Subject: _gnutls_x509_get_dn: when no data ensure we return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE This aligns with the previous (prior to RFC4514 improvements) behavior of the function. --- lib/x509/dn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/x509/dn.c b/lib/x509/dn.c index 3395941403..b1b8a54e76 100644 --- a/lib/x509/dn.c +++ b/lib/x509/dn.c @@ -208,8 +208,12 @@ _gnutls_x509_get_dn(ASN1_TYPE asn1_struct, result = asn1_number_of_elements(asn1_struct, asn1_rdn_name, &k1); if (result != ASN1_SUCCESS) { - gnutls_assert(); - result = _gnutls_asn2err(result); + if (result == ASN1_ELEMENT_NOT_FOUND || result == ASN1_VALUE_NOT_FOUND) { + result = gnutls_assert_val(GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE); + } else { + gnutls_assert(); + result = _gnutls_asn2err(result); + } goto cleanup; } -- cgit v1.2.1