summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_prs.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-11-10 19:05:00 +0000
committerLuke Leighton <lkcl@samba.org>1998-11-10 19:05:00 +0000
commit1e1c2ec93c204e6fd3ebba6dfb11e4fbc136e10c (patch)
tree1bf71664960c671d6447a085a5087ce13bb14fea /source3/rpc_parse/parse_prs.c
parent313d8ef27df81118b57f3d214db75be25e38b612 (diff)
downloadsamba-1e1c2ec93c204e6fd3ebba6dfb11e4fbc136e10c.tar.gz
samba-1e1c2ec93c204e6fd3ebba6dfb11e4fbc136e10c.tar.bz2
samba-1e1c2ec93c204e6fd3ebba6dfb11e4fbc136e10c.zip
rpcclient registry commands.
(This used to be commit 36fcb4a6e643a05d06a2a273d74318fee7f2c647)
Diffstat (limited to 'source3/rpc_parse/parse_prs.c')
-rw-r--r--source3/rpc_parse/parse_prs.c58
1 files changed, 54 insertions, 4 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index d031a828f1..873a689792 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -175,13 +175,13 @@ BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *d
stream a "not" unicode string, length/buffer specified separately,
in byte chars
********************************************************************/
-BOOL prs_uninotstr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNINOTSTR2 *str)
+BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str)
{
char *q = mem_data(&(ps->data), ps->offset);
if (q == NULL) return False;
- DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->uni_max_len)
- ps->offset += str->uni_buf_len;
+ DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->buf_len/2)
+ ps->offset += str->buf_len;
return True;
}
@@ -210,7 +210,22 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *
char *q = mem_data(&(ps->data), ps->offset);
if (q == NULL) return False;
- DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->uni_max_len)
+ DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->uni_str_len)
+ ps->offset += str->uni_str_len * sizeof(uint16);
+
+ return True;
+}
+
+/******************************************************************
+ stream a unicode string, length/buffer specified separately,
+ in uint16 chars.
+ ********************************************************************/
+BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth)
+{
+ char *q = mem_data(&(ps->data), ps->offset);
+ if (q == NULL) return False;
+
+ DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->str.buffer, str->uni_str_len)
ps->offset += str->uni_str_len * sizeof(uint16);
return True;
@@ -284,3 +299,38 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, ui
return True;
}
+/*******************************************************************
+ prs_uint16 wrapper. call this and it sets up a pointer to where the
+ uint16 should be stored, or gets the size if reading
+ ********************************************************************/
+BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *off_ptr)
+{
+ (*off_ptr) = ps->offset;
+ if (ps->io)
+ {
+ /* reading. */
+ return prs_uint16(name, ps, depth, data16);
+ }
+ return True;
+}
+
+/*******************************************************************
+ prs_uint16 wrapper. call this and it retrospectively stores the size.
+ does nothing on reading, as that is already handled by ...._pre()
+ ********************************************************************/
+BOOL prs_uint16_post(char *name, prs_struct *ps, int depth,
+ uint32 ptr_uint16, uint32 start_offset)
+{
+ if (!ps->io)
+ {
+ /* storing: go back and do a retrospective job. i hate this */
+ uint16 data_size = ps->offset - start_offset;
+ uint32 old_offset = ps->offset;
+
+ ps->offset = ptr_uint16;
+ prs_uint16(name, ps, depth, &data_size);
+ ps->offset = old_offset;
+ }
+ return True;
+}
+