The branch, master has been updated
via 0f2cf82... s4:torture - WINREG RPC - reactivate test
"SetValueExtended" for s4
via 811c601... s4:WINREG RPC - we support only non-volatile keys
via cc4e5c8... s4:registry - "LDB backend" - don't test for "0" as
string termination on binary and unknown typed values
via 1cdeb0c... s4:WINREG RPC - specify the performed create action for
"CreateKey"
via 2f79217... s4:registry - handle type "DWORD_BIG_ENDIAN" as type
"DWORD"
via d82b325... s4:torture WINREG - enhance test for "QWORD" type
via 66f94ca... s4:torture WINREG - enhance test for "DWORD_BIG_ENDIAN"
type
via a5503179.. s4:registry - "LDB backend" - fix up memory allocation
for dynamic integers
via 1d49a26... s4:registry - "LDB backend" - Fix up the storage of
binary REG_SZ/REG_EXPAND_SZ values
from 6e48267... s3: Open winbindd_cache.tdb with read/write access.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 0f2cf82e5e52da6fc71742df7b13c9f372bcf113
Author: Matthias Dieter Wallnöfer <[email protected]>
Date: Sun Mar 21 14:30:53 2010 +0100
s4:torture - WINREG RPC - reactivate test "SetValueExtended" for s4
Should be definitely fixed now.
commit 811c601ae081485bff778a99a6b510029da0a88f
Author: Matthias Dieter Wallnöfer <[email protected]>
Date: Sun Mar 21 14:20:41 2010 +0100
s4:WINREG RPC - we support only non-volatile keys
commit cc4e5c8beb95e67d91add0334807ada6eea8f9b7
Author: Matthias Dieter Wallnöfer <[email protected]>
Date: Sun Mar 21 14:10:17 2010 +0100
s4:registry - "LDB backend" - don't test for "0" as string termination on
binary and unknown typed values
commit 1cdeb0c0d280312df3e1c93a30e03cd0a7459fe9
Author: Matthias Dieter Wallnöfer <[email protected]>
Date: Fri Mar 19 20:23:36 2010 +0100
s4:WINREG RPC - specify the performed create action for "CreateKey"
To make the WINREG RPC testsuite happy.
commit 2f79217964ef2f3b4b5c8bd8780db88081ecbc5d
Author: Matthias Dieter Wallnöfer <[email protected]>
Date: Fri Mar 19 19:55:32 2010 +0100
s4:registry - handle type "DWORD_BIG_ENDIAN" as type "DWORD"
Further tests show that (at least per default) there aren't any differences
between them.
commit d82b325bc315d4d1dc4e5489e0c5df1764835540
Author: Matthias Dieter Wallnöfer <[email protected]>
Date: Fri Mar 19 19:50:17 2010 +0100
s4:torture WINREG - enhance test for "QWORD" type
We need to know how this behaves.
commit 66f94ca3ecea628be73d37ea5a972783949f955b
Author: Matthias Dieter Wallnöfer <[email protected]>
Date: Fri Mar 19 19:40:07 2010 +0100
s4:torture WINREG - enhance test for "DWORD_BIG_ENDIAN" type
We need to know how this behaves.
commit a55031792dfd56e1d8f235ea6cdd6383507ee5e4
Author: Matthias Dieter Wallnöfer <[email protected]>
Date: Fri Mar 19 19:14:44 2010 +0100
s4:registry - "LDB backend" - fix up memory allocation for dynamic integers
We don't need to reserve memory for NULL termination when storing data as
integers.
commit 1d49a266abbe6ae0bf50f456399099a31814b9a9
Author: Matthias Dieter Wallnöfer <[email protected]>
Date: Fri Mar 19 18:23:00 2010 +0100
s4:registry - "LDB backend" - Fix up the storage of binary
REG_SZ/REG_EXPAND_SZ values
There seem to exist also UTF16 sequences which have byte sizes of a
multiple of
two but are invalid (gd's winreg test shows this).
-----------------------------------------------------------------------
Summary of changes:
source4/lib/registry/ldb.c | 40 +++++++++++++------------------
source4/lib/registry/tests/generic.c | 2 +-
source4/lib/registry/util.c | 9 +-----
source4/rpc_server/winreg/rpc_winreg.c | 16 ++++++++++++-
source4/torture/rpc/winreg.c | 12 +++++++--
5 files changed, 44 insertions(+), 35 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index a86dacd..5f1a06c 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -89,7 +89,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
if (val->data[0] != '\0') {
/* The data is a plain DWORD */
uint32_t tmp = strtoul((char *)val->data, NULL,
0);
- data->data = talloc_size(mem_ctx,
sizeof(uint32_t) + 1);
+ data->data = talloc_size(mem_ctx,
sizeof(uint32_t));
if (data->data != NULL) {
SIVAL(data->data, 0, tmp);
}
@@ -116,7 +116,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
if (val->data[0] != '\0') {
/* The data is a plain QWORD */
uint64_t tmp = strtoull((char *)val->data,
NULL, 0);
- data->data = talloc_size(mem_ctx,
sizeof(uint64_t) + 1);
+ data->data = talloc_size(mem_ctx,
sizeof(uint64_t));
if (data->data != NULL) {
SBVAL(data->data, 0, tmp);
}
@@ -181,10 +181,9 @@ static struct ldb_message *reg_ldb_pack_value(struct
ldb_context *ctx,
switch (type) {
case REG_SZ:
case REG_EXPAND_SZ:
- if ((data.length > 0) && (data.data != NULL)
- && (data.data[0] != '\0')) {
+ if ((data.length > 0) && (data.data != NULL)) {
struct ldb_val *val;
- bool ret2;
+ bool ret2 = false;
val = talloc_zero(msg, struct ldb_val);
if (val == NULL) {
@@ -192,20 +191,22 @@ static struct ldb_message *reg_ldb_pack_value(struct
ldb_context *ctx,
return NULL;
}
+ /* Only when the "data.length" is dividable by two try
+ * the charset conversion, otherwise stick with the
+ * default of the "ret2" variable set to "false" (which
+ * means binary storage and no conversion) */
if (data.length % 2 == 0) {
/* The data is provided as UTF16 string */
ret2 = convert_string_talloc(mem_ctx, CH_UTF16,
CH_UTF8,
(void *)data.data,
data.length,
(void
**)&val->data, &val->length,
false);
- if (!ret2) {
- talloc_free(msg);
- return NULL;
- }
- } else {
- /* Provide a possibility to store also UTF8
- * REG_SZ/REG_EXPAND_SZ values. This is done
- * by adding a '\0' in front of the data */
+ }
+ if (!ret2) {
+ /* Provide a possibility to store also binary
+ * UTF8 REG_SZ/REG_EXPAND_SZ values as fallback
+ * mechanism. This is done by adding a '\0' in
+ * front of the data */
val->data = talloc_size(msg, data.length + 1);
if (val->data == NULL) {
talloc_free(msg);
@@ -227,14 +228,8 @@ static struct ldb_message *reg_ldb_pack_value(struct
ldb_context *ctx,
if (data.length == sizeof(uint32_t)) {
char *conv_str;
- if (type == REG_DWORD) {
- conv_str = talloc_asprintf(msg,
"0x%8.8x",
-
IVAL(data.data, 0));
- } else {
- conv_str = talloc_asprintf(msg,
"0x%8.8x",
-
RIVAL(data.data, 0));
- }
-
+ conv_str = talloc_asprintf(msg, "0x%8.8x",
+ IVAL(data.data, 0));
if (conv_str == NULL) {
talloc_free(msg);
return NULL;
@@ -307,8 +302,7 @@ static struct ldb_message *reg_ldb_pack_value(struct
ldb_context *ctx,
case REG_BINARY:
default:
- if ((data.length > 0) && (data.data != NULL)
- && (data.data[0] != '\0')) {
+ if ((data.length > 0) && (data.data != NULL)) {
ret = ldb_msg_add_value(msg, "data", &data, NULL);
} else {
ret = ldb_msg_add_empty(msg, "data",
LDB_FLAG_MOD_DELETE, NULL);
diff --git a/source4/lib/registry/tests/generic.c
b/source4/lib/registry/tests/generic.c
index 1e8effa..206fad0 100644
--- a/source4/lib/registry/tests/generic.c
+++ b/source4/lib/registry/tests/generic.c
@@ -74,7 +74,7 @@ static bool test_reg_val_data_string_dword_big_endian(struct
torture_context *ct
{
uint32_t d = 0x20;
DATA_BLOB db = { (uint8_t *)&d, sizeof(d) };
- torture_assert_str_equal(ctx, "0x20000000",
+ torture_assert_str_equal(ctx, "0x00000020",
reg_val_data_string(ctx,
lp_iconv_convenience(ctx->lp_ctx), REG_DWORD_BIG_ENDIAN, db),
"dword failed");
return true;
diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c
index 7afca62..3c12899 100644
--- a/source4/lib/registry/util.c
+++ b/source4/lib/registry/util.c
@@ -87,13 +87,8 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
case REG_DWORD:
case REG_DWORD_BIG_ENDIAN:
if (data.length == sizeof(uint32_t)) {
- if (type == REG_DWORD) {
- ret = talloc_asprintf(mem_ctx,
"0x%8.8x",
- IVAL(data.data,
0));
- } else {
- ret = talloc_asprintf(mem_ctx,
"0x%8.8x",
- RIVAL(data.data,
0));
- }
+ ret = talloc_asprintf(mem_ctx, "0x%8.8x",
+ IVAL(data.data, 0));
}
break;
case REG_QWORD:
diff --git a/source4/rpc_server/winreg/rpc_winreg.c
b/source4/rpc_server/winreg/rpc_winreg.c
index 61920b2..5bfc655 100644
--- a/source4/rpc_server/winreg/rpc_winreg.c
+++ b/source4/rpc_server/winreg/rpc_winreg.c
@@ -126,6 +126,11 @@ static WERROR dcesrv_winreg_CreateKey(struct
dcesrv_call_state *dce_call,
{
case SECURITY_SYSTEM:
case SECURITY_ADMINISTRATOR:
+ /* we support only non volatile keys */
+ if (r->in.options != REG_KEYTYPE_NON_VOLATILE) {
+ return WERR_NOT_SUPPORTED;
+ }
+
/* the security descriptor is optional */
if (r->in.secdesc != NULL) {
DATA_BLOB sdblob;
@@ -144,12 +149,21 @@ static WERROR dcesrv_winreg_CreateKey(struct
dcesrv_call_state *dce_call,
result = reg_key_add_name(newh, key, r->in.name.name, NULL,
r->in.secdesc?&sd:NULL, (struct registry_key
**)&newh->data);
+
+ r->out.action_taken = talloc(mem_ctx, enum winreg_CreateAction);
+ if (r->out.action_taken == NULL) {
+ talloc_free(newh);
+ return WERR_NOMEM;
+ }
+ *r->out.action_taken = REG_ACTION_NONE;
+
if (W_ERROR_IS_OK(result)) {
r->out.new_handle = &newh->wire_handle;
+ *r->out.action_taken = REG_CREATED_NEW_KEY;
} else {
talloc_free(newh);
}
-
+
return result;
default:
return WERR_ACCESS_DENIED;
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 14abd51..17a76ea 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -1919,10 +1919,13 @@ static bool test_SetValue_simple(struct
dcerpc_binding_handle *b,
{
const char *value_name = TEST_VALUE;
uint32_t value = 0x12345678;
+ uint64_t value2 = 0x12345678;
const char *string = "torture";
DATA_BLOB blob;
enum winreg_Type types[] = {
REG_DWORD,
+ REG_DWORD_BIG_ENDIAN,
+ REG_QWORD,
REG_BINARY,
REG_SZ,
REG_MULTI_SZ
@@ -1939,9 +1942,13 @@ static bool test_SetValue_simple(struct
dcerpc_binding_handle *b,
switch (types[t]) {
case REG_DWORD:
+ case REG_DWORD_BIG_ENDIAN:
blob = data_blob_talloc_zero(tctx, 4);
SIVAL(blob.data, 0, value);
break;
+ case REG_QWORD:
+ blob = data_blob_talloc_zero(tctx, 8);
+ SBVAL(blob.data, 0, value2);
case REG_BINARY:
blob = data_blob_string_const("binary_blob");
break;
@@ -2025,9 +2032,8 @@ static bool test_SetValue_extended(struct
dcerpc_binding_handle *b,
};
int t, l;
- if (torture_setting_bool(tctx, "samba3", false) ||
- torture_setting_bool(tctx, "samba4", false)) {
- torture_skip(tctx, "skipping extended SetValue test against
Samba");
+ if (torture_setting_bool(tctx, "samba3", false)) {
+ torture_skip(tctx, "skipping extended SetValue test against
Samba 3");
}
torture_comment(tctx, "Testing SetValue (extended formats)\n");
--
Samba Shared Repository