mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
13.16.2007 5425887fa59196b7ea2474d4893f10bb1a265446
Fix for issue 2612.

Initialization of the ADS fails when both servers where configured for replication separately.

The problem is that the entry that we read from the ADS is not complete (is missing the public key attribute). So when we use the server entry we read from one ADS to register that server in the other ADS the registration is not complete.

The fix consists simply on reading the public key certificate in the ADS when we construct the object representing the server.
1 files modified
22 ■■■■■ changed files
opendj-sdk/opends/src/ads/org/opends/admin/ads/ADSContext.java 22 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/ads/org/opends/admin/ads/ADSContext.java
@@ -708,6 +708,28 @@
        SearchResult sr = (SearchResult)ne.next();
        Map<ServerProperty,Object> properties =
          makePropertiesFromServerAttrs(sr.getAttributes());
        Object keyId = properties.get(ServerProperty.INSTANCE_KEY_ID);
        if (keyId != null)
        {
          try
          {
            SearchControls sc1 = new SearchControls();
            sc1.setSearchScope(SearchControls.ONELEVEL_SCOPE);
            final String attrIDs[] = { "ds-cfg-public-key-certificate;binary" };
            sc1.setReturningAttributes(attrIDs);
            SearchResult certEntry =
              dirContext.search(getInstanceKeysContainerDN(),
              "(ds-cfg-key-id="+keyId+")", sc).next();
            Attribute certAttr = certEntry.getAttributes().get(attrIDs[0]);
            properties.put(ServerProperty.INSTANCE_PUBLIC_KEY_CERTIFICATE,
                certAttr.get());
          }
          catch (NameNotFoundException x)
          {
            LOG.log(Level.WARNING, "Could not find public key for "+properties);
          }
        }
        result.add(properties);
      }
    }