summaryrefslogtreecommitdiff
path: root/source4/rpc_server
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-12-10 20:07:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:29 -0500
commit444a86792471c0bef33dde15c7a4a33e16a951b4 (patch)
tree075b0cdd27acb80470a4e90e99598cbcea3b082c /source4/rpc_server
parent60c69445f6fa86b27bd697cc8af52b582f620725 (diff)
downloadsamba-444a86792471c0bef33dde15c7a4a33e16a951b4.tar.gz
samba-444a86792471c0bef33dde15c7a4a33e16a951b4.tar.bz2
samba-444a86792471c0bef33dde15c7a4a33e16a951b4.zip
r4132: - Bunch of rather large fixes in the registry
- Added some README files Not everything works yet, e.g. the EnumValue test appears to be broken. (This used to be commit c169e86c1f52763b83e77e509f89cb91f9b69071)
Diffstat (limited to 'source4/rpc_server')
-rw-r--r--source4/rpc_server/winreg/README3
-rw-r--r--source4/rpc_server/winreg/rpc_winreg.c58
2 files changed, 29 insertions, 32 deletions
diff --git a/source4/rpc_server/winreg/README b/source4/rpc_server/winreg/README
new file mode 100644
index 0000000000..7563843253
--- /dev/null
+++ b/source4/rpc_server/winreg/README
@@ -0,0 +1,3 @@
+This is the RPC server for the registry for Samba. It is basically
+a front-end for the registry library in lib/registry. See lib/registry/README for
+more details.
diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c
index 3e9341b122..dfe3be5d8a 100644
--- a/source4/rpc_server/winreg/rpc_winreg.c
+++ b/source4/rpc_server/winreg/rpc_winreg.c
@@ -28,40 +28,34 @@
enum handle_types { HTYPE_REGVAL, HTYPE_REGKEY };
-static void winreg_destroy_hive(struct dcesrv_connection *c, struct dcesrv_handle *h)
+static NTSTATUS dcerpc_winreg_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface)
{
- reg_close(((struct registry_key *)h->data)->hive->reg_ctx);
+ struct registry_context *ctx;
+ reg_open_local(&ctx);
+
+ dce_call->conn->private = ctx;
+
+ return NT_STATUS_OK;
}
-static WERROR winreg_openhive (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, const char *hivename, struct policy_handle **outh)
+#define DCESRV_INTERFACE_WINREG_BIND dcerpc_winreg_bind
+
+static WERROR winreg_openhive (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, uint32_t hkey, struct policy_handle **outh)
{
- struct registry_context *ctx;
+ struct registry_context *ctx = dce_call->conn->private;
struct dcesrv_handle *h;
WERROR error;
- const char *conf = lp_parm_string(-1, "registry", hivename);
- char *backend, *location;
-
- if (!conf) {
- return WERR_NOT_SUPPORTED;
- }
- backend = talloc_strdup(mem_ctx, conf);
- location = strchr(backend, ':');
+ h = dcesrv_handle_new(dce_call->conn, HTYPE_REGKEY);
- if (location) {
- *location = '\0';
- location++;
+ error = reg_get_hive(ctx, hkey, (struct registry_key **)&h->data);
+ if (!W_ERROR_IS_OK(error)) {
+ return error;
}
-
- error = reg_open(&ctx, backend, location, NULL);
- if(!W_ERROR_IS_OK(error)) return error;
- h = dcesrv_handle_new(dce_call->conn, HTYPE_REGKEY);
- h->data = ctx->hives[0]->root;
- SMB_ASSERT(h->data);
- h->destroy = winreg_destroy_hive;
*outh = &h->wire_handle;
- return WERR_OK;
+
+ return error;
}
#define func_winreg_OpenHive(k,n) static WERROR winreg_Open ## k (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_Open ## k *r) \
@@ -69,15 +63,15 @@ static WERROR winreg_openhive (struct dcesrv_call_state *dce_call, TALLOC_CTX *m
return winreg_openhive (dce_call, mem_ctx, n, &r->out.handle);\
}
-func_winreg_OpenHive(HKCR,"HKEY_CLASSES_ROOT")
-func_winreg_OpenHive(HKCU,"HKEY_CURRENT_USER")
-func_winreg_OpenHive(HKLM,"HKEY_LOCAL_MACHINE")
-func_winreg_OpenHive(HKPD,"HKEY_PERFORMANCE_DATA")
-func_winreg_OpenHive(HKU,"HKEY_USERS")
-func_winreg_OpenHive(HKCC,"HKEY_CURRENT_CONFIG")
-func_winreg_OpenHive(HKDD,"HKEY_DYN_DATA")
-func_winreg_OpenHive(HKPT,"HKEY_PT")
-func_winreg_OpenHive(HKPN,"HKEY_PN")
+func_winreg_OpenHive(HKCR,HKEY_CLASSES_ROOT)
+func_winreg_OpenHive(HKCU,HKEY_CURRENT_USER)
+func_winreg_OpenHive(HKLM,HKEY_LOCAL_MACHINE)
+func_winreg_OpenHive(HKPD,HKEY_PERFORMANCE_DATA)
+func_winreg_OpenHive(HKU,HKEY_USERS)
+func_winreg_OpenHive(HKCC,HKEY_CURRENT_CONFIG)
+func_winreg_OpenHive(HKDD,HKEY_DYN_DATA)
+func_winreg_OpenHive(HKPT,HKEY_PT)
+func_winreg_OpenHive(HKPN,HKEY_PN)
/*
winreg_CloseKey