Here are potentially useful libraries used in Samba project.
TDB (Trivial DataBase)
"In concept, it is very much like GDBM, and BSD's DB except that it allows multiple simultaneous writers and uses locking internally to keep writers from trampling on each other. tdb is also extremely small."
It has added transactions support.
"Hierarchical, reference counted memory pool system with destructors. It is the core memory allocator used in Samba (LGPL)."
man 3 talloc
"Tevent is an event system based on the talloc memory management library."
All Samba related sub-projects one can find at http://samba.com under "Related Sites".
Additionally here is page with junk code form Samba author:
More description of junk code in conference materials.
Especially worth mentioning is 'segv_handler'.