From 2c46a26a8bbc4130a6dc195a77b760d26016d5a1 Mon Sep 17 00:00:00 2001
From: Gerald Carter <jerry@samba.org>
Date: Fri, 14 Jul 2000 16:58:03 +0000
Subject: removed prs_data(), prs_free_data(), and prs_realloc_data() as these
 were unneeded and replaced by the real functions already in HEAD.

Added a few more functions to parse_spoolss.c to help with the
rpcclient merge from TNG.
(This used to be commit 3bc9af4c1dbdb664970541f6091982ffccc87b31)
---
 source3/rpc_parse/parse_prs.c     | 93 ---------------------------------------
 source3/rpc_parse/parse_spoolss.c | 72 +++++++++++++++++++++++++-----
 2 files changed, 60 insertions(+), 105 deletions(-)

(limited to 'source3')

diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 5b5834084f..1bda5ef506 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -897,99 +897,6 @@ BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32,
 	return True;
 }
 
-/*******************************************************************
- frees a memory buffer.
- ********************************************************************/
-void prs_free_data(prs_struct *buf)
-{
-        if (buf == NULL)
-                return;
-
-        if (buf->data_p != NULL)
-        {
-                free(buf->data_p);
-                buf->data_p = NULL;
-        }
-        buf->buffer_size = 0;
-}
-
-/*******************************************************************
- reallocate a memory buffer
-********************************************************************/
-BOOL prs_realloc_data(prs_struct *buf, size_t new_size)
-{
-        char *new_data;
-
-        /* prs_sma_init();  JERRY */
-
-        prs_debug(buf, 200, "prs_realloc_data - before", "prs_realloc_data");
-
-        SMB_ASSERT(((ssize_t) new_size) >= 0);
-
-        if (new_size == 0)
-        {
-                prs_free_data(buf);
-                return True;
-        }
-
-        /* new_data = sma_realloc(prs_sma_region, buf->data_p, new_size); */
-        new_data = realloc(buf->data_p, new_size);
-
-        if (new_data != NULL)
-        {
-                if (new_size > buf->buffer_size)
-                {
-                        memset(&new_data[buf->buffer_size], 0,
-                               new_size - buf->buffer_size);
-                }
-                buf->data_p = new_data;
-                buf->buffer_size = new_size;
-        }
-        else if (buf->buffer_size >= new_size)
-        {
-                DEBUG(3, ("prs_realloc_data: warning - "
-                          "could not realloc to %d\n", new_size));
-        }
-        else
-        {
-                DEBUG(3, ("prs_realloc_data: error - "
-                          "could not realloc to %d\n", new_size));
-
-                prs_free_data(buf);
-                return False;
-        }
-
-        prs_debug(buf, 200, "prs_realloc_data - after", "prs_realloc_data");
-        return True;
-}
-
-/*******************************************************************
- return the memory location specified by offset; may return NULL.
- ********************************************************************/
-char *prs_data(const prs_struct *buf, uint32 offset)
-{
-
-	/* 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_p[offset]);
-        }
-
-	/* default return */
-        return NULL;
-}
-
-
-
-
 /* useful function to store a structure in rpc wire format */
 int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps)
 {
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index c0c6e36ae1..9f5fdccfe7 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -24,17 +24,6 @@
 
 #include "includes.h"
 
-#ifdef TNG
-	#define prs_uint16 _prs_uint16
-	#define prs_uint32 _prs_uint32
-	#define prs_uint8s _prs_uint8s
-	#define prs_uint16s _prs_uint16s
-	#define prs_unistr _prs_unistr
-	#define init_unistr2 make_unistr2
-	#define init_buf_unistr2 make_buf_unistr2
-#endif
-
-
 extern int DEBUGLEVEL;
 /*******************************************************************
 return the length of a UNISTR string.
@@ -325,7 +314,7 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs
 	prs_debug(ps, depth, desc, "smb_io_notify_info_data");
 	depth++;
 
-	how_many_words=data->size;	
+	how_many_words=data->size;
 	if (how_many_words==POINTER) {
 		how_many_words=TWO_VALUE;
 	}
@@ -785,6 +774,26 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_
 	return True;
 }
 
+/*******************************************************************
+ * make a structure.
+ ********************************************************************/
+BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u,
+                                const POLICY_HND *handle,
+                                const UNISTR2 *valuename,
+                                uint32 size)
+{
+        if (q_u == NULL) return False;
+
+        DEBUG(5,("make_spoolss_q_getprinterdata\n"));
+
+        q_u->handle = *handle;
+        copy_unistr2(&q_u->valuename, valuename);
+        q_u->size = size;
+
+        return True;
+}
+
+
 /*******************************************************************
  * read a structure.
  * called from spoolss_q_getprinterdata (srv_spoolss.c)
@@ -3252,6 +3261,24 @@ BOOL new_spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS
 	return True;		
 }
 
+/*******************************************************************
+ * init a structure.
+ ********************************************************************/
+BOOL make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u,
+                                const char *name,
+                                const char *environment,
+                                uint32 level,
+                                NEW_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);
+
+        q_u->level=level;
+        q_u->buffer=buffer;
+        q_u->offered=offered;
+
+        return True;
+}
 
 /*******************************************************************
  Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure.
@@ -4208,6 +4235,27 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni,
 	return True;
 }
 
+/*******************************************************************
+ * init a structure.
+ ********************************************************************/
+BOOL make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u,
+                                fstring servername, fstring env_name, uint32 level,
+                                NEW_BUFFER *buffer, uint32 offered)
+{
+        q_u->name_ptr = (servername != NULL) ? 1 : 0;
+        init_unistr2(&(q_u->name), servername, strlen(servername));
+
+        q_u->environment_ptr = (env_name != NULL) ? 1 : 0;
+        init_unistr2(&(q_u->environment), env_name, strlen(env_name));
+
+        q_u->level=level;
+        q_u->buffer=buffer;
+        q_u->offered=offered;
+
+        return True;
+}
+
+
 /*******************************************************************
  Parse a SPOOL_Q_GETPRINTERDRIVERDIR structure.
 ********************************************************************/  
-- 
cgit