summaryrefslogtreecommitdiffstats
path: root/source/rpc_parse
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2002-01-02 07:48:07 +0000
committerMartin Pool <mbp@samba.org>2002-01-02 07:48:07 +0000
commit92a3ab274e6cf09a8ba39b91f8bbacba6de40b37 (patch)
tree4ac1432d99b0f68e97f7f016393f10e48c112680 /source/rpc_parse
parentd3dd28f6c443187b8d820d5a39c7c5b3be2fa95c (diff)
downloadsamba-92a3ab274e6cf09a8ba39b91f8bbacba6de40b37.tar.gz
samba-92a3ab274e6cf09a8ba39b91f8bbacba6de40b37.tar.xz
samba-92a3ab274e6cf09a8ba39b91f8bbacba6de40b37.zip
Add prs_dump_before to dump everything from the start of the prs
buffer up to the current position, and use this to dump pipe buffers just before parsing.
Diffstat (limited to 'source/rpc_parse')
-rw-r--r--source/rpc_parse/parse_prs.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/source/rpc_parse/parse_prs.c b/source/rpc_parse/parse_prs.c
index f902210b7b8..8bb9f1c70aa 100644
--- a/source/rpc_parse/parse_prs.c
+++ b/source/rpc_parse/parse_prs.c
@@ -23,11 +23,30 @@
#include "includes.h"
-/*******************************************************************
-dump a prs to a file
- ********************************************************************/
+/**
+ * Dump a prs to a file: from the current location through to the end.
+ **/
void prs_dump(char *name, int v, prs_struct *ps)
{
+ prs_dump_region(name, v, ps, ps->data_offset, ps->buffer_size);
+}
+
+
+/**
+ * Dump from the start of the prs to the current location.
+ **/
+void prs_dump_before(char *name, int v, prs_struct *ps)
+{
+ prs_dump_region(name, v, ps, 0, ps->data_offset);
+}
+
+
+/**
+ * Dump everything from the start of the prs up to the current location.
+ **/
+void prs_dump_region(char *name, int v, prs_struct *ps,
+ int from_off, int to_off)
+{
int fd, i;
pstring fname;
if (DEBUGLEVEL < 50) return;
@@ -41,7 +60,7 @@ void prs_dump(char *name, int v, prs_struct *ps)
if (fd != -1 || errno != EEXIST) break;
}
if (fd != -1) {
- write(fd, ps->data_p + ps->data_offset, ps->buffer_size - ps->data_offset);
+ write(fd, ps->data_p + from_off, to_off - from_off);
close(fd);
DEBUG(0,("created %s\n", fname));
}