summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/rpc_parse/parse_prs.c4
-rw-r--r--source3/rpc_parse/parse_spoolss.c40
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c44
3 files changed, 45 insertions, 43 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 1bda5ef506..5f43e52975 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -817,7 +817,7 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, int len, int m
BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset)
{
- (*offset) = ps->data_offset;
+ *offset = ps->data_offset;
if (UNMARSHALLING(ps)) {
/* reading. */
return prs_uint16(name, ps, depth, data16);
@@ -864,7 +864,7 @@ BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16,
BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset)
{
- (*offset) = ps->data_offset;
+ *offset = ps->data_offset;
if (UNMARSHALLING(ps)) {
/* reading. */
return prs_uint32(name, ps, depth, data32);
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index 9f5fdccfe7..a6de6d45d9 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -333,10 +333,9 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs
return False;
if(!prs_uint32("id", ps, depth, &data->id))
return False;
-#if 1 /* JRATEST - NEEDED ???? */
if(!prs_uint32("how many words", ps, depth, &how_many_words))
return False;
-#endif /* JRATEST - NEEDED ???? */
+
/*prs_align(ps);*/
@@ -1358,7 +1357,7 @@ static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int d
********************************************************************/
static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *string)
{
- prs_struct *ps=&(buffer->prs);
+ prs_struct *ps=&buffer->prs;
if (MARSHALLING(ps)) {
uint32 struct_offset = prs_offset(ps);
@@ -1421,15 +1420,6 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui
p=*string;
q=*string;
-#if 0 /* JRATEST */
- if (p == NULL) {
- relative_offset = 0;
- if (!prs_uint32("offset", ps, depth, &relative_offset))
- return False;
- return True;
- }
-#endif
-
/* first write the last 0 */
buffer->string_at_end -= 2;
if(!prs_set_offset(ps, buffer->string_at_end))
@@ -1438,13 +1428,6 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui
if(!prs_uint16("leading zero", ps, depth, &zero))
return False;
-#if 0 /* JRATEST */
- if (p == NULL)
- p = &zero;
- if (q == NULL)
- q = &zero;
-#endif /* JRATEST */
-
while (p && (*p!=0)) {
while (*q!=0)
q++;
@@ -1532,11 +1515,15 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth,
}
if (*secdesc != NULL) {
+#if 0 /* JRATEST */
+ if(!prs_set_offset(ps, 0x54))
+ return False;
+#else
buffer->string_at_end -= sec_desc_size(*secdesc);
if(!prs_set_offset(ps, buffer->string_at_end))
return False;
-
+#endif
/* write the secdesc */
if (!sec_io_desc(desc, secdesc, ps, depth))
return False;
@@ -1547,6 +1534,10 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth,
relative_offset=buffer->string_at_end - buffer->struct_start;
/* write its offset */
+#if 0 /* JRATEST */
+ relative_offset = 0x54;
+#endif
+
if (!prs_uint32("offset", ps, depth, &relative_offset))
return False;
} else {
@@ -1763,6 +1754,7 @@ BOOL new_smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *i
********************************************************************/
BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth)
{
+ uint32 sec_offset;
prs_struct *ps=&buffer->prs;
prs_debug(ps, depth, desc, "new_smb_io_printer_info_2");
@@ -1798,7 +1790,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i
if (!new_smb_io_relstr("parameters", buffer, depth, &info->parameters))
return False;
- if (!new_smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc))
+ if (!prs_uint32_pre("secdesc_ptr ", ps, depth, NULL, &sec_offset))
return False;
if (!prs_uint32("attributes", ps, depth, &info->attributes))
@@ -1818,6 +1810,12 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i
if (!prs_uint32("averageppm", ps, depth, &info->averageppm))
return False;
+ if (!prs_uint32_post("secdesc_ptr", ps, depth, NULL, sec_offset, info->secdesc ? prs_offset(ps) : 0 ))
+ return False;
+
+ if (!sec_io_desc("secdesc", &info->secdesc, ps, depth))
+ return False;
+
return True;
}
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index e30180a250..0143f531d5 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -495,7 +495,11 @@ static BOOL alloc_buffer_size(NEW_BUFFER *buffer, uint32 buffer_size)
prs_set_offset(ps, old_offset);
+#if 0 /* JRATEST */
+ buffer->string_at_end = buffer_size;
+#else
buffer->string_at_end=prs_data_size(ps);
+#endif
return True;
}
@@ -3240,12 +3244,12 @@ static void fill_job_info_1(JOB_INFO_1 *job_info, print_queue_struct *queue,
snprintf(temp_name, sizeof(temp_name), "\\\\%s", global_myname);
job_info->jobid=queue->job;
- init_unistr(&(job_info->printername), lp_servicename(snum));
- init_unistr(&(job_info->machinename), temp_name);
- init_unistr(&(job_info->username), queue->user);
- init_unistr(&(job_info->document), queue->file);
- init_unistr(&(job_info->datatype), "RAW");
- init_unistr(&(job_info->text_status), "");
+ init_unistr(&job_info->printername, lp_servicename(snum));
+ init_unistr(&job_info->machinename, temp_name);
+ init_unistr(&job_info->username, queue->user);
+ init_unistr(&job_info->document, queue->file);
+ init_unistr(&job_info->datatype, "RAW");
+ init_unistr(&job_info->text_status, "");
job_info->status=nt_printj_status(queue->status);
job_info->priority=queue->priority;
job_info->position=position;
@@ -3279,14 +3283,14 @@ static BOOL fill_job_info_2(JOB_INFO_2 *job_info, print_queue_struct *queue,
init_unistr(&(job_info->printername), chaine);
- init_unistr(&(job_info->machinename), temp_name);
- init_unistr(&(job_info->username), queue->user);
- init_unistr(&(job_info->document), queue->file);
- init_unistr(&(job_info->notifyname), queue->user);
- init_unistr(&(job_info->datatype), "RAW");
- init_unistr(&(job_info->printprocessor), "winprint");
- init_unistr(&(job_info->parameters), "");
- init_unistr(&(job_info->text_status), "");
+ init_unistr(&job_info->machinename, temp_name);
+ init_unistr(&job_info->username, queue->user);
+ init_unistr(&job_info->document, queue->file);
+ init_unistr(&job_info->notifyname, queue->user);
+ init_unistr(&job_info->datatype, "RAW");
+ init_unistr(&job_info->printprocessor, "winprint");
+ init_unistr(&job_info->parameters, "");
+ init_unistr(&job_info->text_status, "");
/* and here the security descriptor */
@@ -3328,13 +3332,13 @@ static uint32 enumjobs_level1(print_queue_struct *queue, int snum,
}
for (i=0; i<*returned; i++)
- fill_job_info_1(&(info[i]), &(queue[i]), i, snum);
+ fill_job_info_1(&info[i], &queue[i], i, snum);
safe_free(queue);
/* check the required size. */
for (i=0; i<*returned; i++)
- (*needed) += spoolss_size_job_info_1(&(info[i]));
+ (*needed) += spoolss_size_job_info_1(&info[i]);
if (!alloc_buffer_size(buffer, *needed)) {
safe_free(info);
@@ -3343,7 +3347,7 @@ static uint32 enumjobs_level1(print_queue_struct *queue, int snum,
/* fill the buffer with the structures */
for (i=0; i<*returned; i++)
- new_smb_io_job_info_1("", buffer, &(info[i]), 0);
+ new_smb_io_job_info_1("", buffer, &info[i], 0);
/* clear memory */
safe_free(info);
@@ -3374,13 +3378,13 @@ static uint32 enumjobs_level2(print_queue_struct *queue, int snum,
}
for (i=0; i<*returned; i++)
- fill_job_info_2(&(info[i]), &(queue[i]), i, snum);
+ fill_job_info_2(&(info[i]), &queue[i], i, snum);
safe_free(queue);
/* check the required size. */
for (i=0; i<*returned; i++)
- (*needed) += spoolss_size_job_info_2(&(info[i]));
+ (*needed) += spoolss_size_job_info_2(&info[i]);
if (!alloc_buffer_size(buffer, *needed)) {
safe_free(info);
@@ -3389,7 +3393,7 @@ static uint32 enumjobs_level2(print_queue_struct *queue, int snum,
/* fill the buffer with the structures */
for (i=0; i<*returned; i++)
- new_smb_io_job_info_2("", buffer, &(info[i]), 0);
+ new_smb_io_job_info_2("", buffer, &info[i], 0);
/* clear memory */
safe_free(info);