[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Sun Feb 7 00:42:28 MST 2010


The branch, master has been updated
       via  5ab6a8d... s4-registry: fixed byte order assumptions
      from  70534ad... tdb: raise version to 1.2.1

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


- Log -----------------------------------------------------------------
commit 5ab6a8d077712c789bbd245f5f7cac7fc71cba81
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sun Feb 7 18:11:42 2010 +1100

    s4-registry: fixed byte order assumptions
    
    the registry tests were broken on big-endian systems

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

Summary of changes:
 source4/lib/registry/ldb.c            |    3 ++-
 source4/lib/registry/patchfile_preg.c |    4 ++--
 source4/lib/registry/regf.c           |    2 +-
 source4/lib/registry/util.c           |    7 ++++---
 4 files changed, 9 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 033fdcb..d70489a 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -80,7 +80,8 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
 
 	case REG_DWORD: {
 		uint32_t tmp = strtoul((char *)val->data, NULL, 0);
-		*data = data_blob_talloc(mem_ctx, &tmp, 4);
+		*data = data_blob_talloc(mem_ctx, NULL, 4);
+		SIVAL(data->data, 0, tmp);
 		}
 		break;
 
diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c
index 30a9aea..d7b4bc3 100644
--- a/source4/lib/registry/patchfile_preg.c
+++ b/source4/lib/registry/patchfile_preg.c
@@ -109,7 +109,7 @@ static WERROR reg_preg_diff_del_value(void *_data, const char *key_name,
 	val = talloc_asprintf(data->ctx, "**Del.%s", value_name);
 
 	blob.data = (uint8_t *)talloc(data->ctx, uint32_t);
-	*(uint32_t *)blob.data = 0;
+	SIVAL(blob.data, 0, 0);
 	blob.length = 4;
 	return reg_preg_diff_set_value(data, key_name, val, REG_DWORD, blob);
 }
@@ -120,7 +120,7 @@ static WERROR reg_preg_diff_del_all_values(void *_data, const char *key_name)
 	DATA_BLOB blob;
 
 	blob.data = (uint8_t *)talloc(data->ctx, uint32_t);
-	*(uint32_t *)blob.data = 0;	
+	SIVAL(blob.data, 0, 0);
 	blob.length = 4;
 
 	return reg_preg_diff_set_value(data, key_name, "**DelVals.", REG_DWORD, blob);
diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index a96c7db..b5b676f 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -1816,7 +1816,7 @@ static WERROR regf_set_value(struct hive_key *key, const char *name,
 	vk.data_type = type;
 	if (type == REG_DWORD) {
 		vk.data_length |= 0x80000000;
-		vk.data_offset = *(uint32_t *)data.data;
+		vk.data_offset = IVAL(data.data, 0);
 	} else {
 		/* Store data somewhere */
 		vk.data_offset = hbin_store(regf, data);
diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c
index 5d451df..ba739c4 100644
--- a/source4/lib/registry/util.c
+++ b/source4/lib/registry/util.c
@@ -75,11 +75,11 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
 			ret = data_blob_hex_string_upper(mem_ctx, &data);
 			break;
 		case REG_DWORD:
-			if (*(int *)data.data == 0) {
+			if (IVAL(data.data, 0) == 0) {
 				ret = talloc_strdup(mem_ctx, "0");
 			} else {
 				ret = talloc_asprintf(mem_ctx, "0x%x",
-						      *(int *)data.data);
+						      IVAL(data.data, 0));
 			}
 			break;
 		case REG_NONE:
@@ -147,7 +147,8 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx,
 			break;
 		case REG_DWORD: {
 			uint32_t tmp = strtol(data_str, NULL, 0);
-			*data = data_blob_talloc(mem_ctx, &tmp, 4);
+			*data = data_blob_talloc(mem_ctx, NULL, 4);
+			SIVAL(data->data, 0, tmp);
 			}
 			break;
 		case REG_NONE:


-- 
Samba Shared Repository


More information about the samba-cvs mailing list