Chris,

Thank you very much for the help.

-Ethan

-----Original Message-----
From: Chris Ridd [mailto:[EMAIL PROTECTED]
Sent: Saturday, October 18, 2003 1:06 AM
To: Bisceglia, Ethan; [EMAIL PROTECTED]
Subject: Re: Net::LDAP add


On 17/10/03 8:10 pm, Ethan Bisceglia <[EMAIL PROTECTED]> wrote:

> Hello all,
> 
> I'm a bit new to Net::LDAP and need little help.  I am trying to script an
> LDAP->add to automate the insertion of new customers to our directory.
> 
> I am successful when I insert attributes into ou=<company
> name>,ou=TradingPartners,o=marketsite,o=company.com.  The problem occurs
> when I attempt to add an ou underneath this entry.  I am trying to add
> ou=Contacts,ou=<company name>,ou=TradingPartners,o=marketsite,o=company.com.
> The script runs without producing any errors, but this sub-ou never shows up
> in LDAP browser.  I also have difficulty deleting the entry that is visible.
> LDAP browser complains that the delete cannot be performed on a non-leaf
> item as if this sub-ou is really present.  I really appreciate any help you
> can give.
> 
> 
> 
> 
> 
> my $result =
> $ldap->add("ou=$tpshortname,ou=TradingPartners,o=marketsite,o=company.com",
>           attr => [ 'displayName' => $tpshortname,
>                     'postalCode'  => '12345',
>                     'objectClass' => 'msbtradingpartner',
>                     'objectClass' => 'organizationalunit',
>                     'objectClass' => 'top',

When adding an attribute (like objectClass) that has multiple values, you
need to do it this way:

                      'objectClass' => ['msbtradingpartner',
                                        'organizationalunit','top'],

Also,

>                     'url'         => '',

A zero length string may not be legal for the url attribute (which is
non-standard, so I'm guessing.) If you don't want to set a value for an
attribute, just don't set it!

> my $result2 =
> $ldap->add("ou=Contacts,ou=$tpshortname,ou=TradingPartners,o=marketsite,o=co
> mpany.com",
>            attr => [ 'ou'      => 'Contacts',
>                      'objectClass:' => 'organizationalunit',
>                      'objectClass:' => 'top'

You probably meant to set 'objectClass', not 'objectClass:' ! The same
comment from above applies here.

Your LDAP server *should* have prevented you from adding an entry without an
objectClass attribute. The entry you're adding would fail the server's
"schema checks". You could ask your server's administrator to turn schema
checking on - it is useful for you when learning this stuff, and heck, it is
is useful anyway because it keeps some semblence of consistency in the
directory information (which is always good.) Work with the directory, not
against it :-)

The lack of schema checking is also probably allowing the empty value for
url.

Cheers,

Chris

Reply via email to