Thanks everyone for all the assistance. I finally found the source of my
error. I was assigning ntUserDomainId inside an if block earlier in the
code like this:

if (something) {
        my $ntUserDomainId = something_else;
} else {
        .....
}
$mesg = $entry->add('objectClass' => 'ntUser',
                'ntUserDomainId' => $ntUserDomainId,
                'ntUserHomeDir' => "\\\\host.tld\\home\\$ntUserDomainId"
                );


Obviously, this scoped $ntUserDomainId incorrectly, so it was undefined
in my entry->add function. A subtle mistake that I kept overlooking. I
used the debugger, but was checking it's value as soon as it was
defined, and not where the error was actually occuring. D'oh!

Thanks again for all the quick, helpful response.

Prentice


Prentice Bisbal wrote:
> Okay guys, I need another pair of eyes to try find an error in my code.
> Can any of you see anything wrong with this bit of code?
> 
> $mesg = $entry->add('objectClass' => 'ntUser',
>               'ntUserDomainId' => $ntUserDomainId,
>               'ntUserHomeDir' => "\\\\host.tld\\home\\$ntUserDomainId"
>               );
> 
> .
> 
> When I run my program, I get this error:
> 
> Use of uninitialized value in concatenation (.) or string at
> ./add_nt_attribs.pl line 120, <STDIN> line 1.
> Use of uninitialized value in length at
> /usr/local/perl-5.8/lib/site_perl/5.8.8/Convert/ASN1/_encode.pm line
> 143, <STDIN> line 1.
> Use of uninitialized value in concatenation (.) or string at
> /usr/local/perl-5.8/lib/site_perl/5.8.8/Convert/ASN1/_encode.pm line
> 144, <STDIN> line 1.
> ntUserDomainId: value #0 invalid per syntax at
> /usr/local/perl-5.8/lib/site_perl/5.8.8/Net/LDAP/Entry.pm line 268
> 
> $entry already exists in LDAP, and I'm just trying to add this new
> objectClass and related attributes to the entry. Am I doing this the
> wrong way?
> 
> Should I be using a function other than entry->add(), like $ldap->modify()?
> 


Reply via email to