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

lutoff
07.50.2008 9b6dfe96f8d0e0c92c4fdbf3f65459271bca425c
Fix for issue #2270 (export-ldif doesn't exclude operational attributes when it's a task)

Add the following attribute into 'ds-task-export'

attributeTypes: ( 1.3.6.1.4.1.26027.1.1.464
NAME 'ds-task-export-include-operational-attributes'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE
X-ORIGIN 'OpenDS Directory Server' )


When export-ldif is ran as a task, we add the corresponding attribute
value in the created task entry if the --excludeOperational is present
5 files modified
33 ■■■■■ changed files
opends/resource/schema/02-config.ldif 6 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/config/ConfigConstants.java 6 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tasks/ExportTask.java 8 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/ExportLDIF.java 9 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/LDIFExportConfig.java 4 ●●●● patch | view | raw | blame | history
opends/resource/schema/02-config.ldif
@@ -2252,6 +2252,11 @@
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.464
  NAME 'ds-task-export-include-operational-attributes'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.1
  NAME 'ds-cfg-access-control-handler'
  SUP top
@@ -2953,6 +2958,7 @@
        ds-task-export-wrap-column $
        ds-task-export-compress-ldif $
        ds-task-export-encrypt-ldif $
        ds-task-export-include-operational-attributes $
        ds-task-export-sign-hash )
  X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.69
opends/src/server/org/opends/server/config/ConfigConstants.java
@@ -4123,6 +4123,12 @@
  public static final String ATTR_TASK_EXPORT_WRAP_COLUMN =
       NAME_PREFIX_TASK + "export-wrap-column";
  /**
   * The name of the attribute in an export task definition that specifies
   * that operational attributes have to be included.
   */
  public static final String ATTR_TASK_EXPORT_INCLUDE_OPERATIONAL_ATTRIBUTES =
       NAME_PREFIX_TASK + "export-include-operational-attributes";
  /**
opends/src/server/org/opends/server/tasks/ExportTask.java
@@ -131,6 +131,7 @@
  private boolean compressLDIF;
  private boolean encryptLDIF;
  private boolean signHash;
  private boolean includeOperationalAttributes;
  private ArrayList<String> includeAttributeStrings;
  private ArrayList<String> excludeAttributeStrings;
  private ArrayList<String> includeFilterStrings;
@@ -189,6 +190,7 @@
    AttributeType typeIncludeBranch;
    AttributeType typeExcludeBranch;
    AttributeType typeWrapColumn;
    AttributeType typeIncludeOperationalAttributes;
    typeLdifFile =
@@ -217,6 +219,8 @@
         getAttributeType(ATTR_TASK_EXPORT_EXCLUDE_BRANCH, true);
    typeWrapColumn =
         getAttributeType(ATTR_TASK_EXPORT_WRAP_COLUMN, true);
    typeIncludeOperationalAttributes =
      getAttributeType(ATTR_TASK_EXPORT_INCLUDE_OPERATIONAL_ATTRIBUTES, true);
    List<Attribute> attrList;
@@ -260,6 +264,9 @@
    attrList = taskEntry.getAttribute(typeWrapColumn);
    wrapColumn = TaskUtils.getSingleValueInteger(attrList, 0);
    attrList = taskEntry.getAttribute(typeIncludeOperationalAttributes);
    includeOperationalAttributes = TaskUtils.getBoolean(attrList, true);
  }
@@ -522,6 +529,7 @@
    exportConfig.setIncludeFilters(includeFilters);
    exportConfig.setSignHash(signHash);
    exportConfig.setWrapColumn(wrapColumn);
    exportConfig.setIncludeOperationalAttributes(includeOperationalAttributes);
    // FIXME -- Should this be conditional?
    exportConfig.setInvokeExportPlugins(true);
opends/src/server/org/opends/server/tools/ExportLDIF.java
@@ -467,6 +467,15 @@
      attributes.add(
              new LDAPAttribute(ATTR_TASK_EXPORT_WRAP_COLUMN, values));
    }
    if (excludeOperationalAttrs.isPresent())
    {
      values = new ArrayList<ASN1OctetString>(1);
      values.add(new ASN1OctetString("false"));
      attributes.add(
          new LDAPAttribute(ATTR_TASK_EXPORT_INCLUDE_OPERATIONAL_ATTRIBUTES,
              values));
    }
  }
  /**
opends/src/server/org/opends/server/types/LDIFExportConfig.java
@@ -69,6 +69,9 @@
  // Indicates whether the data should be encrypted as it is written.
  private boolean encryptData;
  // Indicates whether we should exclude operational attributes.
  private boolean excludeOperationalAttributes;
  // Indicates whether to generate a cryptographic hash of the data as
  // it is // written.
  private boolean hashData;
@@ -155,6 +158,7 @@
    includeFilters               = new ArrayList<SearchFilter>();
    compressData                 = false;
    encryptData                  = false;
    excludeOperationalAttributes = false;
    hashData                     = false;
    includeObjectClasses         = true;
    includeOperationalAttributes = true;