From e349126d23ab22a1ef0640277bb672d63e6dd27b Mon Sep 17 00:00:00 2001
From: Chris Ridd <chris.ridd@forgerock.com>
Date: Mon, 22 Sep 2014 10:10:09 +0000
Subject: [PATCH] OPENDJ-1565 CR-4564: Optionally bind to a local address

---
 opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java b/opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
index 2fbdd9d..bf09c48 100644
--- a/opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
+++ b/opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
@@ -21,7 +21,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2011-2013 ForgeRock AS.
+ *      Copyright 2011-2014 ForgeRock AS.
  */
 package org.opends.server.extensions;
 
@@ -1334,7 +1334,11 @@
           plainSocket.setTcpNoDelay(cfg.isUseTCPNoDelay());
           plainSocket.setKeepAlive(cfg.isUseTCPKeepAlive());
           plainSocket.setSoTimeout(timeoutMS);
-
+          if (cfg.getSourceAddress() != null)
+          {
+            InetSocketAddress local = new InetSocketAddress(cfg.getSourceAddress(), 0);
+            plainSocket.bind(local);
+          }
           // Connect the ldapSocket.
           plainSocket.connect(socketAddress, timeoutMS);
 

--
Gitblit v1.10.0