dbwrap_watch: Protect against corrupt records
authorVolker Lendecke <vl@samba.org>
Wed, 15 Mar 2017 15:54:34 +0000 (16:54 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 1 May 2017 08:40:21 +0000 (10:40 +0200)
commit6f81f07303773d15ce16629c6759540b1d9adab7
tree0528f2f83e0cef8c99019c6cf732fe2d9f65566d
parent5e00fdd4dd7a4ca67538527182ee0fd91c90df58
dbwrap_watch: Protect against corrupt records

If locking.tdb contains invalid records, "get_file_infos" called from directory
enumeration crashes in Samba 4.4. The reason is that if "dbwrap_watched_parse"
returns -1 due to record corruption, dbwrap_watched_parse_record returns
NT_STATUS_OK without having called the parse function. Before 66cba9939b76f
this led to "lck->data" to be uninitialized data, so smbd 4.4 would crash in
this case.  After 66cba9939b76f we implicitly initialize "state.lck" to NULL,
so we don't have this particular problem anymore

Apply the fix in master too, returning NT_STATUS_OK from parse_record without
having called the parser could lead to bugs in other cases too.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/dbwrap/dbwrap_watch.c