1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

815 Commits

Author SHA1 Message Date
Michael Adam
4754743860 s3:registry: let reg_values_need_update() return true if the backend does not implement the method
Otherwise the value cache might become outdated.

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Mon May  7 16:11:05 CEST 2012 on sn-devel-104
2012-05-07 16:11:05 +02:00
Michael Adam
fb58951f93 s3:registry: let reg_subkeys_need_update() return true if the backend does not implement the method
Otherwise the subkey cache might become outdated.
2012-05-07 14:09:09 +02:00
Michael Adam
16a24dc182 s3:registry: implement values_need_update and subkeys_need_update in the smbconf backend
It simply calls to the regdb functions.
This fixes a caching issue uncovered by recent changes.

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Sat May  5 04:10:43 CEST 2012 on sn-devel-104
2012-05-05 04:10:42 +02:00
Michael Adam
cd98954c6d s3:registry: return error when Key does not exist in regdb_fetch_values_internal() 2012-05-05 02:22:00 +02:00
Volker Lendecke
05456aca34 s3: Remove an unused variable
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Thu Apr 26 12:17:14 CEST 2012 on sn-devel-104
2012-04-26 12:17:13 +02:00
Michael Adam
c333885fa1 s3:registry: replace call to reg_openkey() in reg_createkey() by accesscheck.
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:12 +02:00
Michael Adam
7f205bcbf2 s3:registry: remove a superfluous fill_subkey_cache() in reg_createkey()
Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:12 +02:00
Michael Adam
4b7817aa80 s3:registry: use fill_subkey_cache to check exsistence in regkey_open_onelevel().
Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:12 +02:00
Michael Adam
be2cb08e40 s3:registry: let fill_subkey_cache return WERR_BADFILE when the subkey list could not be loaded
WERR_NO_MORE_ITEMS seems inappropriate.

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:12 +02:00
Michael Adam
1703e6fe09 s3:registry: convert reg_openkey() to use talloc instead of SMB_STRDUP etc
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:12 +02:00
Michael Adam
323ec9f9b4 s3:registry untangle an assignment from the check in regkey_open_onelevel()
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:12 +02:00
Michael Adam
640cecab19 s3:registry: untangle assignment from check in regkey_open_onelevel()
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:11 +02:00
Michael Adam
22451f7f45 s3:registry: fix seqnum race in regdb_fetch_keys_internal
This prevents race between fetching seqnum and key content.

Because there is currently no way to atomically fetch the
record along with the seqnum, I use a loop.
This is far from optimal and should should ideally be done
differently. But for now it fixes the race.

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:11 +02:00
Michael Adam
7ea8bd3605 s3:registry: fix seqnum race in fetch_values_internal
This prevents race between fetching seqnum and key content.

Because there is currently no way to atomically fetch the
record along with the seqnum, I use a loop.
This is far from optimal and should should ideally be done
differently. But for now it fixes the race.

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:11 +02:00
Michael Adam
ab83005b30 s3:registry: update the seqnum in the subkey cache at the end of regval_store_keys
The purpose is to prevent next reads from going to disk.

Note that this will currently only be effective with local tdbs, not
with ctdb: For tdb, store and delete bump the seqnum while transaction
commit does not. For ctdb, transaction commit bumps the seqnum, while
store and delete don't... This needs fixing (in ctdb).

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:11 +02:00
Michael Adam
4367071f62 s3:registry:db: update the value container seqnum after storing/deleting to prevent next read from going to disk if possible
Note that this will currently only be effective in the local TDB implementation.
For CTDB, this wont work since seqnum currently works differently there (needs
fixing): For tdb, store and delete operations bump the db seqnum, while
transaction commits don't. For ctdb, the seqnum is bumped by the transaction
commit but not by store and delete operations.

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:11 +02:00
Michael Adam
8c7047b0e7 s3:registry: wrap reg_deletekey() into a transaction
This is wrong layering but fixes a race condition.

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:11 +02:00
Michael Adam
32ac4f4b34 s3:registry: wrap reg_createkey() in a transaction
This is wrong layering (calling into regdb_transaction* in the reg_api code)
but fixes a potential race. It makes the multi-step create procedure atomic.

This should completely be done in the backend.

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:10 +02:00
Michael Adam
1af68be008 s3:registry: untangle assignments from checks in reg_createkey()
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:10 +02:00
Michael Adam
8d19ac7474 s3:registry: wrap reg_deletevalue() in a transaction
This is at the wrong layer, but if fixes a race potentially causing
data corruption by concurrent access.

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:10 +02:00
Michael Adam
97bf05871a s3:registry: untangle assignment from check in reg_deletevalue()
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:10 +02:00
Michael Adam
8ddc2aa0e1 s3:registry: fix race in reg_setvalue that could lead to data corruption
(there was no lock around fetching the values and storing them)

The layering is wrong in that it uses regdb transactions in reg_api

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:10 +02:00
Michael Adam
705ea5b8c2 s3:registry: untangle assignment from check and add a debugmessage in reg_setvalue()
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:10 +02:00
Michael Adam
04aa303fb1 s3:registry: don't leak the old contents when updating the value cache
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:09 +02:00
Michael Adam
f4747250ea s3:registry: fix debug message in regdb_store_values_internal()
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:09 +02:00
Michael Adam
44159330db s3:registry: improve log message in regdb_unpack_values()
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:09 +02:00
Michael Adam
6f67f5d5b7 s3:registry: fix a debug message typo
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:09 +02:00
Michael Adam
64a9ab4f82 s3:registry: add a new function regval_ctr_value_byname()
This is like regval_ctr_key_exists() but does not return bool,
but the regval_blob instead, if found, and NULL if not found.

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:31:01 +02:00
Michael Adam
2fc610caf5 s3:registry: rename regval_ctr_key_exists() to regval_ctr_value_exists()
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:23:05 +02:00
Michael Adam
6c016734aa s3:registry:reg_api: fix reg_queryvalue to not fail when values are modified while it runs
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:23:05 +02:00
Michael Adam
877af95ed7 s3:registry: make regdb_values_need_update() static
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:23:05 +02:00
Michael Adam
bc48100530 s3:registry: make regdb_subkeys_need_update() static
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:23:05 +02:00
Michael Adam
a3b1c13cd4 s3:registry: make regdb_store_values() static
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:23:04 +02:00
Michael Adam
6ab2eb8295 s3:registry: make regdb_fetch_values() static
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:23:04 +02:00
Michael Adam
5fdd602605 s3:registry: make regdb_fetch_keys() static
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:23:04 +02:00
Michael Adam
4cf44177ac s3:registry: make regdb_store_keys() static
Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:23:04 +02:00
Michael Adam
37715930c2 s3:registry: printing backend: use regdb options via ops struct, not directly
just like the other backends.

This is in preparation of making the backend functions private

Signed-off-by: Andreas Schneider <asn@samba.org>
2012-04-25 14:23:04 +02:00
Olaf Flebbe
b8dea7e82d Wrong assertion/comparison: Compare value not pointer
Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Apr 13 02:23:36 CEST 2012 on sn-devel-104
2012-04-13 02:23:35 +02:00
Jelmer Vernooij
6f1b735cc2 adt_tree: Avoid WERROR. 2012-03-24 16:41:35 +01:00
Andrew Bartlett
3b5326e987 s3-registry Remove unused dup_registry_value() and free_registry_value() 2012-02-17 12:19:29 +01:00
Andrew Bartlett
7824fd5954 s3-registry: Remove unused prs_uint8()
Found by callcatcher: http://www.skynet.ie/~caolan/Packages/callcatcher.html

Andrew Bartlett
2012-02-10 16:45:12 +11:00
Gregor Beck
f1545048eb s3:registry: do not write empty value lists to registry.tdb
Signed-off-by: Michael Adam <obnox@samba.org>

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Tue Jan 24 13:54:09 CET 2012 on sn-devel-104
2012-01-24 13:54:09 +01:00
Volker Lendecke
45e61fcf61 s3: Add a "lock_order" argument to db_open
This will be used to enforce a lock hierarchy between the databases. We have
seen deadlocks between locking.tdb, brlock.tdb, serverid.tdb and notify*.tdb.
These should be fixed by refusing a dbwrap_fetch_locked that does not follow a
defined lock hierarchy.
2012-01-18 14:48:04 +01:00
David Disseldorp
bd5fe0a333 s3-perfcount: fix incorrect array length calculations
As reported by Ismail Doenmez (idonmez@suse.com), sizeof() is
incorrectly used by _reg_perfcount_init_data_block() in an attempt to
determine the length of a talloced array.

Signed-off-by: Günther Deschner <gd@samba.org>

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Wed Jan  4 16:54:37 CET 2012 on sn-devel-104
2012-01-04 16:54:37 +01:00
Volker Lendecke
75d3b9ce08 s3: Fix some False/NULL hickups
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Tue Dec 20 13:13:17 CET 2011 on sn-devel-104
2011-12-20 13:13:17 +01:00
Michael Adam
2a69de6fde s3:registry: replace use of rawmemchr by portable equivalent use of strchr. 2011-12-06 10:45:42 +01:00
Gregor Beck
d74b3f941f lib/util: factor out tdb_data_is_empty
Signed-off-by: Michael Adam <obnox@samba.org>

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Sat Dec  3 05:20:30 CET 2011 on sn-devel-104
2011-12-03 05:20:30 +01:00
Gregor Beck
789aa9aab2 s3:registry: do not use regdb functions during db upgrade
It is importante to not use the database backend implementation
in the upgrade. Otherwise this would only work as long as this
is the newset version. In future versions of the registry, this
(then) intermediate upgrade step would change in behaviour and not
work as expected any more.

Signed-off-by: Michael Adam <obnox@samba.org>
2011-12-03 03:48:31 +01:00
Gregor Beck
3a2fd7c0e2 s3:registry: write INFO/version if we create registry.tdb
Signed-off-by: Michael Adam <obnox@samba.org>
2011-11-25 13:24:34 +01:00
Michael Adam
6727429aea s3:registry: prevent unnecessary transactions in regdb_init
Skip the transaction for the upgrade code, if the database
is already at code-level.

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Wed Nov  9 15:06:59 CET 2011 on sn-devel-104
2011-11-09 15:06:58 +01:00