Issue 6789 - SDAP_DIAGNOSTIC_MESSAGE returns (null) for ldap_install_tls() failures
Summary: SDAP_DIAGNOSTIC_MESSAGE returns (null) for ldap_install_tls() failures
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-14 12:17 UTC by sgallagh@redhat.com
Modified: 2014-08-01 21:03 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description sgallagh@redhat.com 2011-01-14 12:17:32 UTC
Full_Name: Stephen Gallagher
Version: openldap-2.4.23
OS: Fedora 14 x86_64
URL: https://fedorahosted.org/sssd/ticket/699
Submission from: (NULL) (98.110.239.235)


We have this code in the SSSD (which uses the openldap shared libraries for LDAP
communication).


    ret = ldap_install_tls(state->sh->ldap);
    if (ret != LDAP_SUCCESS) {

        optret = ldap_get_option(state->sh->ldap,
                                 SDAP_DIAGNOSTIC_MESSAGE,
                                 (void*)&tlserr);
        if (optret == LDAP_SUCCESS) {
            DEBUG(3, ("ldap_install_tls failed: [%s] [%s]\n",
                      ldap_err2string(ret),
                      tlserr));
            sss_log(SSS_LOG_ERR, "Could not start TLS encryption. %s", tlserr);
            ldap_memfree(tlserr);
        }
        else {
            DEBUG(3, ("ldap_install_tls failed: [%s]\n",
                      ldap_err2string(ret)));
            sss_log(SSS_LOG_ERR, "Could not start TLS encryption. "
                                 "Check for certificate issues.");
        }


However, whenever there is an issue (such as an invalid/expired certificate) our
logs read:

(Fri Dec  3 14:13:33 2010) [sssd[be[LDAP]]] [sdap_connect_done] (3):
ldap_install_tls failed: [Connect error] [(null)]

This means that the ldap_get_option(SDAP_DIAGNOSTIC_MESSAGE) is returning
LDAP_SUCCESS, but the returned message is "(null)". This is not the same
behavior as with an LDAPS connection, where it will in fact return a message
indicating what certificate error was.
Comment 1 sgallagh@redhat.com 2011-01-14 13:23:18 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I just determined that this didn't occur on openldap-2.4.21, (on that
version, we properly get a lot of useful information about why the
connection failed).

This leads me to believe that this issue is likely related to the recent
switch to Mozilla NSS for crypto support.
- -- 
Stephen Gallagher
RHCE 804006346421761

Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk0wTkYACgkQeiVVYja6o6OFTQCeK7qYIw3754PfDolxkcld/D/B
CpoAn0ubzxgg3ekr7Ik1SydV9NkS36ln
=r+Ff
-----END PGP SIGNATURE-----

Comment 2 rich.megginson@gmail.com 2011-01-18 16:15:56 UTC
The problem is that NSS does not provide an error code to descriptive 
error string mapping.  It needs to be added.  Can the Subject of this 
bug be changed to something like
LDAP_OPT_DIAGNOSTIC_MESSAGE should return descriptive message when using 
MozNSS for TLS

Comment 3 Howard Chu 2011-01-20 19:00:03 UTC
changed notes
changed state Open to Feedback
Comment 4 Howard Chu 2011-03-16 10:25:15 UTC
changed notes
changed state Feedback to Closed
Comment 5 sgallagh@redhat.com 2011-04-13 14:20:34 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Has there been any progress on this issue? It causes a lot of headaches
trying to debug connection issues in SSSD.

- -- 
Stephen Gallagher
RHCE 804006346421761

Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk2lsTIACgkQeiVVYja6o6Nh7wCdF5Sn/IsMpNH9gB8WA9A7tEgB
ctUAoKPTUIL1rfZPnArrNBmAxQ/VuEq7
=DxDR
-----END PGP SIGNATURE-----

Comment 6 rich.megginson@gmail.com 2011-04-15 16:03:05 UTC
When https://bugzilla.mozilla.org/show_bug.cgi?id=172051 is fixed, error 
messages will magically appear.

Comment 7 OpenLDAP project 2014-08-01 21:03:47 UTC
MozNSS, not ours