From 7c30dbb5403772b323df3ad907d9ed15d23b5aee Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Thu, 29 Apr 2010 20:35:40 +0000
Subject: [PATCH] Last batch of changes for this week. This adds support for the IETF based Password Policy for LDAP as SubEntry. Also resolves the following issues : - 4544 :  initializeBackend() should not set JE env config params directly. - 4478 : ECL in draft compat mode / search lastchangenumber can be very long - 4538 : Virtual attributes not retrieved when entry cache configured - 4547 : Search Filter Matching differ for cn=Directory Manager and plain user. - 4514 : Logs shows unexpected message with replication monitoring data missing (Partial fix) - 4534 : Replication using security does not work after server restart - 4516 : SEVERE_ERROR: servers (...) have the same ServerId In addition, they also improve reliability and performance in various areas including CollectiveAttributes, Virtual Attributes and Subentries management, Schema loading, Replication...

---
 opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java |   41 +++++++++++++++++++++--------------------
 1 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java b/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java
index 42b255c..db31ee0 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2006-2009 Sun Microsystems, Inc.
+ *      Copyright 2006-2010 Sun Microsystems, Inc.
  */
 package org.opends.server.replication.server;
 
@@ -104,13 +104,6 @@
       }
 
       oldGenerationId = -100;
-
-      // Duplicate server ?
-      if (!replicationServerDomain.checkForDuplicateRS(this))
-      {
-        abortStart(null);
-        return false;
-      }
     }
     catch(Exception e)
     {
@@ -179,10 +172,8 @@
   public void connect(String serviceId, boolean sslEncryption)
   throws DirectoryException
   {
-
-    //
-    // the encryption we will request to the peer as we are the session creator
-    this.initSslEncryption = sslEncryption;
+    // we are the initiator and decides of the encryption
+    this.sslEncryption = sslEncryption;
 
     setServiceIdAndDomain(serviceId, false);
 
@@ -194,9 +185,6 @@
       //
       lockDomain(false); // no timeout
 
-      // we are the initiator and decides of the encryption
-      boolean sessionInitiatorSSLEncryption = this.initSslEncryption;
-
       // Send start
       ReplServerStartMsg outReplServerStartMsg =
         sendStartToRemote(ProtocolVersion.getCurrentVersion());
@@ -217,12 +205,19 @@
       // Process hello from remote
       processStartFromRemote((ReplServerStartMsg)msg);
 
+      // Duplicate server ?
+      if (!replicationServerDomain.checkForDuplicateRS(this))
+      {
+        abortStart(null);
+        return;
+      }
+
       // Log
       logStartHandshakeSNDandRCV(outReplServerStartMsg,(ReplServerStartMsg)msg);
 
       // Until here session is encrypted then it depends on the negociation
       // The session initiator decides whether to use SSL.
-      if (!sessionInitiatorSSLEncryption)
+      if (!this.sslEncryption)
         session.stopEncryption();
 
       if (protocolVersion > ProtocolVersion.REPLICATION_PROTOCOL_V1)
@@ -286,13 +281,19 @@
     oldGenerationId = -100;
     try
     {
-      // Process start from remote
-      boolean sessionInitiatorSSLEncryption =
-        processStartFromRemote(inReplServerStartMsg);
+      // The initiator decides if the session is encrypted
+      sslEncryption = processStartFromRemote(inReplServerStartMsg);
 
       // lock with timeout
       lockDomain(true);
 
+      // Duplicate server ?
+      if (!replicationServerDomain.checkForDuplicateRS(this))
+      {
+        abortStart(null);
+        return;
+      }
+
       this.localGenerationId = replicationServerDomain.getGenerationId();
       ReplServerStartMsg outReplServerStartMsg =
         sendStartToRemote(protocolVersion);
@@ -302,7 +303,7 @@
 
       // until here session is encrypted then it depends on the negotiation
       // The session initiator decides whether to use SSL.
-      if (!sessionInitiatorSSLEncryption)
+      if (!sslEncryption)
         session.stopEncryption();
 
       TopologyMsg inTopoMsg = null;

--
Gitblit v1.10.0