You should check your schema and verify that:

a) The object classes "posixAccount" and "shadowAccount" exist;
b) That the classes "top", "account", "posixAccount" and "shadowAccount" do
not contain any
REQUIRED attributes beyond "uid" and "cn" (which are the only two attributes I
see you providing to this entry);
c) Repeat step b) for the object class listed as "superior" to the classes
listed in b) above (except for top, which has no superior). Do the same for
the superior classes' superior classes until you get to "top".

You may also want to do a printLDIF on your entry to verify that it looks the
way you expect it to.
And if you're really desperate, look in the directory daemon's "errors" log;
you will often find an error message in there that tells you exactly what's
wrong. (I know that with iplanet, the error message in the log tends to be
more useful than the generic "Object class violation" message permitted by the
LDAP standard. Can't say what openLDAP provides but we can always keep our
fingers crossed, eh?)

Cheers,
Dave K.



"Alejandro Arana" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all,
>
> My system is Linux Red Hat 7.1 with openldap 2.0.7, Netscape SDK,
> perl-ldap and i am trying to create a user entry from perl using this
code:
>
> ...
> $entry = $conn->newEntry();
> $dn = "uid=$uid,ou=People," . $config{base};
> $entry->setDN ($dn);
> $entry->{objectclass} = [ "top", "account", "posixAccount",
> "shadowAccount" ];
> $entry->addValue("uid", $uid);
> $entry->addValue("cn", "User Test");
> $conn->add($entry);
> ...
>
> and always get this error:
>
>    65:Object class violation
>
> If i change the $entry->{objectclass}= [ "top", "account",
> "posixAccount", "shadowAccount" ]; to
>
>   $entry->{objectclass} = [ "top"];
>
> the user entry is created, but i can't add attributes because the other
> object classes is not defined.
>
> Does anyone have a perl code that create a user entry in LDAP?
>
>
> Thanks
>
> Alejandro A.
>
>
>
>


Reply via email to