From a4e2fc0298e8d60aa0e4bcfd3304303d952e0972 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Fri, 28 Nov 2014 14:52:21 +0000
Subject: [PATCH] OPENDJ-1607 Revert changes to revision 11339

---
 opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java
index 36ba5f2..dd1c16b 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java
@@ -63,7 +63,6 @@
 import org.forgerock.opendj.ldap.controls.SimplePagedResultsControl;
 import org.forgerock.opendj.ldap.controls.VirtualListViewRequestControl;
 import org.forgerock.opendj.ldap.controls.VirtualListViewResponseControl;
-import org.forgerock.opendj.ldap.requests.BindRequest;
 import org.forgerock.opendj.ldap.requests.Requests;
 import org.forgerock.opendj.ldap.requests.SearchRequest;
 import org.forgerock.opendj.ldap.responses.Result;
@@ -89,7 +88,6 @@
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
 import static com.forgerock.opendj.cli.Utils.*;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
-import static com.forgerock.opendj.ldap.tools.Utils.*;
 
 /**
  * A tool that can be used to issue Search requests to the Directory Server.
@@ -241,7 +239,6 @@
                         "[filter] [attributes ...]");
         ConnectionFactoryProvider connectionFactoryProvider;
         ConnectionFactory connectionFactory;
-        BindRequest bindRequest;
 
         BooleanArgument countEntries;
         BooleanArgument dontWrap;
@@ -443,8 +440,7 @@
                 return 0;
             }
 
-            connectionFactory = connectionFactoryProvider.getConnectionFactory();
-            bindRequest = connectionFactoryProvider.getBindRequest();
+            connectionFactory = connectionFactoryProvider.getAuthenticatedConnectionFactory();
         } catch (final ArgumentException ae) {
             final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
             errPrintln(message);
@@ -829,13 +825,11 @@
         Connection connection;
         try {
             connection = connectionFactory.getConnection();
-            if (bindRequest != null) {
-                printPasswordPolicyResults(this, connection.bind(bindRequest));
-            }
         } catch (final LdapException ere) {
-            return printErrorMessage(this, ere);
+            return Utils.printErrorMessage(this, ere);
         }
 
+        Utils.printPasswordPolicyResults(this, connection);
 
         try {
             int filterIndex = 0;

--
Gitblit v1.10.0