Uploaded image for project: 'Directory Studio'
  1. Directory Studio
  2. DIRSTUDIO-1079

Creating a new entry using an existing one fails because teh entryCSN at is being copied

    Details

      Description

      When we create a new entry using an existing entry as a template, if the existing entry has an entryCSN attribute, it will be present in the new entry. This is not good because first this is an operational attribute and second because this attribute will be rejected by the remote server

        Activity

        Show
        elecharny Emmanuel Lecharny added a comment - Fixed with http://svn.apache.org/viewvc?rev=1718144&view=rev
        Hide
        elecharny Emmanuel Lecharny added a comment - - edited

        Thanks for pointing me to the right class/line.

        It's with an OpenLDAP server. The EntryCSN AT is NON-MODIFIABLE, but strange enough, the schema pulled from the server does not expose this attribute, so that make senses that's is being copied from the other entry.

        Funny enough, the problem is not existing when using the ldif editor.

        The problem is that we are testing the AT modifiable flag, and for some specific attributes that are not returned by schemas (DirX, etc), we have a HashSet which is supposed to contain the non-user modifiable attributes, and the SchemaUtils.isModifiable() method is testing the attributes against this hashSet :

            public static boolean isModifiable( AttributeType atd )
            {
                ...
                // Check some default no-user-modification attributes
                // e.g. Siemens DirX doesn't provide a good schema.
                // TODO: make default no-user-modification attributes configurable
                if ( CollectionUtils.containsAny( NON_MODIFIABLE_ATTRIBUTE_OIDS_AND_NAMES, getLowerCaseIdentifiers( atd ) ) )
                {
                    return false;
                }
        
                return true;
            }
        

        So we could expect this hashSet to contain the entryCSN attribute, but...

        Here is the way this hashSet is initialized :

            /** The well-known non-modifiable attributes */
            public static final Set<String> NON_MODIFIABLE_ATTRIBUTE_OIDS_AND_NAMES = new HashSet<String>();
            static
            {
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.CREATE_TIMESTAMP_AT ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.CREATE_TIMESTAMP_AT_OID ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.CREATORS_NAME_AT ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.CREATORS_NAME_AT_OID ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.MODIFY_TIMESTAMP_AT ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.MODIFY_TIMESTAMP_AT_OID ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.MODIFIERS_NAME_AT ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.MODIFIERS_NAME_AT_OID ) );
        
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.SUBSCHEMA_SUBENTRY_AT_OID ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.STRUCTURAL_OBJECT_CLASS_AT ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES
                    .add( Strings.toLowerCase( SchemaConstants.STRUCTURAL_OBJECT_CLASS_AT_OID ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.GOVERNING_STRUCTURE_RULE_AT ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings
                    .toLowerCase( SchemaConstants.GOVERNING_STRUCTURE_RULE_AT_OID ) );
        
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.ENTRY_UUID_AT ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.ENTRY_UUID_AT_OID ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.ENTRY_CSN_AT ) );
                OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.ENTRY_DN_AT ) );
                ...
        

        All is there (except the ENTRY_CSN_OID), so we are fine, except that we are NOT filling the right hashSet. Most certainly a bad copy/paste (and that was back from 2009, commit 754547 ...

        I'm going to fix that.

        Show
        elecharny Emmanuel Lecharny added a comment - - edited Thanks for pointing me to the right class/line. It's with an OpenLDAP server. The EntryCSN AT is NON-MODIFIABLE, but strange enough, the schema pulled from the server does not expose this attribute, so that make senses that's is being copied from the other entry. Funny enough, the problem is not existing when using the ldif editor. The problem is that we are testing the AT modifiable flag, and for some specific attributes that are not returned by schemas (DirX, etc), we have a HashSet which is supposed to contain the non-user modifiable attributes, and the SchemaUtils.isModifiable() method is testing the attributes against this hashSet : public static boolean isModifiable( AttributeType atd ) { ... // Check some default no-user-modification attributes // e.g. Siemens DirX doesn't provide a good schema. // TODO: make default no-user-modification attributes configurable if ( CollectionUtils.containsAny( NON_MODIFIABLE_ATTRIBUTE_OIDS_AND_NAMES, getLowerCaseIdentifiers( atd ) ) ) { return false; } return true; } So we could expect this hashSet to contain the entryCSN attribute, but... Here is the way this hashSet is initialized : /** The well-known non-modifiable attributes */ public static final Set<String> NON_MODIFIABLE_ATTRIBUTE_OIDS_AND_NAMES = new HashSet<String>(); static { OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.CREATE_TIMESTAMP_AT ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.CREATE_TIMESTAMP_AT_OID ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.CREATORS_NAME_AT ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.CREATORS_NAME_AT_OID ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.MODIFY_TIMESTAMP_AT ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.MODIFY_TIMESTAMP_AT_OID ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.MODIFIERS_NAME_AT ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.MODIFIERS_NAME_AT_OID ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.SUBSCHEMA_SUBENTRY_AT_OID ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.STRUCTURAL_OBJECT_CLASS_AT ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES .add( Strings.toLowerCase( SchemaConstants.STRUCTURAL_OBJECT_CLASS_AT_OID ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.GOVERNING_STRUCTURE_RULE_AT ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings .toLowerCase( SchemaConstants.GOVERNING_STRUCTURE_RULE_AT_OID ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.ENTRY_UUID_AT ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.ENTRY_UUID_AT_OID ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.ENTRY_CSN_AT ) ); OPERATIONAL_ATTRIBUTES_OIDS_AND_NAMES.add( Strings.toLowerCase( SchemaConstants.ENTRY_DN_AT ) ); ... All is there (except the ENTRY_CSN_OID), so we are fine, except that we are NOT filling the right hashSet. Most certainly a bad copy/paste (and that was back from 2009, commit 754547 ... I'm going to fix that.
        Hide
        seelmann Stefan Seelmann added a comment -

        Hi Emmanuel, when using an existing entry as template, the non-usermodifyable attributes are filtered out (see NewEntryTypeWizardPage lines 212-215). Which server do you use? Maybe the schema isn't loaded correctly from the server? Is the entryCSN font style italic in the entry editor?

        Show
        seelmann Stefan Seelmann added a comment - Hi Emmanuel, when using an existing entry as template, the non-usermodifyable attributes are filtered out (see NewEntryTypeWizardPage lines 212-215). Which server do you use? Maybe the schema isn't loaded correctly from the server? Is the entryCSN font style italic in the entry editor?

          People

          • Assignee:
            Unassigned
            Reporter:
            elecharny Emmanuel Lecharny
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development