diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-11-14 13:31:34 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-11-14 13:34:55 +0100 |
commit | 1fc2cb4e1bfa8300b532650ce1d899a836a6a813 (patch) | |
tree | cd79392a40c7b8d55fe42e232699b1e67dd67399 | |
parent | 70bf8475bb0ab178fe36ee4c601a6cfec8e70a3f (diff) | |
download | gnutls-1fc2cb4e1bfa8300b532650ce1d899a836a6a813.tar.gz |
_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.
-rw-r--r-- | lib/x509/dn.c | 8 |
1 files 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; } |