| opends/resource/config/admin-backend.ldif | ●●●●● patch | view | raw | blame | history | |
| opends/resource/config/config.ldif | ●●●●● patch | view | raw | blame | history | |
| opends/src/ads/org/opends/admin/ads/ADSContext.java | ●●●●● patch | view | raw | blame | history | |
| opends/src/ads/org/opends/admin/ads/ADSContextHelper.java | ●●●●● patch | view | raw | blame | history | |
| opends/src/ads/org/opends/admin/ads/SubtreeDeleteControl.java | ●●●●● patch | view | raw | blame | history | |
| opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java | ●●●●● patch | view | raw | blame | history | |
| opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java | ●●●●● patch | view | raw | blame | history |
opends/resource/config/admin-backend.ldif
New file @@ -0,0 +1,32 @@ dn: cn=admin data objectClass: ds-cfg-branch objectClass: top cn: admin data dn: cn=instance keys,cn=admin data objectClass: ds-cfg-branch objectClass: top cn: instance keys dn: cn=secret keys,cn=admin data objectClass: ds-cfg-branch objectClass: top cn: secret keys dn: cn=Administrators,cn=admin data objectClass: top objectClass: groupofurls memberURL: ldap:///cn=Administrators,cn=admin data??one?(objectclass=*) description: Group of identities which have full access. cn: Administrators dn: cn=Server Groups,cn=admin data objectClass: ds-cfg-branch objectClass: top cn: Server Groups dn: cn=all-servers,cn=Server Groups,cn=admin data objectClass: groupOfUniqueNames objectClass: top cn: all-servers opends/resource/config/config.ldif
@@ -356,6 +356,17 @@ ds-cfg-task-backing-file: config/tasks.ldif ds-cfg-task-retention-time: 24 hours dn: ds-cfg-backend-id=adminRoot,cn=Backends,cn=config objectClass: top objectClass: ds-cfg-backend objectClass: ds-cfg-ldif-backend ds-cfg-backend-id: adminRoot ds-cfg-backend-enabled: true ds-cfg-backend-class: org.opends.server.backends.LDIFBackend ds-cfg-backend-writability-mode: enabled ds-cfg-backend-base-dn: cn=admin data ds-cfg-ldif-file: config/admin-backend.ldif dn: cn=Certificate Mappers,cn=config objectClass: top objectClass: ds-cfg-branch opends/src/ads/org/opends/admin/ads/ADSContext.java
@@ -54,6 +54,8 @@ import javax.naming.ldap.InitialLdapContext; import javax.naming.ldap.LdapName; import javax.naming.ldap.Rdn; import javax.naming.ldap.Control; import javax.naming.ldap.LdapContext; /** * Class used to update and read the contents of the Administration Data. @@ -942,22 +944,22 @@ public void createAdminData(String backendName) throws ADSContextException { // Add the administration suffix createAdministrationSuffix(backendName); // createAdministrationSuffix(backendName); // Create the DIT below the administration suffix createTopContainerEntry(); createAdministratorContainerEntry(); // createTopContainerEntry(); // createAdministratorContainerEntry(); createContainerEntry(getServerContainerDN()); createContainerEntry(getServerGroupContainerDN()); // createContainerEntry(getServerGroupContainerDN()); // Add the default "all-servers" group Map<ServerGroupProperty, Object> allServersGroupsMap = new HashMap<ServerGroupProperty, Object>(); allServersGroupsMap.put(ServerGroupProperty.UID, ALL_SERVERGROUP_NAME); createServerGroup(allServersGroupsMap); // Map<ServerGroupProperty, Object> allServersGroupsMap = // new HashMap<ServerGroupProperty, Object>(); // allServersGroupsMap.put(ServerGroupProperty.UID, ALL_SERVERGROUP_NAME); // createServerGroup(allServersGroupsMap); // Create the CryptoManager DIT below the administration suffix createContainerEntry(getInstanceKeysContainerDN()); // createContainerEntry(getInstanceKeysContainerDN()); } /** @@ -966,7 +968,25 @@ */ public void removeAdminData() throws ADSContextException { removeAdministrationSuffix(); LdapName dn = nameFromDN(getServerContainerDN()); try { Control[] controls = new Control[] { new SubtreeDeleteControl() }; LdapContext tmpContext = dirContext.newInstance(controls); try { tmpContext.destroySubcontext(dn); } finally { tmpContext.close(); } } catch(NamingException x) { throw new ADSContextException( ADSContextException.ErrorType.ERROR_UNEXPECTED, x); } } @@ -979,7 +999,7 @@ */ public boolean hasAdminData() throws ADSContextException { return isExistingEntry(nameFromDN(getAdministrationSuffixDN())); return isExistingEntry(nameFromDN(getServerContainerDN())); } /** @@ -1975,28 +1995,29 @@ * Administration Suffix will be used. * @throws ADSContextException if something goes wrong. */ public void createAdministrationSuffix(String backendName) throws ADSContextException { ADSContextHelper helper = new ADSContextHelper(); String ben = backendName ; if (backendName == null) { ben = getDefaultBackendName() ; } helper.createAdministrationSuffix(getDirContext(), ben, getDbName(), getImportTemp()); } // public void createAdministrationSuffix(String backendName) // throws ADSContextException // { // ADSContextHelper helper = new ADSContextHelper(); // String ben = backendName ; // if (backendName == null) // { // ben = getDefaultBackendName() ; // } // helper.createAdministrationSuffix(getDirContext(), ben, // getDbName(), getImportTemp()); // } /** * Removes the administration suffix. * @throws ADSContextException if something goes wrong. */ private void removeAdministrationSuffix() throws ADSContextException { ADSContextHelper helper = new ADSContextHelper(); helper.removeAdministrationSuffix(getDirContext(), getDefaultBackendName()); } // private void removeAdministrationSuffix() throws ADSContextException // { // ADSContextHelper helper = new ADSContextHelper(); // helper.removeAdministrationSuffix(getDirContext(), // getDefaultBackendName()); // } /** * Returns the default backend name of the administration data. @@ -2007,15 +2028,15 @@ return "adminRoot"; } private static String getDbName() { return "adminDb"; } private static String getImportTemp() { return "importAdminTemp"; } // private static String getDbName() // { // return "adminDb"; // } // // private static String getImportTemp() // { // return "importAdminTemp"; // } opends/src/ads/org/opends/admin/ads/ADSContextHelper.java
@@ -28,7 +28,6 @@ package org.opends.admin.ads; import java.util.SortedSet; import java.util.TreeSet; import javax.naming.ldap.InitialLdapContext; @@ -37,7 +36,6 @@ import org.opends.server.admin.client.ldap.JNDIDirContextAdaptor; import org.opends.server.admin.client.ldap.LDAPManagementContext; import org.opends.server.admin.std.client.*; import org.opends.server.admin.std.meta.*; import org.opends.server.types.DN; /** @@ -122,52 +120,52 @@ * @throws ADSContextException if the administration suffix could not be * created. */ public void createAdministrationSuffix(InitialLdapContext ctx, String backendName, String dbDirectory, String importTempDirectory) throws ADSContextException { try { ManagementContext mCtx = LDAPManagementContext.createFromContext( JNDIDirContextAdaptor.adapt(ctx)); RootCfgClient root = mCtx.getRootConfiguration(); JEBackendCfgClient backend = null; try { backend = (JEBackendCfgClient)root.getBackend(backendName); } catch (ManagedObjectNotFoundException e) { } catch (ClassCastException cce) { throw new ADSContextException( ADSContextException.ErrorType.UNEXPECTED_ADS_BACKEND_TYPE, cce); } if (backend == null) { JEBackendCfgDefn provider = JEBackendCfgDefn.getInstance(); backend = root.createBackend(provider, backendName, null); backend.setBackendEnabled(true); backend.setBackendId(backendName); backend.setBackendDirectory(dbDirectory); backend.setBackendImportTempDirectory(importTempDirectory); backend.setBackendWritabilityMode( BackendCfgDefn.BackendWritabilityMode.ENABLED); } SortedSet<DN> suffixes = backend.getBackendBaseDN(); if (suffixes == null) { suffixes = new TreeSet<DN>(); } suffixes.add(DN.decode(ADSContext.getAdministrationSuffixDN())); backend.setBackendBaseDN(suffixes); backend.commit(); } catch (Throwable t) { throw new ADSContextException( ADSContextException.ErrorType.ERROR_UNEXPECTED, t); } } // public void createAdministrationSuffix(InitialLdapContext ctx, // String backendName, String dbDirectory, String importTempDirectory) // throws ADSContextException // { // try // { // ManagementContext mCtx = LDAPManagementContext.createFromContext( // JNDIDirContextAdaptor.adapt(ctx)); // RootCfgClient root = mCtx.getRootConfiguration(); // JEBackendCfgClient backend = null; // try // { // backend = (JEBackendCfgClient)root.getBackend(backendName); // } // catch (ManagedObjectNotFoundException e) // { // } // catch (ClassCastException cce) // { // throw new ADSContextException( // ADSContextException.ErrorType.UNEXPECTED_ADS_BACKEND_TYPE, cce); // } // if (backend == null) // { // JEBackendCfgDefn provider = JEBackendCfgDefn.getInstance(); // backend = root.createBackend(provider, backendName, null); // backend.setBackendEnabled(true); // backend.setBackendId(backendName); // backend.setBackendDirectory(dbDirectory); // backend.setBackendImportTempDirectory(importTempDirectory); // backend.setBackendWritabilityMode( // BackendCfgDefn.BackendWritabilityMode.ENABLED); // } // SortedSet<DN> suffixes = backend.getBackendBaseDN(); // if (suffixes == null) // { // suffixes = new TreeSet<DN>(); // } // suffixes.add(DN.decode(ADSContext.getAdministrationSuffixDN())); // backend.setBackendBaseDN(suffixes); // backend.commit(); // } // catch (Throwable t) // { // throw new ADSContextException( // ADSContextException.ErrorType.ERROR_UNEXPECTED, t); // } // } } opends/src/ads/org/opends/admin/ads/SubtreeDeleteControl.java
New file @@ -0,0 +1,82 @@ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at * trunk/opends/resource/legal-notices/OpenDS.LICENSE * or https://OpenDS.dev.java.net/OpenDS.LICENSE. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, * add the following below this CDDL HEADER, with the fields enclosed * by brackets "[]" replaced with your own identifying information: * Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END * * * Portions Copyright 2007 Sun Microsystems, Inc. */ package org.opends.admin.ads; import javax.naming.ldap.Control; /** * This class implements the LDAP subtree delete control for JNDI. */ public class SubtreeDeleteControl implements Control { /** * The serial version identifier required to satisfy the compiler * because this class implements <CODE>javax.ldap.naming.Control</CODE>, * which extends the <CODE>java.io.Serializable</CODE> interface. * This value was generated using the <CODE>serialver</CODE> * command-line utility included with the Java SDK. */ static final long serialVersionUID = 3941576361457157921L; /** * Retrieves the object identifier assigned for the LDAP control. * * @return The non-null object identifier string. */ public String getID() { return "1.2.840.113556.1.4.805"; } /** * Determines the criticality of the LDAP control. * A critical control must not be ignored by the server. * In other words, if the server receives a critical control * that it does not support, regardless of whether the control * makes sense for the operation, the operation will not be performed * and an <tt>OperationNotSupportedException</tt> will be thrown. * @return true if this control is critical; false otherwise. */ public boolean isCritical() { return true; } /** * Retrieves the ASN.1 BER encoded value of the LDAP control. * The result is the raw BER bytes including the tag and length of * the control's value. It does not include the controls OID or criticality. * * Null is returned if the value is absent. * * @return A possibly null byte array representing the ASN.1 BER encoded * value of the LDAP control. */ public byte[] getEncodedValue() { return new byte[] {}; } } opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java
@@ -2135,6 +2135,14 @@ } /** * Helper type for the <CODE>getCommonSuffixes</CODE> method. */ private enum SuffixRelationType { NOT_REPLICATED, FULLY_REPLICATED, REPLICATED, NOT_FULLY_REPLICATED, ALL } /** * Returns a Collection containing a list of suffixes that are defined in * two servers at the same time (depending on the value of the argument * replicated this list contains only the suffixes that are replicated @@ -2148,10 +2156,6 @@ * @return a Collection containing a list of suffixes that are replicated * (or those that can be replicated) in two servers. */ private enum SuffixRelationType { NOT_REPLICATED, FULLY_REPLICATED, REPLICATED, NOT_FULLY_REPLICATED, ALL }; private Collection<String> getCommonSuffixes( InitialLdapContext ctx1, InitialLdapContext ctx2, SuffixRelationType type) { @@ -3296,7 +3300,7 @@ } else if (!adsCtx1.hasAdminData() && adsCtx2.hasAdminData()) { adsCtx1.createAdministrationSuffix(null); // adsCtx1.createAdministrationSuffix(null); if (!hasAdministrator(adsCtx2.getDirContext())) { adsCtx2.createAdministrator(getAdministratorProperties(uData)); @@ -3310,7 +3314,7 @@ } else if (adsCtx1.hasAdminData() && !adsCtx2.hasAdminData()) { adsCtx2.createAdministrationSuffix(null); // adsCtx2.createAdministrationSuffix(null); if (!hasAdministrator(adsCtx1.getDirContext())) { adsCtx1.createAdministrator(getAdministratorProperties(uData)); @@ -3330,7 +3334,7 @@ adsCtx1.registerServer(server1.getAdsProperties()); server2.updateAdsPropertiesWithServerProperties(); adsCtx1.registerServer(server2.getAdsProperties()); adsCtx2.createAdministrationSuffix(null); // adsCtx2.createAdministrationSuffix(null); ctxSource = ctx1; ctxDestination = ctx2; @@ -3340,7 +3344,7 @@ catch (ADSContextException adce) { throw new ReplicationCliException( ERR_REPLICATION_UPDATING_ADS.get(adce.getMessage()), ERR_REPLICATION_UPDATING_ADS.get(adce.getReason()), ERROR_UPDATING_ADS, adce); } if (!adsAlreadyReplicated) opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -2027,13 +2027,13 @@ /* Act on local server depending on if using remote or local ADS */ notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CREATING_ADS.get())); localCtx = createLocalContext(); if (isRemoteServer) { /* Create an empty ADS suffix on the local server. */ ADSContext localAdsContext = new ADSContext(localCtx); localAdsContext.createAdministrationSuffix(null); } else // if (isRemoteServer) // { // /* Create an empty ADS suffix on the local server. */ // ADSContext localAdsContext = new ADSContext(localCtx); // localAdsContext.createAdministrationSuffix(null); // } if (!isRemoteServer) { /* Configure local server to have an ADS */ adsContext = new ADSContext(localCtx); // adsContext owns localCtx