summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_misc.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-01-15 17:22:48 +0000
committerGerald Carter <jerry@samba.org>2003-01-15 17:22:48 +0000
commit4242eda183393b0535ac8ef880b4f441c60137af (patch)
tree661f28140c58a598567a22932406885a19c5ce7b /source3/rpc_parse/parse_misc.c
parent6999ff1d484ea8f1957b3479b24ec3fea228fdd0 (diff)
downloadsamba-4242eda183393b0535ac8ef880b4f441c60137af.tar.gz
samba-4242eda183393b0535ac8ef880b4f441c60137af.tar.bz2
samba-4242eda183393b0535ac8ef880b4f441c60137af.zip
merging some rpcclient and net functionality from HEAD
(This used to be commit 7a4c87484237308cb3ad0d671687da7e0f6e733b)
Diffstat (limited to 'source3/rpc_parse/parse_misc.c')
-rw-r--r--source3/rpc_parse/parse_misc.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index a9157e29b6..9d3bd6f28a 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -1042,6 +1042,55 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *
return True;
}
+
+/*******************************************************************
+ Reads or writes a UNISTR_ARRAY structure.
+********************************************************************/
+BOOL smb_io_unistr_array(const char *desc, UNISTR_ARRAY *array, prs_struct *ps, int depth)
+{
+ int i;
+
+ depth++;
+
+ array->count = 0;
+
+ if(!prs_uint32("ref_id", ps, depth, &array->ref_id))
+ return False;
+
+ if (! array->ref_id) {
+ return True;
+ }
+
+ if(!prs_uint32("count", ps, depth, &array->count))
+ return False;
+
+ if (array->count == 0) {
+ return True;
+ }
+
+ array->strings = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->strings[0]));
+ if (! array->strings) {
+ return False;
+ }
+
+ for (i=0;i<array->count;i++) {
+ if(!prs_uint16("length", ps, depth, &array->strings[i].length))
+ return False;
+ if(!prs_uint16("size", ps, depth, &array->strings[i].size))
+ return False;
+ if(!prs_uint32("ref_id", ps, depth, &array->strings[i].ref_id))
+ return False;
+ }
+
+ for (i=0;i<array->count;i++) {
+ if (! smb_io_unistr2("string", &array->strings[i].string, array->strings[i].ref_id, ps, depth))
+ return False;
+ }
+
+ return True;
+}
+
+
/*******************************************************************
Inits a DOM_RID2 structure.
********************************************************************/