Index: registry.h =================================================================== --- registry.h (revision 24700) +++ registry.h (working copy) @@ -80,7 +80,6 @@ typedef void (*reg_value_notification_function) (void); struct cli_credentials; -struct registry_context; struct registry_operations { const char *name; Index: tools/common.c =================================================================== --- tools/common.c (revision 24700) +++ tools/common.c (working copy) @@ -24,7 +24,7 @@ struct registry_context *reg_common_open_remote(const char *remote, struct cli_credentials *creds) { - struct registry_context *h; + struct registry_context *h = NULL; WERROR error; error = reg_open_remote(&h, NULL, creds, remote, NULL); @@ -40,7 +40,7 @@ struct registry_key *reg_common_open_file(const char *path, struct cli_credentials *creds) { struct hive_key *hive_root; - struct registry_context *h; + struct registry_context *h = NULL; WERROR error; error = reg_open_hive(NULL, path, NULL, creds, &hive_root); @@ -62,7 +62,7 @@ struct registry_context *reg_common_open_local(struct cli_credentials *creds) { WERROR error; - struct registry_context *h; + struct registry_context *h = NULL; error = reg_open_samba(NULL, &h, NULL, creds); Index: rpc.c =================================================================== --- rpc.c (revision 24700) +++ rpc.c (working copy) @@ -32,7 +32,7 @@ }; struct rpc_registry_context { - struct registry_context context; + const struct registry_operations *ops; struct dcerpc_pipe *pipe; }; @@ -95,8 +95,6 @@ struct registry_key **k) { int n; - struct rpc_registry_context *rctx = talloc_get_type(ctx, - struct rpc_registry_context); struct rpc_key *mykeydata; for(n = 0; known_hives[n].hkey; n++) { @@ -110,10 +108,11 @@ } mykeydata = talloc(ctx, struct rpc_key); - mykeydata->pipe = rctx->pipe; + mykeydata->key = **k; + mykeydata->pipe = ctx->pipe; mykeydata->num_values = -1; mykeydata->num_subkeys = -1; - return known_hives[n].open(mykeydata->pipe, *k, &(mykeydata->pol)); + return known_hives[n].open(mykeydata->pipe, ctx, &(mykeydata->pol)); } #if 0 @@ -355,6 +354,7 @@ static struct registry_operations reg_backend_rpc = { .name = "rpc", .open_key = rpc_open_key, + .get_predefined_key = rpc_get_predefined_key, .enum_key = rpc_get_subkey_by_index, .enum_value = rpc_get_value_by_index, .create_key = rpc_add_key, @@ -369,31 +369,30 @@ { NTSTATUS status; struct dcerpc_pipe *p; - struct rpc_registry_context *rctx; + struct rpc_registry_context *ret = talloc_zero(NULL, struct rpc_registry_context); dcerpc_init(); - rctx = talloc(NULL, struct rpc_registry_context); - /* Default to local smbd if no connection is specified */ if (!location) { - location = talloc_strdup(ctx, "ncalrpc:"); + location = talloc_strdup(ret, "ncalrpc:"); } - status = dcerpc_pipe_connect(*ctx /* TALLOC_CTX */, + status = dcerpc_pipe_connect(ret /* TALLOC_CTX */, &p, location, &ndr_table_winreg, credentials, ev); - rctx->pipe = p; - if(NT_STATUS_IS_ERR(status)) { DEBUG(1, ("Unable to open '%s': %s\n", location, nt_errstr(status))); - talloc_free(*ctx); - *ctx = NULL; + talloc_free(ret); + ret = NULL; return ntstatus_to_werror(status); } - *ctx = (struct registry_context *)rctx; + ret->ops = ®_backend_rpc; + ret->pipe = p; + *ctx = (struct registry_context *)ret; + return WERR_OK; } Index: local.c =================================================================== --- local.c (revision 24700) +++ local.c (working copy) @@ -30,7 +30,7 @@ }; struct registry_local { - struct registry_context registry; + const struct registry_operations *ops; struct mountpoint { struct reg_key_path path; @@ -294,7 +294,7 @@ W_ERROR_HAVE_NO_MEMORY(ret); - ret->registry.ops = &local_ops; + ret->ops = &local_ops; ret->session_info = session_info; ret->credentials = credentials;