summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-09-02 00:34:12 +0200
committerMichael Adam <obnox@samba.org>2011-09-02 10:17:20 +0200
commitfff30e9f88f404bf3521f892e325222b2e8773aa (patch)
treef2f5d510f6d995d99f3c76d6fcdfafea2b3eef31
parent39c6de28fa5bdbd32c465a08e589deee3ee2c074 (diff)
downloadsamba-fff30e9f88f404bf3521f892e325222b2e8773aa.tar.gz
samba-fff30e9f88f404bf3521f892e325222b2e8773aa.tar.bz2
samba-fff30e9f88f404bf3521f892e325222b2e8773aa.zip
s3:registry: introduce a define REGDB_CODE_VERSION and use it in regdb code.
This is to not use the precise code version REGDB_VERSION_V3 explicitly in the code.
-rw-r--r--source3/registry/reg_backend_db.c16
-rw-r--r--source3/registry/reg_db.h2
2 files changed, 9 insertions, 9 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index 2a17705834..5857b0790e 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -73,11 +73,11 @@ static NTSTATUS regdb_trans_do_action(struct db_context *db, void *private_data)
version_id = dbwrap_fetch_int32(db, REGDB_VERSION_KEYNAME);
- if (version_id != REGDB_VERSION_V3) {
+ if (version_id != REGDB_CODE_VERSION) {
DEBUG(0, ("ERROR: changed registry version %d found while "
"trying to write to the registry. Version %d "
"expected. Denying access.\n",
- version_id, REGDB_VERSION_V3));
+ version_id, REGDB_CODE_VERSION));
return NT_STATUS_ACCESS_DENIED;
}
@@ -618,7 +618,7 @@ done:
WERROR regdb_init(void)
{
- uint32 vers_id, expected_version;
+ uint32 vers_id;
WERROR werr;
if (regdb) {
@@ -647,22 +647,20 @@ WERROR regdb_init(void)
DEBUG(10, ("regdb_init: registry db openend. refcount reset (%d)\n",
regdb_refcount));
- expected_version = REGDB_VERSION_V3;
-
vers_id = dbwrap_fetch_int32(regdb, REGDB_VERSION_KEYNAME);
if (vers_id == -1) {
DEBUG(10, ("regdb_init: registry version uninitialized "
"(got %d), initializing to version %d\n",
- vers_id, expected_version));
+ vers_id, REGDB_CODE_VERSION));
- werr = regdb_store_regdb_version(regdb, expected_version);
+ werr = regdb_store_regdb_version(regdb, REGDB_CODE_VERSION);
return werr;
}
- if (vers_id > expected_version || vers_id == 0) {
+ if (vers_id > REGDB_CODE_VERSION || vers_id == 0) {
DEBUG(0, ("regdb_init: unknown registry version %d "
"(code version = %d), refusing initialization\n",
- vers_id, expected_version));
+ vers_id, REGDB_CODE_VERSION));
return WERR_CAN_NOT_COMPLETE;
}
diff --git a/source3/registry/reg_db.h b/source3/registry/reg_db.h
index 9782c1eab4..d0d9fd3931 100644
--- a/source3/registry/reg_db.h
+++ b/source3/registry/reg_db.h
@@ -27,6 +27,8 @@
#define REGDB_VERSION_V3 3 /* different definition of key existence, */
/* sorted subkeys cache removed. */
+#define REGDB_CODE_VERSION REGDB_VERSION_V3
+
#define REG_VALUE_PREFIX "SAMBA_REGVAL"
#define REG_SECDESC_PREFIX "SAMBA_SECDESC"
#define REG_SORTED_SUBKEYS_PREFIX "SAMBA_SORTED_SUBKEYS"