summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2000-07-10 19:55:39 +0000
committerGerald Carter <jerry@samba.org>2000-07-10 19:55:39 +0000
commit64db2010fbc3c1eaaa2d9c7de5b56c1c9edb06e1 (patch)
treed9a2570d35ff5045f97a047e7b035b83c9740f2d /source3/rpc_parse
parent709059f5f130ebfcd9ad7779b7b045defd83daec (diff)
downloadsamba-64db2010fbc3c1eaaa2d9c7de5b56c1c9edb06e1.tar.gz
samba-64db2010fbc3c1eaaa2d9c7de5b56c1c9edb06e1.tar.bz2
samba-64db2010fbc3c1eaaa2d9c7de5b56c1c9edb06e1.zip
included a a new prs_unistr(). Is currently #if'd out (denoted
by RPCCLIENT_TEST) in order to not break anything in the smbd code (and to give time to review it). Originally written by JF. In effect, this checkin makes no changes to parse_prs.c at all. jerry (This used to be commit 4f431ea1f5d1d3b868d0bb56a299070e608c2512)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_prs.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 3b17f51c95..8bfc638d5d 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -627,6 +627,8 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *
return True;
}
+
+
/******************************************************************
Stream a unicode string, length/buffer specified separately,
in uint16 chars. We use DBG_RW_PCVAL, not DBG_RW_PSVAL here
@@ -709,6 +711,96 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
return True;
}
+#if 0 /* RPCCLIENT_TEST */
+BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
+{
+ int len = 0;
+ unsigned char *p = (unsigned char *)str->buffer;
+ uint8 *start;
+ char *q;
+ char zero=0;
+
+ if (MARSHALLING(ps)) {
+
+ for(len = 0; len < (sizeof(str->buffer) / sizeof(str->buffer[0])) &&
+ str->buffer[len] != 0; len++)
+ ;
+
+ q = prs_mem_get(ps, (len+1)*2);
+ if (q == NULL)
+ return False;
+
+ start = (uint8*)q;
+
+ for(len = 0; len < (sizeof(str->buffer) / sizeof(str->buffer[0])) &&
+ str->buffer[len] != 0; len++)
+ {
+ if(ps->bigendian_data)
+ {
+ RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0);
+ p += 2;
+ q += 2;
+ }
+ else
+ {
+ RW_CVAL(ps->io, q, *p, 0);
+ p++;
+ q++;
+ RW_CVAL(ps->io, q, *p, 0);
+ p++;
+ q++;
+ }
+ }
+
+ /*
+ * even if the string is 'empty' (only an \0 char)
+ * at this point the leading \0 hasn't been parsed.
+ * so parse it now
+ */
+
+ RW_CVAL(ps->io, q, zero, 0);
+ q++;
+ RW_CVAL(ps->io, q, zero, 0);
+ q++;
+
+ len++;
+
+ dump_data(5+depth, (char *)start, len * 2);
+ }
+ else { /* unmarshalling */
+
+ len = -1;
+ q = prs_data_p(ps) + prs_offset(ps);
+
+ do
+ {
+ len++;
+
+ if(ps->bigendian_data)
+ {
+ RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0);
+ p += 2;
+ q += 2;
+ } else {
+ RW_CVAL(ps->io, q, *p, 0);
+ p++;
+ q++;
+ RW_CVAL(ps->io, q, *p, 0);
+ p++;
+ q++;
+ }
+ } while (len < (sizeof(str->buffer) / sizeof(str->buffer[0])) &&
+ str->buffer[len] != 0);
+ }
+
+ ps->data_offset += len*2;
+
+ return True;
+}
+
+#endif /* RPCCLIENT_TEST */
+
+
/*******************************************************************
Stream a null-terminated string. len is strlen, and therefore does
not include the null-termination character.