LDAP_LOCAL_ERROR

Some unknown number of hours wasted… hopefully this will help someone else before they disappear too much into no-search-result darkness.

Using Perl’s Net::LDAP to manage LDAP entries, I was getting the following error back after calling “update” on an Entry object

    LDAP error 82 (LDAP_LOCAL_ERROR: An error occurred in C<Net::LDAP>;)

This, it turns out, was because I was trying to update an entry without having put in any modifications with the following sort of code path:

    $entry->replace ( $attribute => $value )
        unless $entry->get_value($attribute) eq $value;
    $entry->update($ldap);

I (appear to) have fixed this by refactoring to:

    unless ($entry->get_value($attribute) eq $value) {
        $entry->replace ( $attribute => $value );
        $entry->update($ldap);
    }

So, basically, don’t call update() unless you’ve got changes to make 🙂

Leave a Reply