diff options
author | Günther Deschner <gd@samba.org> | 2010-06-29 16:13:15 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-07-02 10:50:21 +0200 |
commit | b381fba0892021f164223bae8b0951014a28735e (patch) | |
tree | 5dc8f39ea4997a0863e9506dbe9387ca7ceb6971 /source3/libgpo/gpext | |
parent | 84c5dd1e4bb1b4c45d7b5ac68ab432cfc399835c (diff) | |
download | samba-b381fba0892021f164223bae8b0951014a28735e.tar.gz samba-b381fba0892021f164223bae8b0951014a28735e.tar.xz samba-b381fba0892021f164223bae8b0951014a28735e.zip |
s3-registry: avoid using registry_value union.
Just pull and push data as is.
Guenther
Diffstat (limited to 'source3/libgpo/gpext')
-rw-r--r-- | source3/libgpo/gpext/registry.c | 21 | ||||
-rw-r--r-- | source3/libgpo/gpext/scripts.c | 8 |
2 files changed, 13 insertions, 16 deletions
diff --git a/source3/libgpo/gpext/registry.c b/source3/libgpo/gpext/registry.c index 57840a4c06d..a7e8a5e9481 100644 --- a/source3/libgpo/gpext/registry.c +++ b/source3/libgpo/gpext/registry.c @@ -293,24 +293,19 @@ static bool gp_reg_entry_from_file_entry(TALLOC_CTX *mem_ctx, switch (data->type) { case REG_DWORD: - data->v.dword = atoi((char *)file_entry->data); + if (file_entry->size < 4) { + return false; + } + data->data = data_blob_talloc(mem_ctx, NULL, 4); + SIVAL(data->data.data, 0, atoi((char *)file_entry->data)); break; case REG_BINARY: - data->v.binary = data_blob_talloc(mem_ctx, - file_entry->data, - file_entry->size); + case REG_SZ: + data->data.length = file_entry->size; + data->data.data = file_entry->data; break; case REG_NONE: break; - case REG_SZ: - if (!pull_ucs2_talloc(mem_ctx, &data->v.sz.str, - (const smb_ucs2_t *) - file_entry->data, - &data->v.sz.len)) { - data->v.sz.len = -1; - } - - break; case REG_DWORD_BIG_ENDIAN: case REG_EXPAND_SZ: case REG_LINK: diff --git a/source3/libgpo/gpext/scripts.c b/source3/libgpo/gpext/scripts.c index f03dff4e348..fee1461f011 100644 --- a/source3/libgpo/gpext/scripts.c +++ b/source3/libgpo/gpext/scripts.c @@ -96,11 +96,13 @@ static NTSTATUS generate_gp_registry_entry(TALLOC_CTX *mem_ctx, data->type = data_type; switch (data->type) { case REG_QWORD: - data->v.qword = *(uint64_t *)data_p; + data->data = data_blob_talloc(mem_ctx, NULL, 8); + SBVAL(data->data.data, 0, *(uint64_t *)data_p); break; case REG_SZ: - data->v.sz.str = talloc_strdup(mem_ctx, (char *)data_p); - data->v.sz.len = strlen(data->v.sz.str); + if (!push_reg_sz(mem_ctx, &data->data, (char *)data_p)) { + return NT_STATUS_NO_MEMORY; + } break; default: return NT_STATUS_NOT_SUPPORTED; |