From 0f1a5919e0da06bad7e7af7ec29c7f8818682d99 Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Thu, 10 Oct 2013 11:07:57 -0700
Subject: [PATCH] From: Stef Walter <stefw@redhat.com> ITS#7695 Fix ldapsearch
 regression with CLDAP

Don't try to parse the result of a CLDAP bind request. Since these are
faked, no message is actually returned.
---
 clients/tools/common.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/clients/tools/common.c b/clients/tools/common.c
index 9b17ad6a71..9bd97730d9 100644
--- a/clients/tools/common.c
+++ b/clients/tools/common.c
@@ -1521,11 +1521,13 @@ tool_bind( LDAP *ld )
 			tool_exit( ld, LDAP_LOCAL_ERROR );
 		}
 
-		rc = ldap_parse_result( ld, result, &err, &matched, &info, &refs,
-			&ctrls, 1 );
-		if ( rc != LDAP_SUCCESS ) {
-			tool_perror( "ldap_bind parse result", rc, NULL, matched, info, refs );
-			tool_exit( ld, LDAP_LOCAL_ERROR );
+		if ( result ) {
+			rc = ldap_parse_result( ld, result, &err, &matched, &info, &refs,
+			                        &ctrls, 1 );
+			if ( rc != LDAP_SUCCESS ) {
+				tool_perror( "ldap_bind parse result", rc, NULL, matched, info, refs );
+				tool_exit( ld, LDAP_LOCAL_ERROR );
+			}
 		}
 
 #ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
-- 
GitLab