What I am currently doing is:
- renumber the indexes of the siblings of the overlay that's going to be
deleted
- remove the CfEntryInfo of the overlay from the internal config tree
- remove the Entry from the underlying LDIF database
Additionally I need to remove the overlay's slap_overinst structure from
the overlay list of the backend and in case it was the last overlay,
restore the original BackendInfo structure and delete the
SLAP_DBFLAG_GLOBAL_OVERLAY flag from the BackendDB structure of the
underlying database (for global overlays). Currently I use the
overlay_destroy_one() function for this task. This also calls the
db_destroy() hook of the overlay which should take are of free
resources held by the overlay.
I am a bit unsure about the db_destroy() part. Is that enough or is it
needed to call the db_close() hooks (when provided by the overlay)
before calling db_destroy()? Did I miss something else? Is anybody else
currently working on this?
Up to now I am testing this only with some simpler overlays (memberof,
pcache), I assume that deleting overlays that instantiate their own
databases (like pcache, translucent(?)) might get a little more hairy.