summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-23 16:19:26 +0100
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-23 16:46:17 +0100
commit3a2488870f8f52e14948b50ec9b91de1c9a990b9 (patch)
treef7251cfffb969ad58f490cc7c802bbb3edf011d1 /source4
parent0426b5b78678f4ffe564aa58a00a8f01790e7b1f (diff)
downloadsamba-3a2488870f8f52e14948b50ec9b91de1c9a990b9.tar.gz
samba-3a2488870f8f52e14948b50ec9b91de1c9a990b9.tar.bz2
samba-3a2488870f8f52e14948b50ec9b91de1c9a990b9.zip
s4:registry - "reg_ldb_pack_value" - provide workarounds when the server receives non-standard data.
For now we reset/delete the "data" attribute. Anyway there is the need to find a better solution (we probably want to change the format and save all data as we got it like Windows itself does). These workarounds are needed since for example the Windows 2000 Registry Editor initialises empty REG_SZ strings with content '\0' and length 1 (not a valid UTF16 sequence - "convert_string_talloc" breaks). So we simply reset/delete the "data" attribute which works (no content).
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/registry/ldb.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 9b834faa98..b897641f33 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -162,6 +162,9 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
false);
if (ret2) {
ret = ldb_msg_add_value(msg, "data", val, NULL);
+ } else {
+ /* workaround for non-standard data */
+ ret = ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
}
} else {
ret = ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
@@ -181,6 +184,9 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
return NULL;
}
ret = ldb_msg_add_string(msg, "data", conv_str);
+ } else {
+ /* workaround for non-standard data */
+ ret = ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
}
} else {
ret = ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
@@ -199,6 +205,9 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
return NULL;
}
ret = ldb_msg_add_string(msg, "data", conv_str);
+ } else {
+ /* workaround for non-standard data */
+ ret = ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
}
} else {
ret = ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);