summaryrefslogtreecommitdiff
path: root/source4/lib/registry/tests/hive.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-05-23 15:24:40 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-05-23 15:24:40 +0200
commit7fb26774021986a08d03db968a7826ee64ea7410 (patch)
tree272d8e4f7671b48c95c817724b41d9c27de1e282 /source4/lib/registry/tests/hive.c
parentfd01b27edd5a83306f4ce567e31d43641dd003b8 (diff)
parent1186579f94d81bc633b8f20e8ad8673313c8c39b (diff)
downloadsamba-7fb26774021986a08d03db968a7826ee64ea7410.tar.gz
samba-7fb26774021986a08d03db968a7826ee64ea7410.tar.bz2
samba-7fb26774021986a08d03db968a7826ee64ea7410.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into registry
(This used to be commit e8d96b61db1cddc2d8dca45e6e9b53d5c31ee5d4)
Diffstat (limited to 'source4/lib/registry/tests/hive.c')
-rw-r--r--source4/lib/registry/tests/hive.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c
index 474704b517..edc97c2468 100644
--- a/source4/lib/registry/tests/hive.c
+++ b/source4/lib/registry/tests/hive.c
@@ -69,14 +69,15 @@ static bool test_keyinfo_nums(struct torture_context *tctx, void *test_data)
struct hive_key *root = (struct hive_key *)test_data;
WERROR error;
struct hive_key *subkey;
- uint32_t data = 42;
+ char data[4];
+ SIVAL(data, 0, 42);
error = hive_key_add_name(tctx, root, "Nested Keyll", NULL,
NULL, &subkey);
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
error = hive_key_set_value(root, "Answer", REG_DWORD,
- data_blob_talloc(tctx, &data, sizeof(data)));
+ data_blob_talloc(tctx, data, sizeof(data)));
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
/* This is a new backend. There should be no subkeys and no
@@ -120,7 +121,8 @@ static bool test_del_recursive(struct torture_context *tctx,
struct hive_key *subkey2;
const struct hive_key *root = (const struct hive_key *)test_data;
TALLOC_CTX *mem_ctx = tctx;
- uint32_t data = 42;
+ char data[4];
+ SIVAL(data, 0, 42);
/* Create a new key under the root */
error = hive_key_add_name(mem_ctx, root, "Parent Key", NULL,
@@ -134,7 +136,7 @@ static bool test_del_recursive(struct torture_context *tctx,
/* Create a new value under "Child Key" */
error = hive_key_set_value(subkey2, "Answer Recursive", REG_DWORD,
- data_blob_talloc(mem_ctx, &data, sizeof(data)));
+ data_blob_talloc(mem_ctx, data, sizeof(data)));
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
/* Deleting "Parent Key" will also delete "Child Key" and the value. */
@@ -180,14 +182,15 @@ static bool test_set_value(struct torture_context *tctx,
struct hive_key *subkey;
const struct hive_key *root = (const struct hive_key *)test_data;
TALLOC_CTX *mem_ctx = tctx;
- uint32_t data = 42;
+ char data[4];
+ SIVAL(data, 0, 42);
error = hive_key_add_name(mem_ctx, root, "YA Nested Key", NULL,
NULL, &subkey);
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
error = hive_key_set_value(subkey, "Answer", REG_DWORD,
- data_blob_talloc(mem_ctx, &data, sizeof(data)));
+ data_blob_talloc(mem_ctx, data, sizeof(data)));
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
return true;
@@ -199,10 +202,12 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data)
struct hive_key *subkey;
const struct hive_key *root = (const struct hive_key *)test_data;
TALLOC_CTX *mem_ctx = tctx;
- uint32_t data = 42;
+ char data[4];
uint32_t type;
DATA_BLOB value;
+ SIVAL(data, 0, 42);
+
error = hive_key_add_name(mem_ctx, root, "EYA Nested Key", NULL,
NULL, &subkey);
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
@@ -212,7 +217,7 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data)
"getting missing value");
error = hive_key_set_value(subkey, "Answer", REG_DWORD,
- data_blob_talloc(mem_ctx, &data, sizeof(data)));
+ data_blob_talloc(mem_ctx, data, sizeof(data)));
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
error = hive_get_value(mem_ctx, subkey, "Answer", &type, &value);
@@ -233,16 +238,18 @@ static bool test_del_value(struct torture_context *tctx, const void *test_data)
struct hive_key *subkey;
const struct hive_key *root = (const struct hive_key *)test_data;
TALLOC_CTX *mem_ctx = tctx;
- uint32_t data = 42;
+ char data[4];
uint32_t type;
DATA_BLOB value;
+ SIVAL(data, 0, 42);
+
error = hive_key_add_name(mem_ctx, root, "EEYA Nested Key", NULL,
NULL, &subkey);
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
error = hive_key_set_value(subkey, "Answer", REG_DWORD,
- data_blob_talloc(mem_ctx, &data, sizeof(data)));
+ data_blob_talloc(mem_ctx, data, sizeof(data)));
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
error = hive_key_del_value(subkey, "Answer");
@@ -265,17 +272,19 @@ static bool test_list_values(struct torture_context *tctx,
struct hive_key *subkey;
const struct hive_key *root = (const struct hive_key *)test_data;
TALLOC_CTX *mem_ctx = tctx;
- uint32_t data = 42;
+ char data[4];
uint32_t type;
DATA_BLOB value;
const char *name;
+ int data_val = 42;
+ SIVAL(data, 0, data_val);
error = hive_key_add_name(mem_ctx, root, "AYAYA Nested Key", NULL,
NULL, &subkey);
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
error = hive_key_set_value(subkey, "Answer", REG_DWORD,
- data_blob_talloc(mem_ctx, &data, sizeof(data)));
+ data_blob_talloc(mem_ctx, data, sizeof(data)));
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
error = hive_get_value_by_index(mem_ctx, subkey, 0, &name,
@@ -288,7 +297,7 @@ static bool test_list_values(struct torture_context *tctx,
torture_assert_int_equal(tctx, type, REG_DWORD, "value type");
- torture_assert_int_equal(tctx, data, IVAL(value.data, 0), "value data");
+ torture_assert_int_equal(tctx, data_val, IVAL(value.data, 0), "value data");
error = hive_get_value_by_index(mem_ctx, subkey, 1, &name,
&type, &value);
@@ -416,7 +425,7 @@ static bool hive_setup_ldb(struct torture_context *tctx, void **data)
rmdir(dirname);
- error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->lp_ctx, &key);
+ error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->ev, tctx->lp_ctx, &key);
if (!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Unable to initialize ldb hive\n");
return false;