From 1dfff197eadcf24823d7915e6eead2a850f679f9 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 14 Feb 2012 16:09:28 +0000
Subject: [PATCH] Fix OPENDJ-420: Rare SSLExceptions while handling LDAPS connections and big LDAP searches
---
opends/src/server/org/opends/server/extensions/SASLContext.java | 63 ++++++++++++++++++++++++++++---
1 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/opends/src/server/org/opends/server/extensions/SASLContext.java b/opends/src/server/org/opends/server/extensions/SASLContext.java
index 78a6c5b..a549f70 100644
--- a/opends/src/server/org/opends/server/extensions/SASLContext.java
+++ b/opends/src/server/org/opends/server/extensions/SASLContext.java
@@ -447,16 +447,65 @@
/**
- * Return the negotiated buffer size.
+ * Returns the negotiated maximum size of protected data which can be received
+ * from the client.
*
- * @param prop
- * The buffer size property to return.
- * @return The value of the negotiated buffer size.
+ * @return The negotiated maximum size of protected data which can be received
+ * from the client.
*/
- int getBufSize(final String prop)
+ int getMaxReceiveBufferSize()
{
- final String sizeStr = (String) saslServer.getNegotiatedProperty(prop);
- return Integer.parseInt(sizeStr);
+ String str = (String) saslServer.getNegotiatedProperty(Sasl.MAX_BUFFER);
+ if (str != null)
+ {
+ try
+ {
+ return Integer.parseInt(str);
+ }
+ catch (NumberFormatException e)
+ {
+ if (debugEnabled())
+ {
+ TRACER.debugCaught(DebugLogLevel.ERROR, e);
+ }
+ }
+ }
+
+ // Default buffer size if not specified according to Java SASL
+ // documentation.
+ return 65536;
+ }
+
+
+
+ /**
+ * Returns the negotiated maximum size of raw data which can be sent to the
+ * client.
+ *
+ * @return The negotiated maximum size of raw data which can be sent to the
+ * client.
+ */
+ int getMaxRawSendBufferSize()
+ {
+ String str = (String) saslServer.getNegotiatedProperty(Sasl.RAW_SEND_SIZE);
+ if (str != null)
+ {
+ try
+ {
+ return Integer.parseInt(str);
+ }
+ catch (NumberFormatException e)
+ {
+ if (debugEnabled())
+ {
+ TRACER.debugCaught(DebugLogLevel.ERROR, e);
+ }
+ }
+ }
+
+ // Default buffer size if not specified according to Java SASL
+ // documentation.
+ return 65536;
}
--
Gitblit v1.10.0