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

294 Commits

Author SHA1 Message Date
Michael Adam
2b162db6e9 s3:registry: add helper function regdb_delete_sorted_subkeys()
Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>

Signed-off-by: Michael Adam <obnox@samba.org>
2011-06-30 15:41:22 +02:00
Rusty Russell
5a7874e119 tdb_traverse/tdb_traverse_read: check returns for negative, not -1.
TDB2 returns a negative error number on failure.  This is compatible
if we always check for < 0 instead of == -1.

Also, there's no tdb_traverse_read in TDB2: we don't try to make
traverse reliable any more, so there are no write locks anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:35 +02:00
Andrew Bartlett
3d15137653 s3-talloc Change TALLOC_ARRAY() to talloc_array()
Using the standard macro makes it easier to move code into common, as
TALLOC_ARRAY isn't standard talloc.
2011-06-09 12:40:08 +02:00
Andrew Bartlett
381423b1bd libcli/security: move secdesc.c to the top level libcli/security
This code does not rely on lp_ or other source3 only functions, so can
be part of the common library.

Andrew Bartlett
2011-05-31 00:32:07 +02:00
Andrew Bartlett
c615ebed6e s3-lib Replace StrCaseCmp() with strcasecmp_m()
strcasecmp_m() never needs to call to talloc, and via next_codepoint()
still has an ASCII fast-path bypassing iconv() calls.

Andrew Bartlett
2011-05-18 16:12:08 +02:00
Michael Adam
26b6831164 s3:registry: add a warning debug message when the sorted subkeys is created from key_exists() 2011-05-12 11:48:30 +02:00
Michael Adam
daf5f29d49 s3:registry: recreate the sorted subkeys cache when storing keys
This is to avoid turning the next read operation into a write op.
2011-05-12 11:48:30 +02:00
Michael Adam
1a6ac6a944 s3:registry: add create_sorted_subkeys() to delete and recreate the sorted subkeys key
This is to be used from other places than the key_exists() code path.
2011-05-12 11:48:30 +02:00
Michael Adam
b1eac2daf3 s3:registry: turn create_sorted_subkeys_internal to NTSTATUS return type
(from bool)
2011-05-12 11:48:30 +02:00
Michael Adam
f5f9355ebe s3:registry: rename create_sorted_subkeys() to create_sorted_subkeys_internal() 2011-05-12 11:48:29 +02:00
Michael Adam
04f0a1cb7b s3:registry: fix a typo in a debug message 2011-05-12 11:48:29 +02:00
Günther Deschner
d8cfca3a9b s3: only include tdb headers where needed.
Guenther
2011-05-06 10:48:10 +02:00
Volker Lendecke
b48e22347d s3: Fix Coverity ID 2047, UNUSED_VALUE
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Fri Apr 22 10:53:24 CEST 2011 on sn-devel-104
2011-04-22 10:53:24 +02:00
Günther Deschner
0e771263ee s3-includes: only include system/filesys.h when needed.
Guenther
2011-03-30 01:13:07 +02:00
Michael Adam
14502c5458 s3:registry: fix comments in regdb_store_regdb_version() 2011-01-27 21:43:48 +01:00
Michael Adam
d91189727a s3:registry: improve debug messages about regdb refcount changes
Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Tue Dec  7 15:18:03 CET 2010 on sn-devel-104
2010-12-07 15:18:03 +01:00
Volker Lendecke
4b2e2f94bb s3: Streamline regdb_normalize_keynames_fn a bit
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Thu Oct 28 14:32:11 UTC 2010 on sn-devel-104
2010-10-28 14:32:11 +00:00
Volker Lendecke
8b87603de4 s3: Fix the registry upgrade code
The strings have the 0-terminator as part of the keys. The rest of the registry
code would not cope well without.
2010-10-28 15:50:14 +02:00
Michael Adam
cda2db5edf s3:registry: fix some trailing spaces in reg_backend_db
Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Tue Oct 12 14:15:42 UTC 2010 on sn-devel-104
2010-10-12 14:15:42 +00:00
Günther Deschner
7a05ca2c9c s3-build: use dbwrap.h only where needed.
Guenther
2010-08-26 00:25:55 +02:00
Günther Deschner
813fbbd68c s3-build: avoid to globally include printing and spoolss headers.
This shrinks precompiled headers by 3MB and will slightly speed up any build.

Guenther
2010-07-31 00:50:31 +02:00
Andreas Schneider
96c25cdad5 s3-spoolss: Create winprint print processor key.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:14 -04:00
Andreas Schneider
65eb38bc00 s3-registry: Init all needed registry keys for printing.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:06 -04:00
Günther Deschner
ddb8fae401 s3-registry: allow to read NULL entries (that we allow to store) back from the tdb.
Guenther
2010-07-02 10:50:21 +02:00
Michael Adam
6d973607c3 s3:registry: use regdb_store_regdb_version() in regdb_init(). 2010-06-25 18:13:06 +02:00
Michael Adam
2f44dcc96b s3:registry: use regdb_store_regdb_version() in regdb_upgrade_v1_to_v2() 2010-06-25 18:12:28 +02:00
Michael Adam
5641ee02fd s3:registry: add a function regdb_store_regdb_version() 2010-06-25 18:11:35 +02:00
Michael Adam
a9bec6b779 s3:registry: rename regdb_upgrade_to_version_2() -> regdb_upgrade_v1_to_v2() 2010-06-25 18:04:52 +02:00
Michael Adam
8e4f812823 s3:registry: improve logic of upgrade code in regdb_init()
Don't overwrite unknown versions (0 or > 2) of the registry.
2010-06-25 17:35:42 +02:00
Michael Adam
3703b79b11 s3:registry: fix some debug messages in regdb_ini() 2010-06-25 17:35:42 +02:00
Andreas Schneider
15bacaf3c5 s3-registry: Convert registry key delimiter from slash to backslash.
This is needed to support keynames containing a '/' like TCP/IP. Which
is used in serveral standard paths.

Signed-off-by: Michael Adam <obnox@samba.org>
2010-06-25 17:35:41 +02:00
Andreas Schneider
f540833632 s3-registry: Added a db upgrade function to normalize the key delimiter.
This converts the key delimiter from a slash to a blackslash. We need to
support keynames with a backslash.

Signed-off-by: Michael Adam <obnox@samba.org>
2010-06-25 17:35:41 +02:00
Michael Adam
5cac4e648c s3:registry: use normalize_reg_path() in regdb_set_secdesc()
instead of normalize_dbkey
2010-06-24 15:36:20 +02:00
Michael Adam
4c948251d9 s3:registry: use normalize_reg_path() in regdb_get_secdesc()
instead of normalize_dbkey.
2010-06-24 15:36:20 +02:00
Michael Adam
0fe1ff99a1 s3:registry: move reg_objects.h to registry/ and use it only where needed
Every place outside of registry/ where this is used, should probably
be changed to use pure reg_api.c code.
2010-05-25 10:35:31 +02:00
Michael Adam
a71dac4882 s3:registry: user regval_ctr/blob accessor functions in reg_backend_db.c 2010-05-25 10:35:28 +02:00
Michael Adam
773255ba50 s3:registry: rename reg_util.{c,h} to reg_util_internal.{c,h} 2010-05-25 10:35:27 +02:00
Michael Adam
d335f292ce s3:registry: extract the reg_backend_db prototypes into their own header.
And use them only where needed.
2010-05-25 10:35:25 +02:00
Michael Adam
9ccf66379a s3:registry: adapt callers of regval_ctr_addvalue to uint8 * instead of char * 2010-05-25 10:35:25 +02:00
Michael Adam
4ae77b2ef9 s3:registry: extract the reg_util prototypes into their own header.
And use them only where needed.
2010-05-25 10:35:25 +02:00
Gregor Beck
0a173444ac s3: registry: fix query empty valuenames
Remove a check introduced with commit 80c2446321
wich causes queries for values with empty name to fail. Empty valuenames are
used for the so called default value of a key.

Signed-off-by: Michael Adam <obnox@samba.org>
2010-05-21 00:22:45 +02:00
Günther Deschner
fe31b67d5e s3-registry: only include registry headers when really needed.
Guenther
2010-05-18 01:15:38 +02:00
Günther Deschner
3d5972c43f s3-libgpo: move group policy protos to where they belong.
Guenther
2010-05-17 21:07:17 +02:00
Andrew Tridgell
7cff685c7e s3: convert registry and printing code to TYPESAFE_QSORT() 2010-02-14 18:44:21 +11:00
Michael Adam
a752bbd10d 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
2010-02-12 23:12:12 +01:00
Michael Adam
cc5b22a016 s3:registry: add an extra check for dsize==0 to regdb_fetch_keys_internal()
Don't only rely on dptr == NULL.
I stumbled over this one when rewriting some of the dbwrap_ctdb code.

Michael
2009-11-03 01:02:39 +01:00
Michael Adam
f6f2151a39 s3:registry: add safety check for return value of tdb_unpack to regdb_fetch_keys_internal()
Prevents segfaults in some situations.

(For a non existent or empty record, we sometimes rely on the fetch operation
 to return dsize==0 and sometimes we rely on dptr==NULL.)

Michael
2009-11-03 01:02:38 +01:00
Günther Deschner
1b0f3b7e3a s3-registry: use regval_ctr_addvalue_sz().
Greatly simplifies and cleanes up the code.

Guenther
2009-09-30 00:30:12 +02:00
Günther Deschner
2c11b73391 s3-registry: use push_reg_sz().
Guenther
2009-09-30 00:29:49 +02:00
Michael Adam
5a525f7f28 s3:registry: db backend: add my C
Michael
2009-07-15 14:01:58 +02:00
Michael Adam
78576117eb s3:registry: flush the provided subkey_ctr in regdb_fetch_keys_internal()
This way, we always return what has really been read from the db,
and not more. The callers assume exactly this, but one could hand
in an already pre-filled subkey container...

Michael
2009-07-15 14:01:58 +02:00
Michael Adam
dc0bcfa188 s3:registry: turn regdb_fetch_keys_internal() from int to WERROR return type
This way, more error information is propagated to the callers.

Michael
2009-07-15 14:01:57 +02:00
Michael Adam
c52dd1d5b8 s3:registry: use transaction wrapper in create_sorted_subkeys()
Michael
2009-07-15 14:01:56 +02:00
Michael Adam
109ea29b2c s3:registry: restructure logic of create_sorted_subkes() slightly
This makes it clearer to me, and it also makes it easier to
use the transaction retry wrapper in the next step.

Michael
2009-07-15 14:01:56 +02:00
Michael Adam
2d6dbcd0b1 s3:registry: use transaction wrapper in regdb_delete_subkey().
Michael
2009-07-15 14:01:55 +02:00
Michael Adam
a48d8353c7 s3:registry: add a comment header for the delete_subkey set of commands.
Michael
2009-07-15 14:01:55 +02:00
Michael Adam
5640598cbb s3:registry: add a comment header for the create_subkey set of functions
Michael
2009-07-15 14:01:54 +02:00
Michael Adam
8c7b960493 s3:registry: use transaction wrapper in regdb_create_subkey()
Michael
2009-07-15 14:01:54 +02:00
Michael Adam
86d747e19f s3:registry: use transaction wrapper in regdb_store_keys_internal().
Michael
2009-07-15 14:01:53 +02:00
Michael Adam
f93c9e0d41 s3:registry: don't leak to talloc_stack in regdb_store_keys_internal2()
and catch one potential talloc failure.

Michael
2009-07-15 14:01:53 +02:00
Michael Adam
3eec829e2f s3:registry: unify exit logic and remove leaking to talloc_stack in regdb_store_keys_internal()
Michael
2009-07-15 14:01:53 +02:00
Michael Adam
14f593aa0f s3:registry: change regdb_store_keys_internal2() to return WERROR
instead of bool for better error propagation.

Michael
2009-07-15 14:01:52 +02:00
Michael Adam
1c65c98f33 s3:registry: refactor adding of builtin reg values out
into regdb_ctr_add_value(). For readability.

Michael
2009-07-15 14:01:52 +02:00
Michael Adam
cf4f808b8b s3:registry: use transaction wrapper in init_registry_data()
Michael
2009-07-15 14:01:51 +02:00
Michael Adam
e6340963cf s3:registry: add regdb_store_values_internal() that takes a db_context argument
Michael
2009-07-15 14:01:51 +02:00
Michael Adam
302265aae1 s3:registry: add a regdb_fetch_values_internal() that takes a db_context argument
Michael
2009-07-15 14:01:50 +02:00
Michael Adam
8a5b164b20 s3:registry: use transaction wrapper in init_registry_key().
Michael
2009-07-15 14:01:50 +02:00
Michael Adam
95ebf534d2 s3:registry: add db_context argument to init_registry_key_internal()
Michael
2009-07-15 14:01:49 +02:00
Michael Adam
a00109e1e6 s3:registry: panic upon error at transaction_cancel in create_sorted_subkeys
Michael
2009-07-15 14:01:49 +02:00
Michael Adam
3189828087 s3:registry: fix a comment in create_sorted_subkeys()
Michael
2009-07-15 14:01:48 +02:00
Michael Adam
4c366a0946 s3:registry: don't loop transaction_commit in create_sorted_subkeys() upon error
This would try to commit a higher level transaction upon commit-error.

Michael
2009-07-15 14:01:48 +02:00
Michael Adam
6cb14409af s3:registry: in regdb_delete_subkey(), don't use the transaction wrappers.
This way, the db handle gets used explicitly and the core of the
function can be abstracted.

Michael
2009-07-15 14:01:47 +02:00
Michael Adam
4eeacd6ef0 s3:registry: in regdb_delete_subkey(), panic if transaction_cancel fails
Michael
2009-07-15 14:01:47 +02:00
Michael Adam
355892c296 s3:registry: panic upon failed transaction_cancel in regdb_create_subkey()
Michael
2009-07-15 14:01:47 +02:00
Michael Adam
3409a44da2 s3:registry: don't use exported transaction wrappers in regdb_create_subkey()
So that the regdb handle is again explicit and the core of the
function can be abstracted.

Michael
2009-07-15 14:01:46 +02:00
Michael Adam
1dfaa371fa s3:registry: create regdb_store_keys_internal() with db_context argument
and let exported regdb_store_keys() just call regdb_store_keys_internal()
with regdb as an argument. Internally, in reg_backend_db.c, always use the
_internal version.

Michael
2009-07-15 14:01:46 +02:00
Michael Adam
eb1958ca3d s3:registry: rename regdb_store_keys_internal() to regdb_store_keys_internal2()
Michael
2009-07-15 14:01:45 +02:00
Michael Adam
589bacfbdb s3:registry: create regdb_fetch_keys_internal() with db_context argument
and let exported regdb_fetch_keys() just call regdb_fetch_keys_internal()
with regdb as an argument. Internally, in reg_backend_db.c, always use the
_internal version.

Michael
2009-07-15 14:01:45 +02:00
Michael Adam
db4f797e35 s3:registry: add db_context argument to scan_parent_subkeys()
Michael
2009-07-15 14:01:44 +02:00
Michael Adam
c01d955ac0 s3:registry: add db_context argument to regdb_fetch_key_internal()
Michael
2009-07-15 14:01:44 +02:00
Michael Adam
a18a10c07a s3:registry: add db_context argument to regdb_store_keys_internal()
Michael
2009-07-15 14:01:43 +02:00
Michael Adam
528bf38875 s3:registry: add db_context argument to regdb_delete_key_lists()
Michael
2009-07-15 14:01:43 +02:00
Michael Adam
86e927cb05 s3:registry: add db_context argument to regdb_delete_subkeylist()
Michael
2009-07-15 14:01:42 +02:00
Michael Adam
bd983dba6b s3:registry: add db_context argument to regdb_delete_secdesc()
Michael
2009-07-15 14:01:42 +02:00
Michael Adam
ec6b6727d8 s3:registry: add db_context argument to regdb_delete_values()
Michael
2009-07-15 14:01:41 +02:00
Michael Adam
2b380c73a4 s3:registry: add db_context argument to regdb_delete_key_with_prefix()
Michael
2009-07-15 14:01:41 +02:00
Michael Adam
e935d8616b s3:registry: replace typedef REGISTRY_OPS by struct registry_ops
Michael
2009-04-27 11:21:04 +02:00
Michael Adam
8185d31fb0 s3:registry: replace typedef REGISTRY_VALUE by struct regval_blob
Michael
2009-04-27 11:21:03 +02:00
Michael Adam
221151a2a2 s3:registry: replace typedef REGVAL_CTR by struct regval_ctr.
This paves the way for hiding the typedef and the implementation
from the surface.

Michael
2009-04-27 11:21:02 +02:00
Michael Adam
b5fbe06d74 s3:registry: implement delete_subkey in the db backend
Michael
2009-02-26 13:22:55 +01:00
Michael Adam
61bdfd09ed s3:registry: refactor deletion of various subkey lists out of regdb_store_keys()
Micheal
2009-02-26 13:22:55 +01:00
Michael Adam
13ceeeedbc s3:registry: streamline and cleanup regdb_set_secdesc() somewhat.
Michael
2009-02-26 13:22:55 +01:00
Michael Adam
2fb944bde1 s3:registry: refactor deletion of value/secdesc/subkey list tdb records out
of regdb_store_values().

Michael
2009-02-26 13:22:55 +01:00
Michael Adam
20e40d3b7d s3:registry: implement create_subkey for the db backend.
Michael
2009-02-26 13:22:54 +01:00
Michael Adam
69be6f5c1d s3:registry: use regsubkey_ctr_get_seqnum() in reg_backend_db.c
Michael
2009-02-26 13:22:53 +01:00
Michael Adam
8a74b535c8 s3:registry: use regsubkey_ctr_set_seqnum() in reg_backend_db.c
Michael
2009-02-26 13:22:53 +01:00
Michael Adam
3c15d053f5 s3:registry: use regsubkey_ctr_init() in reg_backend_db.c
instead of using talloc directly.

Michael
2009-02-26 13:22:53 +01:00
Michael Adam
63b576424d s3:registry: don't directly access key->subkeys->subkeys[] in reg_backend_db.c
Use the reg_objects accessor regsubkey_ctr_specific_key() instead.

Michael
2009-02-26 13:22:51 +01:00
Michael Adam
62b53507d2 s3:registry: don't directly access key->subkeys->num_subkeys in reg_backend_db.
Use the reg_objects api instead.

Michael
2009-02-26 13:22:51 +01:00
Michael Adam
58fc61217d s3:registry: replace typedef "REGSUBKEY_CTR" by "struct regsubkey_ctr"
This paves the way for hiding the typedef and the implementation from the
surface.

Michael
2009-02-26 13:22:51 +01:00
Michael Adam
b56f449d6b Revert "Fix a O(n^2) algorithm in regdb_fetch_keys()"
This reverts commit a13f065bad.

This fix is reverted, because the speedup is going to move
further down into reg_objects.c. The unsorted list of subkey names
is going to be indexed: This O(n^2) search bites us in more places.
This re-establishes the abstraction of reg_objects.c.

Michael
2009-02-26 13:22:51 +01:00
Michael Adam
ba0e944c46 s3:registry: provide transaction_start|commit|cancel fns for the registry tdb
Michael
2009-02-26 11:05:22 +01:00
Volker Lendecke
170830c008 Wrap creating the sorted subkey cache in a transaction
Signed-off-by: Michael Adam <obnox@samba.org>
2009-02-26 11:05:22 +01:00
Volker Lendecke
5c91cdcc47 Add a comment describing the sorted subkeys
Signed-off-by: Michael Adam <obnox@samba.org>
2009-02-26 11:05:22 +01:00
Volker Lendecke
1b1aac412c Add sorted subkey cache
On my box this gets net conf list for 1000 records down to .1 seconds

Signed-off-by: Michael Adam <obnox@samba.org>
2009-02-26 11:05:22 +01:00
Jeremy Allison
2ca48d3740 Fix printf type warning.
Jeremy.
2009-02-19 13:11:36 -08:00
Volker Lendecke
a13f065bad Fix a O(n^2) algorithm in regdb_fetch_keys() 2009-02-19 20:06:29 +01:00
Volker Lendecke
d0ee90ace9 Fix a buffer handling bug when adding lots of registry keys
This is *ancient*... From 2002, and nobody noticed until someone added lots of
shares using net conf... :-)
2009-02-19 14:26:50 +01:00
Jelmer Vernooij
ddcab787c4 Rename dos_errstr() to win_errstr() for consistency with Samba 4. 2008-11-01 17:19:26 +01:00
Andrew Tridgell
0f41961e4f first cut at adding full transactions for ctdb to samba3
(This used to be commit f91a3e0f7b)
2008-08-13 11:54:08 +02:00
Michael Adam
6e16022d62 registry: use _bystring wrappers to dbwrap_trans_(store|delete).
Michael
(This used to be commit 103ce6c9e9)
2008-08-05 23:40:26 +02:00
Michael Adam
a8ae5228f5 registry: bump debug level to 1 in regdb_init() if storing version string fails.
Higher level callers should take care of level 0 messages.

Michael
(This used to be commit b5829e04ea)
2008-07-15 14:25:00 +02:00
Michael Adam
0586d981a7 registry: bump debug level to 1 in regdb_init() if opening the registry fails.
Higher level callers take care of level 0 messages or more drastic measures.

Michael
(This used to be commit 111d802b5c)
2008-07-15 14:22:55 +02:00
Michael Adam
f587e0310c registry: fix logic in deleting subkeys record in regdb_fetch_keys().
Don't cancel on NT_STATUS_NOT_FOUND error from dbwrap_delete_bystring().
So deletion of an "incomlete" registry key, i.e. one with an entry in
the list of subkeys of its parent key but not a subkey list of its own,
works again.

Michael
(This used to be commit 75be2116ac)
2008-07-09 10:43:25 +02:00
Michael Adam
ad2e1757e7 registry: improve logic for deleting value records in regdb_store_keys().
Don't ignore all errors from dbwrap_delete_bystring() but
only NT_STATUS_NOT_FOUND.

Michael
(This used to be commit d7ec9b2d52)
2008-07-09 10:43:25 +02:00
Michael Adam
70d8e57c17 registry: fetch regdb_fetch_keys() when a key exists but not its subkey-record.
According to the new policy a key (that is not a base key) exists,
iff it exists in the subkey list of its parent key.

Usually this subkeylist is present, but in a transaction-less
dbwrap backend (ctdb), a failing write can leave an "incomplete"
key without its own subkeylist-record. (Otherwise such an
incomplete key can be generated with e.g. tdbtool.)
For such a key net registry enumerate (e.g.) would fail.
This commit fixes this behaviour of regdb_fetch_keys().

Michael
(This used to be commit f329aaf045)
2008-07-08 17:10:01 +02:00
Michael Adam
f7d39653f5 registry: add removal of secdesc of a key to regdb_store_keys().
Michael
(This used to be commit a01d8fe5e8)
2008-05-08 18:29:10 +02:00
Michael Adam
1f279f866f registry: add comments to removing lists in regdb_store_keys().
Michael
(This used to be commit 3e89217e7e)
2008-05-08 18:29:10 +02:00
Michael Adam
9f7653bfa1 registry: change order of deleting value and subkey lists in store_keys().
Next step in the plan to make store_keys safer without transactions.

Michael
(This used to be commit f7c8718dea)
2008-05-08 18:29:10 +02:00
Michael Adam
453141b395 registry: adapt comment to first step in regdb_store_keys().
Michael
(This used to be commit 97592db08a)
2008-05-08 18:29:10 +02:00
Michael Adam
8c2b976208 registry: adapt comment of last step in regdb_store_keys().
adding number (3) ....

Michael
(This used to be commit a03a17365d)
2008-05-08 18:29:10 +02:00
Michael Adam
315c7b7824 registry: regdb_store_keys: move storing the subkey list down after removing values.
Michael
(This used to be commit 986030cdda)
2008-05-08 18:29:10 +02:00
Michael Adam
01e640f6ea registry: add comment explaining workflow to make store_keys safe w/o transactions
/*
 * Make the store operation as safe as possible without transactions:
 *
 * (1) For each subkey removed from ctr compared with old_subkeys:
 *
 *     (a) First delete the value db entry.
 *
 *     (b) Next delete the secdesc db record.
 *
 *     (c) Then delete the subkey list entry.
 *
 * (2) Now write the list of subkeys of the parent key,
 *     deleting removed entries and adding new ones.
 *
 * (3) Finally create the subkey list entries for the added keys.
 *
 * This way if we crash half-way in between deleting the subkeys
 * and storing the parent's list of subkeys, no old data can pop up
 * out of the blue when re-adding keys later on.
 */

The workflow is going to be modified to meet this agendain the next commits.

Michael
(This used to be commit 55dd9bdd14)
2008-05-08 18:29:10 +02:00
Michael Adam
7fa4cd2421 registry: check for existence of non base key in regdb_store_keys() before proceeding.
Michael
(This used to be commit 52413c94fc)
2008-05-08 18:29:09 +02:00
Michael Adam
8e21d223f7 registry: add a function regdb_key_is_base_key() to check whether is composite.
This partly duplicates code from regdb_key_exists(). Maybe refactor later.

Michael
(This used to be commit c27d03bba8)
2008-05-08 18:29:09 +02:00
Michael Adam
4095b008ee registry: check for existence of key in regdb_set_secdesc() before proceeding.
Michael
(This used to be commit 347bab7f4a)
2008-05-08 18:29:09 +02:00
Michael Adam
7d35d4e2a4 registry: check for existence of key in regdb_get_secdesc() before proceeding.
Michael
(This used to be commit 727e5a87c0)
2008-05-08 18:29:09 +02:00
Michael Adam
ba94ab2ed8 registry: check for existence of key in regdb_store_values() before proceeding.
Michael
(This used to be commit 8a2c9d965d)
2008-05-08 18:29:09 +02:00
Michael Adam
4394c2dafb registry: check for existence of key in regdb_fetch_keys() before proceeding.
Michael
(This used to be commit cf653e101d)
2008-05-08 18:29:09 +02:00
Michael Adam
00ce73850d registry: check for existence of key in regdb_fetch_values() first.
This uses the new semantics for existence of a key.

Michael
(This used to be commit 56a58690d3)
2008-05-08 18:29:09 +02:00
Michael Adam
284bab74a7 registry: free talloc context on error path in regdb_fetch_values().
Michael
(This used to be commit 978aef3a86)
2008-05-08 18:29:09 +02:00
Michael Adam
a26880c372 registry: Implement new semantics for existence of registry key in tdb.
Existence of a key is defined as follows:
* If the key is a base key (without separator), the key exists
  iff the corresponding entry exist in the registry tdb.
* If the key is not a base key, the key exists, iff it exists
  in the list of subkeys of it's parent keyname's tdb entry.

Michael
(This used to be commit 477008367f)
2008-05-08 18:29:09 +02:00
Michael Adam
120aacfac5 registry: free temporary data in regdb_fetch_key_internal().
Michael
(This used to be commit 2b25f480ba)
2008-05-08 18:29:08 +02:00
Michael Adam
79a009b876 registry: change order of arguments of regdb_fetch_key_internal()
list talloc context first.

Michael
(This used to be commit 23d7002b22)
2008-05-08 18:29:08 +02:00
Michael Adam
f50002b491 registry: skip writes of existing keys in init_registry_data().
Michael
(This used to be commit 37dabf9317)
2008-04-30 12:42:33 +02:00
Michael Adam
9fe870affa registry: save writes in init_registry_data() if data does already exist.
This is done by first checking if all data (keys and values) exists
(using new regdb_key_exists()) and kompletely skipping all writes if it does.

Michael
(This used to be commit 7c5f1583cb)
2008-04-30 12:42:32 +02:00
Michael Adam
ed6a9edb1e registry: check for existence of key init_registry_key and possibly save a write.
Michael
(This used to be commit 3ab5a2f1b3)
2008-04-30 12:42:32 +02:00
Michael Adam
6ec4c8631a registry: add function regdb_key_exists() to check for existence of a key.
The existence of the registry key entry (and not the values entry!) is
taken as the criterion for existence.

Michael
(This used to be commit 207a0ece45)
2008-04-30 12:42:32 +02:00
Michael Adam
167d54cc67 registry: use regdb_fetch_key_internal() in regdb_fetch_values().
Michael
(This used to be commit 3316541ac9)
2008-04-30 12:42:32 +02:00
Michael Adam
6b4ed4b8f3 registry: use regdb_fetch_key_internal() in regdb_fetch_keys().
Michael
(This used to be commit 78f924ca05)
2008-04-30 12:42:32 +02:00
Michael Adam
5379dda0cd registry: add a function for fetching a tdb record for a given keystring
regdb_fetch_key_internal()

Michael
(This used to be commit 97bed9a236)
2008-04-30 12:42:32 +02:00
Michael Adam
411ae73283 registry: combine talloc_strdup() and normalize_reg_path() in regdb_fetch_keys().
the talloc_strdup() call is just and extra allocation here.

Michael
(This used to be commit 217233349b)
2008-04-30 12:42:32 +02:00
Michael Adam
dba75c0831 registry: use normalize_reg_path() in regdb_fetch_keys()
instead of handcrafting normalization.

Michael
(This used to be commit 1e4d2310d0)
2008-04-30 12:42:31 +02:00
Michael Adam
caba2d3a64 registry: use dbwrap_fetch_bystring() in regdb_fetch_values().
Michael
(This used to be commit 569f9844e9)
2008-04-30 12:42:31 +02:00
Michael Adam
9d933dedf9 registry: use dbwrap_fetch_bystring() in regdb_fetch_keys().
instead of using regdb->fetch and constructing tdb data
from the registry key string by hand.

Michael
(This used to be commit 87a58140f0)
2008-04-30 12:42:31 +02:00
Michael Adam
86d189dad1 registry: honour the WERROR that regsubkey_ctr_addkey gives in regdb_fetch_keys.
Michael
(This used to be commit 7dd7471da7)
2008-04-13 15:41:07 +02:00
Michael Adam
26a5652f6d registry: change init_registry_key() and init_registry_data() to return WERR
Michael
(This used to be commit e0718f04a7)
2008-04-13 15:33:47 +02:00
Michael Adam
6b85938f27 registry: change regdb_init() to return WERROR instead of bool.
Michael
(This used to be commit c312852abc)
2008-04-13 15:33:47 +02:00
Volker Lendecke
16198dc51e Convert dbwrap_trans_delete to NTSTATUS
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(This used to be commit dead193f46)
2008-04-01 14:04:22 +02:00
Volker Lendecke
fcdfff1cc8 Convert dbwrap_trans_store to NTSTATUS
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(This used to be commit 5f4de856af)
2008-04-01 14:04:22 +02:00