X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=clients%2Ftools%2Fldapsearch.c;h=9b349da6b09289d11aa0943742b4933ee13b62f7;hb=78f6d75586381f3cfa0af8a7e3e72e862a76a730;hp=3bb90f945427807364ad71854e208c34bcec1c46;hpb=ef3fb24f398b1bbbf9532ec06b81424523572bee;p=openldap diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 3bb90f9454..9b349da6b0 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -680,7 +680,8 @@ main( int argc, char **argv ) } if( ld == NULL ) { - fprintf( stderr, "Could not create LDAP session handle (%d): %s\n", rc ); + fprintf( stderr, "Could not create LDAP session handle (%d): %s\n", + rc, ldap_err2string(rc) ); return EXIT_FAILURE; } @@ -724,9 +725,13 @@ main( int argc, char **argv ) return EXIT_FAILURE; } - if ( use_tls && ldap_start_tls_s( ld, NULL, NULL ) != LDAP_SUCCESS ) { - if ( use_tls > 1 ) { + if ( use_tls ) { + rc = ldap_start_tls_s( ld, NULL, NULL ); + + if ( rc != LDAP_SUCCESS && use_tls > 1 ) { ldap_perror( ld, "ldap_start_tls" ); + fprintf( stderr, "Could not start TLS %d: %s\n", + rc, ldap_err2string( rc ) ); return EXIT_FAILURE; } fprintf( stderr, "WARNING: could not start TLS\n" );