diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-09-04 17:22:20 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-09-04 17:29:21 +1000 |
commit | 8995491f59e7b6cee79b4249424e886f54f6b94d (patch) | |
tree | 9d8d767702c6ae2ab4b4ad8ae361b82e14a5bf28 /source4/lib/ldb/include | |
parent | 5121499816db70bf7bd380f604c22311be8fd3de (diff) | |
download | samba-8995491f59e7b6cee79b4249424e886f54f6b94d.tar.gz samba-8995491f59e7b6cee79b4249424e886f54f6b94d.tar.bz2 samba-8995491f59e7b6cee79b4249424e886f54f6b94d.zip |
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.
Diffstat (limited to 'source4/lib/ldb/include')
-rw-r--r-- | source4/lib/ldb/include/ldb_private.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index 3cda9a3e33..a70d9c704d 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -47,10 +47,13 @@ struct ldb_module_ops; struct ldb_backend_ops; +#define LDB_HANDLE_FLAG_DONE_CALLED 1 + struct ldb_handle { int status; enum ldb_state state; struct ldb_context *ldb; + unsigned flags; }; /* basic module structure */ |