From f736e7897d882981831fcc86c0810c7030266621 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Mon, 9 Mar 2009 12:33:18 +0100 Subject: [PATCH] s3-spoolss: remove old spoolss_GetJob and spoolss_EnumJob. Guenther (cherry picked from commit e605e4503cbf60560a4022b7cb095e1c8cdad0f4) (cherry picked from commit 8594d1cc52437d941e9d0218edcb458a2ea1aba4) --- source3/include/proto.h | 10 -- source3/include/rpc_spoolss.h | 120 -------------- source3/rpc_parse/parse_spoolss.c | 310 ------------------------------------ source3/rpc_server/srv_spoolss_nt.c | 72 --------- 4 files changed, 512 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 6afc133ac9f..f55da34e59c 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5846,8 +5846,6 @@ bool smb_io_printer_driver_info_1(const char *desc, RPC_BUFFER *buffer, DRIVER_I bool smb_io_printer_driver_info_2(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) ; bool smb_io_printer_driver_info_3(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_3 *info, int depth); bool smb_io_printer_driver_info_6(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_6 *info, int depth); -bool smb_io_job_info_1(const char *desc, RPC_BUFFER *buffer, JOB_INFO_1 *info, int depth); -bool smb_io_job_info_2(const char *desc, RPC_BUFFER *buffer, JOB_INFO_2 *info, int depth); uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info); uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info); uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info); @@ -5861,8 +5859,6 @@ uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info); uint32 spoolss_size_string_array(uint16 *string); uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info); uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info); -uint32 spoolss_size_job_info_1(JOB_INFO_1 *info); -uint32 spoolss_size_job_info_2(JOB_INFO_2 *info); uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p); bool spoolss_io_q_getprinterdriver2(const char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth); bool spoolss_io_r_getprinterdriver2(const char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth); @@ -5878,8 +5874,6 @@ bool spoolss_io_q_enumprinters(const char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_ bool spoolss_io_r_enumprinters(const char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth); bool spoolss_io_r_getprinter(const char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth); bool spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth); -bool spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth); -bool spoolss_io_q_enumjobs(const char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth); bool spoolss_io_r_enumprinterdrivers(const char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth); bool make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, const char *name, @@ -5900,8 +5894,6 @@ bool make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND char* value, uint32 data_type, char* data, uint32 data_size); bool spoolss_io_q_setprinterdata(const char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth); bool spoolss_io_r_setprinterdata(const char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth); -bool spoolss_io_r_getjob(const char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth); -bool spoolss_io_q_getjob(const char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth); void free_devmode(DEVICEMODE *devmode); void free_printer_info_1(PRINTER_INFO_1 *printer); void free_printer_info_2(PRINTER_INFO_2 *printer); @@ -5910,7 +5902,6 @@ void free_printer_info_4(PRINTER_INFO_4 *printer); void free_printer_info_5(PRINTER_INFO_5 *printer); void free_printer_info_6(PRINTER_INFO_6 *printer); void free_printer_info_7(PRINTER_INFO_7 *printer); -void free_job_info_2(JOB_INFO_2 *job); bool make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, POLICY_HND *hnd, const char *key, uint32 size); @@ -6124,7 +6115,6 @@ WERROR _spoolss_enumprinterdrivers( pipes_struct *p, SPOOL_Q_ENUMPRINTERDRIVERS WERROR enumports_hook(TALLOC_CTX *ctx, int *count, char ***lines ); WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, SPOOL_R_ENUMPRINTERDATA *r_u); WERROR _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SPOOL_R_SETPRINTERDATA *r_u); -WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_u); WERROR _spoolss_enumprinterkey(pipes_struct *p, SPOOL_Q_ENUMPRINTERKEY *q_u, SPOOL_R_ENUMPRINTERKEY *r_u); WERROR _spoolss_enumprinterdataex(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATAEX *q_u, SPOOL_R_ENUMPRINTERDATAEX *r_u); diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index fdce63aba31..3ddc10623bf 100644 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -606,95 +606,6 @@ typedef struct systemtime } SYSTEMTIME; -typedef struct s_job_info_1 -{ - uint32 jobid; - UNISTR printername; - UNISTR machinename; - UNISTR username; - UNISTR document; - UNISTR datatype; - UNISTR text_status; - uint32 status; - uint32 priority; - uint32 position; - uint32 totalpages; - uint32 pagesprinted; - SYSTEMTIME submitted; -} -JOB_INFO_1; - -typedef struct s_job_info_2 -{ - uint32 jobid; - UNISTR printername; - UNISTR machinename; - UNISTR username; - UNISTR document; - UNISTR notifyname; - UNISTR datatype; - UNISTR printprocessor; - UNISTR parameters; - UNISTR drivername; - DEVICEMODE *devmode; - UNISTR text_status; -/* SEC_DESC sec_desc;*/ - uint32 status; - uint32 priority; - uint32 position; - uint32 starttime; - uint32 untiltime; - uint32 totalpages; - uint32 size; - SYSTEMTIME submitted; - uint32 timeelapsed; - uint32 pagesprinted; -} -JOB_INFO_2; - -typedef struct spool_q_enumjobs -{ - POLICY_HND handle; - uint32 firstjob; - uint32 numofjobs; - uint32 level; - RPC_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_ENUMJOBS; - -typedef struct job_info_ctr_info -{ - union - { - JOB_INFO_1 *job_info_1; - JOB_INFO_2 *job_info_2; - void *info; - } job; - -} JOB_INFO_CTR; - -typedef struct spool_r_enumjobs -{ - RPC_BUFFER *buffer; - uint32 needed; - uint32 returned; - WERROR status; -} -SPOOL_R_ENUMJOBS; - -typedef struct job_info_info -{ - union - { - JOB_INFO_1 job_info_1; - JOB_INFO_2 job_info_2; - } - job; - -} -JOB_INFO; - typedef struct spool_q_enumprinterdrivers { uint32 name_ptr; @@ -772,37 +683,6 @@ typedef struct _form } FORM; -typedef struct spool_q_getjob -{ - POLICY_HND handle; - uint32 jobid; - uint32 level; - RPC_BUFFER *buffer; - uint32 offered; -} -SPOOL_Q_GETJOB; - -typedef struct pjob_info_info -{ - union - { - JOB_INFO_1 *job_info_1; - JOB_INFO_2 *job_info_2; - void *info; - } - job; - -} -PJOB_INFO; - -typedef struct spool_r_getjob -{ - RPC_BUFFER *buffer; - uint32 needed; - WERROR status; -} -SPOOL_R_GETJOB; - typedef struct spool_q_enumprinterkey { POLICY_HND handle; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ea40fc8bae3..1b47dbea3f2 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -386,18 +386,6 @@ static uint32 size_of_device_mode(DEVICEMODE *devmode) } /******************************************************************* - * return the length of a uint32 (obvious, but the code is clean) - ********************************************************************/ - -static uint32 size_of_systemtime(SYSTEMTIME *systime) -{ - if (systime==NULL) - return (4); - else - return (sizeof(SYSTEMTIME) +4); -} - -/******************************************************************* Parse a DEVMODE structure and its relative pointer. ********************************************************************/ @@ -979,117 +967,6 @@ bool smb_io_printer_driver_info_6(const char *desc, RPC_BUFFER *buffer, DRIVER_I } /******************************************************************* - Parse a JOB_INFO_1 structure. -********************************************************************/ - -bool smb_io_job_info_1(const char *desc, RPC_BUFFER *buffer, JOB_INFO_1 *info, int depth) -{ - prs_struct *ps=&buffer->prs; - - prs_debug(ps, depth, desc, "smb_io_job_info_1"); - depth++; - - buffer->struct_start=prs_offset(ps); - - if (!prs_uint32("jobid", ps, depth, &info->jobid)) - return False; - if (!smb_io_relstr("printername", buffer, depth, &info->printername)) - return False; - if (!smb_io_relstr("machinename", buffer, depth, &info->machinename)) - return False; - if (!smb_io_relstr("username", buffer, depth, &info->username)) - return False; - if (!smb_io_relstr("document", buffer, depth, &info->document)) - return False; - if (!smb_io_relstr("datatype", buffer, depth, &info->datatype)) - return False; - if (!smb_io_relstr("text_status", buffer, depth, &info->text_status)) - return False; - if (!prs_uint32("status", ps, depth, &info->status)) - return False; - if (!prs_uint32("priority", ps, depth, &info->priority)) - return False; - if (!prs_uint32("position", ps, depth, &info->position)) - return False; - if (!prs_uint32("totalpages", ps, depth, &info->totalpages)) - return False; - if (!prs_uint32("pagesprinted", ps, depth, &info->pagesprinted)) - return False; - if (!spoolss_io_system_time("submitted", ps, depth, &info->submitted)) - return False; - - return True; -} - -/******************************************************************* - Parse a JOB_INFO_2 structure. -********************************************************************/ - -bool smb_io_job_info_2(const char *desc, RPC_BUFFER *buffer, JOB_INFO_2 *info, int depth) -{ - uint32 pipo=0; - prs_struct *ps=&buffer->prs; - - prs_debug(ps, depth, desc, "smb_io_job_info_2"); - depth++; - - buffer->struct_start=prs_offset(ps); - - if (!prs_uint32("jobid",ps, depth, &info->jobid)) - return False; - if (!smb_io_relstr("printername", buffer, depth, &info->printername)) - return False; - if (!smb_io_relstr("machinename", buffer, depth, &info->machinename)) - return False; - if (!smb_io_relstr("username", buffer, depth, &info->username)) - return False; - if (!smb_io_relstr("document", buffer, depth, &info->document)) - return False; - if (!smb_io_relstr("notifyname", buffer, depth, &info->notifyname)) - return False; - if (!smb_io_relstr("datatype", buffer, depth, &info->datatype)) - return False; - - if (!smb_io_relstr("printprocessor", buffer, depth, &info->printprocessor)) - return False; - if (!smb_io_relstr("parameters", buffer, depth, &info->parameters)) - return False; - if (!smb_io_relstr("drivername", buffer, depth, &info->drivername)) - return False; - if (!smb_io_reldevmode("devmode", buffer, depth, &info->devmode)) - return False; - if (!smb_io_relstr("text_status", buffer, depth, &info->text_status)) - return False; - -/* SEC_DESC sec_desc;*/ - if (!prs_uint32("Hack! sec desc", ps, depth, &pipo)) - return False; - - if (!prs_uint32("status",ps, depth, &info->status)) - return False; - if (!prs_uint32("priority",ps, depth, &info->priority)) - return False; - if (!prs_uint32("position",ps, depth, &info->position)) - return False; - if (!prs_uint32("starttime",ps, depth, &info->starttime)) - return False; - if (!prs_uint32("untiltime",ps, depth, &info->untiltime)) - return False; - if (!prs_uint32("totalpages",ps, depth, &info->totalpages)) - return False; - if (!prs_uint32("size",ps, depth, &info->size)) - return False; - if (!spoolss_io_system_time("submitted", ps, depth, &info->submitted) ) - return False; - if (!prs_uint32("timeelapsed",ps, depth, &info->timeelapsed)) - return False; - if (!prs_uint32("pagesprinted",ps, depth, &info->pagesprinted)) - return False; - - return True; -} - -/******************************************************************* return the size required by a struct in the stream ********************************************************************/ @@ -1384,67 +1261,6 @@ uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ - -uint32 spoolss_size_job_info_1(JOB_INFO_1 *info) -{ - int size=0; - size+=size_of_uint32( &info->jobid ); - size+=size_of_relative_string( &info->printername ); - size+=size_of_relative_string( &info->machinename ); - size+=size_of_relative_string( &info->username ); - size+=size_of_relative_string( &info->document ); - size+=size_of_relative_string( &info->datatype ); - size+=size_of_relative_string( &info->text_status ); - size+=size_of_uint32( &info->status ); - size+=size_of_uint32( &info->priority ); - size+=size_of_uint32( &info->position ); - size+=size_of_uint32( &info->totalpages ); - size+=size_of_uint32( &info->pagesprinted ); - size+=size_of_systemtime( &info->submitted ); - - return size; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ - -uint32 spoolss_size_job_info_2(JOB_INFO_2 *info) -{ - int size=0; - - size+=4; /* size of sec desc ptr */ - - size+=size_of_uint32( &info->jobid ); - size+=size_of_relative_string( &info->printername ); - size+=size_of_relative_string( &info->machinename ); - size+=size_of_relative_string( &info->username ); - size+=size_of_relative_string( &info->document ); - size+=size_of_relative_string( &info->notifyname ); - size+=size_of_relative_string( &info->datatype ); - size+=size_of_relative_string( &info->printprocessor ); - size+=size_of_relative_string( &info->parameters ); - size+=size_of_relative_string( &info->drivername ); - size+=size_of_device_mode( info->devmode ); - size+=size_of_relative_string( &info->text_status ); -/* SEC_DESC sec_desc;*/ - size+=size_of_uint32( &info->status ); - size+=size_of_uint32( &info->priority ); - size+=size_of_uint32( &info->position ); - size+=size_of_uint32( &info->starttime ); - size+=size_of_uint32( &info->untiltime ); - size+=size_of_uint32( &info->totalpages ); - size+=size_of_uint32( &info->size ); - size+=size_of_systemtime( &info->submitted ); - size+=size_of_uint32( &info->timeelapsed ); - size+=size_of_uint32( &info->pagesprinted ); - - return size; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p) { uint32 size = 0; @@ -1684,68 +1500,6 @@ bool spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_stru } /******************************************************************* -********************************************************************/ - -bool spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_enumjobs"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("needed", ps, depth, &r_u->needed)) - return False; - - if (!prs_uint32("returned", ps, depth, &r_u->returned)) - return False; - - if (!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -bool spoolss_io_q_enumjobs(const char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_q_enumjobs"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!smb_io_pol_hnd("printer handle",&q_u->handle, ps, depth)) - return False; - - if (!prs_uint32("firstjob", ps, depth, &q_u->firstjob)) - return False; - if (!prs_uint32("numofjobs", ps, depth, &q_u->numofjobs)) - return False; - if (!prs_uint32("level", ps, depth, &q_u->level)) - return False; - - if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) - return False; - - if(!prs_align(ps)) - return False; - - if (!prs_uint32("offered", ps, depth, &q_u->offered)) - return False; - - return True; -} - -/******************************************************************* Parse a SPOOL_R_ENUMPRINTERDRIVERS structure. ********************************************************************/ @@ -2049,64 +1803,6 @@ bool spoolss_io_r_setprinterdata(const char *desc, SPOOL_R_SETPRINTERDATA *r_u, return True; } -/******************************************************************* - Parse a SPOOL_R_GETJOB structure. -********************************************************************/ - -bool spoolss_io_r_getjob(const char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_getjob"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("needed", ps, depth, &r_u->needed)) - return False; - - if (!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* - Parse a SPOOL_Q_GETJOB structure. -********************************************************************/ - -bool spoolss_io_q_getjob(const char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, ""); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) - return False; - if(!prs_uint32("jobid", ps, depth, &q_u->jobid)) - return False; - if(!prs_uint32("level", ps, depth, &q_u->level)) - return False; - - if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("offered", ps, depth, &q_u->offered)) - return False; - - return True; -} - void free_devmode(DEVICEMODE *devmode) { if (devmode!=NULL) { @@ -2154,12 +1850,6 @@ void free_printer_info_7(PRINTER_INFO_7 *printer) SAFE_FREE(printer); } -void free_job_info_2(JOB_INFO_2 *job) -{ - if (job!=NULL) - free_devmode(job->devmode); -} - /******************************************************************* * read a structure. ********************************************************************/ diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index b982065032c..e758d029ed7 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -6841,78 +6841,6 @@ static WERROR fill_job_info2(TALLOC_CTX *mem_ctx, return WERR_OK; } - -/**************************************************************************** -****************************************************************************/ - -static void fill_job_info_1(JOB_INFO_1 *job_info, const print_queue_struct *queue, - int position, int snum, - const NT_PRINTER_INFO_LEVEL *ntprinter) -{ - struct tm *t; - - t=gmtime(&queue->time); - - job_info->jobid=queue->job; - init_unistr(&job_info->printername, lp_servicename(snum)); - init_unistr(&job_info->machinename, ntprinter->info_2->servername); - init_unistr(&job_info->username, queue->fs_user); - init_unistr(&job_info->document, queue->fs_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; - job_info->totalpages=queue->page_count; - job_info->pagesprinted=0; - - make_systemtime(&job_info->submitted, t); -} - -/**************************************************************************** -****************************************************************************/ - -static bool fill_job_info_2(JOB_INFO_2 *job_info, const print_queue_struct *queue, - int position, int snum, - const NT_PRINTER_INFO_LEVEL *ntprinter, - DEVICEMODE *devmode) -{ - struct tm *t; - - t=gmtime(&queue->time); - - job_info->jobid=queue->job; - - init_unistr(&job_info->printername, ntprinter->info_2->printername); - - init_unistr(&job_info->machinename, ntprinter->info_2->servername); - init_unistr(&job_info->username, queue->fs_user); - init_unistr(&job_info->document, queue->fs_file); - init_unistr(&job_info->notifyname, queue->fs_user); - init_unistr(&job_info->datatype, "RAW"); - init_unistr(&job_info->printprocessor, "winprint"); - init_unistr(&job_info->parameters, ""); - init_unistr(&job_info->drivername, ntprinter->info_2->drivername); - init_unistr(&job_info->text_status, ""); - -/* and here the security descriptor */ - - job_info->status=nt_printj_status(queue->status); - job_info->priority=queue->priority; - job_info->position=position; - job_info->starttime=0; - job_info->untiltime=0; - job_info->totalpages=queue->page_count; - job_info->size=queue->size; - make_systemtime(&(job_info->submitted), t); - job_info->timeelapsed=0; - job_info->pagesprinted=0; - - job_info->devmode = devmode; - - return (True); -} - /**************************************************************************** Enumjobs at level 1. ****************************************************************************/ -- 2.11.4.GIT