diff options
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/rpc_parse/parse_spoolss.c | 120 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 6 |
3 files changed, 6 insertions, 124 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index db1f41d9b3..d9154cca6f 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -3185,11 +3185,7 @@ void free_devmode(DEVICEMODE *devmode); void free_printer_info_1(PRINTER_INFO_1 *printer); void free_printer_info_2(PRINTER_INFO_2 *printer); void free_printer_info_3(PRINTER_INFO_3 *printer); -void free_print2_array(uint32 num_entries, PRINTER_INFO_2 **entries); -void free_print1_array(uint32 num_entries, PRINTER_INFO_1 **entries); -void free_job1_array(uint32 num_entries, JOB_INFO_1 **entries); void free_job_info_2(JOB_INFO_2 *job); -void free_job2_array(uint32 num_entries, JOB_INFO_2 **entries); BOOL make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, const fstring string, uint32 printer, uint32 type); BOOL spoolss_io_q_replyopenprinter(char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, prs_struct *ps, int depth); diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index fb4150b2ce..0a4375c1d4 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4701,7 +4701,7 @@ BOOL make_spool_buffer5(TALLOC_CTX *ctx, BUFFER5 *buf5, uint32 len, uint16 *src) buf5->buf_len = len; if((buf5->buffer=(uint16*)talloc(ctx, sizeof(uint16)*len)) == NULL) { - DEBUG(0,("make_spool_buffer5: Unable to malloc memory for buffer!\n")); + DEBUG(0,("make_spool_buffer5: Unable to talloc memory for buffer!\n")); return False; } @@ -5622,124 +5622,10 @@ void free_printer_info_3(PRINTER_INFO_3 *printer) } } -static PRINTER_INFO_2 *prt2_dup(const PRINTER_INFO_2* from) -{ - PRINTER_INFO_2 *copy = (PRINTER_INFO_2 *)malloc(sizeof(PRINTER_INFO_2)); - if (copy != NULL) { - if (from != NULL) - memcpy(copy, from, sizeof(*copy)); - else - ZERO_STRUCTP(copy); - } - return copy; -} - -void free_print2_array(uint32 num_entries, PRINTER_INFO_2 **entries) -{ - void(*fn)(void*) = (void(*)(void*))&free_printer_info_2; - free_void_array(num_entries, (void**)entries, *fn); -} - -PRINTER_INFO_2 *add_print2_to_array(uint32 *len, PRINTER_INFO_2 ***array, - const PRINTER_INFO_2 *prt) -{ - void*(*fn)(const void*) = (void*(*)(const void*))&prt2_dup; - return (PRINTER_INFO_2*)add_copy_to_array(len, - (void***)array, (const void*)prt, *fn, True); -} - -static PRINTER_INFO_1 *prt1_dup(const PRINTER_INFO_1* from) -{ - PRINTER_INFO_1 *copy = (PRINTER_INFO_1 *)malloc(sizeof(PRINTER_INFO_1)); - if (copy != NULL) { - if (from != NULL) - memcpy(copy, from, sizeof(*copy)); - else - ZERO_STRUCTP(copy); - } - return copy; -} - -void free_print1_array(uint32 num_entries, PRINTER_INFO_1 **entries) -{ - void(*fn)(void*) = (void(*)(void*))&free; - free_void_array(num_entries, (void**)entries, *fn); -} - -PRINTER_INFO_1 *add_print1_to_array(uint32 *len, PRINTER_INFO_1 ***array, - const PRINTER_INFO_1 *prt) -{ - void*(*fn)(const void*) = (void*(*)(const void*))&prt1_dup; - return (PRINTER_INFO_1*)add_copy_to_array(len, - (void***)array, (const void*)prt, *fn, True); -} - -static JOB_INFO_1 *job1_dup(const JOB_INFO_1* from) -{ - JOB_INFO_1 *copy = (JOB_INFO_1 *)malloc(sizeof(JOB_INFO_1)); - if (copy != NULL) - { - if (from != NULL) - { - memcpy(copy, from, sizeof(*copy)); - } - else - { - ZERO_STRUCTP(copy); - } - } - return copy; -} - -void free_job1_array(uint32 num_entries, JOB_INFO_1 **entries) -{ - void(*fn)(void*) = (void(*)(void*))&free; - free_void_array(num_entries, (void**)entries, *fn); -} - -JOB_INFO_1 *add_job1_to_array(uint32 *len, JOB_INFO_1 ***array, - const JOB_INFO_1 *job) -{ - void*(*fn)(const void*) = (void*(*)(const void*))&job1_dup; - return (JOB_INFO_1*)add_copy_to_array(len, - (void***)array, (const void*)job, *fn, True); -} - -static JOB_INFO_2 *job2_dup(const JOB_INFO_2* from) -{ - JOB_INFO_2 *copy = (JOB_INFO_2 *)malloc(sizeof(JOB_INFO_2)); - if (copy != NULL) - { - if (from != NULL) - { - memcpy(copy, from, sizeof(*copy)); - } - else - { - ZERO_STRUCTP(copy); - } - } - return copy; -} - void free_job_info_2(JOB_INFO_2 *job) { - if (job!=NULL) - free_devmode(job->devmode); -} - -void free_job2_array(uint32 num_entries, JOB_INFO_2 **entries) -{ - void(*fn)(void*) = (void(*)(void*))&free_job_info_2; - free_void_array(num_entries, (void**)entries, *fn); -} - -JOB_INFO_2 *add_job2_to_array(uint32 *len, JOB_INFO_2 ***array, - const JOB_INFO_2 *job) -{ - void*(*fn)(const void*) = (void*(*)(const void*))&job2_dup; - return (JOB_INFO_2*)add_copy_to_array(len, - (void***)array, (const void*)job, *fn, True); + if (job!=NULL) + free_devmode(job->devmode); } /******************************************************************* diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index d17082b880..5e666a9a7a 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -2870,7 +2870,7 @@ static BOOL enum_all_printers_info_1(uint32 flags, NEW_BUFFER *buffer, uint32 of return ERROR_NOT_ENOUGH_MEMORY; } DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_1\n", *returned)); - memcpy(&(printers[*returned]), ¤t_prt, sizeof(PRINTER_INFO_1)); + memcpy(&printers[*returned], ¤t_prt, sizeof(PRINTER_INFO_1)); (*returned)++; } } @@ -2878,14 +2878,14 @@ static BOOL enum_all_printers_info_1(uint32 flags, NEW_BUFFER *buffer, uint32 of /* check the required size. */ for (i=0; i<*returned; i++) - (*needed) += spoolss_size_printer_info_1(&(printers[i])); + (*needed) += spoolss_size_printer_info_1(&printers[i]); if (!alloc_buffer_size(buffer, *needed)) return ERROR_INSUFFICIENT_BUFFER; /* fill the buffer with the structures */ for (i=0; i<*returned; i++) - new_smb_io_printer_info_1("", buffer, &(printers[i]), 0); + new_smb_io_printer_info_1("", buffer, &printers[i], 0); /* clear memory */ safe_free(printers); |