summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-11-14 13:31:34 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-11-14 13:34:55 +0100
commit1fc2cb4e1bfa8300b532650ce1d899a836a6a813 (patch)
treecd79392a40c7b8d55fe42e232699b1e67dd67399
parent70bf8475bb0ab178fe36ee4c601a6cfec8e70a3f (diff)
downloadgnutls-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.c8
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;
}