diff options
author | Wilco Baan Hofman <wilco@synlap.(none)> | 2008-04-15 21:35:59 +0200 |
---|---|---|
committer | Wilco Baan Hofman <wilco@synlap.(none)> | 2008-04-15 21:35:59 +0200 |
commit | 439f75f522d241aa78f06572c47ff6b871289793 (patch) | |
tree | 228c2082cd44a1fc71b92f81218e2ac0f799e93b /source4/lib | |
parent | 5e687d79533684949deb9bd9bc86f88eab4ae310 (diff) | |
download | samba-439f75f522d241aa78f06572c47ff6b871289793.tar.gz samba-439f75f522d241aa78f06572c47ff6b871289793.tar.bz2 samba-439f75f522d241aa78f06572c47ff6b871289793.zip |
More patchfile fixes. Write support should work now.
(This used to be commit cc38f2f086b92bbe65bd6e7f4e03fdf7f21ef2f6)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/registry/patchfile_preg.c | 27 | ||||
-rw-r--r-- | source4/lib/registry/tests/diff.c | 22 |
2 files changed, 35 insertions, 14 deletions
diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c index ea41a9e21b..c2bc8d10b3 100644 --- a/source4/lib/registry/patchfile_preg.c +++ b/source4/lib/registry/patchfile_preg.c @@ -92,27 +92,40 @@ static WERROR reg_preg_diff_del_key(void *_data, const char *key_name) DATA_BLOB blob; parent_name = talloc_strndup(data->ctx, key_name, strrchr(key_name, '\\')-key_name); - blob.data = (void *)talloc_strndup(data->ctx, key_name, + blob.data = (void *)talloc_strndup(data->ctx, key_name+(strrchr(key_name, '\\')-key_name)+1, strlen(key_name)-(strrchr(key_name, '\\')-key_name)); blob.length = strlen((char *)blob.data)+1; /* FIXME: These values should be accumulated to be written at done(). */ - reg_preg_diff_set_value(_data, parent_name, "**DeleteKeys", REG_SZ, blob); - - return WERR_OK; + return reg_preg_diff_set_value(data, parent_name, "**DeleteKeys", REG_SZ, blob); } -/* FIXME These functions need to be implemented */ static WERROR reg_preg_diff_del_value(void *_data, const char *key_name, const char *value_name) { - return WERR_NOT_SUPPORTED; + struct preg_data *data = _data; + char *val; + DATA_BLOB blob; + + val = talloc_asprintf(data->ctx, "**Del.%s", value_name); + + blob.data = (void *)talloc(data->ctx, uint32_t); + *(uint32_t *)blob.data = 0; + blob.length = 4; + return reg_preg_diff_set_value(data, key_name, val, REG_DWORD, blob); } static WERROR reg_preg_diff_del_all_values(void *_data, const char *key_name) { - return WERR_NOT_SUPPORTED; + struct preg_data *data = _data; + DATA_BLOB blob; + + blob.data = (void *)talloc(data->ctx, uint32_t); + *(uint32_t *)blob.data = 0; + blob.length = 4; + + return reg_preg_diff_set_value(data, key_name, "**DelVals.", REG_DWORD, blob); } static WERROR reg_preg_diff_done(void *_data) diff --git a/source4/lib/registry/tests/diff.c b/source4/lib/registry/tests/diff.c index 4bd868ea51..492f4de0b5 100644 --- a/source4/lib/registry/tests/diff.c +++ b/source4/lib/registry/tests/diff.c @@ -211,21 +211,29 @@ static bool diff_setup_tcase(struct torture_context *tctx, void **data) error = reg_mount_hive(r2_ctx, r2_hkcu, HKEY_CURRENT_USER, NULL); torture_assert_werr_ok(tctx, error, "Mounting hive failed"); - error = r1_ctx->ops->get_predefined_key(r2_ctx, HKEY_LOCAL_MACHINE, &key); + error = r1_ctx->ops->get_predefined_key(r1_ctx, HKEY_CURRENT_USER, &key); + torture_assert_werr_ok(tctx, error, "Opening HKEY_CURRENT_USER failed"); + error = r1_ctx->ops->create_key(r1_ctx, key, "Network", NULL, NULL, &newkey); + torture_assert_werr_ok(tctx, error, "Opening HKCU\\Network failed"); + error = r1_ctx->ops->create_key(r1_ctx, newkey, "L", NULL, NULL, &newkey); + torture_assert_werr_ok(tctx, error, "Opening HKCU\\Network\\L failed"); + + error = r2_ctx->ops->get_predefined_key(r2_ctx, HKEY_LOCAL_MACHINE, &key); torture_assert_werr_ok(tctx, error, "Opening HKEY_LOCAL_MACHINE failed"); - error = r1_ctx->ops->create_key(r2_ctx, key, "Software", NULL, NULL, &newkey); + error = r2_ctx->ops->create_key(r2_ctx, key, "Software", NULL, NULL, &newkey); torture_assert_werr_ok(tctx, error, "Creating HKLM\\Sofware failed"); - error = r1_ctx->ops->create_key(r2_ctx, newkey, "Microsoft", NULL, NULL, &newkey); + error = r2_ctx->ops->create_key(r2_ctx, newkey, "Microsoft", NULL, NULL, &newkey); torture_assert_werr_ok(tctx, error, "Creating HKLM\\Software\\Microsoft failed"); - error = r1_ctx->ops->create_key(r2_ctx, newkey, "Windows", NULL, NULL, &newkey); + error = r2_ctx->ops->create_key(r2_ctx, newkey, "Windows", NULL, NULL, &newkey); torture_assert_werr_ok(tctx, error, "Creating HKLM\\Software\\Microsoft\\Windows failed"); - error = r1_ctx->ops->create_key(r2_ctx, newkey, "CurrentVersion", NULL, NULL, &newkey); + error = r2_ctx->ops->create_key(r2_ctx, newkey, "CurrentVersion", NULL, NULL, &newkey); torture_assert_werr_ok(tctx, error, "Creating HKLM\\..\\Windows\\CurrentVersion failed"); - error = r1_ctx->ops->create_key(r2_ctx, newkey, "Policies", NULL, NULL, &newkey); + error = r2_ctx->ops->create_key(r2_ctx, newkey, "Policies", NULL, NULL, &newkey); torture_assert_werr_ok(tctx, error, "Creating HKLM\\..\\CurrentVersion\\Policies failed"); - error = r1_ctx->ops->create_key(r2_ctx, newkey, "Explorer", NULL, NULL, &newkey); + error = r2_ctx->ops->create_key(r2_ctx, newkey, "Explorer", NULL, NULL, &newkey); torture_assert_werr_ok(tctx, error, "Creating HKLM\\..\\Policies\\Explorer failed"); + blob.data = (void *)talloc(r2_ctx, uint32_t); SIVAL(blob.data, 0, 0x03ffffff); blob.length = sizeof(uint32_t); |