Bug 700557 - Linked attrs callbacks access free'd pointers after close
The linked attributes plug-in callbacks can still try to access free'd
resources after it's close callback has been called. This can cause
ns-slapd to crash.
This same issue actually applies to the following plug-ins:
- DNA
- Linked Attributes
- Managed Entries
We should address this issue in all of these plug-ins. We need to
unset the started flag in the close() callbacks, which needs to be
done with the write lock on the config held. To prevent problems
with waiting readers, we need to make all readers check if the started
flag is set after they obtain a reader lock. This will deal with the
case where the plug-in was stopped while a thread was waiting on a
reader lock. We also need to be sure to NOT free the lock in the
close() function so that these waiting readers don't crash the
server.