Revert "Registry server: Enhances commit "type" != NULL (when getting values)"
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Mon, 15 Sep 2008 17:14:31 +0000 (19:14 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 21 Oct 2008 12:40:41 +0000 (14:40 +0200)
This reverts commit 32d00f5e2c5a67dac806ee07f030f3ac2ad108f9.
This patch hasn't been right. Repost it in the right way.

source4/rpc_server/winreg/rpc_winreg.c

index 30c1ed3db652f5f3264e5e54f4558da52d65ba91..5cabae53a234c918ff17eb89e567fd3fee698859 100644 (file)
@@ -259,6 +259,7 @@ static WERROR dcesrv_winreg_EnumValue(struct dcesrv_call_state *dce_call,
        struct dcesrv_handle *h;
        struct registry_key *key;
        const char *data_name;
+       uint32_t data_type;
        DATA_BLOB data;
        WERROR result;
 
@@ -267,11 +268,12 @@ static WERROR dcesrv_winreg_EnumValue(struct dcesrv_call_state *dce_call,
        key = h->data;
 
        result = reg_key_get_value_by_index(mem_ctx, (struct registry_key *)h->data,
-               r->in.enum_index, &data_name, r->out.type, &data);
+               r->in.enum_index, &data_name, &data_type, &data);
 
        if (!W_ERROR_IS_OK(result)) {
                /* if the lookup wasn't successful, send client query back */
                data_name = r->in.name->name;
+               data_type = *r->in.type;
                data.data = r->in.value;
                data.length = *r->in.length;
        }
@@ -291,6 +293,8 @@ static WERROR dcesrv_winreg_EnumValue(struct dcesrv_call_state *dce_call,
        }
        r->out.name->size = r->in.name->size;
 
+       *r->out.value = data_type;
+
        /* check the client has enough room for the value */
        if (r->in.value != NULL &&
            r->in.size != NULL &&
@@ -458,6 +462,7 @@ static WERROR dcesrv_winreg_QueryValue(struct dcesrv_call_state *dce_call,
                                       struct winreg_QueryValue *r)
 {
        struct dcesrv_handle *h;
+       uint32_t value_type;
        DATA_BLOB value_data;
        WERROR result;
 
@@ -470,15 +475,21 @@ static WERROR dcesrv_winreg_QueryValue(struct dcesrv_call_state *dce_call,
        case SECURITY_USER:
                result = reg_key_get_value_by_name(mem_ctx,
                        (struct registry_key *)h->data, r->in.value_name.name,
-                                                  r->out.type, &value_data);
+                                                  &value_type, &value_data);
                
                if (!W_ERROR_IS_OK(result)) {
                        /* if the lookup wasn't successful, send client query back */
+                       value_type = *r->in.type;
                        value_data.data = r->in.data;
                        value_data.length = *r->in.length;
                }
 
                /* Just asking for the size of the buffer */
+               r->out.type = talloc(mem_ctx, uint32_t);
+               if (!r->out.type) {
+                       return WERR_NOMEM;
+               }
+               *r->out.type = value_type;
                r->out.length = talloc(mem_ctx, uint32_t);
                if (!r->out.length) {
                        return WERR_NOMEM;