summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-15 11:51:42 +0100
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-15 13:27:35 +0100
commit00934d4c2fd449493ad52127616445673f0de5b5 (patch)
tree1459e78aedcc71776840cfe5ce38101b5f520f1a /source4
parent80300af278d346049f9bfd48f013bc2055dc104b (diff)
downloadsamba-00934d4c2fd449493ad52127616445673f0de5b5.tar.gz
samba-00934d4c2fd449493ad52127616445673f0de5b5.tar.bz2
samba-00934d4c2fd449493ad52127616445673f0de5b5.zip
s4:registry - fix up the output of hexadecimal values
Use a fixed-length representation to avoid platform-specific issues.
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/registry/ldb.c4
-rw-r--r--source4/lib/registry/util.c16
2 files changed, 6 insertions, 14 deletions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 5c52cb238f..6676193ef4 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -225,7 +225,7 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
if (data.length == sizeof(uint32_t)) {
char *conv_str;
- conv_str = talloc_asprintf(msg, "0x%x", IVAL(data.data, 0));
+ conv_str = talloc_asprintf(msg, "0x%8.8x", IVAL(data.data, 0));
if (conv_str == NULL) {
talloc_free(msg);
return NULL;
@@ -263,7 +263,7 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
if (data.length == sizeof(uint64_t)) {
char *conv_str;
- conv_str = talloc_asprintf(msg, "0x%llx", BVAL(data.data, 0));
+ conv_str = talloc_asprintf(msg, "0x%16.16llx", BVAL(data.data, 0));
if (conv_str == NULL) {
talloc_free(msg);
return NULL;
diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c
index c7f4c0844e..5b4c41f752 100644
--- a/source4/lib/registry/util.c
+++ b/source4/lib/registry/util.c
@@ -86,22 +86,14 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
break;
case REG_DWORD:
if (data.length == sizeof(uint32_t)) {
- if (IVAL(data.data, 0) == 0) {
- ret = talloc_strdup(mem_ctx, "0");
- } else {
- ret = talloc_asprintf(mem_ctx, "0x%x",
- IVAL(data.data, 0));
- }
+ ret = talloc_asprintf(mem_ctx, "0x%8.8x",
+ IVAL(data.data, 0));
}
break;
case REG_QWORD:
if (data.length == sizeof(uint64_t)) {
- if (BVAL(data.data, 0) == 0) {
- ret = talloc_strdup(mem_ctx, "0");
- } else {
- ret = talloc_asprintf(mem_ctx, "0x%llx",
- BVAL(data.data, 0));
- }
+ ret = talloc_asprintf(mem_ctx, "0x%16.16llx",
+ BVAL(data.data, 0));
}
break;
case REG_NONE: