summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/registry/ldb.c39
-rw-r--r--source4/rpc_server/winreg/rpc_winreg.c54
2 files changed, 63 insertions, 30 deletions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 42c99fbb24..e384fdbaf0 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -258,6 +258,15 @@ static WERROR ldb_get_subkey_by_id(TALLOC_CTX *mem_ctx,
{
struct ldb_message_element *el;
struct ldb_key_data *kd = talloc_get_type(k, struct ldb_key_data);
+
+ /* Initialization */
+ if (name != NULL)
+ *name = NULL;
+ if (classname != NULL)
+ *classname = NULL; /* TODO: Store properly */
+ if (last_mod_time != NULL)
+ *last_mod_time = 0; /* TODO: we need to add this to the
+ ldb backend properly */
/* Do a search if necessary */
if (kd->subkeys == NULL) {
@@ -274,13 +283,6 @@ static WERROR ldb_get_subkey_by_id(TALLOC_CTX *mem_ctx,
if (name != NULL)
*name = talloc_strdup(mem_ctx, (char *)el->values[0].data);
- if (classname != NULL)
- *classname = NULL; /* TODO: Store properly */
-
- if (last_mod_time != NULL)
- *last_mod_time = 0; /* TODO: we need to add this to the
- ldb backend properly */
-
return WERR_OK;
}
@@ -729,6 +731,22 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
{
struct ldb_key_data *kd = talloc_get_type(key, struct ldb_key_data);
+ /* Initialization */
+ if (classname != NULL)
+ *classname = NULL;
+ if (num_subkeys != NULL)
+ *num_subkeys = 0;
+ if (num_values != NULL)
+ *num_values = 0;
+ if (last_change_time != NULL)
+ *last_change_time = 0;
+ if (max_subkeynamelen != NULL)
+ *max_subkeynamelen = 0;
+ if (max_valnamelen != NULL)
+ *max_valnamelen = 0;
+ if (max_valbufsize != NULL)
+ *max_valbufsize = 0;
+
if (kd->subkeys == NULL) {
W_ERROR_NOT_OK_RETURN(cache_subkeys(kd));
}
@@ -737,20 +755,13 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
W_ERROR_NOT_OK_RETURN(cache_values(kd));
}
- /* FIXME */
- if (classname != NULL)
- *classname = NULL;
-
if (num_subkeys != NULL) {
*num_subkeys = kd->subkey_count;
}
-
if (num_values != NULL) {
*num_values = kd->value_count;
}
- if (last_change_time != NULL)
- *last_change_time = 0;
if (max_subkeynamelen != NULL) {
int i;
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;