s3:registry: eliminate race condition in creating/scanning sorted subkeys
authorMichael Adam <obnox@samba.org>
Mon, 8 Feb 2010 10:01:47 +0000 (11:01 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 8 Feb 2010 21:56:10 +0000 (22:56 +0100)
commit0710d76be8858fb6aa38d58b27fd8c8888e90edc
tree74fc7be748e0ad91f11b20b80220c5e42c40d4a6
parent381137d4f1fef5c6c686b805fb0e320212958e2a
s3:registry: eliminate race condition in creating/scanning sorted subkeys

Called, from key_exists, scan_sorted_subkeys re-creates the sorted
subkeys record of the given key and then searches through it.
The race is that between creation and parsing of the sorted subkey
record, another process that stores some other subkey of the same
parent key will delete the sorted subkey record, resulting in an
WERR_BADFILE of an operation that should actually succeed.

This patch fixes the issue by wrapping the creation and parsing
into a transaction.

Michael
source3/registry/reg_backend_db.c