diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2004-04-05 20:44:33 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:50:41 -0500 |
commit | b96025eb15e3648e77e0e6aa343e23ca2f1156da (patch) | |
tree | de172e59aa322f1f015f941ca6cc8c5ff596777d /source4/rpc_server | |
parent | 220ea5b6e6e4d049cb80c1c206ead6021b807283 (diff) | |
download | samba-b96025eb15e3648e77e0e6aa343e23ca2f1156da.tar.gz samba-b96025eb15e3648e77e0e6aa343e23ca2f1156da.tar.bz2 samba-b96025eb15e3648e77e0e6aa343e23ca2f1156da.zip |
r61: - Implement first call in the winreg rpc server
- Add some initial implementation of the ldb backend
- More checks in the winreg torture test
(This used to be commit ae2b63b6f1821bc4f693cb8e2a5f78718c483c24)
Diffstat (limited to 'source4/rpc_server')
-rw-r--r-- | source4/rpc_server/handles.c | 2 | ||||
-rw-r--r-- | source4/rpc_server/winreg/rpc_winreg.c | 47 |
2 files changed, 47 insertions, 2 deletions
diff --git a/source4/rpc_server/handles.c b/source4/rpc_server/handles.c index 043318c075..611dc42f76 100644 --- a/source4/rpc_server/handles.c +++ b/source4/rpc_server/handles.c @@ -32,7 +32,7 @@ struct dcesrv_handle *dcesrv_handle_new(struct dcesrv_connection *dce_conn, struct dcesrv_handle *h; mem_ctx = talloc_init("rpc handle type %d\n", handle_type); - if (!mem_ctx) { +if (!mem_ctx) { return NULL; } h = talloc(mem_ctx, sizeof(*h)); diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index 2787c07847..e5658abb09 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -22,12 +22,39 @@ #include "includes.h" +enum handle_types { HTYPE_REGKEY, HTYPE_REGVAL }; + +struct _privatedata { + REG_HANDLE *registry; +}; + + +/* this function is called when the client disconnects the endpoint */ +static void winreg_unbind(struct dcesrv_connection *dc, const struct dcesrv_interface *di) +{ + struct _privatedata *data = dc->private; + reg_free(data->registry); +} + +static NTSTATUS winreg_bind(struct dcesrv_call_state *dc, const struct dcesrv_interface *di) +{ + struct _privatedata *data; + data = talloc(dc->mem_ctx, sizeof(struct _privatedata)); + data->registry = reg_open("nt4", "/home/aurelia/jelmer/NTUSER.DAT", False); + dc->conn->private = data; + return NT_STATUS_OK; +} + +#define DCESRV_INTERFACE_WINREG_BIND winreg_bind +#define DCESRV_INTERFACE_WINREG_UNBIND winreg_unbind + /* winreg_OpenHKCR */ static NTSTATUS winreg_OpenHKCR(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_OpenHKCR *r) { + return NT_STATUS_NOT_IMPLEMENTED; } @@ -38,7 +65,20 @@ static NTSTATUS winreg_OpenHKCR(struct dcesrv_call_state *dce_call, TALLOC_CTX * static NTSTATUS winreg_OpenHKCU(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_OpenHKCU *r) { - return NT_STATUS_NOT_IMPLEMENTED; + struct _privatedata *data = dce_call->conn->private; + REG_KEY *k = reg_open_key(reg_get_root(data->registry), "\\HKEY_CURRENT_USER"); + + if(!k) { + r->out.result = WERR_BADFILE; + } else { + struct dcesrv_handle *h = dcesrv_handle_new(dce_call->conn, HTYPE_REGKEY); + h->data = k; + r->out.handle = &(h->wire_handle); + } + + r->out.result = WERR_OK; + + return NT_STATUS_OK; } @@ -178,6 +218,11 @@ static NTSTATUS winreg_NotifyChangeKeyValue(struct dcesrv_call_state *dce_call, static NTSTATUS winreg_OpenKey(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_OpenKey *r) { + struct dcesrv_handle *h = dcesrv_handle_fetch(dce_call->conn, r->in.handle, HTYPE_REGKEY); + if(!h) { + return NT_STATUS_INVALID_HANDLE; + } + return NT_STATUS_NOT_IMPLEMENTED; } |