Chris,
I just pulled this off the top of my head but I believe you need to deal
with object class like this;

@objectclasses = qw(top person etc etc);
$entry->setValues("objectclass", @objectclasses);

I hope this helps,
Keene Hammond

Fighting from a Directory Enabled World...

"Christopher Burke" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> [EMAIL PROTECTED] (David J Kernen) wrote in
> <[EMAIL PROTECTED]>:
>
> >Christopher Burke wrote:
> >
> >> ************ add.pl **************
> >> #!/usr/local/bin/perl
> >> use Mozilla::LDAP::Conn;
> >> use Mozilla::LDAP::Utils;
> >>
> >> $server     = "server.com";
> >> $port       = 389;
> >> $connectas  = "cn=Directory Manager";
> >> $connectpwd = "PASSWORD";
> >>
> >> $conn = new Mozilla::LDAP::Conn($server,$port,$connectas,$connectpwd)
> >>             or die("EXPORT: No LDAP connection");
> >>
> >> $entry = new Mozilla::LDAP::Entry;
> >> $entry->setDN('cn=Mr Joe Smith,ou=Staff,o=Org Name,c=AU');
> >> $entry->{objectclass} = ["top","person"];
> >> $entry->{cn} = 'Mr Joe Smith';
> >> $entry->printLDIF();
> >> if ($conn->add($entry)) {
> >>   print "Succesful Add\n";
> >> } else {
> >>   print "Failed to add entry, error ".$conn->getErrorString()."\n";
> >> }
> >> $conn->close;
> >>
> >> **************WHAT HAPPENS*****************
> >>
> >> ldap% ./add.pl
> >> dn: cn=Mr Joe Smith,ou=Staff,o=The University of Queensland,c=AU
> >> objectclass: top
> >> objectclass: person
> >> cn: Mr Joe Smith
> >>
> >> Failed to add entry, error Protocol error
> >
> >My schema (which is unchanged from the "out-of-the-box" schema lists:
> >
> >objectclass top
> >        oid 2.5.6.0
> >        requires
> >                objectClass
> >        allows
> >                aci,
> >                passwordExpirationTime
> ># [ ... ]
> >objectclass person
> >        oid 2.5.6.6
> >        superior top
> >        requires
> >                sn,
> >                cn
> >        allows
> >                description,
> >                seeAlso,
> >                telephoneNumber,
> >                userPassword
> >
> >I don't see a surname being set. And I don't see anything in the schema
> >permitting ou=Staff,o=Org Name,c=AU in the dn. Of course you may have
> >updated your schema but if you haven't then the entry you've created is
> >violating the schema. Try: 1) adding the sn attribute, 2) including
> >"inetOrgPerson" in the objectclass attribute.
> >
> >Dave Kernen
> >
>
> It is a simplified example, the problem is not an attribute or anything
> else - I have diagnosed the problem to be in the Perldap code itself. THe
> contstruct $entry->{expr} doesn't work for the Hash implementation of
> Perldap if 'expr' is complex.
>



Reply via email to