Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#401] Change "Object class violation (65)" -> "Naming violation (64)" LDAP result code for DIT Structure Rule violation #410

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,15 @@ public void applyModifications(List<Modification> mods)
}



private ResultCode typeConformsToSchemaError = null;

/**
* Returns a error when entry type does not conform to a schema
* requirements. Otherwise returns {@code null}
**/
public ResutCode getTypeConformsToSchemaError() {
maximthomas marked this conversation as resolved.
Show resolved Hide resolved
return typeConformsToSchemaError;
}
/**
* Indicates whether this entry conforms to the server's schema
* requirements. The checks performed by this method include:
Expand Down Expand Up @@ -1564,6 +1572,7 @@ public boolean conformsToSchema(Entry parentEntry,
boolean validateStructureRules,
LocalizableMessageBuilder invalidReason)
{
typeErrorconformsToSchema= OBJECTCLASS_VIOLATION;
maximthomas marked this conversation as resolved.
Show resolved Hide resolved
// Get the structural objectclass for the entry. If there isn't
// one, or if there's more than one, then see if that's OK.
AcceptRejectWarn structuralPolicy =
Expand Down Expand Up @@ -1640,6 +1649,7 @@ else if (structuralPolicy == AcceptRejectWarn.WARN)

if (validateNameForms)
{
typeErrorconformsToSchema= NAMING_VIOLATION;
maximthomas marked this conversation as resolved.
Show resolved Hide resolved
/**
* There may be multiple nameforms registered with this
* structural objectclass.However, we need to select only one
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ private void checkSchema(Entry parentEntry) throws DirectoryException
LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
if (! entry.conformsToSchema(parentEntry, true, true, true, invalidReason))
{
throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION,
throw new DirectoryException(entry.getTypeConformsToSchemaError(),
invalidReason.toMessage());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2011-2016 ForgeRock AS.
* Portions copyright 2024 3A Systems,LLC.
*/
package org.opends.server.workflowelement.localbackend;

Expand Down Expand Up @@ -670,7 +671,7 @@ private void applyRDNChanges(List<Modification> modifications)
if (! newEntry.conformsToSchema(null, false, true, true,
invalidReason))
{
throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION,
throw new DirectoryException(newEntry.getTypeConformsToSchemaError(),
ERR_MODDN_VIOLATES_SCHEMA.get(entryDN, invalidReason));
}

Expand Down Expand Up @@ -742,7 +743,7 @@ private void applyPreOpModifications(List<Modification> modifications,
if (! newEntry.conformsToSchema(null, false, true, true,
invalidReason))
{
throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION,
throw new DirectoryException(newEntry.getTypeConformsToSchemaError(),
ERR_MODDN_PREOP_VIOLATES_SCHEMA.get(entryDN, invalidReason));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ private void processModify() throws CanceledOperationException
LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
if (!modifiedEntry.conformsToSchema(null, false, false, false, invalidReason))
{
setResultCode(ResultCode.OBJECTCLASS_VIOLATION);
setResultCode(modifiedEntry.getTypeConformsToSchemaError());
appendErrorMessage(ERR_MODIFY_VIOLATES_SCHEMA.get(entryDN, invalidReason));
return;
}
Expand Down
Loading