From 02b3abec25ed0b303906c5dae9dd527171762d9a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 3 Sep 2005 17:17:30 +0000 Subject: r10007: Merge data_blk and data_len member of registry_value into a DATA_BLOB. Fix handling of REG_DWORD in the LDB backend. Fix a couple of warnings (This used to be commit 709fdc7ebf5a77cfb50359fad978884777decc3b) --- source4/lib/registry/tools/regdiff.c | 2 +- source4/lib/registry/tools/regpatch.c | 8 +++++--- source4/lib/registry/tools/regshell.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'source4/lib/registry/tools') diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c index a9d189c033..307ec3793e 100644 --- a/source4/lib/registry/tools/regdiff.c +++ b/source4/lib/registry/tools/regdiff.c @@ -72,7 +72,7 @@ static void writediff(struct registry_key *oldkey, struct registry_key *newkey, for(i = 0; W_ERROR_IS_OK(error1 = reg_key_get_value_by_index(mem_ctx, newkey, i, &v1)); i++) { error2 = reg_key_get_value_by_name(mem_ctx, oldkey, v1->name, &v2); - if ((W_ERROR_IS_OK(error2) && (v2->data_len != v1->data_len || memcmp(v1->data_blk, v2->data_blk, v1->data_len))) + if ((W_ERROR_IS_OK(error2) && data_blob_equal(&v1->data, &v2->data)) || W_ERROR_EQUAL(error2, WERR_DEST_NOT_FOUND)) { fprintf(out, "\"%s\"=%s:%s\n", v1->name, str_regtype(v1->data_type), reg_val_data_string(mem_ctx, v1)); } diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c index c2f01ce5b4..5f7d4376d4 100644 --- a/source4/lib/registry/tools/regpatch.c +++ b/source4/lib/registry/tools/regpatch.c @@ -704,9 +704,11 @@ static int nt_apply_reg_command_file(struct registry_context *r, const char *cmd DEBUG(0, ("Error removing value '%s'\n", val->name)); } modified = True; - } - else { - if(!W_ERROR_IS_OK(reg_val_set(tmp, val->name, val->type, val->val, strlen(val->val)))) { + } else { + DATA_BLOB blob; + blob.data = (uint8_t *)val->val; + blob.length = strlen(val->val); + if(!W_ERROR_IS_OK(reg_val_set(tmp, val->name, val->type, blob))) { DEBUG(0, ("Error adding new value '%s'\n", val->name)); continue; } diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 108cc17336..496b9dc7e5 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -80,7 +80,7 @@ static struct registry_key *cmd_set(TALLOC_CTX *mem_ctx, struct registry_context } else { struct registry_value *val; if (reg_string_to_val(mem_ctx, argv[2], argv[3], &val)) { - WERROR error = reg_val_set(cur, argv[1], val->data_type, val->data_blk, val->data_len); + WERROR error = reg_val_set(cur, argv[1], val->data_type, val->data); if (!W_ERROR_IS_OK(error)) { fprintf(stderr, "Error setting value: %s\n", win_errstr(error)); return NULL; -- cgit