gnutls_x509_crt_list_import2 returns 0, and not the number of certificates read
Description of problem:
The function gnutls_x509_crt_list_import2 is documented as returning a negative value if an error occurs, or the number of certificates read if the import was successful. However, at the end of the function in the source code (gitlab master), 0 is always returned on success. There is an integer 'ret' used throughout the function, which stores the result of the internal call to gnutls_x509_crt_list_import2, but this is only returned if it is less than 0. I believe that either ret should be returned, or the documentation should be updated to describe the observed behaviour.
Version of gnutls used:
3.5.8
Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)
Debian 9.8 (stretch)
Steps to Reproduce:
-
- Generate one certificate and store it in DER format.
-
- Use this function to import the certificate.
Actual results:
The call to gnutls_x509_crt_list_import2 returns 0.
Expected results:
The call to gnutls_x509_crt_list_import2 should return 1.