]> git.sur5r.net Git - openldap/blobdiff - clients/tools/ldapsearch.c
Fix URI
[openldap] / clients / tools / ldapsearch.c
index dd2712bdcdb95f3a6ed155b2d16e2639b037fa79..9b349da6b09289d11aa0943742b4933ee13b62f7 100644 (file)
@@ -725,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" );