diff options
-rw-r--r-- | source4/gtk/tools/gregedit.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/common/reg_interface.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/common/reg_util.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_nt4.c | 32 | ||||
-rw-r--r-- | source4/lib/registry/registry.h (renamed from source4/include/registry.h) | 1 | ||||
-rw-r--r-- | source4/lib/registry/tools/regdiff.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/tools/regpatch.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/tools/regshell.c | 16 | ||||
-rw-r--r-- | source4/lib/registry/tools/regtree.c | 2 | ||||
-rw-r--r-- | source4/rpc_server/winreg/rpc_winreg.c | 2 |
10 files changed, 53 insertions, 10 deletions
diff --git a/source4/gtk/tools/gregedit.c b/source4/gtk/tools/gregedit.c index 26aedf2084..c574b5246b 100644 --- a/source4/gtk/tools/gregedit.c +++ b/source4/gtk/tools/gregedit.c @@ -21,7 +21,7 @@ #include "includes.h" #include "dynconfig.h" -#include "registry.h" +#include "lib/registry/registry.h" #include "lib/cmdline/popt_common.h" #include "gtk/common/select.h" #include "gtk/common/gtk-smb.h" diff --git a/source4/lib/registry/common/reg_interface.c b/source4/lib/registry/common/reg_interface.c index ddd4ecbe93..74f158b027 100644 --- a/source4/lib/registry/common/reg_interface.c +++ b/source4/lib/registry/common/reg_interface.c @@ -20,7 +20,7 @@ #include "includes.h" #include "dlinklist.h" -#include "registry.h" +#include "lib/registry/registry.h" /* List of available backends */ static struct reg_init_function_entry *backends = NULL; diff --git a/source4/lib/registry/common/reg_util.c b/source4/lib/registry/common/reg_util.c index a0d4db6f57..ae30839cca 100644 --- a/source4/lib/registry/common/reg_util.c +++ b/source4/lib/registry/common/reg_util.c @@ -19,7 +19,7 @@ */ #include "includes.h" -#include "registry.h" +#include "lib/registry/registry.h" #include "librpc/gen_ndr/winreg.h" static const struct { diff --git a/source4/lib/registry/reg_backend_nt4.c b/source4/lib/registry/reg_backend_nt4.c index cf67abb322..4fc458dee4 100644 --- a/source4/lib/registry/reg_backend_nt4.c +++ b/source4/lib/registry/reg_backend_nt4.c @@ -376,7 +376,11 @@ static struct registry_key *regf_get_key (TALLOC_CTX *ctx, struct regf_data *reg ret->name = talloc_steal(ret, nk->key_name); ret->last_mod = nk->last_change; - ret->class_name = NULL; /* FIXME: get somehow using clsname_offset */ + + if (nk->clsname_offset != -1) { + DATA_BLOB data = hbin_get(regf, nk->clsname_offset); + ret->class_name = talloc_strndup(ret, (char*)data.data, nk->clsname_length); + } ret->backend_data = nk; return ret; @@ -581,6 +585,30 @@ static WERROR regf_add_key (TALLOC_CTX *ctx, struct registry_key *parent, const return WERR_OK; } +static WERROR regf_set_value (struct registry_key *key, const char *name, uint32_t type, DATA_BLOB data) +{ + /* FIXME */ + + return WERR_NOT_SUPPORTED; +} + +static WERROR regf_save(struct registry_hive *hive, const char *location) +{ + struct regf_data *regf = hive->backend_data; + struct tdr_push *push = talloc_zero(regf, struct tdr_push); + int i; + + tdr_push_regf_hdr(push, regf->header); + + for (i = 0; regf->hbins[i]; i++) { + tdr_push_hbin_block(push, regf->hbins[i]); + } + + file_save(location, push->data.data, push->data.length); + + return WERR_OK; +} + static WERROR nt_open_hive (struct registry_hive *h, struct registry_key **key) { struct regf_data *regf; @@ -676,6 +704,8 @@ static struct hive_operations reg_backend_nt4 = { .get_value_by_index = regf_get_value, .key_get_sec_desc = regf_get_sec_desc, .add_key = regf_add_key, + .set_value = regf_set_value, + .save_hive = regf_save, }; NTSTATUS registry_nt4_init(void) diff --git a/source4/include/registry.h b/source4/lib/registry/registry.h index 06442514f0..f9e8a7698c 100644 --- a/source4/include/registry.h +++ b/source4/lib/registry/registry.h @@ -80,6 +80,7 @@ struct hive_operations { /* Implement this one */ WERROR (*open_hive) (struct registry_hive *, struct registry_key **); + WERROR (*save_hive) (struct registry_hive *, const char *location); /* Or this one */ WERROR (*open_key) (TALLOC_CTX *, struct registry_key *, const char *name, struct registry_key **); diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c index 307ec3793e..3d8201330e 100644 --- a/source4/lib/registry/tools/regdiff.c +++ b/source4/lib/registry/tools/regdiff.c @@ -21,7 +21,7 @@ #include "includes.h" #include "dynconfig.h" -#include "registry.h" +#include "lib/registry/registry.h" #include "lib/cmdline/popt_common.h" static void writediff(struct registry_key *oldkey, struct registry_key *newkey, FILE *out) diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c index 5f7d4376d4..887f53df37 100644 --- a/source4/lib/registry/tools/regpatch.c +++ b/source4/lib/registry/tools/regpatch.c @@ -22,7 +22,7 @@ #include "includes.h" #include "dynconfig.h" -#include "registry.h" +#include "lib/registry/registry.h" #include "lib/cmdline/popt_common.h" #include "system/filesys.h" #include "librpc/gen_ndr/winreg.h" diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 496b9dc7e5..08da5ae2fd 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -21,9 +21,10 @@ #include "includes.h" #include "dynconfig.h" -#include "registry.h" +#include "lib/registry/registry.h" #include "lib/cmdline/popt_common.h" #include "system/time.h" +#include "librpc/gen_ndr/ndr_security.h" /* * ck/cd - change key @@ -33,19 +34,30 @@ * mkkey/mkdir - make key * ch - change hive * info - show key info + * save - save hive * help * exit */ static struct registry_key *cmd_info(TALLOC_CTX *mem_ctx, struct registry_context *ctx,struct registry_key *cur, int argc, char **argv) { + struct security_descriptor *sec_desc = NULL; time_t last_mod; + WERROR error; + printf("Name: %s\n", cur->name); printf("Full path: %s\n", cur->path); printf("Key Class: %s\n", cur->class_name); last_mod = nt_time_to_unix(cur->last_mod); printf("Time Last Modified: %s\n", ctime(&last_mod)); - /* FIXME: Security info */ + + error = reg_get_sec_desc(mem_ctx, cur, &sec_desc); + if (!W_ERROR_IS_OK(error)) { + printf("Error getting security descriptor\n"); + } else { + ndr_print_debug((ndr_print_fn_t)ndr_print_security_descriptor, "Security", sec_desc); + } + talloc_free(sec_desc); return cur; } diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index 38dffed85d..c24e66412f 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -21,7 +21,7 @@ #include "includes.h" #include "dynconfig.h" -#include "registry.h" +#include "lib/registry/registry.h" #include "lib/cmdline/popt_common.h" static void print_tree(int l, struct registry_key *p, int fullpath, int novals) diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index ba11b07148..df92dfcff8 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -22,7 +22,7 @@ #include "includes.h" #include "rpc_server/dcerpc_server.h" -#include "registry.h" +#include "lib/registry/registry.h" #include "librpc/gen_ndr/ndr_winreg.h" #include "rpc_server/common/common.h" |