Uploaded image for project: 'Directory Client API'
  1. Directory Client API
  2. DIRAPI-156

LdapNetworkConnection.addSchema doesn't register attribute types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.0-M20
    • 1.0.0-M22
    • None

    Description

      I'm loading schema with code like:

      con.loadSchema(new JarLdifSchemaLoader());
      con.addSchema("custom.schema");

      Later an exception is thrown while I'm handling some search results. The entry in question looks like:

      dn: cn=ICRCSSTAccess,ou=Roles,o=jaas,dc=xoint,dc=net
      objectClass: groupOfNames
      cn: ICRCSSTAccess
      member: uid=gturner,ou=people,dc=xoint,dc=net
      member: uuid=98bb35ee-9ff3-444f-9925-7fe762810d50,o=Asus,ou=customers,dc=xoint,dc=net

      The code where the exception is thrown looks like:

      Attribute memberAttribute = entry.get("member");
      if (memberAttribute != null)
      for (Iterator<Value<?>> iterator = memberAttribute.iterator();
      iterator.hasNext()

      { @SuppressWarnings("unchecked") Value<String> value = (Value<String>) iterator.next(); String member = value.getValue(); Dn memberDn = new Dn(context.getSchemaManager(), member); members.add(memberDn); }

      It is the Dn instantiation that throws the following stacktrace:

      org.apache.directory.api.ldap.model.exception.LdapInvalidDnException: ERR_04188 The type cannot be empty or null
      at org.apache.directory.api.ldap.model.name.Dn.atavOidToName(Dn.java:1106)
      at org.apache.directory.api.ldap.model.name.Dn.rdnOidToName(Dn.java:1143)
      at org.apache.directory.api.ldap.model.name.Rdn.apply(Rdn.java:454)
      at org.apache.directory.api.ldap.model.name.Dn.apply(Dn.java:1202)
      at org.apache.directory.api.ldap.model.name.Dn.apply(Dn.java:1281)
      at org.apache.directory.api.ldap.model.name.Dn.<init>(Dn.java:287)
      at net.xoint.usermanager.model.Role.<init>(Role.java:45)
      at net.xoint.usermanager.model.LDAPLoader.loadRoles(LDAPLoader.java:75)
      at net.xoint.usermanager.model.LDAPLoader.load(LDAPLoader.java:52)
      at net.xoint.usermanager.UserManagerTest.test2(UserManagerTest.java:134)
      Caused by: org.apache.directory.api.ldap.model.exception.LdapInvalidDnException: ERR_04188 The type cannot be empty or null
      at org.apache.directory.api.ldap.model.name.Ava.apply(Ava.java:476)
      at org.apache.directory.api.ldap.model.name.Dn.atavOidToName(Dn.java:1100)
      ... 36 more
      Caused by: org.apache.directory.api.ldap.model.exception.LdapNoSuchAttributeException: ERR_04269 ATTRIBUTE_TYPE for OID 1.3.6.1.4.1.38541.2.1.3 do\
      es not exist!
      at org.apache.directory.api.ldap.model.schema.registries.DefaultAttributeTypeRegistry.lookup(DefaultAttributeTypeRegistry.java:293)
      at org.apache.directory.api.ldap.model.schema.registries.DefaultAttributeTypeRegistry.lookup(DefaultAttributeTypeRegistry.java:47)
      at org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager.lookupAttributeTypeRegistry(DefaultSchemaManager.java:1604)
      at org.apache.directory.api.ldap.model.name.Ava.apply(Ava.java:470)
      ... 37 more
      Caused by: org.apache.directory.api.ldap.model.exception.LdapException: ERR_04269 ATTRIBUTE_TYPE for OID 1.3.6.1.4.1.38541.2.1.3 does not exist!
      at org.apache.directory.api.ldap.model.schema.registries.DefaultSchemaObjectRegistry.lookup(DefaultSchemaObjectRegistry.java:176)
      at org.apache.directory.api.ldap.model.schema.registries.DefaultAttributeTypeRegistry.lookup(DefaultAttributeTypeRegistry.java:289)
      ... 40 more

      OID 1.3.6.1.4.1.38541.2.1.3 is the uuid attribute that is part of a member DN. "custom.schema" defines it as follows:

      attributetype ( 1.3.6.1.4.1.38541.2.1.3
      NAME 'uuid'
      DESC 'The customer UUID'
      EQUALITY UUIDMatch
      SYNTAX 1.3.6.1.1.16.1
      SINGLE-VALUE )

      While scrutinizing the source, looking for why this attribute wouldn't be found in the DefaultSchemaObjectRegistry#byName Map for the AttributeTypeRegistry, I'm beginning to suspect that somewhere around where LdapNetworkConnection#addSchema is calling AttributeTypeRegistry#addMappingFor, it hasn't quite finished the job, perhaps something like calling AttributeTypeRegistry#register (which seems to be the only method that put's into the byName Map).

      Mailing List reference: https://mail-archives.apache.org/mod_mbox/directory-api/201308.mbox/%3C87eh9mhl46.fsf@zoth-ommog.unzane.com%3E

      Attachments

        1. DIRAPI-156.patch
          2 kB
          Gerald Turner

        Activity

          People

            elecharny Emmanuel Lécharny
            gturner Gerald Turner
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: