diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2008-09-13 13:32:39 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-10-21 14:40:41 +0200 |
commit | e23e99764436b9a8432dd6552d12c3ad82a27362 (patch) | |
tree | 9848729178674beb8080857cc0307e3148952d1b /source4/rpc_server | |
parent | f58f74949d1c596a9c696dc71b325f7d4475fc5f (diff) | |
download | samba-e23e99764436b9a8432dd6552d12c3ad82a27362.tar.gz samba-e23e99764436b9a8432dd6552d12c3ad82a27362.tar.bz2 samba-e23e99764436b9a8432dd6552d12c3ad82a27362.zip |
Registry server: More work to be compatible
Some fixup's and assure, that we send only initialized values.
Diffstat (limited to 'source4/rpc_server')
-rw-r--r-- | source4/rpc_server/winreg/rpc_winreg.c | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index 62f2676bd2..df965101cd 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -3,7 +3,8 @@ endpoint server for the winreg pipe - Copyright (C) Jelmer Vernooij 2004 + Copyright (C) 2004 Jelmer Vernooij, jelmer@samba.org + Copyright (C) 2008 Matthias Dieter Wallnöfer, mwallnoefer@yahoo.de This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -212,25 +213,40 @@ static WERROR dcesrv_winreg_EnumKey(struct dcesrv_call_state *dce_call, struct winreg_EnumKey *r) { struct dcesrv_handle *h; - const char *name; + const char *name, *classname; NTTIME last_mod; DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY); r->out.result = reg_key_get_subkey_by_index(mem_ctx, - (struct registry_key *)h->data, - r->in.enum_index, - &name, NULL, &last_mod); + (struct registry_key *)h->data, r->in.enum_index, + &name, &classname, &last_mod); if (2*strlen_m_term(name) > r->in.name->size) { return WERR_MORE_DATA; } - r->out.name->length = 2*strlen_m_term(name); - r->out.name->name = name; - r->out.keyclass = talloc_zero(mem_ctx, struct winreg_StringBuf); - if (r->in.last_changed_time) { - r->out.last_changed_time = &last_mod; + + if (name != NULL) { + r->out.name->name = name; + r->out.name->length = 2*strlen_m_term(name); + } else { + r->out.name->name = r->in.name->name; + r->out.name->length = r->in.name->length; + } + r->out.name->size = r->in.name->size; + + r->out.keyclass = r->in.keyclass; + if (classname != NULL) { + r->out.keyclass->name = classname; + r->out.keyclass->length = 2*strlen_m_term(classname); + } else { + r->out.keyclass->name = r->in.keyclass->name; + r->out.keyclass->length = r->in.keyclass->length; } + r->out.keyclass->size = r->in.keyclass->size; + + if (r->in.last_changed_time != NULL) + r->out.last_changed_time = &last_mod; return r->out.result; } @@ -286,7 +302,7 @@ static WERROR dcesrv_winreg_EnumValue(struct dcesrv_call_state *dce_call, } /* "data_name" is NULL when we query the default attribute */ - if (data_name) { + if (data_name != NULL) { r->out.name->name = data_name; r->out.name->length = 2*strlen_m_term(data_name); } else { @@ -295,11 +311,11 @@ static WERROR dcesrv_winreg_EnumValue(struct dcesrv_call_state *dce_call, } r->out.name->size = r->in.name->size; - if (r->in.value) { + if (r->in.value != NULL) { r->out.value = data.data; } - if (r->in.size) { + if (r->in.size != NULL) { r->out.size = talloc(mem_ctx, uint32_t); *r->out.size = data.length; r->out.length = r->out.size; @@ -433,10 +449,16 @@ static WERROR dcesrv_winreg_QueryInfoKey(struct dcesrv_call_state *dce_call, r->out.num_values, r->out.last_changed_time, r->out.max_subkeylen, r->out.max_valnamelen, r->out.max_valbufsize); - - if (r->out.classname != NULL) + + if (classname != NULL) { r->out.classname->name = classname; - + r->out.classname->name_len = 2*strlen_m_term(classname); + } else { + r->out.classname->name = r->in.classname->name; + r->out.classname->name_len = r->in.classname->name_len; + } + r->out.classname->name_size = r->in.classname->name_size; + return result; default: return WERR_ACCESS_DENIED; |