From fc703a14928c61031589ac6cce8f2985e5fb87a9 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 12 Feb 2009 14:33:26 +0100 Subject: s3-spoolss: remove SPOOL_NOTIFY_INFO_DATA and SPOOL_NOTIFY_INFO alltogether. Guenther --- source3/include/proto.h | 2 - source3/include/rpc_spoolss.h | 30 ---- source3/rpc_parse/parse_spoolss.c | 317 -------------------------------------- 3 files changed, 349 deletions(-) (limited to 'source3') diff --git a/source3/include/proto.h b/source3/include/proto.h index 2aad1e54fd..cf54853a2e 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5813,8 +5813,6 @@ bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int bool spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime); bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime); -bool smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, - prs_struct *ps, int depth); bool spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u ); bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode); bool make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u, diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index 7f7555fd85..26ecf2bfa5 100644 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -406,36 +406,6 @@ typedef struct spool_notify_option } SPOOL_NOTIFY_OPTION; -typedef struct spool_notify_info_data -{ - uint16 type; - uint16 field; - uint32 reserved; - uint32 id; - union { - uint32 value[2]; - struct { - uint32 length; - uint16 *string; - } data; - struct { - uint32 size; - SEC_DESC *desc; - } sd; - } - notify_data; - uint32 size; - uint32 enc_type; -} SPOOL_NOTIFY_INFO_DATA; - -typedef struct spool_notify_info -{ - uint32 version; - uint32 flags; - uint32 count; - SPOOL_NOTIFY_INFO_DATA *data; -} -SPOOL_NOTIFY_INFO; /* If the struct name looks obscure, yes it is ! */ /* RemoteFindFirstPrinterChangeNotificationEx query struct */ diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 828a2f22f9..89676cbaff 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -200,257 +200,6 @@ static bool smb_io_notify_option(const char *desc, SPOOL_NOTIFY_OPTION *option, return True; } -/******************************************************************* -reads or writes an NOTIFY INFO DATA structure. -********************************************************************/ - -static bool smb_io_notify_info_data(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0x0FF0ADDE; - - prs_debug(ps, depth, desc, "smb_io_notify_info_data"); - depth++; - - if(!prs_align(ps)) - return False; - if(!prs_uint16("type", ps, depth, &data->type)) - return False; - if(!prs_uint16("field", ps, depth, &data->field)) - return False; - - if(!prs_uint32("how many words", ps, depth, &data->size)) - return False; - if(!prs_uint32("id", ps, depth, &data->id)) - return False; - if(!prs_uint32("how many words", ps, depth, &data->size)) - return False; - - switch (data->enc_type) { - - /* One and two value data has two uint32 values */ - - case NOTIFY_ONE_VALUE: - case NOTIFY_TWO_VALUE: - - if(!prs_uint32("value[0]", ps, depth, &data->notify_data.value[0])) - return False; - if(!prs_uint32("value[1]", ps, depth, &data->notify_data.value[1])) - return False; - break; - - /* Pointers and strings have a string length and a - pointer. For a string the length is expressed as - the number of uint16 characters plus a trailing - \0\0. */ - - case NOTIFY_POINTER: - - if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length )) - return False; - if(!prs_uint32("pointer", ps, depth, &useless_ptr)) - return False; - - break; - - case NOTIFY_STRING: - - if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length)) - return False; - - if(!prs_uint32("pointer", ps, depth, &useless_ptr)) - return False; - - break; - - case NOTIFY_SECDESC: - if( !prs_uint32( "sd size", ps, depth, &data->notify_data.sd.size ) ) - return False; - if( !prs_uint32( "pointer", ps, depth, &useless_ptr ) ) - return False; - - break; - - default: - DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data\n", - data->enc_type)); - break; - } - - return True; -} - -/******************************************************************* -reads or writes an NOTIFY INFO DATA structure. -********************************************************************/ - -bool smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "smb_io_notify_info_data_strings"); - depth++; - - if(!prs_align(ps)) - return False; - - switch(data->enc_type) { - - /* No data for values */ - - case NOTIFY_ONE_VALUE: - case NOTIFY_TWO_VALUE: - - break; - - /* Strings start with a length in uint16s */ - - case NOTIFY_STRING: - - if (MARSHALLING(ps)) - data->notify_data.data.length /= 2; - - if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length)) - return False; - - if (UNMARSHALLING(ps) && data->notify_data.data.length) { - data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, - data->notify_data.data.length); - - if (!data->notify_data.data.string) - return False; - } - - if (!prs_uint16uni(True, "string", ps, depth, data->notify_data.data.string, - data->notify_data.data.length)) - return False; - - if (MARSHALLING(ps)) - data->notify_data.data.length *= 2; - - break; - - case NOTIFY_POINTER: - - if (UNMARSHALLING(ps) && data->notify_data.data.length) { - data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, - data->notify_data.data.length); - - if (!data->notify_data.data.string) - return False; - } - - if(!prs_uint8s(True,"buffer",ps,depth,(uint8*)data->notify_data.data.string,data->notify_data.data.length)) - return False; - - break; - - case NOTIFY_SECDESC: - if( !prs_uint32("secdesc size ", ps, depth, &data->notify_data.sd.size ) ) - return False; - if ( !sec_io_desc( "sec_desc", &data->notify_data.sd.desc, ps, depth ) ) - return False; - break; - - default: - DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data_strings\n", - data->enc_type)); - break; - } - -#if 0 - if (isvalue==False) { - - /* length of string in unicode include \0 */ - x=data->notify_data.data.length+1; - - if (data->field != 16) - if(!prs_uint32("string length", ps, depth, &x )) - return False; - - if (MARSHALLING(ps)) { - /* These are already in little endian format. Don't byte swap. */ - if (x == 1) { - - /* No memory allocated for this string - therefore following the data.string - pointer is a bad idea. Use a pointer to - the uint32 length union member to - provide a source for a unicode NULL */ - - if(!prs_uint8s(True,"string",ps,depth, (uint8 *)&data->notify_data.data.length,x*2)) - return False; - } else { - - if (data->field == 16) - x /= 2; - - if(!prs_uint16uni(True,"string",ps,depth,data->notify_data.data.string,x)) - return False; - } - } else { - - /* Tallocate memory for string */ - - if (x) { - data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, x * 2); - if (!data->notify_data.data.string) - return False; - } else { - data->notify_data.data.string = NULL; - } - - if(!prs_uint16uni(True,"string",ps,depth,data->notify_data.data.string,x)) - return False; - } - } - -#endif - -#if 0 /* JERRY */ - /* Win2k does not seem to put this parse align here */ - if(!prs_align(ps)) - return False; -#endif - - return True; -} - -/******************************************************************* -reads or writes an NOTIFY INFO structure. -********************************************************************/ - -static bool smb_io_notify_info(const char *desc, SPOOL_NOTIFY_INFO *info, prs_struct *ps, int depth) -{ - int i; - - prs_debug(ps, depth, desc, "smb_io_notify_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("count", ps, depth, &info->count)) - return False; - if(!prs_uint32("version", ps, depth, &info->version)) - return False; - if(!prs_uint32("flags", ps, depth, &info->flags)) - return False; - if(!prs_uint32("count", ps, depth, &info->count)) - return False; - - for (i=0;icount;i++) { - if(!smb_io_notify_info_data(desc, &info->data[i], ps, depth)) - return False; - } - - /* now do the strings at the end of the stream */ - for (i=0;icount;i++) { - if(!smb_io_notify_info_data_strings(desc, &info->data[i], ps, depth)) - return False; - } - - return True; -} - /******************************************************************* ********************************************************************/ @@ -4557,72 +4306,6 @@ void free_job_info_2(JOB_INFO_2 *job) free_devmode(job->devmode); } -#if 0 /* JERRY - not currently used but could be :-) */ - -/******************************************************************* - Deep copy a SPOOL_NOTIFY_INFO_DATA structure - ******************************************************************/ -static bool copy_spool_notify_info_data(SPOOL_NOTIFY_INFO_DATA *dst, - SPOOL_NOTIFY_INFO_DATA *src, int n) -{ - int i; - - memcpy(dst, src, sizeof(SPOOL_NOTIFY_INFO_DATA)*n); - - for (i=0; isize != POINTER) - continue; - len = src->notify_data.data.length; - s = SMB_MALLOC_ARRAY(uint16, len); - if (s == NULL) { - DEBUG(0,("copy_spool_notify_info_data: malloc() failed!\n")); - return False; - } - - memcpy(s, src->notify_data.data.string, len*2); - dst->notify_data.data.string = s; - } - - return True; -} - -/******************************************************************* - Deep copy a SPOOL_NOTIFY_INFO structure - ******************************************************************/ -static bool copy_spool_notify_info(SPOOL_NOTIFY_INFO *dst, SPOOL_NOTIFY_INFO *src) -{ - if (!dst) { - DEBUG(0,("copy_spool_notify_info: NULL destination pointer!\n")); - return False; - } - - dst->version = src->version; - dst->flags = src->flags; - dst->count = src->count; - - if (dst->count) - { - dst->data = SMB_MALLOC_ARRAY(SPOOL_NOTIFY_INFO_DATA, dst->count); - - DEBUG(10,("copy_spool_notify_info: allocating space for [%d] PRINTER_NOTIFY_INFO_DATA entries\n", - dst->count)); - - if (dst->data == NULL) { - DEBUG(0,("copy_spool_notify_info: malloc() failed for [%d] entries!\n", - dst->count)); - return False; - } - - return (copy_spool_notify_info_data(dst->data, src->data, src->count)); - } - - return True; -} -#endif /* JERRY */ - /******************************************************************* * read a structure. ********************************************************************/ -- cgit