ldb: make ldb module programming less error prone
commit8995491f59e7b6cee79b4249424e886f54f6b94d
authorAndrew Tridgell <tridge@samba.org>
Fri, 4 Sep 2009 07:22:20 +0000 (4 17:22 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 4 Sep 2009 07:29:21 +0000 (4 17:29 +1000)
tree9d8d767702c6ae2ab4b4ad8ae361b82e14a5bf28
parent5121499816db70bf7bd380f604c22311be8fd3de
ldb: make ldb module programming less error prone

When a top level method in a module returns an error, it is supposed
to call ldb_module_done(). We ran across a case where this wasn't
done, and then found that in fact that are hundreds of similar cases
in our modules. It took Andrew and I a full day to work out that this
was the cause of a subtle segv in another part of the code.

To try to prevent this happening again, this patch changes
ldb_next_request() to catch the error by checking if a module
returning an error has called ldb_module_done(). If it hasn't then the
call is made on behalf of the module.
source4/lib/ldb/common/ldb_modules.c
source4/lib/ldb/include/ldb_private.h