summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-10-06 20:34:55 +0200
committerMichael Adam <obnox@samba.org>2011-10-11 14:17:58 +0200
commit603c3e1bcb7b4106afe4aefdfed43e7832ede956 (patch)
tree3bbd74811e5a62786975aada7399931db36d1549 /source3/registry
parentce8626cbbe99b26f4e39ace87221792b468b9c93 (diff)
downloadsamba-603c3e1bcb7b4106afe4aefdfed43e7832ede956.tar.gz
samba-603c3e1bcb7b4106afe4aefdfed43e7832ede956.tar.bz2
samba-603c3e1bcb7b4106afe4aefdfed43e7832ede956.zip
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.
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_backend_db.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index ecdf2d22f2..64c466db81 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -71,7 +71,13 @@ static NTSTATUS regdb_trans_do_action(struct db_context *db, void *private_data)
int32_t version_id;
struct regdb_trans_ctx *ctx = (struct regdb_trans_ctx *)private_data;
- version_id = dbwrap_fetch_int32(db, REGDB_VERSION_KEYNAME);
+ status = dbwrap_fetch_int32(db, REGDB_VERSION_KEYNAME, &version_id);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("ERROR: could not fetch registry db version: %s. "
+ "Denying access.\n", nt_errstr(status)));
+ return NT_STATUS_ACCESS_DENIED;
+ }
if (version_id != REGDB_CODE_VERSION) {
DEBUG(0, ("ERROR: changed registry version %d found while "
@@ -627,8 +633,9 @@ done:
WERROR regdb_init(void)
{
- uint32 vers_id;
+ int32_t vers_id;
WERROR werr;
+ NTSTATUS status;
if (regdb) {
DEBUG(10, ("regdb_init: incrementing refcount (%d->%d)\n",
@@ -656,8 +663,8 @@ WERROR regdb_init(void)
DEBUG(10, ("regdb_init: registry db openend. refcount reset (%d)\n",
regdb_refcount));
- vers_id = dbwrap_fetch_int32(regdb, REGDB_VERSION_KEYNAME);
- if (vers_id == -1) {
+ status = dbwrap_fetch_int32(regdb, REGDB_VERSION_KEYNAME, &vers_id);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("regdb_init: registry version uninitialized "
"(got %d), initializing to version %d\n",
vers_id, REGDB_CODE_VERSION));