Registry server "reg_ldb_unpack_value": Tests demonstrate that also "type" doesn...
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Mon, 15 Sep 2008 16:21:45 +0000 (18:21 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 21 Oct 2008 12:40:41 +0000 (14:40 +0200)
source4/lib/registry/ldb.c
source4/rpc_server/winreg/rpc_winreg.c

index be844d75d538a1fc57f4ae6e9c7a6fa2d6ec81eb..95851dace097608e4fffd74e2cdf576578584773 100644 (file)
@@ -52,8 +52,8 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
                                      NULL));
 
        value_type = ldb_msg_find_attr_as_uint(msg, "type", 0);
-       if (type != NULL)
-               *type = value_type; 
+       *type = value_type; 
+
        val = ldb_msg_find_ldb_val(msg, "data");
 
        switch (value_type)
index dbb51b9baf34dc2383186d9299d4db27b1a0e376..5cabae53a234c918ff17eb89e567fd3fee698859 100644 (file)
@@ -68,7 +68,6 @@ static WERROR dcesrv_winreg_openhive(struct dcesrv_call_state *dce_call,
        if (!W_ERROR_IS_OK(result)) {
                return result;
        }
-
        *outh = &h->wire_handle;
 
        return result;
@@ -279,20 +278,6 @@ static WERROR dcesrv_winreg_EnumValue(struct dcesrv_call_state *dce_call,
                data.length = *r->in.length;
        }
 
-       /* the client can optionally pass a NULL for type, meaning they don't
-          want that back */
-       if (r->in.type != NULL) {
-               r->out.type = talloc(mem_ctx, enum winreg_Type);
-               *r->out.type = data_type;
-       }
-
-       /* check the client has enough room for the value */
-       if (r->in.value != NULL &&
-           r->in.size != NULL &&
-           data.length > *r->in.size) {
-               return WERR_MORE_DATA;
-       }
-
        /* and enough room for the name */
        if (r->in.name->size < 2*strlen_m_term(data_name)) {
                return WERR_MORE_DATA;
@@ -308,6 +293,15 @@ 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 &&
+           data.length > *r->in.size) {
+               return WERR_MORE_DATA;
+       }
+
        if (r->in.value != NULL) {
                r->out.value = data.data;
        }