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
Volker Lendecke
5ba7b2042b registry: Don't use an uninitialized value
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-10-08 22:17:10 +02:00
Volker Lendecke
f20d018aa9 registry: Print failure of regdb_unpack_values
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-10-08 22:17:10 +02:00
Volker Lendecke
a9ed0e93bb registry: Add error checks to regdb_unpack_values
This makes "regdb_unpack_values" take a size_t as buflen. The only
caller calls it with TDB_DATA.dsize, which *is* size_t. Convert the
internal "len" variable to the unsigned size_t as well and add overflow
checks. This depends on tdb_unpack to either return -1 or a positive
value less than or equal to the passed-in "size_t" buflen;

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-10-08 22:17:09 +02:00
Volker Lendecke
2a35cbb02f registry: Add error checks to regdb_fetch_keys_internal
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-10-08 22:17:09 +02:00
Volker Lendecke
c2ea100777 lib: Pass mem_ctx to state_path()
Fix a confusing API: Many places TALLOC_FREE the path where it's not
clear you have to do it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2018-08-17 11:30:11 +02:00
Günther Deschner
f22c5f1b9a s3-rpc_cli: add winreg_add_core_driver()
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2017-05-09 16:43:13 +02:00
Günther Deschner
de38834516 werror: replace WERR_REG_IO_FAILURE with WERR_REGISTRY_IO_FAILED in source3/registry/
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-28 00:04:24 +02:00
Günther Deschner
5c842da0cf werror: replace WERR_REG_CORRUPT with WERR_REGISTRY_CORRUPT in source3/registry/reg_backend_db.c
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-28 00:04:23 +02:00
Günther Deschner
118ba610b9 werror: replace WERR_INVALID_PARAM with WERR_INVALID_PARAMETER in source3/registry/
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-28 00:04:22 +02:00
Günther Deschner
f19dcbbb58 werror: replace WERR_NOMEM with WERR_NOT_ENOUGH_MEMORY in source3/registry/
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-28 00:04:18 +02:00
Günther Deschner
22a514f992 werror: replace WERR_BADFILE with WERR_FILE_NOT_FOUND in source3/registry/
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-28 00:04:17 +02:00
Günther Deschner
49c5e4fbce s3-registry: create winprint print processor entry for x64 as well.
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-11 19:57:26 +02:00
Michael Adam
8f158bab9f s3:registry: use dbwrap_purge_bystring instead of dbwrap_delete_bystring
where appropriate

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-03-01 21:50:24 +01:00
Richard Sharpe
ddcf0565bb Convert all uses of uint32/16/8 to _t in source3/registry.
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-12 01:32:12 +02:00
Richard Sharpe
07d3ba435a Change the registry subsystem to use uint32_t from uint32. Also change session.h.
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Apr 16 00:37:28 CEST 2015 on sn-devel-104
2015-04-16 00:37:28 +02:00
Volker Lendecke
2dab2f0f73 registry: Slightly simplify tdb_data_is_cstr
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-11-13 22:10:08 +01:00
David Disseldorp
4b6af0dfa7 reg_backend_db: don't leak state_path onto talloc tos
Also check for allocation failures, and ensure that the regdb refcount
is not set by regdb_open() on failure.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-11-03 23:46:04 +01:00
Michael Adam
906abe55cb s3:registry: introduce REG_DBWRAP_FLAGS to use for all db_open calls
This is in accordance with the use of REG_TDB_FLAGS.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-02-07 16:06:07 +01:00
Michael Adam
cf0cb0add9 dbwrap: add a dbwrap_flags argument to db_open()
This is in preparation to support handing flags to backends,
in particular activating read only record support for ctdb
databases. For a start, this does nothing but adding the
parameter, and all databases use DBWRAP_FLAG_NONE.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-02-07 16:06:06 +01:00
Jeremy Allison
526e875cec Check error returns from strupper_m() (in all reasonable places). 2012-08-09 12:06:54 -07:00
Rusty Russell
15faffc537 source3/registry/reg_backend_db.c: fix stackframe leak
regdb_store_values_internal() doesn't always free its stackframe.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-07-18 05:06:31 +09:30
Volker Lendecke
64fec465c1 dbwrap: dbwrap_trans_store_int32->dbwrap_trans_store_int32_bystring
Signed-off-by: Michael Adam <obnox@samba.org>
2012-06-15 12:14:29 +02:00
Volker Lendecke
737c0a5473 dbwrap: dbwrap_fetch_int32->dbwrap_fetch_int32_bystring
Signed-off-by: Michael Adam <obnox@samba.org>
2012-06-15 12:14:27 +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
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
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
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
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
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
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
Björn Baumbach
66eefde53b s3-registry: fix upgrade code
Assume REGDB_VERSION_V1 if no version key found in registry.tdb

Signed-off-by: Michael Adam <obnox@samba.org>
2011-11-03 10:13:41 +01:00
Michael Adam
240d6217dd s3:registry: improve regdb_create_subkey_internal() to always complete incomlete keys
Originally, this function did not create the key's subkey list record if only
the record was listed in the subkeylist of its parent key. Now this is fixed.

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>
2011-10-12 03:49:05 +02:00
Michael Adam
603c3e1bcb s3:dbwrap: convert dbwrap_fetch_int32() to NTSTATUS return code
Return the int32 value retrieved from the db by reference.
Before this, return value "-1" was used as a error indication,
but it could also be a valid value from the database.
2011-10-11 14:17:58 +02:00
Michael Adam
7057b4d1ac s3:registry: convert reg_backend_db to use dbwrap wrapper functions
Avoid direct use of the db_record and db_context structs
2011-10-11 14:17:57 +02:00
Michael Adam
0e28448a78 s3:dbwrap: convert dbwrap_fetch(), dbwrap_fetch_bystring() and dbwrap_fetch_bystring_upper() to NTSTATUS 2011-10-11 14:17:56 +02:00