From 3a2488870f8f52e14948b50ec9b91de1c9a990b9 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Tue, 23 Mar 2010 16:19:26 +0100 Subject: 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). --- source4/lib/registry/ldb.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source4/lib/registry') 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); -- cgit