OPENDJ-1342 Migrate AVA, RDN, and DN classes: DirectoryException => LocalizedIllegalArgumentException
DN.valueOf() now throws LocalizedIllegalArgumentException (it used to throw DirectoryException)
| | |
| | | for (TreePath path : paths) |
| | | { |
| | | BasicNode node = (BasicNode)path.getLastPathComponent(); |
| | | try |
| | | { |
| | | DN dn = DN.valueOf(node.getDN()); |
| | | entries.add(dn); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | throw new RuntimeException("Unexpected error parsing dn: "+ |
| | | node.getDN(), de); |
| | | } |
| | | entries.add(DN.valueOf(node.getDN())); |
| | | } |
| | | for (BackendDescriptor backend : info.getServerDescriptor().getBackends()) |
| | | { |
| | |
| | | import org.forgerock.opendj.ldap.AVA; |
| | | import org.forgerock.opendj.ldap.AttributeDescription; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.guitools.controlpanel.browser.BrowserController; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | |
| | | import org.opends.guitools.controlpanel.ui.nodes.BasicNode; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.messages.AdminToolMessages; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.opends.server.types.Schema; |
| | | |
| | | /** The task that is called when we must modify an entry. */ |
| | |
| | | this.newEntry = newEntry; |
| | | this.controller = controller; |
| | | this.treePath = path; |
| | | |
| | | DN newDn = newEntry.getName(); |
| | | try |
| | | oldDn = DN.valueOf(oldEntry.getDN()); |
| | | for (BackendDescriptor backend : info.getServerDescriptor().getBackends()) |
| | | { |
| | | oldDn = DN.valueOf(oldEntry.getDN()); |
| | | for (BackendDescriptor backend : info.getServerDescriptor().getBackends()) |
| | | for (BaseDNDescriptor baseDN : backend.getBaseDns()) |
| | | { |
| | | for (BaseDNDescriptor baseDN : backend.getBaseDns()) |
| | | if (newDn.isSubordinateOrEqualTo(baseDN.getDn()) || oldDn.isSubordinateOrEqualTo(baseDN.getDn())) |
| | | { |
| | | if (newDn.isSubordinateOrEqualTo(baseDN.getDn()) || |
| | | oldDn.isSubordinateOrEqualTo(baseDN.getDn())) |
| | | { |
| | | backendSet.add(backend.getBackendID()); |
| | | } |
| | | backendSet.add(backend.getBackendID()); |
| | | } |
| | | } |
| | | mustRename = !newDn.equals(oldDn); |
| | | } |
| | | catch (OpenDsException e) |
| | | { |
| | | throw new RuntimeException("Could not parse DN: " + oldEntry.getDN(), e); |
| | | } |
| | | mustRename = !newDn.equals(oldDn); |
| | | modifications = getModifications(newEntry, oldEntry, getInfo()); |
| | | |
| | | // Find password modifications |
| | | for (ModificationItem mod : modifications) |
| | | { |
| | |
| | | * modifications. |
| | | */ |
| | | ByteString oldRdnValueDeleted = null; |
| | | RDN oldRDN = null; |
| | | try |
| | | { |
| | | oldRDN = DN.valueOf(oldEntry.getDN()).rdn(); |
| | | } |
| | | catch (DirectoryException unexpected) |
| | | { |
| | | throw new RuntimeException("Unexpected error parsing DN: " + oldEntry.getDN(), unexpected); |
| | | } |
| | | RDN oldRDN = DN.valueOf(oldEntry.getDN()).rdn(); |
| | | for (AVA ava : oldRDN) |
| | | { |
| | | if (ava.getAttributeType().equals(attrDesc.getAttributeType())) |
| | |
| | | import org.opends.server.config.ConfigConstants; |
| | | import org.opends.server.tools.LDAPPasswordModify; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.OpenDsException; |
| | | |
| | | /** |
| | | * The task called when we want to reset the password of the user. |
| | | * |
| | | */ |
| | | /** The task called when we want to reset the password of the user. */ |
| | | public class ResetUserPasswordTask extends Task |
| | | { |
| | | private Set<String> backendSet; |
| | |
| | | backendSet = new HashSet<>(); |
| | | this.node = node; |
| | | this.newPassword = pwd; |
| | | try |
| | | dn = DN.valueOf(node.getDN()); |
| | | |
| | | for (BackendDescriptor backend : info.getServerDescriptor().getBackends()) |
| | | { |
| | | dn = DN.valueOf(node.getDN()); |
| | | for (BackendDescriptor backend : info.getServerDescriptor().getBackends()) |
| | | for (BaseDNDescriptor baseDN : backend.getBaseDns()) |
| | | { |
| | | for (BaseDNDescriptor baseDN : backend.getBaseDns()) |
| | | if (dn.isSubordinateOrEqualTo(baseDN.getDn())) |
| | | { |
| | | if (dn.isSubordinateOrEqualTo(baseDN.getDn())) |
| | | { |
| | | backendSet.add(backend.getBackendID()); |
| | | } |
| | | backendSet.add(backend.getBackendID()); |
| | | } |
| | | } |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | | throw new RuntimeException("Could not parse DN: "+node.getDN(), ode); |
| | | } |
| | | |
| | | try |
| | | { |
| | | InitialLdapContext ctx = |
| | |
| | | import javax.swing.event.ListSelectionListener; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.config.LDAPProfile; |
| | | import org.forgerock.opendj.config.PropertyException; |
| | |
| | | { |
| | | try |
| | | { |
| | | org.forgerock.opendj.ldap.DN.valueOf(baseDN); |
| | | DN.valueOf(baseDN); |
| | | } |
| | | catch (OpenDsException oe) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_INVALID_BASE_DN_FOR_VLV_PROVIDED.get(oe.getMessageObject())); |
| | | errors.add(ERR_CTRL_PANEL_INVALID_BASE_DN_FOR_VLV_PROVIDED.get(e.getMessageObject())); |
| | | setPrimaryInvalid(lBaseDN); |
| | | } |
| | | } |
| | |
| | | import org.opends.guitools.controlpanel.util.BackgroundTask; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | | /** |
| | | * The dialog that is displayed when we want to add entries to a set of groups. |
| | | * @author jvergara |
| | | * |
| | | */ |
| | | /** The dialog that is displayed when we want to add entries to a set of groups. */ |
| | | public class AddToGroupPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 1837745944604435848L; |
| | |
| | | oneGroupDefined = true; |
| | | } |
| | | } |
| | | catch (OpenDsException ode) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | errors.add(INFO_CTRL_PANEL_INVALID_DN_DETAILS.get(groupDn, |
| | | ode.getMessageObject())); |
| | | errors.add(INFO_CTRL_PANEL_INVALID_DN_DETAILS.get(groupDn, e.getMessageObject())); |
| | | } |
| | | } |
| | | } |
| | |
| | | Utilities.getParentDialog(this), |
| | | INFO_CTRL_PANEL_ADD_TO_GROUP_TITLE.get(), getInfo()); |
| | | LinkedHashSet<DN> groupDns = new LinkedHashSet<>(); |
| | | String[] grs = groups.getText().split("\n"); |
| | | try |
| | | for (String groupDn : groups.getText().split("\n")) |
| | | { |
| | | for (String groupDn : grs) |
| | | groupDn = groupDn.trim(); |
| | | if (groupDn.length() > 0) |
| | | { |
| | | groupDn = groupDn.trim(); |
| | | if (groupDn.length() > 0) |
| | | { |
| | | groupDns.add(DN.valueOf(groupDn)); |
| | | } |
| | | groupDns.add(DN.valueOf(groupDn)); |
| | | } |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | | throw new RuntimeException( |
| | | "Unexpected error decoding dn. Details: "+ode.getMessageObject(), |
| | | ode); |
| | | } |
| | | |
| | | try |
| | | { |
| | | AddToGroupTask newTask = |
| | |
| | | import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.OpenDsException; |
| | | |
| | | /** |
| | | * A simple dialog where the user can provide a base DN. |
| | | * |
| | | */ |
| | | /** A simple dialog where the user can provide a base DN. */ |
| | | public class BaseDNPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 2742173517231794830L; |
| | |
| | | { |
| | | DN.valueOf(dn.getText()); |
| | | } |
| | | catch (OpenDsException ode) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_INVALID_BASE_DN_PROVIDED.get(ode.getMessageObject())); |
| | | errors.add(ERR_CTRL_PANEL_INVALID_BASE_DN_PROVIDED.get(e.getMessageObject())); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.opends.server.types.Schema; |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | |
| | | for (TreePath path : paths) |
| | | { |
| | | BasicNode node = (BasicNode)path.getLastPathComponent(); |
| | | try |
| | | { |
| | | dns.add(DN.valueOf(node.getDN())); |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | | throw new RuntimeException( |
| | | "Unexpected error decoding dn. Details: "+ode.getMessageObject(), |
| | | ode); |
| | | } |
| | | dns.add(DN.valueOf(node.getDN())); |
| | | } |
| | | if (addToGroupDlg == null) |
| | | { |
| | |
| | | import javax.swing.event.DocumentEvent; |
| | | import javax.swing.event.DocumentListener; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.guitools.controlpanel.browser.BrowserController; |
| | | import org.opends.guitools.controlpanel.datamodel.CustomSearchResult; |
| | | import org.opends.guitools.controlpanel.ui.nodes.BasicNode; |
| | | import org.opends.guitools.controlpanel.util.BackgroundTask; |
| | | import org.opends.guitools.controlpanel.util.LDAPEntryReader; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.util.Base64; |
| | | import org.opends.server.util.LDIFException; |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | | /** |
| | | * The panel used to duplicate an entry. |
| | | * |
| | | */ |
| | | /** The panel used to duplicate an entry. */ |
| | | public class DuplicateEntryPanel extends AbstractNewEntryPanel |
| | | { |
| | | private static final long serialVersionUID = -9879879123123123L; |
| | |
| | | |
| | | DN aParentDN; |
| | | String aRdn; |
| | | try |
| | | DN nodeDN = DN.valueOf(node.getDN()); |
| | | if (nodeDN.isRootDN()) |
| | | { |
| | | DN nodeDN = DN.valueOf(node.getDN()); |
| | | if (nodeDN.isRootDN()) |
| | | { |
| | | aParentDN = nodeDN; |
| | | aRdn = "(1)"; |
| | | } |
| | | else |
| | | { |
| | | aParentDN = nodeDN.parent(); |
| | | aRdn = nodeDN.rdn().getFirstAVA().getAttributeValue() + "-1"; |
| | | } |
| | | aParentDN = nodeDN; |
| | | aRdn = "(1)"; |
| | | } |
| | | catch (DirectoryException de) |
| | | else |
| | | { |
| | | throw new IllegalStateException("Unexpected error decoding dn: '"+ |
| | | node.getDN()+"' error: "+de, de); |
| | | aParentDN = nodeDN.parent(); |
| | | aRdn = nodeDN.rdn().getFirstAVA().getAttributeValue() + "-1"; |
| | | } |
| | | |
| | | parentDN.setText(aParentDN != null ? aParentDN.toString() : ""); |
| | | name.setText(aRdn); |
| | | password.setText(""); |
| | |
| | | readEntry(node); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage getProgressDialogTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_DUPLICATE_ENTRY_TITLE.get(); |
| | |
| | | } |
| | | else |
| | | { |
| | | String newValue; |
| | | try |
| | | { |
| | | DN theDN = DN.valueOf(dn); |
| | | newValue = theDN.rdn().getFirstAVA().getAttributeValue().toString(); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | throw new IllegalStateException("Unexpected error with dn: '"+dn+ |
| | | "' "+de, de); |
| | | } |
| | | String newValue = getFirstValue(dn); |
| | | if (values.size() == 1) |
| | | { |
| | | sb.append("\n"); |
| | |
| | | } |
| | | else |
| | | { |
| | | String oldValue; |
| | | try |
| | | { |
| | | DN oldDN = DN.valueOf(entryToDuplicate.getDN()); |
| | | oldValue = oldDN.rdn().getFirstAVA().getAttributeValue().toString(); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | throw new IllegalStateException("Unexpected error with dn: '"+ |
| | | entryToDuplicate.getDN()+"' "+de, de); |
| | | } |
| | | String oldValue = getFirstValue(entryToDuplicate.getDN()); |
| | | for (Object value : values) |
| | | { |
| | | sb.append("\n"); |
| | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | private String getFirstValue(String dn) |
| | | { |
| | | return DN.valueOf(dn).rdn().getFirstAVA().getAttributeValue().toString(); |
| | | } |
| | | |
| | | private void browseClicked() |
| | | { |
| | | if (browseDlg == null) |
| | |
| | | displayMainPanel(); |
| | | setEnabledOK(true); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | displayErrorMessage(INFO_CTRL_PANEL_ERROR_DIALOG_TITLE.get(), |
| | | de.getMessageObject()); |
| | | displayErrorMessage(INFO_CTRL_PANEL_ERROR_DIALOG_TITLE.get(), e.getMessageObject()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import javax.swing.event.DocumentListener; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.config.LDAPProfile; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | |
| | | } |
| | | } |
| | | } |
| | | catch (OpenDsException oe) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | errors.add(INFO_CTRL_PANEL_INVALID_DN_DETAILS.get(dn, oe.getMessageObject())); |
| | | errors.add(INFO_CTRL_PANEL_INVALID_DN_DETAILS.get(dn, e.getMessageObject())); |
| | | setPrimaryInvalid(lDirectoryBaseDN); |
| | | } |
| | | |
| | |
| | | import org.opends.guitools.controlpanel.ui.nodes.DndBrowserNodes; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.LDAPURL; |
| | | import org.opends.server.types.OpenDsException; |
| | |
| | | oneMemberDefined = true; |
| | | } |
| | | } |
| | | catch (OpenDsException ode) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | errorFound = true; |
| | | errors.add(ERR_CTRL_PANEL_MEMBER_VALUE_NOT_VALID.get(member, ode.getMessageObject())); |
| | | errors.add(ERR_CTRL_PANEL_MEMBER_VALUE_NOT_VALID.get(member, e.getMessageObject())); |
| | | } |
| | | } |
| | | } |
| | |
| | | errors.add(ERR_CTRL_PANEL_REFERENCE_GROUP_NOT_DYNAMIC.get()); |
| | | } |
| | | } |
| | | catch (OpenDsException ode) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | errorFound = true; |
| | | errors.add(ERR_CTRL_PANEL_REFERENCE_GROUP_NOT_VALID.get(ode.getMessageObject())); |
| | | errors.add(ERR_CTRL_PANEL_REFERENCE_GROUP_NOT_VALID.get(e.getMessageObject())); |
| | | } |
| | | if (errorFound) |
| | | { |
| | |
| | | member = member.trim(); |
| | | if (member.length() > 0) |
| | | { |
| | | try |
| | | { |
| | | dns.add(DN.valueOf(member)); |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | | throw new RuntimeException("Unexpected error decoding DN: "+ |
| | | member, ode); |
| | | } |
| | | dns.add(DN.valueOf(member)); |
| | | } |
| | | } |
| | | |
| | |
| | | import javax.swing.event.ListDataListener; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | |
| | | return !index.getBaseDN().equals(DN.valueOf(getBaseDN())) || !index.getScope().equals(getScope()) |
| | | || !index.getFilter().equals(filter.getText().trim()) || !index.getSortOrder().equals(getSortOrder()); |
| | | } |
| | | catch (final OpenDsException odse) |
| | | catch (final LocalizedIllegalArgumentException unused) |
| | | { |
| | | // The base DN is not valid. This means that the index has been modified. |
| | | return true; |
| | |
| | | args.add("--index-name"); |
| | | args.add(indexName); |
| | | |
| | | try |
| | | if (!indexToModify.getBaseDN().equals(DN.valueOf(baseDN))) |
| | | { |
| | | final DN b = DN.valueOf(baseDN); |
| | | if (!indexToModify.getBaseDN().equals(b)) |
| | | { |
| | | args.add("--set"); |
| | | args.add("base-dn:" + baseDN); |
| | | } |
| | | } |
| | | catch (final OpenDsException odse) |
| | | { |
| | | throw new RuntimeException("Unexpected error parsing DN " + getBaseDN() + ": " + odse, odse); |
| | | args.add("--set"); |
| | | args.add("base-dn:" + baseDN); |
| | | } |
| | | |
| | | if (indexToModify.getScope() != searchScope) |
| | |
| | | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.LDAPURL; |
| | | import org.opends.server.types.OpenDsException; |
| | | |
| | | /** Class used to handle the case where numsubordinates does not work between databases. */ |
| | | public class NumSubordinateHacker { |
| | |
| | | if (!isUnreliableEntryListEmpty) { |
| | | boolean isInServer = serverHost.equalsIgnoreCase(url.getHost()) && serverPort == url.getPort(); |
| | | if (isInServer) { |
| | | try |
| | | { |
| | | return unreliableEntryList.contains(DN.valueOf(url.getRawBaseDN())); |
| | | } |
| | | catch (OpenDsException oe) |
| | | { |
| | | throw new RuntimeException("Error decoding DN of url: " + url); |
| | | } |
| | | return unreliableEntryList.contains(DN.valueOf(url.getRawBaseDN())); |
| | | } |
| | | } |
| | | return false; |
| | |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | |
| | | try (LDIFWriter writer = new LDIFWriter(exportConfig)) { |
| | | DN dn = DN.valueOf(baseDn); |
| | | writer.writeEntry(StaticUtils.createEntry(dn)); |
| | | } catch (DirectoryException | LDIFException | IOException de) { |
| | | } catch (LocalizedIllegalArgumentException | LDIFException | IOException de) { |
| | | throw new ApplicationException( |
| | | ReturnCode.CONFIGURATION_ERROR, |
| | | getThrowableMsg(INFO_ERROR_IMPORTING_LDIF.get(), de), de); |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Attributes; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.SearchResultEntry; |
| | |
| | | */ |
| | | private DN searchServerEntry() |
| | | { |
| | | DN returnDN = null; |
| | | |
| | | // Get the LDAP and LDAPS port |
| | | String ldapPort = getAttr("cn=LDAP Connection Handler,cn=Connection Handlers,cn=config", LDAP_PORT); |
| | | String ldapsPort = getAttr("cn=LDAPS Connection Handler,cn=Connection Handlers,cn=config", LDAP_PORT); |
| | |
| | | } |
| | | |
| | | // Look for a local server with the Ldap Port. |
| | | try |
| | | SearchRequest request = newSearchRequest(DN.valueOf("cn=Servers,cn=admin data"), SearchScope.SINGLE_LEVEL); |
| | | InternalSearchOperation op = internalConnection.processSearch(request); |
| | | if (op.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | SearchRequest request = newSearchRequest(DN.valueOf("cn=Servers,cn=admin data"), SearchScope.SINGLE_LEVEL); |
| | | InternalSearchOperation op = internalConnection.processSearch(request); |
| | | if (op.getResultCode() == ResultCode.SUCCESS) |
| | | Entry entry = findSameHostAndPort(op.getSearchEntries(), hostName, ldapPort, ldapsPortEnable, ldapsPort); |
| | | if (entry != null) |
| | | { |
| | | Entry entry = findSameHostAndPort(op.getSearchEntries(), hostName, ldapPort, ldapsPortEnable, ldapsPort); |
| | | if (entry != null) |
| | | { |
| | | returnDN = entry.getName(); |
| | | } |
| | | return entry.getName(); |
| | | } |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | // never happens because the filter is always valid. |
| | | return null; |
| | | } |
| | | return returnDN; |
| | | return null; |
| | | } |
| | | |
| | | private Entry findSameHostAndPort(LinkedList<SearchResultEntry> searchResultEntries, |
| | |
| | | */ |
| | | private String getAttr(String baseDN, String attrName) |
| | | { |
| | | InternalSearchOperation search; |
| | | try |
| | | { |
| | | SearchRequest request = Requests.newSearchRequest(DN.valueOf(baseDN), SearchScope.BASE_OBJECT) |
| | | .addAttribute(attrName); |
| | | search = internalConnection.processSearch(request); |
| | | if (search.getResultCode() != ResultCode.SUCCESS) |
| | | { |
| | | // can not happen |
| | | // best effort. |
| | | // TODO Log an Error. |
| | | return null; |
| | | } |
| | | } |
| | | catch (DirectoryException e) |
| | | SearchRequest request = Requests.newSearchRequest(DN.valueOf(baseDN), SearchScope.BASE_OBJECT) |
| | | .addAttribute(attrName); |
| | | InternalSearchOperation search = internalConnection.processSearch(request); |
| | | if (search.getResultCode() != ResultCode.SUCCESS) |
| | | { |
| | | // can not happen |
| | | // best effort. |
| | | logger.traceException(e); |
| | | // TODO Log an Error. |
| | | return null; |
| | | } |
| | | |
| | |
| | | |
| | | package org.opends.server.admin; |
| | | |
| | | |
| | | |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | |
| | | import java.util.EnumSet; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * DN property definition. |
| | |
| | | */ |
| | | public void setBaseDN(String baseDN) |
| | | throws IllegalArgumentException { |
| | | if (baseDN == null) { |
| | | setBaseDN((DN) null); |
| | | } else { |
| | | try { |
| | | setBaseDN(DN.valueOf(baseDN)); |
| | | } catch (DirectoryException e) { |
| | | throw new IllegalArgumentException(e); |
| | | } |
| | | } |
| | | setBaseDN(baseDN != null ? DN.valueOf(baseDN) : null); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN decodeValue(String value) |
| | | throws PropertyException { |
| | |
| | | DN dn = DN.valueOf(value); |
| | | validateValue(dn); |
| | | return dn; |
| | | } catch (DirectoryException | PropertyException e) { |
| | | } catch (LocalizedIllegalArgumentException | PropertyException e) { |
| | | throw PropertyException.illegalPropertyValueException(this, value); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) { |
| | | return v.visitDN(this, p); |
| | |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.*; |
| | | |
| | | /** |
| | | * A path which can be used to determine the location of a managed |
| | |
| | | /** Appends the RDN sequence representing the provided relation. */ |
| | | private void appendManagedObjectPathElement(RelationDefinition<?, ?> r) { |
| | | // Add the RDN sequence representing the relation. |
| | | try { |
| | | DN localName = DN.valueOf(profile.getRelationRDNSequence(r)); |
| | | dn = dn.child(localName); |
| | | } catch (DirectoryException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | DN localName = DN.valueOf(profile.getRelationRDNSequence(r)); |
| | | dn = dn.child(localName); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | |
| | | + "\" is not associated with the definition \"" + d.getName() + "\""); |
| | | } |
| | | |
| | | DN dn; |
| | | try { |
| | | dn = DN.valueOf(s); |
| | | } catch (DirectoryException e) { |
| | | throw new IllegalArgumentException("Unabled to decode the DN string: \"" |
| | | + s + "\""); |
| | | } |
| | | |
| | | DN dn = DN.valueOf(s); |
| | | RDN rdn = dn.rdn(); |
| | | if (rdn == null) { |
| | | throw new IllegalArgumentException("Unabled to decode the DN string: \"" |
| | |
| | | |
| | | |
| | | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.admin.LDAPProfile; |
| | | import org.opends.server.admin.ManagedObjectPath; |
| | | import org.opends.server.admin.RelationDefinition; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | |
| | | |
| | |
| | | public static DN create(ManagedObjectPath<?, ?> path, |
| | | RelationDefinition<?, ?> relation) { |
| | | DN dn = path.toDN(); |
| | | |
| | | try { |
| | | LDAPProfile profile = LDAPProfile.getInstance(); |
| | | DN localName = DN.valueOf(profile.getRelationRDNSequence(relation)); |
| | | return dn.child(localName); |
| | | } catch (DirectoryException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | LDAPProfile profile = LDAPProfile.getInstance(); |
| | | DN localName = DN.valueOf(profile.getRelationRDNSequence(relation)); |
| | | return dn.child(localName); |
| | | } |
| | | |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | |
| | | { |
| | | subentryDN = DN.valueOf(v); |
| | | } |
| | | catch (DirectoryException e) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | |
| | | import java.util.SortedSet; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.AttributeDescription; |
| | | import org.forgerock.opendj.ldap.AVA; |
| | | import org.forgerock.opendj.ldap.AttributeDescription; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | |
| | | { |
| | | debugSearchIndexDN = DN.valueOf("cn=debugsearch"); |
| | | } |
| | | catch (DirectoryException ex) |
| | | catch (LocalizedIllegalArgumentException unexpected) |
| | | { |
| | | // Should never happen. |
| | | } |
| | |
| | | container.setRights(container.getRights() | ACI_SELF); |
| | | } |
| | | } |
| | | catch (DirectoryException ex) |
| | | catch (LocalizedIllegalArgumentException ex) |
| | | { |
| | | // Log a message and keep going. |
| | | logger.warn(WARN_ACI_NOT_VALID_DN, dnString); |
| | |
| | | import java.util.regex.Pattern; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.api.Group; |
| | |
| | | matched=EnumEvalResult.TRUE; |
| | | break; |
| | | } |
| | | } catch (DirectoryException ex) { |
| | | } catch (LocalizedIllegalArgumentException ignored) { |
| | | break; |
| | | } |
| | | } |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | |
| | | if(dn.equals(clientDN)) { |
| | | return EnumEvalResult.TRUE; |
| | | } |
| | | } catch (DirectoryException ex) { |
| | | } catch (LocalizedIllegalArgumentException ignored) { |
| | | break; |
| | | } |
| | | } |
| | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.config.ConfigConstants; |
| | |
| | | import org.opends.server.replication.server.changelog.file.ECLMultiDomainDBCursor; |
| | | import org.opends.server.replication.server.changelog.file.MultiDomainDBCursor; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.BackupConfig; |
| | | import org.opends.server.types.BackupDirectory; |
| | | import org.opends.server.types.CanceledOperationException; |
| | | import org.opends.server.types.Control; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.FilterType; |
| | |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.types.Privilege; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.opends.server.types.RawAttribute; |
| | | import org.opends.server.types.RestoreConfig; |
| | | import org.opends.server.types.SearchFilter; |
| | |
| | | private static final AttributeType MODIFIERS_NAME_TYPE = getAttributeType(OP_ATTR_MODIFIERS_NAME); |
| | | |
| | | /** The base DN for the external change log. */ |
| | | public static final DN CHANGELOG_BASE_DN; |
| | | |
| | | static |
| | | { |
| | | try |
| | | { |
| | | CHANGELOG_BASE_DN = DN.valueOf(DN_EXTERNAL_CHANGELOG_ROOT); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | public static final DN CHANGELOG_BASE_DN = DN.valueOf(DN_EXTERNAL_CHANGELOG_ROOT); |
| | | |
| | | /** The set of base DNs for this backend. */ |
| | | private DN[] baseDNs; |
| | |
| | | import java.util.TreeSet; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.config.SizeUnit; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | { |
| | | return DN.valueOf(baseDNArg.getValue()); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | printWrappedText(err, ERR_BACKEND_DEBUG_DECODE_BASE_DN.get(baseDNArg.getValue(), getExceptionMessage(de))); |
| | | throw de; |
| | | printWrappedText(err, ERR_BACKEND_DEBUG_DECODE_BASE_DN.get(baseDNArg.getValue(), getExceptionMessage(e))); |
| | | throw e; |
| | | } |
| | | } |
| | | |
| | |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ByteSequenceReader; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.LDAPURL; |
| | |
| | | { |
| | | return DN.valueOf(r.readStringUtf8(dnLength)); |
| | | } |
| | | catch (DirectoryException e) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | throw new StorageRuntimeException("Unable to decode DN from binary value", e); |
| | | } |
| | |
| | | { |
| | | return toKey(DN.valueOf(key)); |
| | | } |
| | | catch (DirectoryException e) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | return ByteString.empty(); |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | |
| | | import org.opends.server.types.CancelResult; |
| | | import org.opends.server.types.CanceledOperationException; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.types.ObjectClass; |
| | |
| | | entryDN = DN.valueOf(rawEntryDN); |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(de); |
| | | setResponseData(de); |
| | | logger.traceException(e); |
| | | setResultCode(ResultCode.INVALID_DN_SYNTAX); |
| | | appendErrorMessage(e.getMessageObject()); |
| | | } |
| | | return entryDN; |
| | | } |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.DITCacheMap; |
| | | import org.opends.server.api.plugin.InternalDirectoryServerPlugin; |
| | | import org.opends.server.api.plugin.PluginResult.PostResponse; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.DisconnectReason; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.operation.PostResponseDeleteOperation; |
| | |
| | | */ |
| | | public AuthenticatedUsers() |
| | | { |
| | | super(toDN(CONFIG_DN), EnumSet.of( |
| | | super(DN.valueOf(CONFIG_DN), EnumSet.of( |
| | | // No implementation is required for add operations, since a connection |
| | | // can not be authenticated as a user that does not exist yet. |
| | | POST_RESPONSE_MODIFY, POST_RESPONSE_MODIFY_DN, POST_RESPONSE_DELETE), |
| | |
| | | DirectoryServer.registerInternalPlugin(this); |
| | | } |
| | | |
| | | private static DN toDN(String dn) |
| | | { |
| | | try |
| | | { |
| | | return DN.valueOf(dn); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Registers the provided user DN and client connection with this object. |
| | | * |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | |
| | | bindDN = null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final DN getBindDN() |
| | | { |
| | |
| | | bindDN = DN.valueOf(rawBindDN); |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(de); |
| | | logger.traceException(e); |
| | | |
| | | setResultCode(ResultCode.INVALID_CREDENTIALS); |
| | | setAuthFailureReason(de.getMessageObject()); |
| | | setAuthFailureReason(e.getMessageObject()); |
| | | } |
| | | return bindDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final ByteString getSimplePassword() |
| | | { |
| | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.AttributeDescription; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | import org.opends.server.types.CancelResult; |
| | | import org.opends.server.types.CanceledOperationException; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Operation; |
| | | import org.opends.server.types.OperationType; |
| | |
| | | { |
| | | entryDN = DN.valueOf(rawEntryDN); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(de); |
| | | logger.traceException(e); |
| | | |
| | | setResultCode(de.getResultCode()); |
| | | appendErrorMessage(de.getMessageObject()); |
| | | setResultCode(ResultCode.INVALID_DN_SYNTAX); |
| | | appendErrorMessage(e.getMessageObject()); |
| | | } |
| | | } |
| | | return entryDN; |
| | |
| | | entryDN = DN.valueOf(rawEntryDN); |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(de); |
| | | logger.traceException(e); |
| | | |
| | | setResultCode(de.getResultCode()); |
| | | appendErrorMessage(de.getMessageObject()); |
| | | setResultCode(ResultCode.INVALID_DN_SYNTAX); |
| | | appendErrorMessage(e.getMessageObject()); |
| | | |
| | | return; |
| | | } |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | |
| | | entryDN = DN.valueOf(rawEntryDN); |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(de); |
| | | setResponseData(de); |
| | | logger.traceException(e); |
| | | setResultCode(ResultCode.INVALID_DN_SYNTAX); |
| | | appendErrorMessage(e.getMessageObject()); |
| | | } |
| | | return entryDN; |
| | | } |
| | |
| | | import javax.management.MBeanServerFactory; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | |
| | | // Re-register all of the change listeners with the configuration. |
| | | for (String dnStr : addListeners.keySet()) |
| | | { |
| | | try |
| | | for (ConfigAddListener listener : addListeners.get(dnStr)) |
| | | { |
| | | DN dn = DN.valueOf(dnStr); |
| | | for (ConfigAddListener listener : addListeners.get(dnStr)) |
| | | { |
| | | configHandler.getConfigEntry(dn).registerAddListener(listener); |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | // This should never happen, so we'll just re-throw it. |
| | | throw new InitializationException(de.getMessageObject()); |
| | | configHandler.getConfigEntry(toDn(dnStr)).registerAddListener(listener); |
| | | } |
| | | } |
| | | |
| | | for (String dnStr : deleteListeners.keySet()) |
| | | { |
| | | try |
| | | for (ConfigDeleteListener listener : deleteListeners.get(dnStr)) |
| | | { |
| | | DN dn = DN.valueOf(dnStr); |
| | | for (ConfigDeleteListener listener : deleteListeners.get(dnStr)) |
| | | { |
| | | configHandler.getConfigEntry(dn).registerDeleteListener(listener); |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | // This should never happen, so we'll just re-throw it. |
| | | throw new InitializationException(de.getMessageObject()); |
| | | configHandler.getConfigEntry(toDn(dnStr)).registerDeleteListener(listener); |
| | | } |
| | | } |
| | | |
| | | for (String dnStr : changeListeners.keySet()) |
| | | { |
| | | try |
| | | for (ConfigChangeListener listener : changeListeners.get(dnStr)) |
| | | { |
| | | DN dn = DN.valueOf(dnStr); |
| | | for (ConfigChangeListener listener : changeListeners.get(dnStr)) |
| | | { |
| | | configHandler.getConfigEntry(dn).registerChangeListener(listener); |
| | | } |
| | | configHandler.getConfigEntry(toDn(dnStr)).registerChangeListener(listener); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | // This should never happen, so we'll just re-throw it. |
| | | throw new InitializationException(de.getMessageObject()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private DN toDn(String dn) throws InitializationException |
| | | { |
| | | try |
| | | { |
| | | return DN.valueOf(dn); |
| | | } |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | // This should never happen, so we'll just re-throw it. |
| | | throw new InitializationException(e.getMessageObject(), e); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public static DN getMonitorProviderDN(MonitorProvider provider) |
| | | { |
| | | String monitorName = provider.getMonitorInstanceName(); |
| | | try |
| | | { |
| | | // Get a complete DN which could be a tree naming schema |
| | | return DN.valueOf("cn="+monitorName+","+DN_MONITOR_ROOT); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | // Cannot reach this point. |
| | | throw new RuntimeException(); |
| | | } |
| | | // Get a complete DN which could be a tree naming schema |
| | | return DN.valueOf("cn=" + provider.getMonitorInstanceName() + "," + DN_MONITOR_ROOT); |
| | | } |
| | | |
| | | /** |
| | |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | |
| | | import org.opends.server.types.CancelResult; |
| | | import org.opends.server.types.CanceledOperationException; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.Operation; |
| | |
| | | entryDN = null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final DN getEntryDN() |
| | | { |
| | | try |
| | | if (entryDN == null) |
| | | { |
| | | if (entryDN == null) |
| | | { |
| | | entryDN = DN.valueOf(rawEntryDN); |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | logger.traceException(de); |
| | | setResultCode(de.getResultCode()); |
| | | appendErrorMessage(de.getMessageObject()); |
| | | entryDN = valueOfRawDN(rawEntryDN); |
| | | } |
| | | return entryDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | private DN valueOfRawDN(ByteString dn) |
| | | { |
| | | try |
| | | { |
| | | return dn != null ? DN.valueOf(dn) : null; |
| | | } |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(e); |
| | | setResultCode(ResultCode.INVALID_DN_SYNTAX); |
| | | appendErrorMessage(e.getMessageObject()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public final ByteString getRawNewRDN() |
| | | { |
| | |
| | | newRDN = RDN.valueOf(rawNewRDN.toString()); |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(de); |
| | | logger.traceException(e); |
| | | |
| | | setResultCode(de.getResultCode()); |
| | | appendErrorMessage(de.getMessageObject()); |
| | | setResultCode(ResultCode.INVALID_DN_SYNTAX); |
| | | appendErrorMessage(e.getMessageObject()); |
| | | } |
| | | return newRDN; |
| | | } |
| | |
| | | newDN = null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final DN getNewSuperior() |
| | | { |
| | | if (rawNewSuperior == null) |
| | | if (newSuperior == null) |
| | | { |
| | | newSuperior = null; |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | if (newSuperior == null) |
| | | { |
| | | newSuperior = DN.valueOf(rawNewSuperior); |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | logger.traceException(de); |
| | | |
| | | setResultCode(de.getResultCode()); |
| | | appendErrorMessage(de.getMessageObject()); |
| | | } |
| | | newSuperior = valueOfRawDN(rawNewSuperior); |
| | | } |
| | | return newSuperior; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final List<Modification> getModifications() |
| | | { |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | |
| | | entryDN = null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final DN getEntryDN() |
| | | { |
| | |
| | | try { |
| | | entryDN = DN.valueOf(rawEntryDN); |
| | | } |
| | | catch (DirectoryException de) { |
| | | logger.traceException(de); |
| | | catch (LocalizedIllegalArgumentException e) { |
| | | logger.traceException(e); |
| | | |
| | | setResultCode(de.getResultCode()); |
| | | appendErrorMessage(de.getMessageObject()); |
| | | setResultCode(ResultCode.INVALID_DN_SYNTAX); |
| | | appendErrorMessage(e.getMessageObject()); |
| | | } |
| | | } |
| | | return entryDN; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final List<RawModification> getRawModifications() |
| | | { |
| | |
| | | import java.util.Set; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DereferenceAliasesPolicy; |
| | |
| | | baseDN = DN.valueOf(rawBaseDN); |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(de); |
| | | setResponseData(de); |
| | | logger.traceException(e); |
| | | setResultCode(ResultCode.INVALID_DN_SYNTAX); |
| | | appendErrorMessage(e.getMessageObject()); |
| | | } |
| | | return baseDN; |
| | | } |
| | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Map.Entry; |
| | | import java.util.Set; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.ConcurrentMap; |
| | | |
| | |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.admin.std.server.VirtualAttributeCfg; |
| | | import org.opends.server.api.VirtualAttributeProvider; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.VirtualAttributeRule; |
| | | |
| | | /** |
| | | * This class defines a utility that will be used to manage the set of |
| | |
| | | |
| | | private DN getDummyDN(VirtualAttributeRule rule) |
| | | { |
| | | try |
| | | { |
| | | String name = rule.getAttributeType().getNameOrOID(); |
| | | return DN.valueOf("cn=" + name + ",cn=Virtual Attributes,cn=config"); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | // should never happen |
| | | throw new RuntimeException(e); |
| | | } |
| | | String name = rule.getAttributeType().getNameOrOID(); |
| | | return DN.valueOf("cn=" + name + ",cn=Virtual Attributes,cn=config"); |
| | | } |
| | | } |
| | |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.io.PrintStream; |
| | | import java.security.*; |
| | | import java.security.GeneralSecurityException; |
| | | import java.security.InvalidKeyException; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.PrivateKey; |
| | | import java.security.SecureRandom; |
| | | import java.security.cert.Certificate; |
| | | import java.security.cert.CertificateFactory; |
| | | import java.text.ParseException; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | | import java.util.UUID; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.zip.DataFormatException; |
| | | import java.util.zip.Deflater; |
| | | import java.util.zip.Inflater; |
| | | |
| | | import javax.crypto.*; |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.CipherInputStream; |
| | | import javax.crypto.CipherOutputStream; |
| | | import javax.crypto.KeyGenerator; |
| | | import javax.crypto.Mac; |
| | | import javax.crypto.SecretKey; |
| | | import javax.crypto.spec.IvParameterSpec; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import javax.net.ssl.KeyManager; |
| | |
| | | import org.opends.server.tools.LDAPConnectionOptions; |
| | | import org.opends.server.tools.LDAPReader; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeBuilder; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.CryptoManager; |
| | | import org.opends.server.types.CryptoManagerException; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.IdentifiedException; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | import org.opends.server.util.Base64; |
| | | import org.opends.server.util.SelectableCertificateKeyManager; |
| | | import org.opends.server.util.ServerConstants; |
| | |
| | | ocCipherKey = DirectoryServer.getObjectClass(OC_CRYPTO_CIPHER_KEY); |
| | | ocMacKey = DirectoryServer.getObjectClass(OC_CRYPTO_MAC_KEY); |
| | | |
| | | try { |
| | | localTruststoreDN = DN.valueOf(DN_TRUST_STORE_ROOT); |
| | | DN adminSuffixDN = DN.valueOf(ADSContext.getAdministrationSuffixDN()); |
| | | instanceKeysDN = adminSuffixDN.child(DN.valueOf("cn=instance keys")); |
| | | secretKeysDN = adminSuffixDN.child(DN.valueOf("cn=secret keys")); |
| | | serversDN = adminSuffixDN.child(DN.valueOf("cn=Servers")); |
| | | } |
| | | catch (DirectoryException ex) { |
| | | logger.traceException(ex); |
| | | throw new InitializationException(ex.getMessageObject()); |
| | | } |
| | | localTruststoreDN = DN.valueOf(DN_TRUST_STORE_ROOT); |
| | | DN adminSuffixDN = DN.valueOf(ADSContext.getAdministrationSuffixDN()); |
| | | instanceKeysDN = adminSuffixDN.child(DN.valueOf("cn=instance keys")); |
| | | secretKeysDN = adminSuffixDN.child(DN.valueOf("cn=secret keys")); |
| | | serversDN = adminSuffixDN.child(DN.valueOf("cn=Servers")); |
| | | |
| | | schemaInitDone = true; |
| | | } |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.CryptoManagerException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | import org.opends.server.types.operation.PostResponseAddOperation; |
| | |
| | | */ |
| | | public CryptoManagerSync() throws InitializationException |
| | | { |
| | | super(toDN(CONFIG_DN), EnumSet.of( |
| | | super(DN.valueOf(CONFIG_DN), EnumSet.of( |
| | | // No implementation required for modify_dn operations |
| | | // FIXME: Technically it is possible to perform a subtree modDN |
| | | // in this case however such subtree modDN would essentially be |
| | |
| | | DirectoryServer.registerInternalPlugin(this); |
| | | } |
| | | |
| | | private static DN toDN(final String dn) throws InitializationException |
| | | { |
| | | try |
| | | { |
| | | return DN.valueOf(dn); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | |
| | | private void searchAdminSuffix() |
| | | { |
| | | SearchRequest request = newSearchRequest(adminSuffixDN, SearchScope.WHOLE_SUBTREE, keySearchFilter); |
| | |
| | | import java.text.ParseException; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.CramMD5SASLMechanismHandlerCfg; |
| | | import org.opends.server.admin.std.server.SASLMechanismHandlerCfg; |
| | | import org.opends.server.api.*; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.api.AuthenticationPolicyState; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.IdentityMapper; |
| | | import org.opends.server.api.SASLMechanismHandler; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.PasswordPolicyState; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.AuthenticationInfo; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | |
| | | { |
| | | userDN = DN.valueOf(userName.substring(3)); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(de); |
| | | logger.traceException(e); |
| | | |
| | | bindOperation.setResultCode(ResultCode.INVALID_CREDENTIALS); |
| | | |
| | | LocalizableMessage message = ERR_SASLCRAMMD5_CANNOT_DECODE_USERNAME_AS_DN.get( |
| | | userName, de.getMessageObject()); |
| | | LocalizableMessage message = ERR_SASLCRAMMD5_CANNOT_DECODE_USERNAME_AS_DN.get(userName, e.getMessageObject()); |
| | | bindOperation.setAuthFailureReason(message); |
| | | return; |
| | | } |
| | |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.Syntax; |
| | | import org.opends.server.admin.std.server.MonitorProviderCfg; |
| | | import org.opends.server.api.AlertGenerator; |
| | |
| | | import org.opends.server.api.ServerShutdownListener; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.Attributes; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getComponentEntryDN() |
| | | { |
| | |
| | | { |
| | | return DN.valueOf(INSTANCENAME); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException ignored) |
| | | { |
| | | return DN.rootDN(); |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getClassName() |
| | | { |
| | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.VirtualAttributeRule; |
| | |
| | | { |
| | | dnSet.add(DN.valueOf(filter.getAssertionValue())); |
| | | } |
| | | catch (DirectoryException e) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(e); |
| | | } |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | |
| | | { |
| | | userDN = DN.valueOf(authzIDStr.substring(3)); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException de) |
| | | { |
| | | logger.traceException(de); |
| | | |
| | |
| | | { |
| | | userDN = DN.valueOf(authzIDStr); |
| | | } |
| | | catch (DirectoryException ignored) |
| | | catch (LocalizedIllegalArgumentException ignored) |
| | | { |
| | | logger.traceException(ignored); |
| | | } |
| | |
| | | { |
| | | targetDN = DN.valueOf(dnString); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(de); |
| | | logger.traceException(e); |
| | | |
| | | operation.setResponseData(de); |
| | | operation.setResultCode(ResultCode.INVALID_DN_SYNTAX); |
| | | operation.appendErrorMessage(e.getMessageObject()); |
| | | return; |
| | | } |
| | | |
| | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.PlainSASLMechanismHandlerCfg; |
| | | import org.opends.server.admin.std.server.SASLMechanismHandlerCfg; |
| | | import org.opends.server.api.AuthenticationPolicyState; |
| | | import org.opends.server.api.IdentityMapper; |
| | | import org.opends.server.api.SASLMechanismHandler; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.AuthenticationInfo; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.Privilege; |
| | | |
| | | /** |
| | | * This class provides an implementation of a SASL mechanism that uses |
| | |
| | | { |
| | | userDN = DN.valueOf(authcID.substring(3)); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(de); |
| | | logger.traceException(e); |
| | | |
| | | bindOperation.setResultCode(ResultCode.INVALID_CREDENTIALS); |
| | | |
| | | LocalizableMessage message = ERR_SASLPLAIN_CANNOT_DECODE_AUTHCID_AS_DN.get( |
| | | authcID, de.getMessageObject()); |
| | | bindOperation.setAuthFailureReason(message); |
| | | bindOperation.setAuthFailureReason( |
| | | ERR_SASLPLAIN_CANNOT_DECODE_AUTHCID_AS_DN.get(authcID, e.getMessageObject())); |
| | | return; |
| | | } |
| | | |
| | | if (userDN.isRootDN()) |
| | | { |
| | | bindOperation.setResultCode(ResultCode.INVALID_CREDENTIALS); |
| | | |
| | | LocalizableMessage message = ERR_SASLPLAIN_AUTHCID_IS_NULL_DN.get(); |
| | | bindOperation.setAuthFailureReason(message); |
| | | bindOperation.setAuthFailureReason(ERR_SASLPLAIN_AUTHCID_IS_NULL_DN.get()); |
| | | return; |
| | | } |
| | | |
| | |
| | | { |
| | | authzDN = DN.valueOf(authzID.substring(3)); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(de); |
| | | logger.traceException(e); |
| | | |
| | | bindOperation.setResultCode(ResultCode.INVALID_CREDENTIALS); |
| | | |
| | | LocalizableMessage message = ERR_SASLPLAIN_AUTHZID_INVALID_DN.get( |
| | | authzID, de.getMessageObject()); |
| | | bindOperation.setAuthFailureReason(message); |
| | | bindOperation.setAuthFailureReason(ERR_SASLPLAIN_AUTHZID_INVALID_DN.get(authzID, e.getMessageObject())); |
| | | return; |
| | | } |
| | | |
| | |
| | | import java.security.PrivilegedExceptionAction; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import javax.security.auth.Subject; |
| | | import javax.security.auth.callback.*; |
| | | import javax.security.auth.login.LoginContext; |
| | | import javax.security.sasl.*; |
| | | |
| | | import org.ietf.jgss.GSSException; |
| | | import javax.security.auth.Subject; |
| | | import javax.security.auth.callback.Callback; |
| | | import javax.security.auth.callback.CallbackHandler; |
| | | import javax.security.auth.callback.NameCallback; |
| | | import javax.security.auth.callback.PasswordCallback; |
| | | import javax.security.auth.callback.UnsupportedCallbackException; |
| | | import javax.security.auth.login.LoginContext; |
| | | import javax.security.sasl.AuthorizeCallback; |
| | | import javax.security.sasl.RealmCallback; |
| | | import javax.security.sasl.Sasl; |
| | | import javax.security.sasl.SaslException; |
| | | import javax.security.sasl.SaslServer; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.ietf.jgss.GSSException; |
| | | import org.opends.server.api.AuthenticationPolicyState; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.IdentityMapper; |
| | |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.PasswordPolicyState; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.LDAPClientConnection; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.AuthenticationInfo; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Privilege; |
| | | |
| | | /** |
| | | * This class defines the SASL context needed to process GSSAPI and DIGEST-MD5 |
| | |
| | | { |
| | | authzDN = DN.valueOf(responseAuthzID.substring(3)); |
| | | } |
| | | catch (final DirectoryException e) |
| | | catch (final LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(e); |
| | | setCallbackMsg(ERR_SASL_AUTHZID_INVALID_DN.get(responseAuthzID, |
| | |
| | | { |
| | | userDN = DN.valueOf(userName.substring(3)); |
| | | } |
| | | catch (final DirectoryException e) |
| | | catch (final LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(e); |
| | | setCallbackMsg(ERR_SASL_CANNOT_DECODE_USERNAME_AS_DN.get(mechanism, |
| | |
| | | import javax.security.auth.x500.X500Principal; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | |
| | | { |
| | | peerDN = DN.valueOf(peerName); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException de) |
| | | { |
| | | LocalizableMessage message = ERR_SATUACM_CANNOT_DECODE_SUBJECT_AS_DN.get( |
| | | peerName, de.getMessageObject()); |
| | |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | { |
| | | targetDN = DN.valueOf(v); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(de); |
| | | logger.traceException(e); |
| | | |
| | | LocalizableMessage message = ERR_VIRTUAL_STATIC_GROUP_CANNOT_DECODE_TARGET. |
| | | get(v, groupEntry.getName(), de.getMessageObject()); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, message, de); |
| | | get(v, groupEntry.getName(), e.getMessageObject()); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, message, e); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageDescriptor.Arg2; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.Group; |
| | | import org.opends.server.authorization.dseecompat.PatternDN; |
| | | import org.opends.server.core.*; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.CompareOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.GroupManager; |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.types.AdditionalLogItem; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.Operation; |
| | | import org.opends.server.types.OperationType; |
| | | |
| | | /** |
| | | * This class provides the base implementation of the access loggers used by the |
| | |
| | | { |
| | | targetDN = DN.valueOf(rawTargetDN); |
| | | } |
| | | catch (final DirectoryException e) |
| | | catch (final LocalizedIllegalArgumentException e) |
| | | { |
| | | // The DN raw target DN was invalid: |
| | | // Invalid DN will never match equal-to patterns, |
| | |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | |
| | | import org.opends.server.schema.UserPasswordSyntax; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeBuilder; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.LDIFImportConfig; |
| | |
| | | |
| | | break policyLoop; |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.warn(WARN_PLUGIN_PWIMPORT_CANNOT_DECODE_POLICY_DN, entry.getName(), de.getMessageObject()); |
| | | logger.warn(WARN_PLUGIN_PWIMPORT_CANNOT_DECODE_POLICY_DN, entry.getName(), e.getMessageObject()); |
| | | break policyLoop; |
| | | } |
| | | } |
| | |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | |
| | | DN movedDN=DN.valueOf(a[1]); |
| | | processModifyDN(origDn, movedDN); |
| | | } |
| | | } catch (DirectoryException ex) { |
| | | } catch (LocalizedIllegalArgumentException e) { |
| | | //This exception should rarely happen since the plugin wrote the DN |
| | | //strings originally. |
| | | logger.error(ERR_PLUGIN_REFERENT_CANNOT_DECODE_STRING_AS_DN, ex.getMessage()); |
| | | logger.error(ERR_PLUGIN_REFERENT_CANNOT_DECODE_STRING_AS_DN, e.getMessage()); |
| | | } |
| | | } |
| | | reader.close(); |
| | |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.AVA; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta.PluginCfgDefn; |
| | |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.types.LDIFImportConfig; |
| | |
| | | { |
| | | entryDN = DN.valueOf(addOperation.getRawEntryDN()); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | return PluginResult.PreParse.stopProcessing(de.getResultCode(), |
| | | ERR_PLUGIN_7BIT_CANNOT_DECODE_DN.get(de.getMessageObject())); |
| | | return PluginResult.PreParse.stopProcessing(ResultCode.INVALID_DN_SYNTAX, |
| | | ERR_PLUGIN_7BIT_CANNOT_DECODE_DN.get(e.getMessageObject())); |
| | | } |
| | | |
| | | if (isInScope(config, entryDN)) |
| | |
| | | { |
| | | entryDN = DN.valueOf(modifyOperation.getRawEntryDN()); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | return PluginResult.PreParse.stopProcessing(de.getResultCode(), |
| | | ERR_PLUGIN_7BIT_CANNOT_DECODE_DN.get(de.getMessageObject())); |
| | | return PluginResult.PreParse.stopProcessing(ResultCode.INVALID_DN_SYNTAX, |
| | | ERR_PLUGIN_7BIT_CANNOT_DECODE_DN.get(e.getMessageObject())); |
| | | } |
| | | |
| | | if (isInScope(config, entryDN)) |
| | |
| | | { |
| | | entryDN = DN.valueOf(modifyDNOperation.getRawEntryDN()); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | return PluginResult.PreParse.stopProcessing(de.getResultCode(), |
| | | ERR_PLUGIN_7BIT_CANNOT_DECODE_DN.get(de.getMessageObject())); |
| | | return PluginResult.PreParse.stopProcessing(ResultCode.INVALID_DN_SYNTAX, |
| | | ERR_PLUGIN_7BIT_CANNOT_DECODE_DN.get(e.getMessageObject())); |
| | | } |
| | | |
| | | if (isInScope(config, entryDN)) |
| | |
| | | { |
| | | newRDN = RDN.valueOf(rawNewRDN.toString()); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | return PluginResult.PreParse.stopProcessing(de.getResultCode(), |
| | | ERR_PLUGIN_7BIT_CANNOT_DECODE_NEW_RDN.get(de.getMessageObject())); |
| | | return PluginResult.PreParse.stopProcessing(ResultCode.INVALID_DN_SYNTAX, |
| | | ERR_PLUGIN_7BIT_CANNOT_DECODE_NEW_RDN.get(e.getMessageObject())); |
| | | } |
| | | |
| | | for (AVA ava : newRDN) |
| | |
| | | import java.util.concurrent.atomic.AtomicLong; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.AttributeDescription; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | super.setIdleTimeLimit(0); |
| | | super.setLookthroughLimit(0); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.traceException(de); |
| | | |
| | | logger.error(ERR_INTERNAL_CANNOT_DECODE_DN, fullDNString, getExceptionMessage(de)); |
| | | logger.traceException(e); |
| | | logger.error(ERR_INTERNAL_CANNOT_DECODE_DN, fullDNString, getExceptionMessage(e)); |
| | | } |
| | | |
| | | connectionID = nextConnectionID.getAndDecrement(); |
| | |
| | | import java.util.zip.DataFormatException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | |
| | | try |
| | | { |
| | | return RDN.valueOf(newRDN); |
| | | } catch (DirectoryException e) |
| | | } |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | // cannot happen |
| | | return null; |
| | |
| | | import java.util.Collection; |
| | | import java.util.zip.DataFormatException; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.ldap.ByteSequenceReader; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.replication.common.CSN; |
| | | import org.opends.server.replication.common.ServerState; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | /** |
| | | * Byte array scanner class helps decode data from byte arrays received via |
| | |
| | | { |
| | | return DN.valueOf(nextString()); |
| | | } |
| | | catch (DirectoryException e) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | throw new DataFormatException(e.getLocalizedMessage()); |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.zip.DataFormatException; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyDNOperationBasis; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.replication.common.CSN; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.operation.PostOperationModifyDNOperation; |
| | | |
| | | import static org.opends.server.replication.protocol.OperationContext.*; |
| | |
| | | { |
| | | DN newSuperiorDN = DN.valueOf(newSuperior); |
| | | return newSuperiorDN.equals(targetDN); |
| | | } catch (DirectoryException e) |
| | | } |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | // The newsuperior was not a correct DN, and therefore does not match the |
| | | // DN given as a parameter. |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int size() |
| | | { |
| | |
| | | import net.jcip.annotations.GuardedBy; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.util.time.TimeService; |
| | | import org.opends.server.replication.common.CSN; |
| | | import org.opends.server.replication.protocol.UpdateMsg; |
| | |
| | | import org.opends.server.replication.server.changelog.api.ChangelogException; |
| | | import org.opends.server.replication.server.changelog.api.ChangelogStateProvider; |
| | | import org.opends.server.replication.server.changelog.file.Log.LogRotationParameters; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | |
| | | domains.put(domainDN, domainId); |
| | | } |
| | | } |
| | | catch(DirectoryException e) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | throw new ChangelogException(ERR_CHANGELOG_UNABLE_TO_DECODE_DN_FROM_DOMAIN_STATE_FILE.get( |
| | | domainsStateFile.getPath(), line), e); |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.messages.Severity; |
| | | import org.opends.messages.TaskMessages; |
| | | import org.opends.server.api.Backend; |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.ExistingFileBehavior; |
| | |
| | | { |
| | | excludeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | logger.error(ERR_LDIFEXPORT_CANNOT_DECODE_EXCLUDE_BASE, s, de.getMessageObject()); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(ERR_LDIFEXPORT_CANNOT_DECODE_EXCLUDE_BASE, s, getExceptionMessage(e)); |
| | |
| | | { |
| | | includeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_CANNOT_DECODE_INCLUDE_BASE, s, de.getMessageObject()); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_CANNOT_DECODE_INCLUDE_BASE, s, getExceptionMessage(e)); |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.messages.Severity; |
| | | import org.opends.messages.TaskMessages; |
| | | import org.opends.server.api.Backend; |
| | |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.tools.makeldif.TemplateFile; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.ExistingFileBehavior; |
| | |
| | | { |
| | | includeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | LocalizableMessage message = ERR_LDIFIMPORT_CANNOT_DECODE_INCLUDE_BASE.get( |
| | | s, de.getMessageObject()); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LocalizableMessage message = ERR_LDIFIMPORT_CANNOT_DECODE_INCLUDE_BASE.get( |
| | |
| | | { |
| | | excludeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | LocalizableMessage message = ERR_LDIFIMPORT_CANNOT_DECODE_EXCLUDE_BASE.get( |
| | | s, de.getMessageObject()); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LocalizableMessage message = ERR_LDIFIMPORT_CANNOT_DECODE_EXCLUDE_BASE.get( |
| | |
| | | { |
| | | includeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_CANNOT_DECODE_INCLUDE_BASE, s, de.getMessageObject()); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_CANNOT_DECODE_INCLUDE_BASE, s, getExceptionMessage(e)); |
| | |
| | | { |
| | | excludeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_CANNOT_DECODE_EXCLUDE_BASE, s, de.getMessageObject()); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_CANNOT_DECODE_EXCLUDE_BASE, s, getExceptionMessage(e)); |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.messages.TaskMessages; |
| | |
| | | return RebuildMode.USER_DEFINED; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected TaskState runTask() |
| | | { |
| | |
| | | { |
| | | rebuildConfig.setBaseDN(DN.valueOf(baseDN)); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | logger.error(ERR_CANNOT_DECODE_BASE_DN, baseDN, de.getMessageObject()); |
| | | logger.error(ERR_CANNOT_DECODE_BASE_DN, baseDN, e.getMessageObject()); |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | |
| | |
| | | { |
| | | backendBaseDN = DN.valueOf(DN_BACKEND_BASE); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | logger.error(ERR_CANNOT_DECODE_BACKEND_BASE_DN, DN_BACKEND_BASE, de.getMessageObject()); |
| | | return configEntries; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(ERR_CANNOT_DECODE_BACKEND_BASE_DN, DN_BACKEND_BASE, getExceptionMessage(e)); |
| | |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.admin.std.server.BackendCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | |
| | | import org.opends.server.config.DNConfigAttribute; |
| | | import org.opends.server.config.StringConfigAttribute; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** This class provides utility functions for all JE related client tools. */ |
| | | /** This class provides utility functions for all backend client tools. */ |
| | | public class BackendToolUtils |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | { |
| | | return DN.valueOf(DN_BACKEND_BASE); |
| | | } |
| | | catch (final DirectoryException de) |
| | | { |
| | | logger.error(ERR_CANNOT_DECODE_BACKEND_BASE_DN, DN_BACKEND_BASE, de.getMessageObject()); |
| | | throw de; |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | | logger.error(ERR_CANNOT_DECODE_BACKEND_BASE_DN, DN_BACKEND_BASE, getExceptionMessage(e)); |
| | | throw e; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import javax.crypto.Cipher; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.config.ManagedObjectDefinition; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.server.config.client.BackendCfgClient; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.opends.quicksetup.installer.Installer; |
| | |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.extensions.SaltedSHA512PasswordStorageScheme; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryEnvironmentConfig; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | |
| | | { |
| | | rootDN = DN.valueOf(rootDNString.getValue()); |
| | | } |
| | | catch (final DirectoryException de) |
| | | catch (final LocalizedIllegalArgumentException e) |
| | | { |
| | | final LocalizableMessage msg = ERR_CONFIGDS_CANNOT_PARSE_ROOT_DN.get( |
| | | rootDNString.getValue(), de.getMessageObject()); |
| | | throw new ConfigureDSException(de, msg); |
| | | rootDNString.getValue(), e.getMessageObject()); |
| | | throw new ConfigureDSException(e, msg); |
| | | } |
| | | } |
| | | return rootDN; |
| | |
| | | dn = DN.valueOf(trustManagerProviderDN.getValue()); |
| | | JCEKSManagerDN = DN.valueOf(jckesDN); |
| | | } |
| | | catch (final DirectoryException de) |
| | | catch (final LocalizedIllegalArgumentException e) |
| | | { |
| | | final String value = trustManagerProviderDN.getValue(); |
| | | final LocalizableMessage errorMessage = de.getMessageObject(); |
| | | final LocalizableMessage errorMessage = e.getMessageObject(); |
| | | final LocalizableMessage message = |
| | | isKeyManager ? ERR_CONFIGDS_CANNOT_PARSE_KEYMANAGER_PROVIDER_DN.get(value, errorMessage) |
| | | : ERR_CONFIGDS_CANNOT_PARSE_TRUSTMANAGER_PROVIDER_DN.get(value, errorMessage); |
| | | throw new ConfigureDSException(de, message); |
| | | throw new ConfigureDSException(e, message); |
| | | } |
| | | |
| | | if (dn.equals(JCEKSManagerDN)) |
| | |
| | | { |
| | | excludeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | logger.error(ERR_LDIFEXPORT_CANNOT_DECODE_EXCLUDE_BASE, s, de.getMessageObject()); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(ERR_LDIFEXPORT_CANNOT_DECODE_EXCLUDE_BASE, s, getExceptionMessage(e)); |
| | |
| | | { |
| | | includeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_CANNOT_DECODE_INCLUDE_BASE, s, de.getMessageObject()); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_CANNOT_DECODE_INCLUDE_BASE, s, getExceptionMessage(e)); |
| | |
| | | { |
| | | includeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_CANNOT_DECODE_INCLUDE_BASE, s, de.getMessageObject()); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_CANNOT_DECODE_INCLUDE_BASE, s, getExceptionMessage(e)); |
| | |
| | | { |
| | | excludeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_CANNOT_DECODE_EXCLUDE_BASE, s, de.getMessageObject()); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(ERR_LDIFIMPORT_CANNOT_DECODE_EXCLUDE_BASE, s, getExceptionMessage(e)); |
| | |
| | | import java.util.TreeMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | |
| | | import org.opends.server.loggers.JDKLogging; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeBuilder; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.ExistingFileBehavior; |
| | | import org.opends.server.types.LDIFExportConfig; |
| | |
| | | DN dn = DN.valueOf(line); |
| | | ignoreEntries.add(dn); |
| | | } |
| | | catch (DirectoryException e) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | LocalizableMessage message = INFO_LDIFDIFF_CANNOT_PARSE_STRING_AS_DN.get( |
| | | line, ignoreEntriesFile.getValue()); |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import org.opends.server.config.DNConfigAttribute; |
| | | import org.opends.server.config.StringConfigAttribute; |
| | |
| | | import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.JDKLogging; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.NullOutputStream; |
| | | import org.opends.server.util.BuildVersion; |
| | |
| | | { |
| | | dn = DN.valueOf(dnStr); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | printWrappedText(err, ERR_LISTBACKENDS_INVALID_DN.get(dnStr, de.getMessage())); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | printWrappedText(err, ERR_LISTBACKENDS_INVALID_DN.get(dnStr, getExceptionMessage(e))); |
| | |
| | | { |
| | | backendBaseDN = DN.valueOf(DN_BACKEND_BASE); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | LocalizableMessage message = ERR_CANNOT_DECODE_BACKEND_BASE_DN.get( |
| | | DN_BACKEND_BASE, de.getMessageObject()); |
| | | throw new ConfigException(message, de); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LocalizableMessage message = ERR_CANNOT_DECODE_BACKEND_BASE_DN.get( |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.admin.std.server.BackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.JDKLogging; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.NullOutputStream; |
| | | import org.opends.server.util.BuildVersion; |
| | |
| | | { |
| | | verifyBaseDN = DN.valueOf(baseDNString.getValue()); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | printWrappedText(err, ERR_CANNOT_DECODE_BASE_DN.get(baseDNString.getValue(), de.getMessageObject())); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | printWrappedText(err, ERR_CANNOT_DECODE_BASE_DN.get(baseDNString.getValue(), getExceptionMessage(e))); |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.LocalizableMessageDescriptor.Arg0; |
| | | import org.forgerock.i18n.LocalizableMessageDescriptor.Arg1; |
| | | import org.forgerock.i18n.LocalizableMessageDescriptor.Arg2; |
| | |
| | | import org.opends.server.tools.tasks.TaskScheduleInteraction; |
| | | import org.opends.server.tools.tasks.TaskScheduleUserData; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.HostPort; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.NullOutputStream; |
| | |
| | | } |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | errPrintln(ERROR_RESET_CHANGE_NUMBER_EXCEPTION.get(de.getLocalizedMessage())); |
| | | errPrintln(ERROR_RESET_CHANGE_NUMBER_EXCEPTION.get(e.getLocalizedMessage())); |
| | | return ERROR_RESET_CHANGE_NUMBER_PROBLEM; |
| | | } |
| | | if (targetBaseDN.isRootDN()) |
| | |
| | | package org.opends.server.types; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.BufferedWriter; |
| | |
| | | { |
| | | configEntryDN = DN.valueOf(dnString); |
| | | } |
| | | catch (DirectoryException de) |
| | | catch (LocalizedIllegalArgumentException e) |
| | | { |
| | | LocalizableMessage message = ERR_BACKUPDIRECTORY_CANNOT_DECODE_DN.get( |
| | | dnString, descriptorFilePath, de.getMessageObject()); |
| | | throw new ConfigException(message, de); |
| | | dnString, descriptorFilePath, e.getMessageObject()); |
| | | throw new ConfigException(message, e); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | import org.forgerock.opendj.ldap.AttributeDescription; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeBuilder; |
| | | import org.opends.server.types.Attributes; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.LDIFImportConfig; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.opends.server.types.RawModification; |
| | | |
| | | /** |
| | |
| | | { |
| | | return DN.valueOf(dnString); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace("DN decode failed for: ", dnString); |
| | | } |
| | | |
| | | LocalizableMessage message = ERR_LDIF_INVALID_DN.get( |
| | | lastEntryLineNumber, line, de.getMessageObject()); |
| | | |
| | | logToRejectWriter(lines, message); |
| | | throw new LDIFException(message, lastEntryLineNumber, true, de); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace("DN decode failed for: ", dnString); |
| | | } |
| | | LocalizableMessage message = ERR_LDIF_INVALID_DN.get( |
| | | lastEntryLineNumber, line, e); |
| | | |
| | | logger.trace("DN decode failed for: ", dnString, e); |
| | | LocalizableMessage message = ERR_LDIF_INVALID_DN.get(lastEntryLineNumber, line, getExceptionMessage(e)); |
| | | logToRejectWriter(lines, message); |
| | | throw new LDIFException(message, lastEntryLineNumber, true, e); |
| | | } |
| | |
| | | try |
| | | { |
| | | newRDN = RDN.valueOf(rdnStr); |
| | | } catch (DirectoryException de) |
| | | { |
| | | logger.traceException(de); |
| | | LocalizableMessage message = ERR_LDIF_INVALID_DN.get( |
| | | lineNumber, line, de.getMessageObject()); |
| | | throw new LDIFException(message, lineNumber, true); |
| | | } catch (Exception e) |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | LocalizableMessage message = |
| | | ERR_LDIF_INVALID_DN.get(lineNumber, line, e.getMessage()); |
| | | LocalizableMessage message = ERR_LDIF_INVALID_DN.get(lineNumber, line, getExceptionMessage(e)); |
| | | throw new LDIFException(message, lineNumber, true); |
| | | } |
| | | |
| | |
| | | try |
| | | { |
| | | newSuperiorDN = DN.valueOf(dnStr); |
| | | } catch (DirectoryException de) |
| | | { |
| | | logger.traceException(de); |
| | | LocalizableMessage message = ERR_LDIF_INVALID_DN.get( |
| | | lineNumber, line, de.getMessageObject()); |
| | | throw new LDIFException(message, lineNumber, true); |
| | | } catch (Exception e) |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | LocalizableMessage message = ERR_LDIF_INVALID_DN.get( |
| | | lineNumber, line, e.getMessage()); |
| | | LocalizableMessage message = ERR_LDIF_INVALID_DN.get(lineNumber, line, getExceptionMessage(e)); |
| | | throw new LDIFException(message, lineNumber, true); |
| | | } |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.admin.client.ldap; |
| | | |
| | | |
| | | |
| | | import java.util.Collection; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedList; |
| | |
| | | import javax.naming.ldap.LdapName; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.types.Entry; |
| | | import org.testng.Assert; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A mock LDAP connection which fakes up search results based on some |
| | | * LDIF content. Implementations should override the modify operations |
| | |
| | | * not exist. |
| | | */ |
| | | private MockEntry getEntry(LdapName dn) { |
| | | DN name; |
| | | try { |
| | | name = DN.valueOf(dn.toString()); |
| | | } catch (DirectoryException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | return entries.get(name); |
| | | return entries.get(DN.valueOf(dn.toString())); |
| | | } |
| | | |
| | | |
| | |
| | | import java.net.InetAddress; |
| | | import java.net.ServerSocket; |
| | | import java.net.Socket; |
| | | import java.util.*; |
| | | import java.util.concurrent.*; |
| | | import java.util.Collection; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Queue; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | import java.util.concurrent.Callable; |
| | | import java.util.concurrent.CountDownLatch; |
| | | import java.util.concurrent.Delayed; |
| | | import java.util.concurrent.ExecutionException; |
| | | import java.util.concurrent.Future; |
| | | import java.util.concurrent.ScheduledExecutorService; |
| | | import java.util.concurrent.ScheduledFuture; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.concurrent.TimeoutException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.io.ASN1; |
| | |
| | | import org.forgerock.opendj.ldap.DereferenceAliasesPolicy; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta.LDAPPassThroughAuthenticationPolicyCfgDefn.MappingPolicy; |
| | |
| | | import org.opends.server.extensions.LDAPPassThroughAuthenticationPolicyFactory.ConnectionFactory; |
| | | import org.opends.server.extensions.LDAPPassThroughAuthenticationPolicyFactory.ConnectionPool; |
| | | import org.opends.server.extensions.LDAPPassThroughAuthenticationPolicyFactory.LDAPConnectionFactory; |
| | | import org.opends.server.protocols.ldap.*; |
| | | import org.opends.server.protocols.ldap.BindRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.ProtocolOp; |
| | | import org.opends.server.protocols.ldap.SearchRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.SearchResultDoneProtocolOp; |
| | | import org.opends.server.protocols.ldap.SearchResultEntryProtocolOp; |
| | | import org.opends.server.protocols.ldap.UnbindRequestProtocolOp; |
| | | import org.opends.server.schema.GeneralizedTimeSyntax; |
| | | import org.opends.server.schema.UserPasswordSyntax; |
| | | import org.opends.server.tools.LDAPReader; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.types.RawFilter; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.opends.server.util.TimeThread; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | |
| | | import static org.opends.server.extensions.LDAPPassThroughAuthenticationPolicyFactory.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | |
| | | MockPolicyCfg withBaseDN(final String baseDN) |
| | | { |
| | | try |
| | | { |
| | | baseDNs.add(DN.valueOf(baseDN)); |
| | | } |
| | | catch (final DirectoryException e) |
| | | { |
| | | throw new RuntimeException(e); |
| | | } |
| | | baseDNs.add(DN.valueOf(baseDN)); |
| | | return this; |
| | | } |
| | | |
| | |
| | | return "Salted SHA-1"; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getCachedPasswordStorageSchemeDN() |
| | | { |
| | | try |
| | | { |
| | | return DN.valueOf("cn=Salted SHA-1,cn=Password Storage Schemes,cn=config"); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return DN.valueOf("cn=Salted SHA-1,cn=Password Storage Schemes,cn=config"); |
| | | } |
| | | |
| | | |
| | |
| | | import java.util.TreeSet; |
| | | |
| | | import org.forgerock.opendj.ldap.AddressMask; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | |
| | | import org.opends.server.loggers.AbstractTextAccessLogPublisher.CriteriaFilter; |
| | | import org.opends.server.loggers.AbstractTextAccessLogPublisher.RootFilter; |
| | | import org.opends.server.types.AuthenticationInfo; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Operation; |
| | | import org.opends.server.types.OperationType; |
| | | import org.testng.annotations.AfterClass; |
| | |
| | | |
| | | private DN dn(final String dn) |
| | | { |
| | | try |
| | | { |
| | | return DN.valueOf(dn); |
| | | } |
| | | catch (final DirectoryException e) |
| | | { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return DN.valueOf(dn); |
| | | } |
| | | |
| | | |
| | |
| | | import java.util.TreeSet; |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta.ReplicationDomainCfgDefn.AssuredType; |
| | | import org.opends.server.admin.std.meta.ReplicationDomainCfgDefn.IsolationPolicy; |
| | | import org.opends.server.admin.std.server.ExternalChangelogDomainCfg; |
| | | import org.opends.server.admin.std.server.ReplicationDomainCfg; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | /** |
| | | * This class implement a configuration object for the MultimasterDomain |
| | |
| | | { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN dn() |
| | | { |
| | | try |
| | | { |
| | | return DN.valueOf("cn=domain, cn=domains,cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config"); |
| | | } catch (DirectoryException e) |
| | | { |
| | | return null; |
| | | } |
| | | return DN.valueOf("cn=domain, cn=domains,cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config"); |
| | | } |
| | | |
| | | /** |
| | | * Set the heartbeat interval. |
| | | */ |
| | | /** Set the heartbeat interval. */ |
| | | public void setHeartbeatInterval(long interval) |
| | | { |
| | | heartbeatInterval = interval; |
| | |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.replication.common.ServerState; |
| | | import org.opends.server.replication.common.ServerStatus; |
| | | import org.opends.server.replication.common.StatusMachineEvent; |
| | | import org.opends.server.replication.protocol.UpdateMsg; |
| | | import org.opends.server.replication.service.ReplicationDomain; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | @SuppressWarnings("javadoc") |
| | | public class DummyReplicationDomain extends ReplicationDomain |
| | | { |
| | | |
| | | private static DN baseDN; |
| | | static |
| | | { |
| | | try |
| | | { |
| | | baseDN = DN.valueOf("cn=DummyReplicationDomain"); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | private static DN baseDN = DN.valueOf("cn=DummyReplicationDomain"); |
| | | |
| | | public DummyReplicationDomain(long generationId) |
| | | { |
| | |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | import static org.assertj.core.api.Assertions.assertThat; |
| | | import static org.assertj.core.api.Assertions.*; |
| | | |
| | | import java.util.LinkedList; |
| | | import java.util.Random; |
| | |
| | | final Random rng = new Random(); |
| | | for (int j = 0; j < 1000000; j++) |
| | | { |
| | | try |
| | | { |
| | | /* |
| | | * Lock a DN whose parent is different each time in order to prevent the thread local |
| | | * cache being used for retrieving the parent DN lock. |
| | | */ |
| | | final int uid = rng.nextInt(); |
| | | final int deviceId = rng.nextInt(); |
| | | final DN dn = DN.valueOf("uid=" + deviceId + ",uid=" + uid + ",dc=example,dc=com"); |
| | | lockManager.tryWriteLockEntry(dn).unlock(); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | throw new RuntimeException(e); |
| | | } |
| | | /* |
| | | * Lock a DN whose parent is different each time in order to prevent the thread local |
| | | * cache being used for retrieving the parent DN lock. |
| | | */ |
| | | final int uid = rng.nextInt(); |
| | | final int deviceId = rng.nextInt(); |
| | | final DN dn = DN.valueOf("uid=" + deviceId + ",uid=" + uid + ",dc=example,dc=com"); |
| | | lockManager.tryWriteLockEntry(dn).unlock(); |
| | | } |
| | | } |
| | | }); |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.forgerock.opendj.ldap.DN; |
| | |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | | @Test(dataProvider = "illegalDNs", expectedExceptions = DirectoryException.class) |
| | | @Test(dataProvider = "illegalDNs", expectedExceptions = LocalizedIllegalArgumentException.class) |
| | | public void testIllegalStringDNs(String dn) throws Exception { |
| | | DN.valueOf(dn); |
| | | } |
| | |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | | @Test(dataProvider = "illegalDNs", expectedExceptions = DirectoryException.class) |
| | | @Test(dataProvider = "illegalDNs", expectedExceptions = LocalizedIllegalArgumentException.class) |
| | | public void testIllegalOctetStringDNs(String dn) throws Exception { |
| | | ByteString octetString = ByteString.valueOfUtf8(dn); |
| | | DN.valueOf(octetString); |
| | |
| | | */ |
| | | private Entry createTestEntry(AttributeType type, String[] values) { |
| | | // Construct entry DN. |
| | | DN entryDN; |
| | | try { |
| | | entryDN = DN.valueOf("dc=example, dc=com"); |
| | | } catch (DirectoryException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | DN entryDN = DN.valueOf("dc=example, dc=com"); |
| | | |
| | | // Get default object classes. |
| | | ObjectClass top = DirectoryServer.getObjectClass("top"); |
| | |
| | | import java.util.Arrays; |
| | | import java.util.Iterator; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.AVA; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | | @Test(dataProvider = "illegalRDNs", expectedExceptions = DirectoryException.class) |
| | | @Test(dataProvider = "illegalRDNs", expectedExceptions = LocalizedIllegalArgumentException.class) |
| | | public void testDecodeString(String rawRDN) throws Exception { |
| | | RDN.valueOf(rawRDN); |
| | | |