summaryrefslogtreecommitdiff
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
commit9ab8dfa381971df9aa8ba7731fa4b8e95a422a4b (patch)
tree8adbddad56422298a9a01fc61cc57370da05bef7
parent5d8a5d9d0dab36da262b0e5b3b25b886fad2b6f5 (diff)
downloadsamba-9ab8dfa381971df9aa8ba7731fa4b8e95a422a4b.tar.gz
samba-9ab8dfa381971df9aa8ba7731fa4b8e95a422a4b.tar.bz2
samba-9ab8dfa381971df9aa8ba7731fa4b8e95a422a4b.zip
#ifndef RPCCLIENT_TEST
use old prs_unistr() #else use new prs_unistr() which handles UNMARSHALL #endif /* RPCCLIENT_TEST */ jerry (This used to be commit fb0e1fb9e31db135eeb8e949a7ad0826906ba1ff)
-rw-r--r--source3/rpc_parse/parse_prs.c51
1 files changed, 16 insertions, 35 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 8bfc638d5d..5b5834084f 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/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;
}