You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Alex Karasulu <ao...@bellsouth.net> on 2006/10/06 02:18:39 UTC

[ApacheDS] Schema Checking

Mbah Tenjoh-Okwen wrote:
> Hi,
> 
> I understand that "LDAP directories use the concept of object classes to 
> define which attributes are allowed for objects of any given type" 
> consequently , I would like to know if the following behavior is normal:
> 
> in ApacheDS I am able to make use of any attribute without having added 
> the object classes which provide these attributes.
> 
> Illustration
> 
> say I have  an entry uid=kevin, ou=users,ou=sample
> kevin has the following attributes  cn=kevin spacey, dc=ke, objectclass=top
> 
> Is it normal for apacheDS to allow me add cn and dc attributes even 
> though I havent added the object classes Person and domain ?

Please start a new thread when you change the topic.

Schema checking should prevent this if it is enabled and by default it 
is in ApacheDS.  If it's not doing that then we have a bug.

Alex

Re: [ApacheDS] Schema Checking

Posted by Stefan Zoerner <sz...@apache.org>.
Hi Mbah!

The behavior you describe below looks very much like a bug to me. I was 
able to reproduce something comparable with the person object class. 
Therefore I ask you to file an issue at JIRA.

Another thing: Probably you know it, but if you use jndi.properties like 
described here,
http://java.sun.com/products/jndi/tutorial/beyond/env/source.html
it is not necessary to read the settings manually.

Greetings from Hamburg,
     Stefan

---8<---

Stefan Zoerner (szoerner@apache.org)
Apache Directory Project
Committer :: PMC Member

Mbah Tenjoh-Okwen wrote:
> 
> 
> 
> 
> here is the code
> 
> 
> public class CreateSubcontext {
> 
>     /**
>      * @param args
>      */
>     public static void main(String[] args)
>     {
>         try
>         {
>             //use properties file to set connection
>             InputStream inputStream = new FileInputStream( 
> "apacheds.properties");
>             Properties properties = new Properties();
>             properties.load(inputStream);
>             properties.setProperty("java.naming.security.credentials", 
> "secret");
>            
>             //create context
>             DirContext ctx=new InitialDirContext(properties);
>            
>             //mould entry
>             Attributes attrs=new BasicAttributes(true);
>             Attribute obj=new BasicAttribute("ObjectClass", "top");
>             Attribute ob = new BasicAttribute("cn", "kevin Spacey");
>             Attribute ob1 = new BasicAttribute("dc", "ke");
>             attrs.put(obj);
>             attrs.put(ob);
>             attrs.put(ob1);
>             String rdns="uid=kevin";
>            
>             //create subcontext
>             DirContext result=ctx.createSubcontext(rdns, attrs);
>             result.close();
>         }catch(Exception e)
>         {
>             System.out.println(e);
>            
>         }
>        
> 
>     }
> 
> }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On 10/6/06, *Alex Karasulu* < aok123@bellsouth.net 
> <ma...@bellsouth.net>> wrote:
> 
>     Mbah Tenjoh-Okwen wrote:
>      > Hi,
>      >
>      > I understand that "LDAP directories use the concept of object
>     classes to
>      > define which attributes are allowed for objects of any given type"
>      > consequently , I would like to know if the following behavior is
>     normal:
>      >
>      > in ApacheDS I am able to make use of any attribute without having
>     added
>      > the object classes which provide these attributes.
>      >
>      > Illustration
>      >
>      > say I have  an entry uid=kevin, ou=users,ou=sample
>      > kevin has the following attributes  cn=kevin spacey, dc=ke,
>     objectclass=top
>      >
>      > Is it normal for apacheDS to allow me add cn and dc attributes even
>      > though I havent added the object classes Person and domain ?
> 
>     Please start a new thread when you change the topic.
> 
>     Schema checking should prevent this if it is enabled and by default it
>     is in ApacheDS.  If it's not doing that then we have a bug.
> 
>     Alex
> 
> 


-- 



Re: [ApacheDS] Schema Checking

Posted by Mbah Tenjoh-Okwen <te...@googlemail.com>.
here is the code


public class CreateSubcontext {

    /**
     * @param args
     */
    public static void main(String[] args)
    {
        try
        {
            //use properties file to set connection
            InputStream inputStream = new FileInputStream( "
apacheds.properties");
            Properties properties = new Properties();
            properties.load(inputStream);
            properties.setProperty("java.naming.security.credentials",
"secret");

            //create context
            DirContext ctx=new InitialDirContext(properties);

            //mould entry
            Attributes attrs=new BasicAttributes(true);
            Attribute obj=new BasicAttribute("ObjectClass", "top");
            Attribute ob = new BasicAttribute("cn", "kevin Spacey");
            Attribute ob1 = new BasicAttribute("dc", "ke");
            attrs.put(obj);
            attrs.put(ob);
            attrs.put(ob1);
            String rdns="uid=kevin";

            //create subcontext
            DirContext result=ctx.createSubcontext(rdns, attrs);
            result.close();
        }catch(Exception e)
        {
            System.out.println(e);

        }


    }

}


















On 10/6/06, Alex Karasulu <ao...@bellsouth.net> wrote:
>
> Mbah Tenjoh-Okwen wrote:
> > Hi,
> >
> > I understand that "LDAP directories use the concept of object classes to
> > define which attributes are allowed for objects of any given type"
> > consequently , I would like to know if the following behavior is normal:
> >
> > in ApacheDS I am able to make use of any attribute without having added
> > the object classes which provide these attributes.
> >
> > Illustration
> >
> > say I have  an entry uid=kevin, ou=users,ou=sample
> > kevin has the following attributes  cn=kevin spacey, dc=ke,
> objectclass=top
> >
> > Is it normal for apacheDS to allow me add cn and dc attributes even
> > though I havent added the object classes Person and domain ?
>
> Please start a new thread when you change the topic.
>
> Schema checking should prevent this if it is enabled and by default it
> is in ApacheDS.  If it's not doing that then we have a bug.
>
> Alex
>