summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorDavid O'Neill <dmo@samba.org>2001-01-17 22:55:02 +0000
committerDavid O'Neill <dmo@samba.org>2001-01-17 22:55:02 +0000
commit22363b9d7893998169ac7a777df466940fd0a000 (patch)
tree6ce4b12a4786a8299d1535277d8d124056f72cf1 /source3/rpc_parse
parent0407ba8b1bad1da4e7d1064fb6632277b03a1afd (diff)
downloadsamba-22363b9d7893998169ac7a777df466940fd0a000.tar.gz
samba-22363b9d7893998169ac7a777df466940fd0a000.tar.bz2
samba-22363b9d7893998169ac7a777df466940fd0a000.zip
Changes from APPLIANCE_HEAD:
source/include/proto.h source/include/rpc_spoolss.h source/rpc_parse/parse_spoolss.c source/rpc_server/srv_spoolss.c source/rpc_server/srv_spoolss_nt.c - speedups in printer queue enumeration - still room for improvement. The construct_dev_mode() still creates and destroys a printer info_2 structure every time it is called. - fixed job->devmode memory leak - converted printer job notification routines to use tallocated memory rather than a fixed 2K buffer. This reduces the memory requirements of a 4500 job queue enumeration from 90MB to about 16MB. (This used to be commit 7853b27bc1765d48d5f06837f8aca71a3a0d1e5d)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_spoolss.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index a6f46285eb..868d90ae74 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -22,7 +22,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
#include "includes.h"
extern int DEBUGLEVEL;
@@ -384,9 +383,31 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data,
return False;
if (MARSHALLING(ps)) {
/* These are already in little endian format. Don't byte swap. */
- if(!prs_uint8s(True,"string",ps,depth,(uint8 *)data->notify_data.data.string,x*2))
- return False;
+ if (x == 1) {
+
+ /* No memory allocated for this string
+ therefore following the data.string
+ pointer is a bad idea. Use a pointer to
+ the uint32 length union member to
+ provide a source for a unicode NULL */
+
+ if(!prs_uint8s(True,"string",ps,depth, (uint8 *)&data->notify_data.data.length,x*2))
+ return False;
+ } else {
+ if(!prs_uint8s(True,"string",ps,depth,(uint8 *)data->notify_data.data.string,x*2))
+ return False;
+ }
} else {
+
+ /* Tallocate memory for string */
+
+ DEBUG(0, ("** tallocating memory\n"));
+
+ data->notify_data.data.string = (uint16 *)
+ talloc(ps->mem_ctx, x * 2);
+ if (!data->notify_data.data.string)
+ return False;
+
if(!prs_uint16s(True,"string",ps,depth,data->notify_data.data.string,x))
return False;
}
@@ -5753,10 +5774,7 @@ static JOB_INFO_2 *job2_dup(const JOB_INFO_2* from)
void free_job_info_2(JOB_INFO_2 *job)
{
if (job!=NULL)
- {
free_devmode(job->devmode);
- free(job);
- }
}
void free_job2_array(uint32 num_entries, JOB_INFO_2 **entries)