summaryrefslogtreecommitdiffstats
path: root/source/rpc_parse/parse_prs.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/rpc_parse/parse_prs.c')
-rw-r--r--source/rpc_parse/parse_prs.c74
1 files changed, 12 insertions, 62 deletions
diff --git a/source/rpc_parse/parse_prs.c b/source/rpc_parse/parse_prs.c
index 843be331877..6d6904dab7a 100644
--- a/source/rpc_parse/parse_prs.c
+++ b/source/rpc_parse/parse_prs.c
@@ -1,5 +1,6 @@
/*
- Unix SMB/CIFS implementation.
+ Unix SMB/Netbios implementation.
+ Version 1.9.
Samba memory buffer functions
Copyright (C) Andrew Tridgell 1992-1997
Copyright (C) Luke Kenneth Casson Leighton 1996-1997
@@ -22,33 +23,11 @@
#include "includes.h"
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_RPC_PARSE
-
-/**
- * Dump a prs to a file: from the current location through to the end.
- **/
+/*******************************************************************
+dump a prs to a file
+ ********************************************************************/
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;
@@ -62,7 +41,7 @@ void prs_dump_region(char *name, int v, prs_struct *ps,
if (fd != -1 || errno != EEXIST) break;
}
if (fd != -1) {
- write(fd, ps->data_p + from_off, to_off - from_off);
+ write(fd, ps->data_p + ps->data_offset, ps->buffer_size - ps->data_offset);
close(fd);
DEBUG(0,("created %s\n", fname));
}
@@ -76,7 +55,7 @@ void prs_dump_region(char *name, int v, prs_struct *ps,
XXXX side-effect of this function is to increase the debug depth XXXX
********************************************************************/
-void prs_debug(prs_struct *ps, int depth, const char *desc, char *fn_name)
+void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name)
{
DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->data_offset, fn_name, desc));
}
@@ -447,10 +426,6 @@ BOOL prs_align(prs_struct *ps)
return True;
}
-/******************************************************************
- Align on a 2 byte boundary
- *****************************************************************/
-
BOOL prs_align_uint16(prs_struct *ps)
{
BOOL ret;
@@ -459,23 +434,6 @@ BOOL prs_align_uint16(prs_struct *ps)
ps->align = 2;
ret = prs_align(ps);
ps->align = old_align;
-
- return ret;
-}
-
-/******************************************************************
- Align on a 8 byte boundary
- *****************************************************************/
-
-BOOL prs_align_uint64(prs_struct *ps)
-{
- BOOL ret;
- uint8 old_align = ps->align;
-
- ps->align = 8;
- ret = prs_align(ps);
- ps->align = old_align;
-
return ret;
}
@@ -638,7 +596,7 @@ BOOL prs_ntstatus(char *name, prs_struct *ps, int depth, NTSTATUS *status)
}
DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name,
- nt_errstr(*status)));
+ get_nt_error_msg(*status)));
ps->data_offset += sizeof(uint32);
@@ -893,11 +851,9 @@ BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *
return False;
if (UNMARSHALLING(ps)) {
- if ( str->buf_len ) {
- str->buffer = (uint16 *)prs_alloc_mem(ps,str->buf_len);
- if ( str->buffer == NULL )
- return False;
- }
+ str->buffer = (uint16 *)prs_alloc_mem(ps,str->buf_len);
+ if (str->buffer == NULL)
+ return False;
}
p = (char *)str->buffer;
@@ -1061,9 +1017,7 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
len++;
- DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
- print_asc(5, (unsigned char*)start, 2*len);
- DEBUG(5, ("\n"));
+ dump_data(5+depth, (char *)start, len * 2);
}
else { /* unmarshalling */
@@ -1116,10 +1070,6 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
/* NULL terminate the UNISTR */
str->buffer[len++] = '\0';
}
-
- DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
- print_asc(5, (unsigned char*)str->buffer, 2*len);
- DEBUG(5, ("\n"));
}
/* set the offset in the prs_struct; 'len' points to the