From a4e999c7e3214de26bdc7a20d5ec25d4ffdf152d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 18 Mar 2009 00:41:47 +0100 Subject: s3-spoolss: remove old spoolss_EnumPrinterDataEx. Guenther --- source3/include/proto.h | 5 - source3/include/rpc_spoolss.h | 38 ------ source3/rpc_parse/parse_spoolss.c | 251 -------------------------------------- 3 files changed, 294 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 2f4c360410..75b9933394 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5829,11 +5829,6 @@ bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int /* The following definitions come from rpc_parse/parse_spoolss.c */ -uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p); -bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src); -bool spoolss_io_q_enumprinterdataex(const char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, prs_struct *ps, int depth); -bool spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth); - /* The following definitions come from rpc_server/srv_eventlog_lib.c */ TDB_CONTEXT *elog_init_tdb( char *tdbfilename ); diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index 40829039da..e1dd0298d0 100644 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -163,43 +163,5 @@ #define JOB_NOTIFY_TOTAL_BYTES 0x16 #define JOB_NOTIFY_BYTES_PRINTED 0x17 -/********************************************/ - -typedef struct printer_enum_values -{ - UNISTR valuename; - uint32 value_len; - uint32 type; - uint8 *data; - uint32 data_len; - -} -PRINTER_ENUM_VALUES; - -typedef struct printer_enum_values_ctr -{ - uint32 size; - uint32 size_of_array; - PRINTER_ENUM_VALUES *values; -} -PRINTER_ENUM_VALUES_CTR; - -typedef struct spool_q_enumprinterdataex -{ - POLICY_HND handle; - UNISTR2 key; - uint32 size; -} -SPOOL_Q_ENUMPRINTERDATAEX; - -typedef struct spool_r_enumprinterdataex -{ - PRINTER_ENUM_VALUES_CTR ctr; - uint32 needed; - uint32 returned; - WERROR status; -} -SPOOL_R_ENUMPRINTERDATAEX; - #endif /* _RPC_SPOOLSS_H */ diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ea093376e5..a234013fbd 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -26,255 +26,4 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* - * return the length of a uint32 (obvious, but the code is clean) - ********************************************************************/ -static uint32 size_of_uint32(uint32 *value) -{ - return (sizeof(*value)); -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ -uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p) -{ - uint32 size = 0; - - if (!p) - return 0; - - /* uint32(offset) + uint32(length) + length) */ - size += (size_of_uint32(&p->value_len)*2) + p->value_len; - size += (size_of_uint32(&p->data_len)*2) + p->data_len + (p->data_len%2) ; - - size += size_of_uint32(&p->type); - - return size; -} - -/******************************************************************* - make a BUFFER5 struct from a uint16* - ******************************************************************/ - -bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src) -{ - - buf5->buf_len = len; - if (src) { - if (len) { - if((buf5->buffer=(uint16*)TALLOC_MEMDUP(mem_ctx, src, sizeof(uint16)*len)) == NULL) { - DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n")); - return False; - } - } else { - buf5->buffer = NULL; - } - } else { - buf5->buffer=NULL; - } - - return True; -} - -/******************************************************************* -********************************************************************/ - -bool make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u, - const POLICY_HND *hnd, const char *key, - uint32 size) -{ - memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - init_unistr2(&q_u->key, key, UNI_STR_TERMINATE); - q_u->size = size; - - return True; -} - -/******************************************************************* - * read a structure. - ********************************************************************/ - -bool spoolss_io_q_enumprinterdataex(const char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdataex"); - depth++; - - if(!prs_align(ps)) - return False; - if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) - return False; - - if(!smb_io_unistr2("", &q_u->key, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("size", ps, depth, &q_u->size)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, - PRINTER_ENUM_VALUES_CTR *ctr, int depth) -{ - int i; - uint32 valuename_offset, - data_offset, - current_offset; - const uint32 basic_unit = 20; /* size of static portion of enum_values */ - - prs_debug(ps, depth, desc, "spoolss_io_printer_enum_values_ctr"); - depth++; - - /* - * offset data begins at 20 bytes per structure * size_of_array. - * Don't forget the uint32 at the beginning - * */ - - current_offset = basic_unit * ctr->size_of_array; - - /* first loop to write basic enum_value information */ - - if (UNMARSHALLING(ps) && ctr->size_of_array) { - ctr->values = PRS_ALLOC_MEM(ps, PRINTER_ENUM_VALUES, ctr->size_of_array); - if (!ctr->values) - return False; - } - - for (i=0; isize_of_array; i++) { - uint32 base_offset, return_offset; - - base_offset = prs_offset(ps); - - valuename_offset = current_offset; - if (!prs_uint32("valuename_offset", ps, depth, &valuename_offset)) - return False; - - /* Read or write the value. */ - - return_offset = prs_offset(ps); - - if (!prs_set_offset(ps, base_offset + valuename_offset)) { - return False; - } - - if (!prs_unistr("valuename", ps, depth, &ctr->values[i].valuename)) - return False; - - /* And go back. */ - if (!prs_set_offset(ps, return_offset)) - return False; - - if (!prs_uint32("value_len", ps, depth, &ctr->values[i].value_len)) - return False; - - if (!prs_uint32("type", ps, depth, &ctr->values[i].type)) - return False; - - data_offset = ctr->values[i].value_len + valuename_offset; - - if (!prs_uint32("data_offset", ps, depth, &data_offset)) - return False; - - if (!prs_uint32("data_len", ps, depth, &ctr->values[i].data_len)) - return False; - - /* Read or write the data. */ - - return_offset = prs_offset(ps); - - if (!prs_set_offset(ps, base_offset + data_offset)) { - return False; - } - - if ( ctr->values[i].data_len ) { - if ( UNMARSHALLING(ps) ) { - ctr->values[i].data = PRS_ALLOC_MEM(ps, uint8, ctr->values[i].data_len); - if (!ctr->values[i].data) - return False; - } - if (!prs_uint8s(False, "data", ps, depth, ctr->values[i].data, ctr->values[i].data_len)) - return False; - } - - current_offset = data_offset + ctr->values[i].data_len - basic_unit; - /* account for 2 byte alignment */ - current_offset += (current_offset % 2); - - /* Remember how far we got. */ - data_offset = prs_offset(ps); - - /* And go back. */ - if (!prs_set_offset(ps, return_offset)) - return False; - - } - - /* Go to the last data offset we got to. */ - - if (!prs_set_offset(ps, data_offset)) - return False; - - /* And ensure we're 2 byte aligned. */ - - if ( !prs_align_uint16(ps) ) - return False; - - return True; -} - -/******************************************************************* - * write a structure. - ********************************************************************/ - -bool spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth) -{ - uint32 data_offset, end_offset; - prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdataex"); - depth++; - - if(!prs_align(ps)) - return False; - - if (!prs_uint32("size", ps, depth, &r_u->ctr.size)) - return False; - - data_offset = prs_offset(ps); - - if (!prs_set_offset(ps, data_offset + r_u->ctr.size)) - 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; - - r_u->ctr.size_of_array = r_u->returned; - - end_offset = prs_offset(ps); - - if (!prs_set_offset(ps, data_offset)) - return False; - - if (r_u->ctr.size) - if (!spoolss_io_printer_enum_values_ctr("", ps, &r_u->ctr, depth )) - return False; - - if (!prs_set_offset(ps, end_offset)) - return False; - return True; -} -- cgit