summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2000-07-11 16:28:59 +0000
committerGerald Carter <jerry@samba.org>2000-07-11 16:28:59 +0000
commitfb0e1fb9e31db135eeb8e949a7ad0826906ba1ff (patch)
tree974b02b4d89617c5594bb024a752ed10db40da39
parent9bd64da1e26a1b4a2df2b0537feb604a40762bb1 (diff)
downloadsamba-fb0e1fb9e31db135eeb8e949a7ad0826906ba1ff.tar.gz
samba-fb0e1fb9e31db135eeb8e949a7ad0826906ba1ff.tar.xz
samba-fb0e1fb9e31db135eeb8e949a7ad0826906ba1ff.zip
#ifndef RPCCLIENT_TEST
use old prs_unistr() #else use new prs_unistr() which handles UNMARSHALL #endif /* RPCCLIENT_TEST */ jerry
-rw-r--r--source/rpc_parse/parse_prs.c51
1 files changed, 16 insertions, 35 deletions
diff --git a/source/rpc_parse/parse_prs.c b/source/rpc_parse/parse_prs.c
index 8bfc638d5d4..5b5834084f8 100644
--- a/source/rpc_parse/parse_prs.c
+++ b/source/rpc_parse/parse_prs.c
@@ -27,35 +27,6 @@ extern int DEBUGLEVEL;
/*******************************************************************
- search for a memory buffer that falls within the specified offset
- ********************************************************************/
-static const prs_struct *prs_find(const prs_struct *buf, uint32 offset)
-{
- const prs_struct *f = NULL;
-
-#if 0 /* comment out by JERRY */
- if (buf == NULL)
- return False;
-
- f = buf;
-
- while (f != NULL && offset >= f->end)
- {
- DEBUG(200, ("prs_find: next[%d..%d]\n", f->start, f->end));
-
- f = f->next;
- }
-
- if (f != NULL)
- {
- DEBUG(200, ("prs_find: found [%d..%d]\n", f->start, f->end));
- }
-
-#endif
- return f;
-}
-
-/*******************************************************************
dump a prs to a file
********************************************************************/
void prs_dump(char *name, int v, prs_struct *ps)
@@ -657,6 +628,7 @@ BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int de
in little-endian format then do it as a stream of bytes.
********************************************************************/
+#ifndef RPCCLIENT_TEST
BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
{
int len = 0;
@@ -710,8 +682,7 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
return True;
}
-
-#if 0 /* RPCCLIENT_TEST */
+#else
BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
{
int len = 0;
@@ -993,16 +964,26 @@ BOOL prs_realloc_data(prs_struct *buf, size_t new_size)
}
/*******************************************************************
- return the memory location specified by may return NULL.
+ return the memory location specified by offset; may return NULL.
********************************************************************/
char *prs_data(const prs_struct *buf, uint32 offset)
{
- buf = prs_find(buf, offset);
- if (buf != NULL)
+
+ /* do we have something to look at? */
+ if (buf == NULL)
+ return NULL;
+
+ /* check to make sure the offset is within range */
+ if ((offset < 0) || (offset >= buf->buffer_size))
+ return NULL;
+
+ /* locate the memory address */
+ if (buf->data_p != NULL)
{
- /* return &(buf->data[offset - buf->start]); */
return &(buf->data_p[offset]);
}
+
+ /* default return */
return NULL;
}