summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-09-25 11:35:46 +0200
committerGünther Deschner <gd@samba.org>2009-09-30 00:31:17 +0200
commitfc1c243348a12d58b8f433901947253e3d998690 (patch)
tree0997fdf5f37606bf747a7bd2c8f92487cf106adf /source3
parent661342ee2f753110b31d0b809517ba94e091a310 (diff)
downloadsamba-fc1c243348a12d58b8f433901947253e3d998690.tar.gz
samba-fc1c243348a12d58b8f433901947253e3d998690.tar.bz2
samba-fc1c243348a12d58b8f433901947253e3d998690.zip
s3-util: use pull_reg_multi_sz in reg_pull_multi_sz.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_reg.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/source3/lib/util_reg.c b/source3/lib/util_reg.c
index eccd26dc34..ca46f86f69 100644
--- a/source3/lib/util_reg.c
+++ b/source3/lib/util_reg.c
@@ -76,39 +76,23 @@ const char *reg_type_lookup(enum winreg_Type type)
WERROR reg_pull_multi_sz(TALLOC_CTX *mem_ctx, const void *buf, size_t len,
uint32 *num_values, char ***values)
{
- const smb_ucs2_t *p = (const smb_ucs2_t *)buf;
- *num_values = 0;
+ DATA_BLOB blob;
+ const char **vals;
+ int i;
- /*
- * Make sure that a talloc context for the strings retrieved exists
- */
+ blob = data_blob_const((uint8_t *)buf, len);
- if (!(*values = TALLOC_ARRAY(mem_ctx, char *, 1))) {
+ if (!pull_reg_multi_sz(mem_ctx, &blob, &vals)) {
return WERR_NOMEM;
}
- len /= 2; /* buf is a set of UCS2 strings */
-
- while (len > 0) {
- char *val;
- size_t dstlen, thislen;
-
- thislen = strnlen_w(p, len) + 1;
- if (!convert_string_talloc(*values, CH_UTF16LE, CH_UNIX,
- p, thislen*2, (void *)&val, &dstlen, true)) {
- TALLOC_FREE(*values);
- return WERR_NOMEM;
- }
-
- ADD_TO_ARRAY(*values, char *, val, values, num_values);
- if (*values == NULL) {
- return WERR_NOMEM;
- }
-
- p += thislen;
- len -= thislen;
+ for (i=0; vals[i]; i++) {
+ ;;
}
+ *num_values = i;
+ *values = (char **)vals;
+
return WERR_OK;
}