From 518c1454ceec785840cef26d8906a8fe7cf0ce1e Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Sat, 06 Jan 2007 23:25:24 +0000
Subject: [PATCH] Update the LDAP authentication handler to fix a potential null pointer exception that could be thrown if the connection to the server was lost between sending the bind request and getting the bind response.
---
opends/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java | 89 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 89 insertions(+), 0 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java b/opends/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java
index 5fb4367..abb33a2 100644
--- a/opends/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java
+++ b/opends/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java
@@ -347,6 +347,14 @@
try
{
ASN1Element responseElement = reader.readElement();
+ if (responseElement == null)
+ {
+ int msgID = MSGID_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE;
+ String message = getMessage(msgID);
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ msgID, message);
+ }
+
responseMessage = LDAPMessage.decode(responseElement.decodeAsSequence());
}
catch (IOException ioe)
@@ -665,6 +673,14 @@
try
{
ASN1Element responseElement = reader.readElement();
+ if (responseElement == null)
+ {
+ int msgID = MSGID_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE;
+ String message = getMessage(msgID);
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ msgID, message);
+ }
+
responseMessage = LDAPMessage.decode(responseElement.decodeAsSequence());
}
catch (IOException ioe)
@@ -931,6 +947,14 @@
try
{
ASN1Element responseElement1 = reader.readElement();
+ if (responseElement1 == null)
+ {
+ int msgID = MSGID_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE;
+ String message = getMessage(msgID);
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ msgID, message);
+ }
+
responseMessage1 =
LDAPMessage.decode(responseElement1.decodeAsSequence());
}
@@ -1076,6 +1100,14 @@
try
{
ASN1Element responseElement = reader.readElement();
+ if (responseElement == null)
+ {
+ int msgID = MSGID_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE;
+ String message = getMessage(msgID);
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ msgID, message);
+ }
+
responseMessage2 = LDAPMessage.decode(responseElement.decodeAsSequence());
}
catch (IOException ioe)
@@ -1536,6 +1568,14 @@
try
{
ASN1Element responseElement1 = reader.readElement();
+ if (responseElement1 == null)
+ {
+ int msgID = MSGID_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE;
+ String message = getMessage(msgID);
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ msgID, message);
+ }
+
responseMessage1 =
LDAPMessage.decode(responseElement1.decodeAsSequence());
}
@@ -1850,6 +1890,14 @@
try
{
ASN1Element responseElement = reader.readElement();
+ if (responseElement == null)
+ {
+ int msgID = MSGID_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE;
+ String message = getMessage(msgID);
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ msgID, message);
+ }
+
responseMessage2 = LDAPMessage.decode(responseElement.decodeAsSequence());
}
catch (IOException ioe)
@@ -2523,6 +2571,14 @@
try
{
ASN1Element responseElement = reader.readElement();
+ if (responseElement == null)
+ {
+ int msgID = MSGID_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE;
+ String message = getMessage(msgID);
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ msgID, message);
+ }
+
responseMessage = LDAPMessage.decode(responseElement.decodeAsSequence());
}
catch (IOException ioe)
@@ -3139,6 +3195,14 @@
try
{
ASN1Element responseElement = reader.readElement();
+ if (responseElement == null)
+ {
+ int msgID = MSGID_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE;
+ String message = getMessage(msgID);
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ msgID, message);
+ }
+
responseMessage = LDAPMessage.decode(responseElement.decodeAsSequence());
}
catch (IOException ioe)
@@ -3371,6 +3435,14 @@
try
{
ASN1Element responseElement = reader.readElement();
+ if (responseElement == null)
+ {
+ int msgID = MSGID_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE;
+ String message = getMessage(msgID);
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ msgID, message);
+ }
+
responseMessage =
LDAPMessage.decode(responseElement.decodeAsSequence());
}
@@ -3549,6 +3621,15 @@
try
{
ASN1Element responseElement = reader.readElement();
+ if (responseElement == null)
+ {
+ int msgID =
+ MSGID_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE;
+ String message = getMessage(msgID);
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ msgID, message);
+ }
+
responseMessage =
LDAPMessage.decode(responseElement.decodeAsSequence());
}
@@ -3762,6 +3843,14 @@
try
{
ASN1Element responseElement = reader.readElement();
+ if (responseElement == null)
+ {
+ int msgID = MSGID_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE;
+ String message = getMessage(msgID);
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ msgID, message);
+ }
+
responseMessage = LDAPMessage.decode(responseElement.decodeAsSequence());
}
catch (IOException ioe)
--
Gitblit v1.10.0