From b3d53e2ce6da661c3b41f03fdb0ecbe44579b593 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 25 Feb 2009 00:30:14 +0100 Subject: s3-spoolss: remove some left-over hand marshalling code and structs. Guenther --- source3/include/proto.h | 16 -- source3/include/rpc_spoolss.h | 93 ----------- source3/rpc_parse/parse_spoolss.c | 324 -------------------------------------- 3 files changed, 433 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 6edad71a99..9366607995 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5867,11 +5867,6 @@ uint32 spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1 *info); uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p); uint32 spoolss_size_printmonitor_info_1(PRINTMONITOR_1 *info); uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info); -bool make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, - const POLICY_HND *hnd, - const fstring architecture, - uint32 level, uint32 clientmajor, uint32 clientminor, - RPC_BUFFER *buffer, uint32 offered); 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); bool make_spoolss_q_enumprinters( @@ -5929,18 +5924,7 @@ bool spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, bool spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth); bool spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct *ps, int depth); -bool spool_io_printer_driver_info_level_3(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, - prs_struct *ps, int depth); -bool spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, - prs_struct *ps, int depth); -bool smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int depth); -bool spool_io_printer_driver_info_level(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth); -bool make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, - SPOOL_Q_ADDPRINTERDRIVER *q_u, const char* srv_name, - uint32 level, PRINTER_DRIVER_CTR *info); bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src); -bool spoolss_io_q_addprinterdriver(const char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth); -bool spoolss_io_r_addprinterdriver(const char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth); bool uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, NT_PRINTER_INFO_LEVEL_2 *d); bool spoolss_io_r_enumprintprocessors(const char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth); diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index 504cfea70b..48609a3cd6 100644 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -945,82 +945,6 @@ typedef struct spool_printer_info_level } SPOOL_PRINTER_INFO_LEVEL; -typedef struct spool_printer_driver_info_level_3 -{ - uint32 cversion; - uint32 name_ptr; - uint32 environment_ptr; - uint32 driverpath_ptr; - uint32 datafile_ptr; - uint32 configfile_ptr; - uint32 helpfile_ptr; - uint32 monitorname_ptr; - uint32 defaultdatatype_ptr; - uint32 dependentfilessize; - uint32 dependentfiles_ptr; - - UNISTR2 name; - UNISTR2 environment; - UNISTR2 driverpath; - UNISTR2 datafile; - UNISTR2 configfile; - UNISTR2 helpfile; - UNISTR2 monitorname; - UNISTR2 defaultdatatype; - BUFFER5 dependentfiles; - -} -SPOOL_PRINTER_DRIVER_INFO_LEVEL_3; - -/* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */ -typedef struct { - uint32 version; - uint32 name_ptr; - uint32 environment_ptr; - uint32 driverpath_ptr; - uint32 datafile_ptr; - uint32 configfile_ptr; - uint32 helpfile_ptr; - uint32 monitorname_ptr; - uint32 defaultdatatype_ptr; - uint32 dependentfiles_len; - uint32 dependentfiles_ptr; - uint32 previousnames_len; - uint32 previousnames_ptr; - NTTIME driverdate; - uint64 driverversion; - uint32 dummy4; - uint32 mfgname_ptr; - uint32 oemurl_ptr; - uint32 hardwareid_ptr; - uint32 provider_ptr; - UNISTR2 name; - UNISTR2 environment; - UNISTR2 driverpath; - UNISTR2 datafile; - UNISTR2 configfile; - UNISTR2 helpfile; - UNISTR2 monitorname; - UNISTR2 defaultdatatype; - BUFFER5 dependentfiles; - BUFFER5 previousnames; - UNISTR2 mfgname; - UNISTR2 oemurl; - UNISTR2 hardwareid; - UNISTR2 provider; -} SPOOL_PRINTER_DRIVER_INFO_LEVEL_6; - - -typedef struct spool_printer_driver_info_level -{ - uint32 level; - uint32 ptr; - SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *info_3; - SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *info_6; -} -SPOOL_PRINTER_DRIVER_INFO_LEVEL; - - typedef struct spool_q_setprinter { POLICY_HND handle; @@ -1057,23 +981,6 @@ typedef struct { WERROR status; } SPOOL_R_ADDPRINTEREX; -/********************************************/ - -typedef struct spool_q_addprinterdriver -{ - uint32 server_name_ptr; - UNISTR2 server_name; - uint32 level; - SPOOL_PRINTER_DRIVER_INFO_LEVEL info; -} -SPOOL_Q_ADDPRINTERDRIVER; - -typedef struct spool_r_addprinterdriver -{ - WERROR status; -} -SPOOL_R_ADDPRINTERDRIVER; - typedef struct spool_q_enumprintprocessors { uint32 name_ptr; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 9c69dd2659..12c7af49cf 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3100,288 +3100,6 @@ bool spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u, return True; } -/******************************************************************* -********************************************************************/ - -bool spool_io_printer_driver_info_level_3(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, - prs_struct *ps, int depth) -{ - SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *il; - - prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level_3"); - depth++; - - /* reading */ - if (UNMARSHALLING(ps)) { - il=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_DRIVER_INFO_LEVEL_3,1); - if(il == NULL) - return False; - *q_u=il; - } - else { - il=*q_u; - } - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("cversion", ps, depth, &il->cversion)) - return False; - if(!prs_uint32("name", ps, depth, &il->name_ptr)) - return False; - if(!prs_uint32("environment", ps, depth, &il->environment_ptr)) - return False; - if(!prs_uint32("driverpath", ps, depth, &il->driverpath_ptr)) - return False; - if(!prs_uint32("datafile", ps, depth, &il->datafile_ptr)) - return False; - if(!prs_uint32("configfile", ps, depth, &il->configfile_ptr)) - return False; - if(!prs_uint32("helpfile", ps, depth, &il->helpfile_ptr)) - return False; - if(!prs_uint32("monitorname", ps, depth, &il->monitorname_ptr)) - return False; - if(!prs_uint32("defaultdatatype", ps, depth, &il->defaultdatatype_ptr)) - return False; - if(!prs_uint32("dependentfilessize", ps, depth, &il->dependentfilessize)) - return False; - if(!prs_uint32("dependentfiles", ps, depth, &il->dependentfiles_ptr)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth)) - return False; - if(!smb_io_unistr2("environment", &il->environment, il->environment_ptr, ps, depth)) - return False; - if(!smb_io_unistr2("driverpath", &il->driverpath, il->driverpath_ptr, ps, depth)) - return False; - if(!smb_io_unistr2("datafile", &il->datafile, il->datafile_ptr, ps, depth)) - return False; - if(!smb_io_unistr2("configfile", &il->configfile, il->configfile_ptr, ps, depth)) - return False; - if(!smb_io_unistr2("helpfile", &il->helpfile, il->helpfile_ptr, ps, depth)) - return False; - if(!smb_io_unistr2("monitorname", &il->monitorname, il->monitorname_ptr, ps, depth)) - return False; - if(!smb_io_unistr2("defaultdatatype", &il->defaultdatatype, il->defaultdatatype_ptr, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if (il->dependentfiles_ptr) - smb_io_buffer5("", &il->dependentfiles, ps, depth); - - return True; -} - -/******************************************************************* -parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure -********************************************************************/ - -bool spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, - prs_struct *ps, int depth) -{ - SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *il; - - prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level_6"); - depth++; - - /* reading */ - if (UNMARSHALLING(ps)) { - il=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_DRIVER_INFO_LEVEL_6,1); - if(il == NULL) - return False; - *q_u=il; - } - else { - il=*q_u; - } - - if(!prs_align(ps)) - return False; - - /* - * I know this seems weird, but I have no other explanation. - * This is observed behavior on both NT4 and 2K servers. - * --jerry - */ - - if (!prs_align_uint64(ps)) - return False; - - /* parse the main elements the packet */ - - if(!prs_uint32("cversion ", ps, depth, &il->version)) - return False; - if(!prs_uint32("name ", ps, depth, &il->name_ptr)) - return False; - if(!prs_uint32("environment ", ps, depth, &il->environment_ptr)) - return False; - if(!prs_uint32("driverpath ", ps, depth, &il->driverpath_ptr)) - return False; - if(!prs_uint32("datafile ", ps, depth, &il->datafile_ptr)) - return False; - if(!prs_uint32("configfile ", ps, depth, &il->configfile_ptr)) - return False; - if(!prs_uint32("helpfile ", ps, depth, &il->helpfile_ptr)) - return False; - if(!prs_uint32("monitorname ", ps, depth, &il->monitorname_ptr)) - return False; - if(!prs_uint32("defaultdatatype", ps, depth, &il->defaultdatatype_ptr)) - return False; - if(!prs_uint32("dependentfiles ", ps, depth, &il->dependentfiles_len)) - return False; - if(!prs_uint32("dependentfiles ", ps, depth, &il->dependentfiles_ptr)) - return False; - if(!prs_uint32("previousnames ", ps, depth, &il->previousnames_len)) - return False; - if(!prs_uint32("previousnames ", ps, depth, &il->previousnames_ptr)) - return False; - if(!smb_io_time("driverdate ", &il->driverdate, ps, depth)) - return False; - if(!prs_uint32("dummy4 ", ps, depth, &il->dummy4)) - return False; - if(!prs_uint64("driverversion ", ps, depth, &il->driverversion)) - return False; - if(!prs_uint32("mfgname ", ps, depth, &il->mfgname_ptr)) - return False; - if(!prs_uint32("oemurl ", ps, depth, &il->oemurl_ptr)) - return False; - if(!prs_uint32("hardwareid ", ps, depth, &il->hardwareid_ptr)) - return False; - if(!prs_uint32("provider ", ps, depth, &il->provider_ptr)) - return False; - - /* parse the structures in the packet */ - - if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("environment", &il->environment, il->environment_ptr, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("driverpath", &il->driverpath, il->driverpath_ptr, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("datafile", &il->datafile, il->datafile_ptr, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("configfile", &il->configfile, il->configfile_ptr, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("helpfile", &il->helpfile, il->helpfile_ptr, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("monitorname", &il->monitorname, il->monitorname_ptr, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("defaultdatatype", &il->defaultdatatype, il->defaultdatatype_ptr, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - if (il->dependentfiles_ptr) { - if(!smb_io_buffer5("dependentfiles", &il->dependentfiles, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - if (il->previousnames_ptr) { - if(!smb_io_buffer5("previousnames", &il->previousnames, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - if(!smb_io_unistr2("mfgname", &il->mfgname, il->mfgname_ptr, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("oemurl", &il->oemurl, il->oemurl_ptr, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("hardwareid", &il->hardwareid, il->hardwareid_ptr, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("provider", &il->provider, il->provider_ptr, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - read a UNICODE array with null terminated strings - and null terminated array - and size of array at beginning -********************************************************************/ - -bool smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) -{ - if (buffer==NULL) return False; - - buffer->offset=0; - buffer->uni_str_len=buffer->uni_max_len; - - if(!prs_uint32("buffer_size", ps, depth, &buffer->uni_max_len)) - return False; - - if(!prs_unistr2(True, "buffer ", ps, depth, buffer)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -bool spool_io_printer_driver_info_level(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level"); - depth++; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("level", ps, depth, &il->level)) - return False; - if(!prs_uint32("ptr", ps, depth, &il->ptr)) - return False; - - if (il->ptr==0) - return True; - - switch (il->level) { - case 3: - if(!spool_io_printer_driver_info_level_3("", &il->info_3, ps, depth)) - return False; - break; - case 6: - if(!spool_io_printer_driver_info_level_6("", &il->info_6, ps, depth)) - return False; - break; - default: - return False; - } - - return True; -} - /******************************************************************* make a BUFFER5 struct from a uint16* ******************************************************************/ @@ -3406,48 +3124,6 @@ bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 return True; } -/******************************************************************* - fill in the prs_struct for a ADDPRINTERDRIVER request PDU - ********************************************************************/ - -bool spoolss_io_q_addprinterdriver(const char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriver"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("server_name_ptr", ps, depth, &q_u->server_name_ptr)) - return False; - if(!smb_io_unistr2("server_name", &q_u->server_name, q_u->server_name_ptr, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("info_level", ps, depth, &q_u->level)) - return False; - - if(!spool_io_printer_driver_info_level("", &q_u->info, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -bool spoolss_io_r_addprinterdriver(const char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriver"); - depth++; - - if(!prs_werror("status", ps, depth, &q_u->status)) - return False; - - return True; -} - /******************************************************************* ********************************************************************/ -- cgit