You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2016/03/07 10:25:40 UTC

[jira] [Created] (DIRAPI-275) Many AttributeType are defined with the wrong m-usage

Emmanuel Lecharny created DIRAPI-275:
----------------------------------------

             Summary: Many AttributeType are defined with the wrong m-usage
                 Key: DIRAPI-275
                 URL: https://issues.apache.org/jira/browse/DIRAPI-275
             Project: Directory Client API
          Issue Type: Bug
    Affects Versions: 1.0.0-M33
            Reporter: Emmanuel Lecharny
             Fix For: 1.0.0-M34


We have some mixture of attributeTypes defined in two ways :

{noformat}
..
./ldap/schema/data/src/main/resources/schema/ou=schema/cn=apache/ou=attributetypes/m-oid=1.3.6.1.1.16.4.ldif:m-usage: DIRECTORY_OPERATION
./ldap/schema/data/src/main/resources/schema/ou=schema/cn=apache/ou=attributetypes/m-oid=1.3.6.1.1.20.ldif:m-usage: DIRECTORY_OPERATION
...
{noformat}

but 

{noformat}
...
./ldap/schema/data/src/main/resources/schema/ou=schema/cn=pwdpolicy/ou=attributetypes/m-oid=1.3.6.1.4.1.42.2.27.8.1.16.ldif:m-usage: directoryOperation
./ldap/schema/data/src/main/resources/schema/ou=schema/cn=pwdpolicy/ou=attributetypes/m-oid=1.3.6.1.4.1.42.2.27.8.1.17.ldif:m-usage: directoryOperation
...
{noformat}

The schema parser does not bail out because of this (ugly) method in {{UsageEnum}} class :

{noformat}
    /**
     * Gets the enumeration type for the attributeType usage string regardless
     * of case.
     * 
     * @param usage the usage string
     * @return the usage enumeration type
     */
    public static UsageEnum getUsage( String usage )
    {
        try
        {
            UsageEnum result = valueOf( usage );

            return result;
        }
        catch ( IllegalArgumentException iae )
        {
            if ( "directoryOperation".equals( usage ) )
            {
                return DIRECTORY_OPERATION;
            }
            else if ( "distributedOperation".equals( usage ) )
            {
                return DISTRIBUTED_OPERATION;
            }
            else if ( "dSAOperation".equals( usage ) )
            {
                return DSA_OPERATION;
            }
            else if ( "userApplications".equals( usage ) )
            {
                return USER_APPLICATIONS;
            }
            else
            {
                return null;
            }
        }
    }
{noformat}

Not that when we have the wrong format, we fall back to a case sensitive comparison. This is very weak...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)