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)
committerKarolin Seeger <kseeger@samba.org>
Wed, 31 Mar 2010 16:00:44 +0000 (18:00 +0200)
commit06d1aeb7b686b8b929cf9bff48aedc9dbb88b7c3
treee3e45a6e4706261191054abac5cf388b3b05338f
parent3ab90b2897cd4e05b21ce46e91e93609e596c80e
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
(cherry picked from commit a752bbd10d661ebc93b8d51bd583eb62eb00ad18)

Fix bug #7314 (registry: creation of sorted subkey record is racy (not atomic)).
source3/registry/reg_backend_db.c