From df8d2595f230a4a3c3e81d8695c76c7e362c0803 Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Wed, 01 Apr 2009 22:51:33 +0000
Subject: [PATCH] Move the password prompting out of the LDAPAuthenticationHandler class so a connection to the server isn't tied up while waiting for the user to enter a password. Issue 3828.
---
opends/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java | 60 ++++--------------------------------------------------------
1 files changed, 4 insertions(+), 56 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java b/opends/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java
index a9c64c8..cac5606 100644
--- a/opends/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java
+++ b/opends/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java
@@ -282,29 +282,10 @@
List<Control> responseControls)
throws ClientException, LDAPException
{
- // See if we need to prompt the user for the password.
+ //Password is empty, set it to ByteString.empty.
if (bindPassword == null)
{
- if (bindDN == null)
- {
bindPassword = ByteString.empty();
- }
- else
- {
- System.out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(
- bindDN.toString()));
- System.out.flush();
- char[] pwChars = PasswordReader.readPassword();
- if (pwChars == null)
- {
- bindPassword = ByteString.empty();
- }
- else
- {
- bindPassword = ByteString.wrap(getBytes(pwChars));
- Arrays.fill(pwChars, '\u0000');
- }
- }
}
@@ -876,21 +857,10 @@
}
- // See if the password was null. If so, then interactively prompt it from
- // the user.
+ // Set password to ByteString.empty if the password is null.
if (bindPassword == null)
{
- System.out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(authID));
- char[] pwChars = PasswordReader.readPassword();
- if (pwChars == null)
- {
bindPassword = ByteString.empty();
- }
- else
- {
- bindPassword = ByteString.wrap(getBytes(pwChars));
- Arrays.fill(pwChars, '\u0000');
- }
}
@@ -1474,21 +1444,10 @@
}
- // See if the password was null. If so, then interactively prompt it from
- // the user.
+ // Set password to ByteString.empty if the password is null.
if (bindPassword == null)
{
- System.out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(authID));
- char[] pwChars = PasswordReader.readPassword();
- if (pwChars == null)
- {
bindPassword = ByteString.empty();
- }
- else
- {
- bindPassword = ByteString.wrap(getBytes(pwChars));
- Arrays.fill(pwChars, '\u0000');
- }
}
@@ -3058,21 +3017,10 @@
}
- // See if the password was null. If so, then interactively prompt it from
- // the user.
+ // Set password to ByteString.empty if the password is null.
if (bindPassword == null)
{
- System.out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(authID));
- char[] pwChars = PasswordReader.readPassword();
- if (pwChars == null)
- {
bindPassword = ByteString.empty();
- }
- else
- {
- bindPassword = ByteString.wrap(getBytes(pwChars));
- Arrays.fill(pwChars, '\u0000');
- }
}
--
Gitblit v1.10.0