summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-04-17 16:53:36 +0200
committerAndrew Tridgell <tridge@samba.org>2008-04-17 16:53:36 +0200
commit3180cbbc5b3396da07c325166e472b143b3abe1e (patch)
tree4724f6827c9ce4bf73bef5048898d5edc1d5d49c /source4/lib
parentdc74e0fad683cb0ef9ee5996aedadd4c377a0f00 (diff)
parente0fe8613a3621e7a1e0488f6698db56ef6c67dd9 (diff)
downloadsamba-3180cbbc5b3396da07c325166e472b143b3abe1e.tar.gz
samba-3180cbbc5b3396da07c325166e472b143b3abe1e.tar.bz2
samba-3180cbbc5b3396da07c325166e472b143b3abe1e.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-test
(This used to be commit c73a3b837ec16fbb846c6e63a45599fca99b3d0b)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/registry/tests/hive.c35
-rw-r--r--source4/lib/registry/tests/registry.c16
2 files changed, 32 insertions, 19 deletions
diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c
index 83abdd793d..29f7e685c1 100644
--- a/source4/lib/registry/tests/hive.c
+++ b/source4/lib/registry/tests/hive.c
@@ -68,14 +68,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
@@ -119,7 +120,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,
@@ -133,7 +135,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. */
@@ -179,14 +181,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;
@@ -198,10 +201,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");
@@ -211,7 +216,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);
@@ -232,16 +237,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");
@@ -264,17 +271,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,
@@ -287,7 +296,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);
diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c
index ec7873a111..ac812823b2 100644
--- a/source4/lib/registry/tests/registry.c
+++ b/source4/lib/registry/tests/registry.c
@@ -281,7 +281,8 @@ static bool test_query_key_nums(struct torture_context *tctx, void *_data)
struct registry_key *root, *subkey1, *subkey2;
WERROR error;
uint32_t num_subkeys, num_values;
- uint32_t data = 42;
+ char data[4];
+ SIVAL(data, 0, 42);
if (!create_test_key(tctx, rctx, "Berlin", &root, &subkey1))
return false;
@@ -353,13 +354,15 @@ static bool test_set_value(struct torture_context *tctx, void *_data)
struct registry_context *rctx = (struct registry_context *)_data;
struct registry_key *subkey = NULL, *root;
WERROR error;
- uint32_t data = 42;
+ char data[4];
+
+ SIVAL(data, 0, 42);
if (!create_test_key(tctx, rctx, "Dusseldorf", &root, &subkey))
return false;
error = reg_val_set(subkey, "Answer", REG_DWORD,
- data_blob_talloc(tctx, &data, sizeof(data)));
+ data_blob_talloc(tctx, data, sizeof(data)));
torture_assert_werr_ok (tctx, error, "setting value");
return true;
@@ -408,8 +411,9 @@ static bool test_get_value(struct torture_context *tctx, void *_data)
struct registry_key *subkey = NULL, *root;
WERROR error;
DATA_BLOB data;
- uint32_t value = 42;
+ char value[4];
uint32_t type;
+ SIVAL(value, 0, 42);
if (!create_test_key(tctx, rctx, "Duisburg", &root, &subkey))
return false;
@@ -420,7 +424,7 @@ static bool test_get_value(struct torture_context *tctx, void *_data)
"getting missing value");
error = reg_val_set(subkey, __FUNCTION__, REG_DWORD,
- data_blob_talloc(tctx, &value, 4));
+ data_blob_talloc(tctx, value, sizeof(value)));
torture_assert_werr_ok(tctx, error, "setting value");
error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__, &type,
@@ -428,7 +432,7 @@ static bool test_get_value(struct torture_context *tctx, void *_data)
torture_assert_werr_ok(tctx, error, "getting value");
torture_assert_int_equal(tctx, 4, data.length, "value length ok");
- torture_assert_mem_equal(tctx, data.data, &value, 4,
+ torture_assert_mem_equal(tctx, data.data, value, 4,
"value content ok");
torture_assert_int_equal(tctx, REG_DWORD, type, "value type");