summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-03-15 19:43:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:01 -0500
commit61dfab9f705cb38e552dcec1822974433997543c (patch)
treef2b5b3f412f7a31c0de1057a9592a3fdcc6fb427 /source3/rpc_parse
parent3b7dccf076628114d4fb1f67ab7aa05457de367d (diff)
downloadsamba-61dfab9f705cb38e552dcec1822974433997543c.tar.gz
samba-61dfab9f705cb38e552dcec1822974433997543c.tar.bz2
samba-61dfab9f705cb38e552dcec1822974433997543c.zip
r5805: merging spoolss parsing changes from trunk and cleaning up resulting segvs
(This used to be commit 25121547caaaed0d60f4db7458570c14e7d21b2a)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_buffer.c512
-rw-r--r--source3/rpc_parse/parse_misc.c19
-rw-r--r--source3/rpc_parse/parse_prs.c28
-rw-r--r--source3/rpc_parse/parse_sec.c2
-rw-r--r--source3/rpc_parse/parse_spoolss.c554
5 files changed, 627 insertions, 488 deletions
diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c
new file mode 100644
index 0000000000..d3584c3954
--- /dev/null
+++ b/source3/rpc_parse/parse_buffer.c
@@ -0,0 +1,512 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * RPC Pipe client / server routines
+ *
+ * Copyright (C) Andrew Tridgell 1992-2000,
+ * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
+ * Copyright (C) Jean François Micouleau 1998-2000,
+ * Copyright (C) Gerald Carter 2000-2005,
+ * Copyright (C) Tim Potter 2001-2002.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "includes.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_RPC_PARSE
+
+/**********************************************************************
+ Initialize a new spoolss buff for use by a client rpc
+**********************************************************************/
+void rpcbuf_init(RPC_BUFFER *buffer, uint32 size, TALLOC_CTX *ctx)
+{
+#if 0
+ buffer->ptr = (size != 0);
+#endif
+ buffer->size = size;
+ buffer->string_at_end = size;
+ prs_init(&buffer->prs, size, ctx, MARSHALL);
+ buffer->struct_start = prs_offset(&buffer->prs);
+}
+
+/*******************************************************************
+ Read/write a RPC_BUFFER struct.
+********************************************************************/
+
+BOOL prs_rpcbuffer(const char *desc, prs_struct *ps, int depth, RPC_BUFFER *buffer)
+{
+ prs_debug(ps, depth, desc, "prs_rpcbuffer");
+ depth++;
+
+ /* reading */
+ if (UNMARSHALLING(ps)) {
+ buffer->size=0;
+ buffer->string_at_end=0;
+
+#if 0
+ if (buffer->ptr==0) {
+ /*
+ * JRA. I'm not sure if the data in here is in big-endian format if
+ * the client is big-endian. Leave as default (little endian) for now.
+ */
+
+ if (!prs_init(&buffer->prs, 0, prs_get_mem_context(ps), UNMARSHALL))
+ return False;
+ return True;
+ }
+#endif
+
+ if (!prs_uint32("size", ps, depth, &buffer->size))
+ return False;
+
+ /*
+ * JRA. I'm not sure if the data in here is in big-endian format if
+ * the client is big-endian. Leave as default (little endian) for now.
+ */
+
+ if (!prs_init(&buffer->prs, buffer->size, prs_get_mem_context(ps), UNMARSHALL))
+ return False;
+
+ if (!prs_append_some_prs_data(&buffer->prs, ps, prs_offset(ps), buffer->size))
+ return False;
+
+ if (!prs_set_offset(&buffer->prs, 0))
+ return False;
+
+ if (!prs_set_offset(ps, buffer->size+prs_offset(ps)))
+ return False;
+
+ buffer->string_at_end=buffer->size;
+
+ return True;
+ }
+ else {
+ BOOL ret = False;
+
+#if 0
+ /* writing */
+ if (buffer->ptr==0) {
+ /* We have finished with the data in buffer->prs - free it. */
+ prs_mem_free(&buffer->prs);
+ return True;
+ }
+#endif
+
+ if (!prs_uint32("size", ps, depth, &buffer->size))
+ goto out;
+
+ if (!prs_append_some_prs_data(ps, &buffer->prs, 0, buffer->size))
+ goto out;
+
+ ret = True;
+ out:
+
+ /* We have finished with the data in buffer->prs - free it. */
+ prs_mem_free(&buffer->prs);
+
+ return ret;
+ }
+}
+
+/*******************************************************************
+ Read/write an RPC_BUFFER* struct.(allocate memory if unmarshalling)
+********************************************************************/
+
+BOOL prs_rpcbuffer_p(const char *desc, prs_struct *ps, int depth, RPC_BUFFER **buffer)
+{
+ uint32 data_p;
+
+ /* caputure the pointer value to stream */
+
+ data_p = (uint32) *buffer;
+
+ if ( !prs_uint32("ptr", ps, depth, &data_p ))
+ return False;
+
+ /* we're done if there is no data */
+
+ if ( !data_p )
+ return True;
+
+ if ( UNMARSHALLING(ps) ) {
+ if ( !(*buffer = PRS_ALLOC_MEM(ps, RPC_BUFFER, 1)) )
+ return False;
+ }
+
+ return prs_rpcbuffer( desc, ps, depth, *buffer);
+}
+
+/****************************************************************************
+ Allocate more memory for a RPC_BUFFER.
+****************************************************************************/
+
+BOOL rpcbuf_alloc_size(RPC_BUFFER *buffer, uint32 buffer_size)
+{
+ prs_struct *ps;
+ uint32 extra_space;
+ uint32 old_offset;
+
+ ps= &buffer->prs;
+
+ /* damn, I'm doing the reverse operation of prs_grow() :) */
+ if (buffer_size < prs_data_size(ps))
+ extra_space=0;
+ else
+ extra_space = buffer_size - prs_data_size(ps);
+
+ /*
+ * save the offset and move to the end of the buffer
+ * prs_grow() checks the extra_space against the offset
+ */
+ old_offset=prs_offset(ps);
+ prs_set_offset(ps, prs_data_size(ps));
+
+ if (!prs_grow(ps, extra_space))
+ return False;
+
+ prs_set_offset(ps, old_offset);
+
+ buffer->string_at_end=prs_data_size(ps);
+
+ return True;
+}
+
+/*******************************************************************
+ move a BUFFER from the query to the reply.
+ As the data pointers in RPC_BUFFER are malloc'ed, not talloc'ed,
+ this is ok. This is an OPTIMIZATION and is not strictly neccessary.
+ Clears the memory to zero also.
+********************************************************************/
+
+void rpcbuf_move(RPC_BUFFER *src, RPC_BUFFER **dest)
+{
+ if ( !src )
+ return;
+
+ prs_switch_type(&src->prs, MARSHALL);
+ if(!prs_set_offset(&src->prs, 0))
+ return;
+ prs_force_dynamic(&src->prs);
+ prs_mem_clear(&src->prs);
+ *dest=src;
+}
+
+/*******************************************************************
+ Get the size of a BUFFER struct.
+********************************************************************/
+
+uint32 rpcbuf_get_size(RPC_BUFFER *buffer)
+{
+ return (buffer->size);
+}
+
+
+/*******************************************************************
+ * write a UNICODE string and its relative pointer.
+ * used by all the RPC structs passing a buffer
+ *
+ * As I'm a nice guy, I'm forcing myself to explain this code.
+ * MS did a good job in the overall spoolss code except in some
+ * functions where they are passing the API buffer directly in the
+ * RPC request/reply. That's to maintain compatiility at the API level.
+ * They could have done it the good way the first time.
+ *
+ * So what happen is: the strings are written at the buffer's end,
+ * in the reverse order of the original structure. Some pointers to
+ * the strings are also in the buffer. Those are relative to the
+ * buffer's start.
+ *
+ * If you don't understand or want to change that function,
+ * first get in touch with me: jfm@samba.org
+ *
+ ********************************************************************/
+
+BOOL smb_io_relstr(const char *desc, RPC_BUFFER *buffer, int depth, UNISTR *string)
+{
+ prs_struct *ps=&buffer->prs;
+
+ if (MARSHALLING(ps)) {
+ uint32 struct_offset = prs_offset(ps);
+ uint32 relative_offset;
+
+ buffer->string_at_end -= (size_of_relative_string(string) - 4);
+ if(!prs_set_offset(ps, buffer->string_at_end))
+ return False;
+#if 0 /* JERRY */
+ /*
+ * Win2k does not align strings in a buffer
+ * Tested against WinNT 4.0 SP 6a & 2k SP2 --jerry
+ */
+ if (!prs_align(ps))
+ return False;
+#endif
+ buffer->string_at_end = prs_offset(ps);
+
+ /* write the string */
+ if (!smb_io_unistr(desc, string, ps, depth))
+ return False;
+
+ if(!prs_set_offset(ps, struct_offset))
+ return False;
+
+ relative_offset=buffer->string_at_end - buffer->struct_start;
+ /* write its offset */
+ if (!prs_uint32("offset", ps, depth, &relative_offset))
+ return False;
+ }
+ else {
+ uint32 old_offset;
+
+ /* read the offset */
+ if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end)))
+ return False;
+
+ if (buffer->string_at_end == 0)
+ return True;
+
+ old_offset = prs_offset(ps);
+ if(!prs_set_offset(ps, buffer->string_at_end+buffer->struct_start))
+ return False;
+
+ /* read the string */
+ if (!smb_io_unistr(desc, string, ps, depth))
+ return False;
+
+ if(!prs_set_offset(ps, old_offset))
+ return False;
+ }
+ return True;
+}
+
+/*******************************************************************
+ * write a array of UNICODE strings and its relative pointer.
+ * used by 2 RPC structs
+ ********************************************************************/
+
+BOOL smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 **string)
+{
+ UNISTR chaine;
+
+ prs_struct *ps=&buffer->prs;
+
+ if (MARSHALLING(ps)) {
+ uint32 struct_offset = prs_offset(ps);
+ uint32 relative_offset;
+ uint16 *p;
+ uint16 *q;
+ uint16 zero=0;
+ p=*string;
+ q=*string;
+
+ /* first write the last 0 */
+ buffer->string_at_end -= 2;
+ if(!prs_set_offset(ps, buffer->string_at_end))
+ return False;
+
+ if(!prs_uint16("leading zero", ps, depth, &zero))
+ return False;
+
+ while (p && (*p!=0)) {
+ while (*q!=0)
+ q++;
+
+ /* Yes this should be malloc not talloc. Don't change. */
+
+ chaine.buffer = SMB_MALLOC((q-p+1)*sizeof(uint16));
+ if (chaine.buffer == NULL)
+ return False;
+
+ memcpy(chaine.buffer, p, (q-p+1)*sizeof(uint16));
+
+ buffer->string_at_end -= (q-p+1)*sizeof(uint16);
+
+ if(!prs_set_offset(ps, buffer->string_at_end)) {
+ SAFE_FREE(chaine.buffer);
+ return False;
+ }
+
+ /* write the string */
+ if (!smb_io_unistr(desc, &chaine, ps, depth)) {
+ SAFE_FREE(chaine.buffer);
+ return False;
+ }
+ q++;
+ p=q;
+
+ SAFE_FREE(chaine.buffer);
+ }
+
+ if(!prs_set_offset(ps, struct_offset))
+ return False;
+
+ relative_offset=buffer->string_at_end - buffer->struct_start;
+ /* write its offset */
+ if (!prs_uint32("offset", ps, depth, &relative_offset))
+ return False;
+
+ } else {
+
+ /* UNMARSHALLING */
+
+ uint32 old_offset;
+ uint16 *chaine2=NULL;
+ int l_chaine=0;
+ int l_chaine2=0;
+ size_t realloc_size = 0;
+
+ *string=NULL;
+
+ /* read the offset */
+ if (!prs_uint32("offset", ps, depth, &buffer->string_at_end))
+ return False;
+
+ old_offset = prs_offset(ps);
+ if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start))
+ return False;
+
+ do {
+ if (!smb_io_unistr(desc, &chaine, ps, depth))
+ return False;
+
+ l_chaine=str_len_uni(&chaine);
+
+ /* we're going to add two more bytes here in case this
+ is the last string in the array and we need to add
+ an extra NULL for termination */
+ if (l_chaine > 0)
+ {
+ uint16 *tc2;
+
+ realloc_size = (l_chaine2+l_chaine+2)*sizeof(uint16);
+
+ /* Yes this should be realloc - it's freed below. JRA */
+
+ if((tc2=(uint16 *)SMB_REALLOC(chaine2, realloc_size)) == NULL) {
+ SAFE_FREE(chaine2);
+ return False;
+ }
+ else chaine2 = tc2;
+ memcpy(chaine2+l_chaine2, chaine.buffer, (l_chaine+1)*sizeof(uint16));
+ l_chaine2+=l_chaine+1;
+ }
+
+ } while(l_chaine!=0);
+
+ /* the end should be bould NULL terminated so add
+ the second one here */
+ if (chaine2)
+ {
+ chaine2[l_chaine2] = '\0';
+ *string=(uint16 *)TALLOC_MEMDUP(prs_get_mem_context(ps),chaine2,realloc_size);
+ SAFE_FREE(chaine2);
+ }
+
+ if(!prs_set_offset(ps, old_offset))
+ return False;
+ }
+ return True;
+}
+
+/*******************************************************************
+ Parse a DEVMODE structure and its relative pointer.
+********************************************************************/
+
+BOOL smb_io_relsecdesc(const char *desc, RPC_BUFFER *buffer, int depth, SEC_DESC **secdesc)
+{
+ prs_struct *ps= &buffer->prs;
+
+ prs_debug(ps, depth, desc, "smb_io_relsecdesc");
+ depth++;
+
+ if (MARSHALLING(ps)) {
+ uint32 struct_offset = prs_offset(ps);
+ uint32 relative_offset;
+
+ if (! *secdesc) {
+ relative_offset = 0;
+ if (!prs_uint32("offset", ps, depth, &relative_offset))
+ return False;
+ return True;
+ }
+
+ if (*secdesc != NULL) {
+ buffer->string_at_end -= sec_desc_size(*secdesc);
+
+ if(!prs_set_offset(ps, buffer->string_at_end))
+ return False;
+ /* write the secdesc */
+ if (!sec_io_desc(desc, secdesc, ps, depth))
+ return False;
+
+ if(!prs_set_offset(ps, struct_offset))
+ return False;
+ }
+
+ relative_offset=buffer->string_at_end - buffer->struct_start;
+ /* write its offset */
+
+ if (!prs_uint32("offset", ps, depth, &relative_offset))
+ return False;
+ } else {
+ uint32 old_offset;
+
+ /* read the offset */
+ if (!prs_uint32("offset", ps, depth, &buffer->string_at_end))
+ return False;
+
+ old_offset = prs_offset(ps);
+ if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start))
+ return False;
+
+ /* read the sd */
+ if (!sec_io_desc(desc, secdesc, ps, depth))
+ return False;
+
+ if(!prs_set_offset(ps, old_offset))
+ return False;
+ }
+ return True;
+}
+
+
+
+/*******************************************************************
+ * return the length of a UNICODE string in number of char, includes:
+ * - the leading zero
+ * - the relative pointer size
+ ********************************************************************/
+
+uint32 size_of_relative_string(UNISTR *string)
+{
+ uint32 size=0;
+
+ size=str_len_uni(string); /* the string length */
+ size=size+1; /* add the trailing zero */
+ size=size*2; /* convert in char */
+ size=size+4; /* add the size of the ptr */
+
+#if 0 /* JERRY */
+ /*
+ * Do not include alignment as Win2k does not align relative
+ * strings within a buffer --jerry
+ */
+ /* Ensure size is 4 byte multiple (prs_align is being called...). */
+ /* size += ((4 - (size & 3)) & 3); */
+#endif
+
+ return size;
+}
+
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index bca40a64c8..dec20769b6 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -1797,3 +1797,22 @@ BOOL make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer)
return True;
}
+
+/*******************************************************************
+return the length of a UNISTR string.
+********************************************************************/
+
+uint32 str_len_uni(UNISTR *source)
+{
+ uint32 i=0;
+
+ if (!source->buffer)
+ return 0;
+
+ while (source->buffer[i])
+ i++;
+
+ return i;
+}
+
+
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 4b78d373ba..566efae7a9 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -647,6 +647,34 @@ BOOL prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32)
}
/*******************************************************************
+ Stream a uint32* (allocate memory if unmarshalling)
+ ********************************************************************/
+
+BOOL prs_uint32_p(const char *name, prs_struct *ps, int depth, uint32 **data32)
+{
+ uint32 data_p;
+
+ /* caputure the pointer value to stream */
+
+ data_p = (uint32) *data32;
+
+ if ( !prs_uint32("ptr", ps, depth, &data_p ))
+ return False;
+
+ /* we're done if there is no data */
+
+ if ( !data_p )
+ return True;
+
+ if (UNMARSHALLING(ps)) {
+ if ( !(*data32 = PRS_ALLOC_MEM(ps, uint32, 1)) )
+ return False;
+ }
+
+ return prs_uint32(name, ps, depth, *data32);
+}
+
+/*******************************************************************
Stream a NTSTATUS
********************************************************************/
diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c
index f6fdf10292..6a752688a0 100644
--- a/source3/rpc_parse/parse_sec.c
+++ b/source3/rpc_parse/parse_sec.c
@@ -133,7 +133,7 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth)
* Note that the size is always a multiple of 4 bytes due to the
* nature of the data structure. Therefore the prs_align() calls
* have been removed as they through us off when doing two-layer
- * marshalling such as in the printing code (NEW_BUFFER). --jerry
+ * marshalling such as in the printing code (RPC_BUFFER). --jerry
*/
if (ppsa == NULL)
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index 2e5244d653..0279074946 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -27,22 +27,6 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_PARSE
-/*******************************************************************
-return the length of a UNISTR string.
-********************************************************************/
-
-static uint32 str_len_uni(UNISTR *source)
-{
- uint32 i=0;
-
- if (!source->buffer)
- return 0;
-
- while (source->buffer[i])
- i++;
-
- return i;
-}
/*******************************************************************
This should be moved in a more generic lib.
@@ -2068,33 +2052,6 @@ static uint32 size_of_nttime(NTTIME *value)
}
/*******************************************************************
- * return the length of a UNICODE string in number of char, includes:
- * - the leading zero
- * - the relative pointer size
- ********************************************************************/
-
-static uint32 size_of_relative_string(UNISTR *string)
-{
- uint32 size=0;
-
- size=str_len_uni(string); /* the string length */
- size=size+1; /* add the trailing zero */
- size=size*2; /* convert in char */
- size=size+4; /* add the size of the ptr */
-
-#if 0 /* JERRY */
- /*
- * Do not include alignment as Win2k does not align relative
- * strings within a buffer --jerry
- */
- /* Ensure size is 4 byte multiple (prs_align is being called...). */
- /* size += ((4 - (size & 3)) & 3); */
-#endif
-
- return size;
-}
-
-/*******************************************************************
* return the length of a uint32 (obvious, but the code is clean)
********************************************************************/
@@ -2119,277 +2076,10 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime)
}
/*******************************************************************
- * write a UNICODE string and its relative pointer.
- * used by all the RPC structs passing a buffer
- *
- * As I'm a nice guy, I'm forcing myself to explain this code.
- * MS did a good job in the overall spoolss code except in some
- * functions where they are passing the API buffer directly in the
- * RPC request/reply. That's to maintain compatiility at the API level.
- * They could have done it the good way the first time.
- *
- * So what happen is: the strings are written at the buffer's end,
- * in the reverse order of the original structure. Some pointers to
- * the strings are also in the buffer. Those are relative to the
- * buffer's start.
- *
- * If you don't understand or want to change that function,
- * first get in touch with me: jfm@samba.org
- *
- ********************************************************************/
-
-static BOOL smb_io_relstr(const char *desc, NEW_BUFFER *buffer, int depth, UNISTR *string)
-{
- prs_struct *ps=&buffer->prs;
-
- if (MARSHALLING(ps)) {
- uint32 struct_offset = prs_offset(ps);
- uint32 relative_offset;
-
- buffer->string_at_end -= (size_of_relative_string(string) - 4);
- if(!prs_set_offset(ps, buffer->string_at_end))
- return False;
-#if 0 /* JERRY */
- /*
- * Win2k does not align strings in a buffer
- * Tested against WinNT 4.0 SP 6a & 2k SP2 --jerry
- */
- if (!prs_align(ps))
- return False;
-#endif
- buffer->string_at_end = prs_offset(ps);
-
- /* write the string */
- if (!smb_io_unistr(desc, string, ps, depth))
- return False;
-
- if(!prs_set_offset(ps, struct_offset))
- return False;
-
- relative_offset=buffer->string_at_end - buffer->struct_start;
- /* write its offset */
- if (!prs_uint32("offset", ps, depth, &relative_offset))
- return False;
- }
- else {
- uint32 old_offset;
-
- /* read the offset */
- if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end)))
- return False;
-
- if (buffer->string_at_end == 0)
- return True;
-
- old_offset = prs_offset(ps);
- if(!prs_set_offset(ps, buffer->string_at_end+buffer->struct_start))
- return False;
-
- /* read the string */
- if (!smb_io_unistr(desc, string, ps, depth))
- return False;
-
- if(!prs_set_offset(ps, old_offset))
- return False;
- }
- return True;
-}
-
-/*******************************************************************
- * write a array of UNICODE strings and its relative pointer.
- * used by 2 RPC structs
- ********************************************************************/
-
-static BOOL smb_io_relarraystr(const char *desc, NEW_BUFFER *buffer, int depth, uint16 **string)
-{
- UNISTR chaine;
-
- prs_struct *ps=&buffer->prs;
-
- if (MARSHALLING(ps)) {
- uint32 struct_offset = prs_offset(ps);
- uint32 relative_offset;
- uint16 *p;
- uint16 *q;
- uint16 zero=0;
- p=*string;
- q=*string;
-
- /* first write the last 0 */
- buffer->string_at_end -= 2;
- if(!prs_set_offset(ps, buffer->string_at_end))
- return False;
-
- if(!prs_uint16("leading zero", ps, depth, &zero))
- return False;
-
- while (p && (*p!=0)) {
- while (*q!=0)
- q++;
-
- /* Yes this should be malloc not talloc. Don't change. */
-
- chaine.buffer = SMB_MALLOC((q-p+1)*sizeof(uint16));
- if (chaine.buffer == NULL)
- return False;
-
- memcpy(chaine.buffer, p, (q-p+1)*sizeof(uint16));
-
- buffer->string_at_end -= (q-p+1)*sizeof(uint16);
-
- if(!prs_set_offset(ps, buffer->string_at_end)) {
- SAFE_FREE(chaine.buffer);
- return False;
- }
-
- /* write the string */
- if (!smb_io_unistr(desc, &chaine, ps, depth)) {
- SAFE_FREE(chaine.buffer);
- return False;
- }
- q++;
- p=q;
-
- SAFE_FREE(chaine.buffer);
- }
-
- if(!prs_set_offset(ps, struct_offset))
- return False;
-
- relative_offset=buffer->string_at_end - buffer->struct_start;
- /* write its offset */
- if (!prs_uint32("offset", ps, depth, &relative_offset))
- return False;
-
- } else {
-
- /* UNMARSHALLING */
-
- uint32 old_offset;
- uint16 *chaine2=NULL;
- int l_chaine=0;
- int l_chaine2=0;
- size_t realloc_size = 0;
-
- *string=NULL;
-
- /* read the offset */
- if (!prs_uint32("offset", ps, depth, &buffer->string_at_end))
- return False;
-
- old_offset = prs_offset(ps);
- if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start))
- return False;
-
- do {
- if (!smb_io_unistr(desc, &chaine, ps, depth))
- return False;
-
- l_chaine=str_len_uni(&chaine);
-
- /* we're going to add two more bytes here in case this
- is the last string in the array and we need to add
- an extra NULL for termination */
- if (l_chaine > 0)
- {
- uint16 *tc2;
-
- realloc_size = (l_chaine2+l_chaine+2)*sizeof(uint16);
-
- /* Yes this should be realloc - it's freed below. JRA */
-
- if((tc2=(uint16 *)SMB_REALLOC(chaine2, realloc_size)) == NULL) {
- SAFE_FREE(chaine2);
- return False;
- }
- else chaine2 = tc2;
- memcpy(chaine2+l_chaine2, chaine.buffer, (l_chaine+1)*sizeof(uint16));
- l_chaine2+=l_chaine+1;
- }
-
- } while(l_chaine!=0);
-
- /* the end should be bould NULL terminated so add
- the second one here */
- if (chaine2)
- {
- chaine2[l_chaine2] = '\0';
- *string=(uint16 *)TALLOC_MEMDUP(prs_get_mem_context(ps),chaine2,realloc_size);
- SAFE_FREE(chaine2);
- }
-
- if(!prs_set_offset(ps, old_offset))
- return False;
- }
- return True;
-}
-
-/*******************************************************************
- Parse a DEVMODE structure and its relative pointer.
-********************************************************************/
-
-static BOOL smb_io_relsecdesc(const char *desc, NEW_BUFFER *buffer, int depth, SEC_DESC **secdesc)
-{
- prs_struct *ps= &buffer->prs;
-
- prs_debug(ps, depth, desc, "smb_io_relsecdesc");
- depth++;
-
- if (MARSHALLING(ps)) {
- uint32 struct_offset = prs_offset(ps);
- uint32 relative_offset;
-
- if (! *secdesc) {
- relative_offset = 0;
- if (!prs_uint32("offset", ps, depth, &relative_offset))
- return False;
- return True;
- }
-
- if (*secdesc != NULL) {
- buffer->string_at_end -= sec_desc_size(*secdesc);
-
- if(!prs_set_offset(ps, buffer->string_at_end))
- return False;
- /* write the secdesc */
- if (!sec_io_desc(desc, secdesc, ps, depth))
- return False;
-
- if(!prs_set_offset(ps, struct_offset))
- return False;
- }
-
- relative_offset=buffer->string_at_end - buffer->struct_start;
- /* write its offset */
-
- if (!prs_uint32("offset", ps, depth, &relative_offset))
- return False;
- } else {
- uint32 old_offset;
-
- /* read the offset */
- if (!prs_uint32("offset", ps, depth, &buffer->string_at_end))
- return False;
-
- old_offset = prs_offset(ps);
- if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start))
- return False;
-
- /* read the sd */
- if (!sec_io_desc(desc, secdesc, ps, depth))
- return False;
-
- if(!prs_set_offset(ps, old_offset))
- return False;
- }
- return True;
-}
-
-/*******************************************************************
Parse a DEVMODE structure and its relative pointer.
********************************************************************/
-static BOOL smb_io_reldevmode(const char *desc, NEW_BUFFER *buffer, int depth, DEVICEMODE **devmode)
+static BOOL smb_io_reldevmode(const char *desc, RPC_BUFFER *buffer, int depth, DEVICEMODE **devmode)
{
prs_struct *ps=&buffer->prs;
@@ -2457,7 +2147,7 @@ static BOOL smb_io_reldevmode(const char *desc, NEW_BUFFER *buffer, int depth, D
Parse a PRINTER_INFO_0 structure.
********************************************************************/
-BOOL smb_io_printer_info_0(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, int depth)
+BOOL smb_io_printer_info_0(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_0 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -2558,7 +2248,7 @@ BOOL smb_io_printer_info_0(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0
Parse a PRINTER_INFO_1 structure.
********************************************************************/
-BOOL smb_io_printer_info_1(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, int depth)
+BOOL smb_io_printer_info_1(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_1 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -2583,7 +2273,7 @@ BOOL smb_io_printer_info_1(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1
Parse a PRINTER_INFO_2 structure.
********************************************************************/
-BOOL smb_io_printer_info_2(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth)
+BOOL smb_io_printer_info_2(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_2 *info, int depth)
{
prs_struct *ps=&buffer->prs;
uint32 dm_offset, sd_offset, current_offset;
@@ -2674,7 +2364,7 @@ BOOL smb_io_printer_info_2(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2
Parse a PRINTER_INFO_3 structure.
********************************************************************/
-BOOL smb_io_printer_info_3(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, int depth)
+BOOL smb_io_printer_info_3(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_3 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -2695,7 +2385,7 @@ BOOL smb_io_printer_info_3(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3
Parse a PRINTER_INFO_4 structure.
********************************************************************/
-BOOL smb_io_printer_info_4(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_4 *info, int depth)
+BOOL smb_io_printer_info_4(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_4 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -2717,7 +2407,7 @@ BOOL smb_io_printer_info_4(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_4
Parse a PRINTER_INFO_5 structure.
********************************************************************/
-BOOL smb_io_printer_info_5(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_5 *info, int depth)
+BOOL smb_io_printer_info_5(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_5 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -2743,7 +2433,7 @@ BOOL smb_io_printer_info_5(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_5
Parse a PRINTER_INFO_7 structure.
********************************************************************/
-BOOL smb_io_printer_info_7(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_7 *info, int depth)
+BOOL smb_io_printer_info_7(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_7 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -2763,7 +2453,7 @@ BOOL smb_io_printer_info_7(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_7
Parse a PORT_INFO_1 structure.
********************************************************************/
-BOOL smb_io_port_info_1(const char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth)
+BOOL smb_io_port_info_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -2782,7 +2472,7 @@ BOOL smb_io_port_info_1(const char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info,
Parse a PORT_INFO_2 structure.
********************************************************************/
-BOOL smb_io_port_info_2(const char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth)
+BOOL smb_io_port_info_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -2809,7 +2499,7 @@ BOOL smb_io_port_info_2(const char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info,
Parse a DRIVER_INFO_1 structure.
********************************************************************/
-BOOL smb_io_printer_driver_info_1(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 *info, int depth)
+BOOL smb_io_printer_driver_info_1(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_1 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -2828,7 +2518,7 @@ BOOL smb_io_printer_driver_info_1(const char *desc, NEW_BUFFER *buffer, DRIVER_I
Parse a DRIVER_INFO_2 structure.
********************************************************************/
-BOOL smb_io_printer_driver_info_2(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 *info, int depth)
+BOOL smb_io_printer_driver_info_2(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_2 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -2857,7 +2547,7 @@ BOOL smb_io_printer_driver_info_2(const char *desc, NEW_BUFFER *buffer, DRIVER_I
Parse a DRIVER_INFO_3 structure.
********************************************************************/
-BOOL smb_io_printer_driver_info_3(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 *info, int depth)
+BOOL smb_io_printer_driver_info_3(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_3 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -2896,7 +2586,7 @@ BOOL smb_io_printer_driver_info_3(const char *desc, NEW_BUFFER *buffer, DRIVER_I
Parse a DRIVER_INFO_6 structure.
********************************************************************/
-BOOL smb_io_printer_driver_info_6(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_6 *info, int depth)
+BOOL smb_io_printer_driver_info_6(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_6 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -2961,7 +2651,7 @@ BOOL smb_io_printer_driver_info_6(const char *desc, NEW_BUFFER *buffer, DRIVER_I
Parse a JOB_INFO_1 structure.
********************************************************************/
-BOOL smb_io_job_info_1(const char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int depth)
+BOOL smb_io_job_info_1(const char *desc, RPC_BUFFER *buffer, JOB_INFO_1 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -3004,7 +2694,7 @@ BOOL smb_io_job_info_1(const char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, i
Parse a JOB_INFO_2 structure.
********************************************************************/
-BOOL smb_io_job_info_2(const char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth)
+BOOL smb_io_job_info_2(const char *desc, RPC_BUFFER *buffer, JOB_INFO_2 *info, int depth)
{
uint32 pipo=0;
prs_struct *ps=&buffer->prs;
@@ -3071,7 +2761,7 @@ BOOL smb_io_job_info_2(const char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, i
/*******************************************************************
********************************************************************/
-BOOL smb_io_form_1(const char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth)
+BOOL smb_io_form_1(const char *desc, RPC_BUFFER *buffer, FORM_1 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -3102,123 +2792,13 @@ BOOL smb_io_form_1(const char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth
return True;
}
-/*******************************************************************
- Read/write a BUFFER struct.
-********************************************************************/
-
-static BOOL spoolss_io_buffer(const char *desc, prs_struct *ps, int depth, NEW_BUFFER **pp_buffer)
-{
- NEW_BUFFER *buffer = *pp_buffer;
-
- prs_debug(ps, depth, desc, "spoolss_io_buffer");
- depth++;
-
- if (UNMARSHALLING(ps))
- buffer = *pp_buffer = PRS_ALLOC_MEM(ps, NEW_BUFFER, 1);
-
- if (buffer == NULL)
- return False;
-
- if (!prs_uint32("ptr", ps, depth, &buffer->ptr))
- return False;
-
- /* reading */
- if (UNMARSHALLING(ps)) {
- buffer->size=0;
- buffer->string_at_end=0;
-
- if (buffer->ptr==0) {
- /*
- * JRA. I'm not sure if the data in here is in big-endian format if
- * the client is big-endian. Leave as default (little endian) for now.
- */
-
- if (!prs_init(&buffer->prs, 0, prs_get_mem_context(ps), UNMARSHALL))
- return False;
- return True;
- }
-
- if (!prs_uint32("size", ps, depth, &buffer->size))
- return False;
-
- /*
- * JRA. I'm not sure if the data in here is in big-endian format if
- * the client is big-endian. Leave as default (little endian) for now.
- */
-
- if (!prs_init(&buffer->prs, buffer->size, prs_get_mem_context(ps), UNMARSHALL))
- return False;
-
- if (!prs_append_some_prs_data(&buffer->prs, ps, prs_offset(ps), buffer->size))
- return False;
-
- if (!prs_set_offset(&buffer->prs, 0))
- return False;
-
- if (!prs_set_offset(ps, buffer->size+prs_offset(ps)))
- return False;
-
- buffer->string_at_end=buffer->size;
-
- return True;
- }
- else {
- BOOL ret = False;
-
- /* writing */
- if (buffer->ptr==0) {
- /* We have finished with the data in buffer->prs - free it. */
- prs_mem_free(&buffer->prs);
- return True;
- }
-
- if (!prs_uint32("size", ps, depth, &buffer->size))
- goto out;
-
- if (!prs_append_some_prs_data(ps, &buffer->prs, 0, buffer->size))
- goto out;
-
- ret = True;
- out:
-
- /* We have finished with the data in buffer->prs - free it. */
- prs_mem_free(&buffer->prs);
-
- return ret;
- }
-}
-
-/*******************************************************************
- move a BUFFER from the query to the reply.
- As the data pointers in NEW_BUFFER are malloc'ed, not talloc'ed,
- this is ok. This is an OPTIMIZATION and is not strictly neccessary.
- Clears the memory to zero also.
-********************************************************************/
-
-void spoolss_move_buffer(NEW_BUFFER *src, NEW_BUFFER **dest)
-{
- prs_switch_type(&src->prs, MARSHALL);
- if(!prs_set_offset(&src->prs, 0))
- return;
- prs_force_dynamic(&src->prs);
- prs_mem_clear(&src->prs);
- *dest=src;
-}
-
-/*******************************************************************
- Get the size of a BUFFER struct.
-********************************************************************/
-uint32 new_get_buffer_size(NEW_BUFFER *buffer)
-{
- return (buffer->size);
-}
/*******************************************************************
Parse a DRIVER_DIRECTORY_1 structure.
********************************************************************/
-BOOL smb_io_driverdir_1(const char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth)
+BOOL smb_io_driverdir_1(const char *desc, RPC_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -3237,7 +2817,7 @@ BOOL smb_io_driverdir_1(const char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1
Parse a PORT_INFO_1 structure.
********************************************************************/
-BOOL smb_io_port_1(const char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth)
+BOOL smb_io_port_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -3256,7 +2836,7 @@ BOOL smb_io_port_1(const char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int
Parse a PORT_INFO_2 structure.
********************************************************************/
-BOOL smb_io_port_2(const char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth)
+BOOL smb_io_port_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -3282,7 +2862,7 @@ BOOL smb_io_port_2(const char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int
/*******************************************************************
********************************************************************/
-BOOL smb_io_printprocessor_info_1(const char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth)
+BOOL smb_io_printprocessor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -3300,7 +2880,7 @@ BOOL smb_io_printprocessor_info_1(const char *desc, NEW_BUFFER *buffer, PRINTPRO
/*******************************************************************
********************************************************************/
-BOOL smb_io_printprocdatatype_info_1(const char *desc, NEW_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth)
+BOOL smb_io_printprocdatatype_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -3318,7 +2898,7 @@ BOOL smb_io_printprocdatatype_info_1(const char *desc, NEW_BUFFER *buffer, PRINT
/*******************************************************************
********************************************************************/
-BOOL smb_io_printmonitor_info_1(const char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 *info, int depth)
+BOOL smb_io_printmonitor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_1 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -3336,7 +2916,7 @@ BOOL smb_io_printmonitor_info_1(const char *desc, NEW_BUFFER *buffer, PRINTMONIT
/*******************************************************************
********************************************************************/
-BOOL smb_io_printmonitor_info_2(const char *desc, NEW_BUFFER *buffer, PRINTMONITOR_2 *info, int depth)
+BOOL smb_io_printmonitor_info_2(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_2 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -3859,7 +3439,7 @@ BOOL make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u,
const POLICY_HND *hnd,
const fstring architecture,
uint32 level, uint32 clientmajor, uint32 clientminor,
- NEW_BUFFER *buffer, uint32 offered)
+ RPC_BUFFER *buffer, uint32 offered)
{
if (q_u == NULL)
return False;
@@ -3903,7 +3483,7 @@ BOOL spoolss_io_q_getprinterdriver2(const char *desc, SPOOL_Q_GETPRINTERDRIVER2
if(!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if(!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if(!prs_align(ps))
@@ -3933,7 +3513,7 @@ BOOL spoolss_io_r_getprinterdriver2(const char *desc, SPOOL_R_GETPRINTERDRIVER2
if (!prs_align(ps))
return False;
- if (!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if (!prs_align(ps))
@@ -3959,7 +3539,7 @@ BOOL make_spoolss_q_enumprinters(
uint32 flags,
char *servername,
uint32 level,
- NEW_BUFFER *buffer,
+ RPC_BUFFER *buffer,
uint32 offered
)
{
@@ -3981,7 +3561,7 @@ BOOL make_spoolss_q_enumprinters(
BOOL make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u,
fstring servername, uint32 level,
- NEW_BUFFER *buffer, uint32 offered)
+ RPC_BUFFER *buffer, uint32 offered)
{
q_u->name_ptr = (servername != NULL) ? 1 : 0;
init_buf_unistr2(&q_u->name, &q_u->name_ptr, servername);
@@ -4019,7 +3599,7 @@ BOOL spoolss_io_q_enumprinters(const char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_
if (!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if (!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if (!prs_align(ps))
@@ -4042,7 +3622,7 @@ BOOL spoolss_io_r_enumprinters(const char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_
if (!prs_align(ps))
return False;
- if (!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if (!prs_align(ps))
@@ -4074,7 +3654,7 @@ BOOL spoolss_io_r_getprinter(const char *desc, SPOOL_R_GETPRINTER *r_u, prs_stru
if (!prs_align(ps))
return False;
- if (!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if (!prs_align(ps))
@@ -4107,7 +3687,7 @@ BOOL spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_stru
if (!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if (!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if (!prs_align(ps))
@@ -4127,7 +3707,7 @@ BOOL make_spoolss_q_getprinter(
SPOOL_Q_GETPRINTER *q_u,
const POLICY_HND *hnd,
uint32 level,
- NEW_BUFFER *buffer,
+ RPC_BUFFER *buffer,
uint32 offered
)
{
@@ -4349,7 +3929,7 @@ BOOL spoolss_io_r_addjob(const char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps,
if(!prs_align(ps))
return False;
- if(!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if(!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if(!prs_align(ps))
@@ -4380,7 +3960,7 @@ BOOL spoolss_io_q_addjob(const char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps,
if(!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if(!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if(!prs_align(ps))
@@ -4403,7 +3983,7 @@ BOOL spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *
if (!prs_align(ps))
return False;
- if (!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if (!prs_align(ps))
@@ -4428,7 +4008,7 @@ BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd,
uint32 firstjob,
uint32 numofjobs,
uint32 level,
- NEW_BUFFER *buffer,
+ RPC_BUFFER *buffer,
uint32 offered)
{
if (q_u == NULL)
@@ -4465,7 +4045,7 @@ BOOL spoolss_io_q_enumjobs(const char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *
if (!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if (!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if(!prs_align(ps))
@@ -4569,7 +4149,7 @@ BOOL spoolss_io_r_enumprinterdrivers(const char *desc, SPOOL_R_ENUMPRINTERDRIVER
if (!prs_align(ps))
return False;
- if (!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if (!prs_align(ps))
@@ -4595,7 +4175,7 @@ BOOL make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u,
const char *name,
const char *environment,
uint32 level,
- NEW_BUFFER *buffer, uint32 offered)
+ RPC_BUFFER *buffer, uint32 offered)
{
init_buf_unistr2(&q_u->name, &q_u->name_ptr, name);
init_buf_unistr2(&q_u->environment, &q_u->environment_ptr, environment);
@@ -4637,7 +4217,7 @@ BOOL spoolss_io_q_enumprinterdrivers(const char *desc, SPOOL_Q_ENUMPRINTERDRIVER
if (!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if (!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if (!prs_align(ps))
@@ -4665,7 +4245,7 @@ BOOL spoolss_io_q_enumforms(const char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct
if (!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if (!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if (!prs_align(ps))
@@ -4687,7 +4267,7 @@ BOOL spoolss_io_r_enumforms(const char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct
if (!prs_align(ps))
return False;
- if (!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if (!prs_align(ps))
@@ -4727,7 +4307,7 @@ BOOL spoolss_io_q_getform(const char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps
if (!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if (!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if (!prs_align(ps))
@@ -4749,7 +4329,7 @@ BOOL spoolss_io_r_getform(const char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps
if (!prs_align(ps))
return False;
- if (!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if (!prs_align(ps))
@@ -4776,7 +4356,7 @@ BOOL spoolss_io_r_enumports(const char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct
if (!prs_align(ps))
return False;
- if (!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if (!prs_align(ps))
@@ -4815,7 +4395,7 @@ BOOL spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct
if (!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if (!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if (!prs_align(ps))
@@ -5815,7 +5395,7 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni,
BOOL make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u,
fstring servername, fstring env_name, uint32 level,
- NEW_BUFFER *buffer, uint32 offered)
+ RPC_BUFFER *buffer, uint32 offered)
{
init_buf_unistr2(&q_u->name, &q_u->name_ptr, servername);
init_buf_unistr2(&q_u->environment, &q_u->environment_ptr, env_name);
@@ -5857,7 +5437,7 @@ BOOL spoolss_io_q_getprinterdriverdir(const char *desc, SPOOL_Q_GETPRINTERDRIVER
if(!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if(!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if(!prs_align(ps))
@@ -5881,7 +5461,7 @@ BOOL spoolss_io_r_getprinterdriverdir(const char *desc, SPOOL_R_GETPRINTERDRIVER
if (!prs_align(ps))
return False;
- if (!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if (!prs_align(ps))
@@ -5907,7 +5487,7 @@ BOOL spoolss_io_r_enumprintprocessors(const char *desc, SPOOL_R_ENUMPRINTPROCESS
if (!prs_align(ps))
return False;
- if (!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if (!prs_align(ps))
@@ -5955,7 +5535,7 @@ BOOL spoolss_io_q_enumprintprocessors(const char *desc, SPOOL_Q_ENUMPRINTPROCESS
if (!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if(!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if (!prs_align(ps))
@@ -6029,7 +5609,7 @@ BOOL spoolss_io_r_enumprintprocdatatypes(const char *desc, SPOOL_R_ENUMPRINTPROC
if (!prs_align(ps))
return False;
- if (!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if (!prs_align(ps))
@@ -6077,7 +5657,7 @@ BOOL spoolss_io_q_enumprintprocdatatypes(const char *desc, SPOOL_Q_ENUMPRINTPROC
if (!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if(!spoolss_io_buffer("buffer", ps, depth, &q_u->buffer))
+ if(!prs_rpcbuffer_p("buffer", ps, depth, &q_u->buffer))
return False;
if (!prs_align(ps))
@@ -6112,7 +5692,7 @@ BOOL spoolss_io_q_enumprintmonitors(const char *desc, SPOOL_Q_ENUMPRINTMONITORS
if (!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if(!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if (!prs_align(ps))
@@ -6135,7 +5715,7 @@ BOOL spoolss_io_r_enumprintmonitors(const char *desc, SPOOL_R_ENUMPRINTMONITORS
if (!prs_align(ps))
return False;
- if (!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if (!prs_align(ps))
@@ -6578,7 +6158,7 @@ BOOL spoolss_io_r_getjob(const char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps,
if (!prs_align(ps))
return False;
- if (!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if (!prs_align(ps))
@@ -6612,7 +6192,7 @@ BOOL spoolss_io_q_getjob(const char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps,
if(!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if(!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if(!prs_align(ps))
@@ -7463,7 +7043,7 @@ BOOL spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX
[in] unistr2 *name,
[in] unistr2 *environment,
[in] uint32 level,
- [in,out] NEW_BUFFER buffer,
+ [in,out] RPC_BUFFER buffer,
[in] uint32 offered,
[out] uint32 needed,
[out] uint32 returned
@@ -7471,7 +7051,7 @@ BOOL spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX
*/
-BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, const char *name, char *environment, int level, NEW_BUFFER *buffer, uint32 offered)
+BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, const char *name, char *environment, int level, RPC_BUFFER *buffer, uint32 offered)
{
DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n"));
@@ -7522,7 +7102,7 @@ BOOL spoolss_io_q_getprintprocessordirectory(const char *desc, SPOOL_Q_GETPRINTP
if(!prs_uint32("level", ps, depth, &q_u->level))
return False;
- if(!spoolss_io_buffer("", ps, depth, &q_u->buffer))
+ if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
return False;
if(!prs_align(ps))
@@ -7546,7 +7126,7 @@ BOOL spoolss_io_r_getprintprocessordirectory(const char *desc, SPOOL_R_GETPRINTP
if(!prs_align(ps))
return False;
- if(!spoolss_io_buffer("", ps, depth, &r_u->buffer))
+ if(!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
return False;
if(!prs_align(ps))
@@ -7561,7 +7141,7 @@ BOOL spoolss_io_r_getprintprocessordirectory(const char *desc, SPOOL_R_GETPRINTP
return True;
}
-BOOL smb_io_printprocessordirectory_1(const char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_DIRECTORY_1 *info, int depth)
+BOOL smb_io_printprocessordirectory_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCESSOR_DIRECTORY_1 *info, int depth)
{
prs_struct *ps=&buffer->prs;
@@ -7625,7 +7205,7 @@ BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle,
BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle,
const char *formname, uint32 level,
- NEW_BUFFER *buffer, uint32 offered)
+ RPC_BUFFER *buffer, uint32 offered)
{
memcpy(&q_u->handle, handle, sizeof(POLICY_HND));
q_u->level = level;
@@ -7641,7 +7221,7 @@ BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle,
********************************************************************/
BOOL make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS *q_u, POLICY_HND *handle,
- uint32 level, NEW_BUFFER *buffer,
+ uint32 level, RPC_BUFFER *buffer,
uint32 offered)
{
memcpy(&q_u->handle, handle, sizeof(POLICY_HND));
@@ -7676,7 +7256,7 @@ BOOL make_spoolss_q_setjob(SPOOL_Q_SETJOB *q_u, POLICY_HND *handle,
********************************************************************/
BOOL make_spoolss_q_getjob(SPOOL_Q_GETJOB *q_u, POLICY_HND *handle,
- uint32 jobid, uint32 level, NEW_BUFFER *buffer,
+ uint32 jobid, uint32 level, RPC_BUFFER *buffer,
uint32 offered)
{
memcpy(&q_u->handle, handle, sizeof(POLICY_HND));