summaryrefslogtreecommitdiff
path: root/source4/rpc_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-08-17 13:06:05 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:33:27 -0500
commita152245a998923888e201d4488b8dc16619d96a1 (patch)
tree3cd313446db9ff0e9a830b0141d6d4a4fbaf232e /source4/rpc_server
parent878e139f09e6e2f87de35341f4340119959469e5 (diff)
downloadsamba-a152245a998923888e201d4488b8dc16619d96a1.tar.gz
samba-a152245a998923888e201d4488b8dc16619d96a1.tar.bz2
samba-a152245a998923888e201d4488b8dc16619d96a1.zip
r9358: - opening a winreg key of "" is the same as re-opening the hive. The
w2k3 regedit does this. - w2k3 expects null termination is string lengths (This used to be commit bcef9e592acd96a2fd7028b299d3d93968d044ae)
Diffstat (limited to 'source4/rpc_server')
-rw-r--r--source4/rpc_server/winreg/rpc_winreg.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c
index 431323d1b6..2cbac091bb 100644
--- a/source4/rpc_server/winreg/rpc_winreg.c
+++ b/source4/rpc_server/winreg/rpc_winreg.c
@@ -166,13 +166,15 @@ static WERROR winreg_EnumKey(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem
r->out.result = reg_key_get_subkey_by_index(mem_ctx, (struct registry_key *)h->data, r->in.enum_index, &key);
if (W_ERROR_IS_OK(r->out.result)) {
- if (2*strlen_m(key->name) > r->in.name->size) {
+ if (2*strlen_m_term(key->name) > r->in.name->size) {
return WERR_MORE_DATA;
}
- r->out.name->length = 2*strlen_m(key->name);
+ r->out.name->length = 2*strlen_m_term(key->name);
r->out.name->name = key->name;
r->out.class = talloc_zero(mem_ctx, struct winreg_StringBuf);
- r->out.last_changed_time = &key->last_mod;
+ if (r->in.last_changed_time) {
+ r->out.last_changed_time = &key->last_mod;
+ }
}
return r->out.result;
@@ -213,13 +215,13 @@ static WERROR winreg_EnumValue(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
}
/* and enough room for the name */
- if (r->in.name->size < 2*strlen_m(value->name)) {
+ if (r->in.name->size < 2*strlen_m_term(value->name)) {
return WERR_MORE_DATA;
}
r->out.name->name = value->name;
- r->out.name->length = 2*strlen_m(value->name);
- r->out.name->size = 2*strlen_m(value->name);
+ r->out.name->length = 2*strlen_m_term(value->name);
+ r->out.name->size = 2*strlen_m_term(value->name);
if (r->in.value) {
r->out.value = value->data_blk;
@@ -294,11 +296,15 @@ static WERROR winreg_OpenKey(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem
DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
- newh = dcesrv_handle_new(dce_call->context, HTYPE_REGKEY);
-
- result = reg_open_key(newh, (struct registry_key *)h->data,
- r->in.keyname.name, (struct registry_key **)&newh->data);
-
+ if (r->in.keyname.name && strcmp(r->in.keyname.name, "") == 0) {
+ newh = talloc_reference(dce_call->context, h);
+ result = WERR_OK;
+ } else {
+ newh = dcesrv_handle_new(dce_call->context, HTYPE_REGKEY);
+ result = reg_open_key(newh, (struct registry_key *)h->data,
+ r->in.keyname.name, (struct registry_key **)&newh->data);
+ }
+
if (W_ERROR_IS_OK(result)) {
r->out.handle = &newh->wire_handle;
} else {