summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-11-24 15:26:32 +0100
committerGünther Deschner <gd@samba.org>2009-11-24 15:48:19 +0100
commit2707dfb441801e753c74657f20b5ca22a274778f (patch)
tree0bed95c9762758d1973281c1ad94e104c16ae470 /source3/lib
parentd4e06596d50e008425b9d346c3814a03eea8309a (diff)
downloadsamba-2707dfb441801e753c74657f20b5ca22a274778f.tar.gz
samba-2707dfb441801e753c74657f20b5ca22a274778f.tar.bz2
samba-2707dfb441801e753c74657f20b5ca22a274778f.zip
s3-registry: use push_reg_multi_sz() in registry_push_value().
Guenther
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_reg_api.c62
1 files changed, 3 insertions, 59 deletions
diff --git a/source3/lib/util_reg_api.c b/source3/lib/util_reg_api.c
index 503db774fc..309fa62762 100644
--- a/source3/lib/util_reg_api.c
+++ b/source3/lib/util_reg_api.c
@@ -155,74 +155,18 @@ WERROR registry_push_value(TALLOC_CTX *mem_ctx,
}
case REG_SZ:
case REG_EXPAND_SZ: {
- if (!convert_string_talloc(mem_ctx, CH_UNIX, CH_UTF16LE,
- value->v.sz.str,
- MIN(value->v.sz.len,
- strlen(value->v.sz.str)+1),
- (void *)&(presult->data),
- &presult->length, False))
+ if (!push_reg_sz(mem_ctx, presult, value->v.sz.str))
{
return WERR_NOMEM;
}
break;
}
- case REG_MULTI_SZ: {
- uint32_t count;
- size_t len = 0;
- char **strings;
- size_t *string_lengths;
- uint32_t ofs;
- TALLOC_CTX *tmp_ctx = talloc_stackframe();
-
- strings = TALLOC_ARRAY(tmp_ctx, char *,
- value->v.multi_sz.num_strings);
- if (strings == NULL) {
- return WERR_NOMEM;
- }
-
- string_lengths = TALLOC_ARRAY(tmp_ctx, size_t,
- value->v.multi_sz.num_strings);
- if (string_lengths == NULL) {
- TALLOC_FREE(tmp_ctx);
- return WERR_NOMEM;
- }
-
- /* convert the single strings */
- for (count = 0; count < value->v.multi_sz.num_strings; count++)
+ case REG_MULTI_SZ:
+ if (!push_reg_multi_sz(mem_ctx, presult, (const char **)value->v.multi_sz.strings))
{
- if (!convert_string_talloc(strings, CH_UNIX,
- CH_UTF16LE, value->v.multi_sz.strings[count],
- strlen(value->v.multi_sz.strings[count])+1,
- (void *)&strings[count],
- &string_lengths[count], false))
- {
-
- TALLOC_FREE(tmp_ctx);
- return WERR_NOMEM;
- }
- len += string_lengths[count];
- }
-
- /* now concatenate all into the data blob */
- presult->data = TALLOC_ARRAY(mem_ctx, uint8_t, len);
- if (presult->data == NULL) {
- TALLOC_FREE(tmp_ctx);
return WERR_NOMEM;
}
- for (count = 0, ofs = 0;
- count < value->v.multi_sz.num_strings;
- count++)
- {
- memcpy(presult->data + ofs, strings[count],
- string_lengths[count]);
- ofs += string_lengths[count];
- }
- presult->length = len;
-
- TALLOC_FREE(tmp_ctx);
-
break;
- }
case REG_BINARY:
*presult = data_blob_talloc(mem_ctx,
value->v.binary.data,