summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_spoolss.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse/parse_spoolss.c')
-rw-r--r--source3/rpc_parse/parse_spoolss.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index bcfaa1d42f..72d88c8129 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -2283,6 +2283,8 @@ BOOL smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info,
BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth)
{
prs_struct *ps=&buffer->prs;
+ uint32 dm_offset, sd_offset, current_offset;
+ uint32 dummy_value = 0;
prs_debug(ps, depth, desc, "smb_io_printer_info_2");
depth++;
@@ -2304,8 +2306,9 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info,
if (!smb_io_relstr("location", buffer, depth, &info->location))
return False;
- /* NT parses the DEVMODE at the end of the struct */
- if (!smb_io_reldevmode("devmode", buffer, depth, &info->devmode))
+ /* save current offset and wind forwared by a uint32 */
+ dm_offset = prs_offset(ps);
+ if (!prs_uint32("devmode", ps, depth, &dummy_value))
return False;
if (!smb_io_relstr("sepfile", buffer, depth, &info->sepfile))
@@ -2317,9 +2320,31 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info,
if (!smb_io_relstr("parameters", buffer, depth, &info->parameters))
return False;
+ /* save current offset for the sec_desc */
+ sd_offset = prs_offset(ps);
+ if (!prs_uint32("sec_desc", ps, depth, &dummy_value))
+ return False;
+
+
+ /* save current location so we can pick back up here */
+ current_offset = prs_offset(ps);
+
+ /* parse the devmode */
+ if (!prs_set_offset(ps, dm_offset))
+ return False;
+ if (!smb_io_reldevmode("devmode", buffer, depth, &info->devmode))
+ return False;
+
+ /* parse the sec_desc */
+ if (!prs_set_offset(ps, sd_offset))
+ return False;
if (!smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc))
return False;
+ /* pick up where we left off */
+ if (!prs_set_offset(ps, current_offset))
+ return False;
+
if (!prs_uint32("attributes", ps, depth, &info->attributes))
return False;
if (!prs_uint32("priority", ps, depth, &info->priority))
@@ -3095,7 +3120,7 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info)
uint32 size=0;
size += 4;
- /* JRA !!!! TESTME - WHAT ABOUT prs_align.... !!! */
+
size += sec_desc_size( info->secdesc );
size+=size_of_device_mode( info->devmode );
@@ -3121,6 +3146,16 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info)
size+=size_of_uint32( &info->status );
size+=size_of_uint32( &info->cjobs );
size+=size_of_uint32( &info->averageppm );
+
+ /*
+ * add any adjustments for alignment. This is
+ * not optimal since we could be calling this
+ * function from a loop (e.g. enumprinters), but
+ * it is easier to maintain the calculation here and
+ * not place the burden on the caller to remember. --jerry
+ */
+ size += size % 4;
+
return size;
}