The branch, master has been updated
       via  79fccc4... s4:registry - "regf backend" - fix it up regarding 
REG_DWORD/REG_DWORD_BIG_ENDIAN_VALUES
      from  8ae956d... s4:winbind/wb_server.c - fix indentation

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 79fccc45bc3acac5d9b15a3585e2526a3b1876f2
Author: Matthias Dieter Wallnöfer <mwallnoe...@yahoo.de>
Date:   Wed Apr 7 20:14:46 2010 +0200

    s4:registry - "regf backend" - fix it up regarding 
REG_DWORD/REG_DWORD_BIG_ENDIAN_VALUES
    
    This is needed to make it platform independently work (also on big endian
    platforms as little endian).
    
    Also add a size check before storing a DWORD.

-----------------------------------------------------------------------

Summary of changes:
 source4/lib/registry/regf.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index 5825ac1..615389e 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -550,10 +550,11 @@ static WERROR regf_get_value(TALLOC_CTX *ctx, struct 
hive_key *key,
                *data_type = vk->data_type;
 
        if (vk->data_length & 0x80000000) {
-               vk->data_length &=~0x80000000;
-               data->data = (uint8_t *)talloc_memdup(ctx, (uint8_t 
*)&vk->data_offset, vk->data_length);
+               /* this is data of type "REG_DWORD" or "REG_DWORD_BIG_ENDIAN" */
+               data->data = talloc_size(ctx, sizeof(uint32_t));
                W_ERROR_HAVE_NO_MEMORY(data->data);
-               data->length = vk->data_length;
+               SIVAL(data->data, 0, vk->data_offset);
+               data->length = sizeof(uint32_t);
        } else {
                *data = hbin_get(regf, vk->data_offset);
        }
@@ -1821,7 +1822,8 @@ static WERROR regf_set_value(struct hive_key *key, const 
char *name,
        /* Set the type and data */
        vk.data_length = data.length;
        vk.data_type = type;
-       if (type == REG_DWORD) {
+       if ((data.length == sizeof(uint32_t)) &&
+           ((type == REG_DWORD) || (type == REG_DWORD_BIG_ENDIAN))) {
                vk.data_length |= 0x80000000;
                vk.data_offset = IVAL(data.data, 0);
        } else {


-- 
Samba Shared Repository

Reply via email to