[SCM] Samba Shared Repository - branch master updated
Matthias Dieter Wallnöfer
mdw at samba.org
Mon Mar 22 17:16:55 MDT 2010
The branch, master has been updated
via f39ef98... Revert "s4:torture - WINREG RPC - reactivate test "SetValueExtended" for s4"
via bca3535... s4:registry - "LDB backend" - revert the binary storage of "REG_SZ", "REG_DWORD" and "REG_QWORD"
via 6a63c38... s4:ldb_modules/util.c - fix two counter variables to be "unsigned"
from 7509b56... share_info.tdb could use non-canonicalized sharenames.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit f39ef9866870d320ae0106dfd09a41c0451e9238
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Tue Mar 23 00:13:26 2010 +0100
Revert "s4:torture - WINREG RPC - reactivate test "SetValueExtended" for s4"
This reverts commit 0f2cf82e5e52da6fc71742df7b13c9f372bcf113.
Naturally we have to revert this for s4 until a new storage mechanism for binary
REG_SZ and REG_*WORD values has been found.
commit bca353561ebc67a4e78fdd84f4316259be29820f
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Tue Mar 23 00:09:22 2010 +0100
s4:registry - "LDB backend" - revert the binary storage of "REG_SZ", "REG_DWORD" and "REG_QWORD"
We agreed that this hack isn't the best of the possible solutions.
commit 6a63c38c1258e5a666f11b5b795828ea7bedbf14
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Mon Mar 22 23:53:17 2010 +0100
s4:ldb_modules/util.c - fix two counter variables to be "unsigned"
-----------------------------------------------------------------------
Summary of changes:
source4/dsdb/samdb/ldb_modules/util.c | 4 +-
source4/lib/registry/ldb.c | 129 +++++----------------------------
source4/torture/rpc/winreg.c | 5 +-
3 files changed, 24 insertions(+), 114 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c
index d04a5f7..f8a6343 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -379,7 +379,7 @@ int dsdb_module_add(struct ldb_module *module,
const struct dsdb_class * get_last_structural_class(const struct dsdb_schema *schema,const struct ldb_message_element *element)
{
const struct dsdb_class *last_class = NULL;
- int i;
+ unsigned int i;
for (i = 0; i < element->num_values; i++){
const struct dsdb_class *tmp_class = dsdb_class_by_lDAPDisplayName_ldb_val(schema, &element->values[i]);
@@ -413,7 +413,7 @@ int dsdb_check_single_valued_link(const struct dsdb_attribute *attr,
const struct ldb_message_element *el)
{
bool found_active = false;
- int i;
+ unsigned int i;
if (!(attr->ldb_schema_attribute->flags & LDB_ATTR_FLAG_SINGLE_VALUE) ||
el->num_values < 2) {
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 8310b6f..ec0b33a 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -61,22 +61,10 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
case REG_SZ:
case REG_EXPAND_SZ:
if (val != NULL) {
- if (val->data[0] != '\0') {
- /* The data should be provided as UTF16 string */
- convert_string_talloc(mem_ctx, CH_UTF8, CH_UTF16,
- val->data, val->length,
- (void **)&data->data, &data->length, false);
- } 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 */
- data->data = talloc_size(mem_ctx, val->length - 1);
- if (data->data != NULL) {
- memcpy(data->data, val->data + 1,
- val->length - 1);
- }
- data->length = val->length - 1;
- }
+ /* The data should be provided as UTF16 string */
+ convert_string_talloc(mem_ctx, CH_UTF8, CH_UTF16,
+ val->data, val->length,
+ (void **)&data->data, &data->length, false);
} else {
data->data = NULL;
data->length = 0;
@@ -86,25 +74,13 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
case REG_DWORD:
case REG_DWORD_BIG_ENDIAN:
if (val != NULL) {
- 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));
- if (data->data != NULL) {
- SIVAL(data->data, 0, tmp);
- }
- data->length = sizeof(uint32_t);
- } else {
- /* Provide a possibility to store also UTF8
- * REG_DWORD values. This is done by adding a
- * '\0' in front of the data */
- data->data = talloc_size(mem_ctx, val->length - 1);
- if (data->data != NULL) {
- memcpy(data->data, val->data + 1,
- val->length - 1);
- }
- data->length = val->length - 1;
+ /* The data is a plain DWORD */
+ uint32_t tmp = strtoul((char *)val->data, NULL, 0);
+ data->data = talloc_size(mem_ctx, sizeof(uint32_t));
+ if (data->data != NULL) {
+ SIVAL(data->data, 0, tmp);
}
+ data->length = sizeof(uint32_t);
} else {
data->data = NULL;
data->length = 0;
@@ -113,25 +89,13 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
case REG_QWORD:
if (val != NULL) {
- 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));
- if (data->data != NULL) {
- SBVAL(data->data, 0, tmp);
- }
- data->length = sizeof(uint64_t);
- } else {
- /* Provide a possibility to store also UTF8
- * REG_QWORD values. This is done by adding a
- * '\0' in front of the data */
- data->data = talloc_size(mem_ctx, val->length - 1);
- if (data->data != NULL) {
- memcpy(data->data, val->data + 1,
- val->length - 1);
- }
- data->length = val->length - 1;
+ /* The data is a plain QWORD */
+ uint64_t tmp = strtoull((char *)val->data, NULL, 0);
+ data->data = talloc_size(mem_ctx, sizeof(uint64_t));
+ if (data->data != NULL) {
+ SBVAL(data->data, 0, tmp);
}
+ data->length = sizeof(uint64_t);
} else {
data->data = NULL;
data->length = 0;
@@ -193,8 +157,7 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
/* 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) */
+ * default of the "ret2" variable set to "false". */
if (data.length % 2 == 0) {
/* The data is provided as UTF16 string */
ret2 = convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8,
@@ -202,21 +165,9 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
(void **)&val->data, &val->length,
false);
}
- 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);
- return NULL;
- }
- val->data[0] = '\0';
- memcpy(val->data + 1, data.data, data.length);
- val->length = data.length + 1;
+ if (ret2) {
+ ret = ldb_msg_add_value(msg, "data", val, NULL);
}
- ret = ldb_msg_add_value(msg, "data", val, NULL);
} else {
ret = ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
}
@@ -235,27 +186,6 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
return NULL;
}
ret = ldb_msg_add_string(msg, "data", conv_str);
- } else {
- /* Provide a possibility to store also UTF8
- * REG_DWORD values. This is done by adding a
- * '\0' in front of the data */
- struct ldb_val *val;
-
- val = talloc_zero(msg, struct ldb_val);
- if (val == NULL) {
- talloc_free(msg);
- return NULL;
- }
-
- val->data = talloc_size(msg, data.length + 1);
- if (val->data == NULL) {
- talloc_free(msg);
- return NULL;
- }
- val->data[0] = '\0';
- memcpy(val->data + 1, data.data, data.length);
- val->length = data.length + 1;
- ret = ldb_msg_add_value(msg, "data", val, NULL);
}
} else {
ret = ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
@@ -273,27 +203,6 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
return NULL;
}
ret = ldb_msg_add_string(msg, "data", conv_str);
- } else {
- /* Provide a possibility to store also UTF8
- * REG_QWORD values. This is done by adding a
- * '\0' in front of the data */
- struct ldb_val *val;
-
- val = talloc_zero(msg, struct ldb_val);
- if (val == NULL) {
- talloc_free(msg);
- return NULL;
- }
-
- val->data = talloc_size(msg, data.length + 1);
- if (val->data == NULL) {
- talloc_free(msg);
- return NULL;
- }
- val->data[0] = '\0';
- memcpy(val->data + 1, data.data, data.length);
- val->length = data.length + 1;
- ret = ldb_msg_add_value(msg, "data", val, NULL);
}
} else {
ret = ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 17a76ea..da46c13 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -2032,8 +2032,9 @@ static bool test_SetValue_extended(struct dcerpc_binding_handle *b,
};
int t, l;
- if (torture_setting_bool(tctx, "samba3", false)) {
- torture_skip(tctx, "skipping extended SetValue test against Samba 3");
+ if (torture_setting_bool(tctx, "samba3", false) ||
+ torture_setting_bool(tctx, "samba4", false)) {
+ torture_skip(tctx, "skipping extended SetValue test against Samba");
}
torture_comment(tctx, "Testing SetValue (extended formats)\n");
--
Samba Shared Repository
More information about the samba-cvs
mailing list