summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-15 18:55:33 +0100
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-16 08:58:31 +0100
commit2f686d8523c0978630c375d377afe23fe07cbf19 (patch)
tree266a4f16073282bc3f8c617a5dec7ffe04b7b303 /source4
parent559575fe40c2d0d860868276c42efacb46dc59aa (diff)
downloadsamba-2f686d8523c0978630c375d377afe23fe07cbf19.tar.gz
samba-2f686d8523c0978630c375d377afe23fe07cbf19.tar.bz2
samba-2f686d8523c0978630c375d377afe23fe07cbf19.zip
s4:registry - introduce the "REG_DWORD_BIG_ENDIAN" datatype
It's like the normal REG_DWORD type but the byte order swapped
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/registry/ldb.c14
-rw-r--r--source4/lib/registry/util.c16
2 files changed, 26 insertions, 4 deletions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 6676193ef4..83905f3e71 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -84,6 +84,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
break;
case REG_DWORD:
+ case REG_DWORD_BIG_ENDIAN:
if (val != NULL) {
if (val->data[0] != '\0') {
/* The data is a plain DWORD */
@@ -221,11 +222,22 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
break;
case REG_DWORD:
+ case REG_DWORD_BIG_ENDIAN:
if ((data.length > 0) && (data.data != NULL)) {
if (data.length == sizeof(uint32_t)) {
char *conv_str;
- conv_str = talloc_asprintf(msg, "0x%8.8x", IVAL(data.data, 0));
+ if (type == REG_DWORD) {
+ conv_str = talloc_asprintf(msg, "0x%8.8x",
+ IVAL(data.data, 0));
+ } else {
+ conv_str = talloc_asprintf(msg, "0x%2.2x%2.2x%2.2x%2.2x",
+ CVAL(data.data, 0),
+ CVAL(data.data, 1),
+ CVAL(data.data, 2),
+ CVAL(data.data, 3));
+ }
+
if (conv_str == NULL) {
talloc_free(msg);
return NULL;
diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c
index fd75f91aac..56212906de 100644
--- a/source4/lib/registry/util.c
+++ b/source4/lib/registry/util.c
@@ -85,9 +85,18 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
}
break;
case REG_DWORD:
+ case REG_DWORD_BIG_ENDIAN:
if (data.length == sizeof(uint32_t)) {
- ret = talloc_asprintf(mem_ctx, "0x%8.8x",
- IVAL(data.data, 0));
+ if (type == REG_DWORD) {
+ ret = talloc_asprintf(mem_ctx, "0x%8.8x",
+ IVAL(data.data, 0));
+ } else {
+ ret = talloc_asprintf(mem_ctx, "0x%2.2x%2.2x%2.2x%2.2x",
+ CVAL(data.data, 0),
+ CVAL(data.data, 1),
+ CVAL(data.data, 2),
+ CVAL(data.data, 3));
+ }
}
break;
case REG_QWORD:
@@ -153,7 +162,8 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx,
(void **)&data->data,
&data->length, false);
break;
- case REG_DWORD: {
+ case REG_DWORD:
+ case REG_DWORD_BIG_ENDIAN: {
uint32_t tmp = strtol(data_str, NULL, 0);
*data = data_blob_talloc(mem_ctx, NULL, sizeof(uint32_t));
SIVAL(data->data, 0, tmp);