summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_spoolss.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse/parse_spoolss.c')
-rw-r--r--source3/rpc_parse/parse_spoolss.c1999
1 files changed, 0 insertions, 1999 deletions
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index 577ba73a42..78c041f863 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -71,459 +71,6 @@ bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime)
}
/*******************************************************************
-reads or writes an NOTIFY OPTION TYPE structure.
-********************************************************************/
-
-/* NOTIFY_OPTION_TYPE and NOTIFY_OPTION_TYPE_DATA are really one
- structure. The _TYPE structure is really the deferred referrants (i.e
- the notify fields array) of the _TYPE structure. -tpot */
-
-static bool smb_io_notify_option_type(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "smb_io_notify_option_type");
- depth++;
-
- if (!prs_align(ps))
- return False;
-
- if(!prs_uint16("type", ps, depth, &type->type))
- return False;
- if(!prs_uint16("reserved0", ps, depth, &type->reserved0))
- return False;
- if(!prs_uint32("reserved1", ps, depth, &type->reserved1))
- return False;
- if(!prs_uint32("reserved2", ps, depth, &type->reserved2))
- return False;
- if(!prs_uint32("count", ps, depth, &type->count))
- return False;
- if(!prs_uint32("fields_ptr", ps, depth, &type->fields_ptr))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes an NOTIFY OPTION TYPE DATA.
-********************************************************************/
-
-static bool smb_io_notify_option_type_data(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth)
-{
- int i;
-
- prs_debug(ps, depth, desc, "smb_io_notify_option_type_data");
- depth++;
-
- /* if there are no fields just return */
- if (type->fields_ptr==0)
- return True;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("count2", ps, depth, &type->count2))
- return False;
-
- if (type->count2 != type->count)
- DEBUG(4,("What a mess, count was %x now is %x !\n", type->count, type->count2));
-
- if (type->count2 > MAX_NOTIFY_TYPE_FOR_NOW) {
- return False;
- }
-
- /* parse the option type data */
- for(i=0;i<type->count2;i++)
- if(!prs_uint16("fields",ps,depth,&type->fields[i]))
- return False;
- return True;
-}
-
-/*******************************************************************
-reads or writes an NOTIFY OPTION structure.
-********************************************************************/
-
-static bool smb_io_notify_option_type_ctr(const char *desc, SPOOL_NOTIFY_OPTION_TYPE_CTR *ctr , prs_struct *ps, int depth)
-{
- int i;
-
- prs_debug(ps, depth, desc, "smb_io_notify_option_type_ctr");
- depth++;
-
- if(!prs_uint32("count", ps, depth, &ctr->count))
- return False;
-
- /* reading */
- if (UNMARSHALLING(ps) && ctr->count)
- if((ctr->type=PRS_ALLOC_MEM(ps,SPOOL_NOTIFY_OPTION_TYPE,ctr->count)) == NULL)
- return False;
-
- /* the option type struct */
- for(i=0;i<ctr->count;i++)
- if(!smb_io_notify_option_type("", &ctr->type[i] , ps, depth))
- return False;
-
- /* the type associated with the option type struct */
- for(i=0;i<ctr->count;i++)
- if(!smb_io_notify_option_type_data("", &ctr->type[i] , ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes an NOTIFY OPTION structure.
-********************************************************************/
-
-static bool smb_io_notify_option(const char *desc, SPOOL_NOTIFY_OPTION *option, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "smb_io_notify_option");
- depth++;
-
- if(!prs_uint32("version", ps, depth, &option->version))
- return False;
- if(!prs_uint32("flags", ps, depth, &option->flags))
- return False;
- if(!prs_uint32("count", ps, depth, &option->count))
- return False;
- if(!prs_uint32("option_type_ptr", ps, depth, &option->option_type_ptr))
- return False;
-
- /* marshalling or unmarshalling, that would work */
- if (option->option_type_ptr!=0) {
- if(!smb_io_notify_option_type_ctr("", &option->ctr ,ps, depth))
- return False;
- }
- else {
- option->ctr.type=NULL;
- option->ctr.count=0;
- }
-
- 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;i<info->count;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;i<info->count;i++) {
- if(!smb_io_notify_info_data_strings(desc, &info->data[i], ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u )
-{
- prs_debug(ps, depth, desc, "");
- depth++;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("size", ps, depth, &q_u->size))
- return False;
-
- if (!prs_io_unistr2_p("", ps, depth, &q_u->client_name))
- return False;
- if (!prs_io_unistr2_p("", ps, depth, &q_u->user_name))
- return False;
-
- if (!prs_uint32("build", ps, depth, &q_u->build))
- return False;
- if (!prs_uint32("major", ps, depth, &q_u->major))
- return False;
- if (!prs_uint32("minor", ps, depth, &q_u->minor))
- return False;
- if (!prs_uint32("processor", ps, depth, &q_u->processor))
- return False;
-
- if (!prs_io_unistr2("", ps, depth, q_u->client_name))
- return False;
- if (!prs_align(ps))
- return False;
-
- if (!prs_io_unistr2("", ps, depth, q_u->user_name))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-static bool spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, int depth)
-{
- if (q_u==NULL)
- return False;
-
- prs_debug(ps, depth, desc, "spool_io_user_level");
- depth++;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("level", ps, depth, &q_u->level))
- return False;
-
- switch ( q_u->level )
- {
- case 1:
- if ( !prs_pointer( "" , ps, depth, (void*)&q_u->user.user1,
- sizeof(SPOOL_USER_1), (PRS_POINTER_CAST)spool_io_user_level_1 ))
- {
- return False;
- }
- break;
- default:
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
* read or write a DEVICEMODE struct.
* on reading allocate memory for the private member
********************************************************************/
@@ -712,220 +259,6 @@ bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE
}
/*******************************************************************
- Read or write a DEVICEMODE container
-********************************************************************/
-
-static bool spoolss_io_devmode_cont(const char *desc, DEVMODE_CTR *dm_c, prs_struct *ps, int depth)
-{
- if (dm_c==NULL)
- return False;
-
- prs_debug(ps, depth, desc, "spoolss_io_devmode_cont");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (!prs_uint32("size", ps, depth, &dm_c->size))
- return False;
-
- if (!prs_uint32("devmode_ptr", ps, depth, &dm_c->devmode_ptr))
- return False;
-
- if (dm_c->size==0 || dm_c->devmode_ptr==0) {
- if (UNMARSHALLING(ps))
- /* if while reading there is no DEVMODE ... */
- dm_c->devmode=NULL;
- return True;
- }
-
- /* so we have a DEVICEMODE to follow */
- if (UNMARSHALLING(ps)) {
- DEBUG(9,("Allocating memory for spoolss_io_devmode\n"));
- dm_c->devmode=PRS_ALLOC_MEM(ps,DEVICEMODE,1);
- if(dm_c->devmode == NULL)
- return False;
- }
-
- /* this is bad code, shouldn't be there */
- if (!prs_uint32("size", ps, depth, &dm_c->size))
- return False;
-
- if (!spoolss_io_devmode(desc, ps, depth, dm_c->devmode))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u,
- const char *srv_name, const char* clientname, const char* user_name,
- uint32 level, PRINTER_INFO_CTR *ctr)
-{
- DEBUG(5,("make_spoolss_q_addprinterex\n"));
-
- if (!ctr || !ctr->printers_2)
- return False;
-
- ZERO_STRUCTP(q_u);
-
- q_u->server_name = TALLOC_P( mem_ctx, UNISTR2 );
- if (!q_u->server_name) {
- return False;
- }
- init_unistr2(q_u->server_name, srv_name, UNI_FLAGS_NONE);
-
- q_u->level = level;
-
- q_u->info.level = level;
- q_u->info.info_ptr = (ctr->printers_2!=NULL)?1:0;
- switch (level) {
- case 2:
- /* init q_u->info.info2 from *info */
- if (!make_spoolss_printer_info_2(mem_ctx, &q_u->info.info_2, ctr->printers_2)) {
- DEBUG(0,("make_spoolss_q_addprinterex: Unable to fill SPOOL_Q_ADDPRINTEREX struct!\n"));
- return False;
- }
- break;
- default :
- break;
- }
-
- q_u->user_switch=1;
-
- q_u->user_ctr.level = 1;
- q_u->user_ctr.user.user1 = TALLOC_P( talloc_tos(), SPOOL_USER_1 );
- if (!q_u->user_ctr.user.user1) {
- return False;
- }
- q_u->user_ctr.user.user1->build = 1381;
- q_u->user_ctr.user.user1->major = 2;
- q_u->user_ctr.user.user1->minor = 0;
- q_u->user_ctr.user.user1->processor = 0;
-
- q_u->user_ctr.user.user1->client_name = TALLOC_P( mem_ctx, UNISTR2 );
- if (!q_u->user_ctr.user.user1->client_name) {
- return False;
- }
- q_u->user_ctr.user.user1->user_name = TALLOC_P( mem_ctx, UNISTR2 );
- if (!q_u->user_ctr.user.user1->user_name) {
- return False;
- }
- init_unistr2(q_u->user_ctr.user.user1->client_name, clientname, UNI_STR_TERMINATE);
- init_unistr2(q_u->user_ctr.user.user1->user_name, user_name, UNI_STR_TERMINATE);
-
- q_u->user_ctr.user.user1->size = q_u->user_ctr.user.user1->user_name->uni_str_len +
- q_u->user_ctr.user.user1->client_name->uni_str_len + 2;
-
- return True;
-}
-
-/*******************************************************************
-create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct
-*******************************************************************/
-
-bool make_spoolss_printer_info_2(TALLOC_CTX *ctx, SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2,
- PRINTER_INFO_2 *info)
-{
-
- SPOOL_PRINTER_INFO_LEVEL_2 *inf;
-
- /* allocate the necessary memory */
- if (!(inf=TALLOC_P(ctx, SPOOL_PRINTER_INFO_LEVEL_2))) {
- DEBUG(0,("make_spoolss_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n"));
- return False;
- }
-
- inf->servername_ptr = (info->servername.buffer!=NULL)?1:0;
- inf->printername_ptr = (info->printername.buffer!=NULL)?1:0;
- inf->sharename_ptr = (info->sharename.buffer!=NULL)?1:0;
- inf->portname_ptr = (info->portname.buffer!=NULL)?1:0;
- inf->drivername_ptr = (info->drivername.buffer!=NULL)?1:0;
- inf->comment_ptr = (info->comment.buffer!=NULL)?1:0;
- inf->location_ptr = (info->location.buffer!=NULL)?1:0;
- inf->devmode_ptr = (info->devmode!=NULL)?1:0;
- inf->sepfile_ptr = (info->sepfile.buffer!=NULL)?1:0;
- inf->printprocessor_ptr = (info->printprocessor.buffer!=NULL)?1:0;
- inf->datatype_ptr = (info->datatype.buffer!=NULL)?1:0;
- inf->parameters_ptr = (info->parameters.buffer!=NULL)?1:0;
- inf->secdesc_ptr = (info->secdesc!=NULL)?1:0;
- inf->attributes = info->attributes;
- inf->priority = info->priority;
- inf->default_priority = info->defaultpriority;
- inf->starttime = info->starttime;
- inf->untiltime = info->untiltime;
- inf->cjobs = info->cjobs;
- inf->averageppm = info->averageppm;
- init_unistr2_from_unistr(inf, &inf->servername, &info->servername);
- init_unistr2_from_unistr(inf, &inf->printername, &info->printername);
- init_unistr2_from_unistr(inf, &inf->sharename, &info->sharename);
- init_unistr2_from_unistr(inf, &inf->portname, &info->portname);
- init_unistr2_from_unistr(inf, &inf->drivername, &info->drivername);
- init_unistr2_from_unistr(inf, &inf->comment, &info->comment);
- init_unistr2_from_unistr(inf, &inf->location, &info->location);
- init_unistr2_from_unistr(inf, &inf->sepfile, &info->sepfile);
- init_unistr2_from_unistr(inf, &inf->printprocessor, &info->printprocessor);
- init_unistr2_from_unistr(inf, &inf->datatype, &info->datatype);
- init_unistr2_from_unistr(inf, &inf->parameters, &info->parameters);
- init_unistr2_from_unistr(inf, &inf->datatype, &info->datatype);
-
- *spool_info2 = inf;
-
- return True;
-}
-
-/*******************************************************************
-create a SPOOL_PRINTER_INFO_3 struct from a PRINTER_INFO_3 struct
-*******************************************************************/
-
-bool make_spoolss_printer_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3 **spool_info3,
- PRINTER_INFO_3 *info)
-{
-
- SPOOL_PRINTER_INFO_LEVEL_3 *inf;
-
- /* allocate the necessary memory */
- if (!(inf=TALLOC_P(mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3))) {
- DEBUG(0,("make_spoolss_printer_info_3: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_3 sruct!\n"));
- return False;
- }
-
- inf->secdesc_ptr = (info->secdesc!=NULL)?1:0;
-
- *spool_info3 = inf;
-
- return True;
-}
-
-/*******************************************************************
-create a SPOOL_PRINTER_INFO_7 struct from a PRINTER_INFO_7 struct
-*******************************************************************/
-
-bool make_spoolss_printer_info_7(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7 **spool_info7,
- PRINTER_INFO_7 *info)
-{
-
- SPOOL_PRINTER_INFO_LEVEL_7 *inf;
-
- /* allocate the necessary memory */
- if (!(inf=TALLOC_P(mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7))) {
- DEBUG(0,("make_spoolss_printer_info_7: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_7 struct!\n"));
- return False;
- }
-
- inf->guid_ptr = (info->guid.buffer!=NULL)?1:0;
- inf->action = info->action;
- init_unistr2_from_unistr(inf, &inf->guid, &info->guid);
-
- *spool_info7 = inf;
-
- return True;
-}
-
-/*******************************************************************
* make a structure.
********************************************************************/
@@ -1014,130 +347,6 @@ bool spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u,
}
/*******************************************************************
- * read a structure.
- * called from spoolss_q_rffpcnex (srv_spoolss.c)
- ********************************************************************/
-
-bool spoolss_io_q_rffpcnex(const char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spoolss_io_q_rffpcnex");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth))
- return False;
- if(!prs_uint32("flags", ps, depth, &q_u->flags))
- return False;
- if(!prs_uint32("options", ps, depth, &q_u->options))
- return False;
- if(!prs_uint32("localmachine_ptr", ps, depth, &q_u->localmachine_ptr))
- return False;
- if(!smb_io_unistr2("localmachine", &q_u->localmachine, q_u->localmachine_ptr, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("printerlocal", ps, depth, &q_u->printerlocal))
- return False;
-
- if(!prs_uint32("option_ptr", ps, depth, &q_u->option_ptr))
- return False;
-
- if (q_u->option_ptr!=0) {
-
- if (UNMARSHALLING(ps))
- if((q_u->option=PRS_ALLOC_MEM(ps,SPOOL_NOTIFY_OPTION,1)) == NULL)
- return False;
-
- if(!smb_io_notify_option("notify option", q_u->option, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
- * write a structure.
- * called from spoolss_r_rffpcnex (srv_spoolss.c)
- ********************************************************************/
-
-bool spoolss_io_r_rffpcnex(const char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spoolss_io_r_rffpcnex");
- depth++;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- * read a structure.
- * called from spoolss_q_rfnpcnex (srv_spoolss.c)
- ********************************************************************/
-
-bool spoolss_io_q_rfnpcnex(const char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spoolss_io_q_rfnpcnex");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth))
- return False;
-
- if(!prs_uint32("change", ps, depth, &q_u->change))
- return False;
-
- if(!prs_uint32("option_ptr", ps, depth, &q_u->option_ptr))
- return False;
-
- if (q_u->option_ptr!=0) {
-
- if (UNMARSHALLING(ps))
- if((q_u->option=PRS_ALLOC_MEM(ps,SPOOL_NOTIFY_OPTION,1)) == NULL)
- return False;
-
- if(!smb_io_notify_option("notify option", q_u->option, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
- * write a structure.
- * called from spoolss_r_rfnpcnex (srv_spoolss.c)
- ********************************************************************/
-
-bool spoolss_io_r_rfnpcnex(const char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spoolss_io_r_rfnpcnex");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (!prs_uint32("info_ptr", ps, depth, &r_u->info_ptr))
- return False;
-
- if(!smb_io_notify_info("notify info", &r_u->info ,ps,depth))
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
* return the length of a uint16 (obvious, but the code is clean)
********************************************************************/
@@ -2556,33 +1765,6 @@ uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info)
}
/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-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)
-{
- if (q_u == NULL)
- return False;
-
- memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
-
- init_buf_unistr2(&q_u->architecture, &q_u->architecture_ptr, architecture);
-
- q_u->level=level;
- q_u->clientmajorversion=clientmajor;
- q_u->clientminorversion=clientminor;
-
- q_u->buffer=buffer;
- q_u->offered=offered;
-
- return True;
-}
-
-/*******************************************************************
* read a structure.
* called from spoolss_getprinterdriver2 (srv_spoolss.c)
********************************************************************/
@@ -2823,211 +2005,6 @@ bool spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_stru
}
/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_getprinter(
- TALLOC_CTX *mem_ctx,
- SPOOL_Q_GETPRINTER *q_u,
- const POLICY_HND *hnd,
- uint32 level,
- RPC_BUFFER *buffer,
- uint32 offered
-)
-{
- if (q_u == NULL)
- {
- return False;
- }
- memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
-
- q_u->level=level;
- q_u->buffer=buffer;
- q_u->offered=offered;
-
- return True;
-}
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-bool make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u,
- const POLICY_HND *hnd, uint32 level, PRINTER_INFO_CTR *info,
- uint32 command)
-{
- SEC_DESC *secdesc;
- DEVICEMODE *devmode;
-
- if (!q_u || !info)
- return False;
-
- memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
-
- q_u->level = level;
- q_u->info.level = level;
- q_u->info.info_ptr = 1; /* Info is != NULL, see above */
- switch (level) {
-
- /* There's no such thing as a setprinter level 1 */
-
- case 2:
- secdesc = info->printers_2->secdesc;
- devmode = info->printers_2->devmode;
-
- make_spoolss_printer_info_2 (mem_ctx, &q_u->info.info_2, info->printers_2);
-#if 1 /* JERRY TEST */
- q_u->secdesc_ctr = SMB_MALLOC_P(SEC_DESC_BUF);
- if (!q_u->secdesc_ctr)
- return False;
- q_u->secdesc_ctr->sd = secdesc;
- q_u->secdesc_ctr->sd_size = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0;
-
- q_u->devmode_ctr.devmode_ptr = (devmode != NULL) ? 1 : 0;
- q_u->devmode_ctr.size = (devmode != NULL) ? sizeof(DEVICEMODE) + (3*sizeof(uint32)) : 0;
- q_u->devmode_ctr.devmode = devmode;
-#else
- q_u->secdesc_ctr = NULL;
-
- q_u->devmode_ctr.devmode_ptr = 0;
- q_u->devmode_ctr.size = 0;
- q_u->devmode_ctr.devmode = NULL;
-#endif
- break;
- case 3:
- secdesc = info->printers_3->secdesc;
-
- make_spoolss_printer_info_3 (mem_ctx, &q_u->info.info_3, info->printers_3);
-
- q_u->secdesc_ctr = SMB_MALLOC_P(SEC_DESC_BUF);
- if (!q_u->secdesc_ctr)
- return False;
- q_u->secdesc_ctr->sd_size = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0;
- q_u->secdesc_ctr->sd = secdesc;
-
- break;
- case 7:
- make_spoolss_printer_info_7 (mem_ctx, &q_u->info.info_7, info->printers_7);
- break;
-
- default:
- DEBUG(0,("make_spoolss_q_setprinter: Unknown info level [%d]\n", level));
- break;
- }
-
-
- q_u->command = command;
-
- return True;
-}
-
-
-/*******************************************************************
-********************************************************************/
-
-bool spoolss_io_r_setprinter(const char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spoolss_io_r_setprinter");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Marshall/unmarshall a SPOOL_Q_SETPRINTER struct.
-********************************************************************/
-
-bool spoolss_io_q_setprinter(const char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth)
-{
- uint32 ptr_sec_desc = 0;
-
- prs_debug(ps, depth, desc, "spoolss_io_q_setprinter");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("printer handle", &q_u->handle ,ps, depth))
- return False;
- if(!prs_uint32("level", ps, depth, &q_u->level))
- return False;
-
- /* check for supported levels and structures we know about */
-
- switch ( q_u->level ) {
- case 0:
- case 2:
- case 3:
- case 7:
- /* supported levels */
- break;
- default:
- DEBUG(0,("spoolss_io_q_setprinter: unsupported printer info level [%d]\n",
- q_u->level));
- return True;
- }
-
-
- if(!spool_io_printer_info_level("", &q_u->info, ps, depth))
- return False;
-
- if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- switch (q_u->level)
- {
- case 2:
- {
- ptr_sec_desc = q_u->info.info_2->secdesc_ptr;
- break;
- }
- case 3:
- {
- /* FIXME ! Our parsing here is wrong I think,
- * but for a level3 it makes no sense for
- * ptr_sec_desc to be NULL. JRA. Based on
- * a Vista sniff from Martin Zielinski <mz@seh.de>.
- */
- if (UNMARSHALLING(ps)) {
- ptr_sec_desc = 1;
- } else {
- ptr_sec_desc = q_u->info.info_3->secdesc_ptr;
- }
- break;
- }
- }
- if (ptr_sec_desc)
- {
- if (!sec_io_desc_buf(desc, &q_u->secdesc_ctr, ps, depth))
- return False;
- } else {
- uint32 dummy = 0;
-
- /* Parse a NULL security descriptor. This should really
- happen inside the sec_io_desc_buf() function. */
-
- prs_debug(ps, depth, "", "sec_io_desc_buf");
- if (!prs_uint32("size", ps, depth + 1, &dummy))
- return False;
- if (!prs_uint32("ptr", ps, depth + 1, &dummy))
- return False;
- }
-
- if(!prs_uint32("command", ps, depth, &q_u->command))
- return False;
-
- return True;
-}
-
-/*******************************************************************
********************************************************************/
bool spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth)
@@ -3323,701 +2300,6 @@ bool spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct
}
/*******************************************************************
- Parse a SPOOL_PRINTER_INFO_LEVEL_1 structure.
-********************************************************************/
-
-bool spool_io_printer_info_level_1(const char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spool_io_printer_info_level_1");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("flags", ps, depth, &il->flags))
- return False;
- if(!prs_uint32("description_ptr", ps, depth, &il->description_ptr))
- return False;
- if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr))
- return False;
- if(!prs_uint32("comment_ptr", ps, depth, &il->comment_ptr))
- return False;
-
- if(!smb_io_unistr2("description", &il->description, il->description_ptr, ps, depth))
- return False;
- if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth))
- return False;
- if(!smb_io_unistr2("comment", &il->comment, il->comment_ptr, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Parse a SPOOL_PRINTER_INFO_LEVEL_3 structure.
-********************************************************************/
-
-bool spool_io_printer_info_level_3(const char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spool_io_printer_info_level_3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("secdesc_ptr", ps, depth, &il->secdesc_ptr))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure.
-********************************************************************/
-
-bool spool_io_printer_info_level_2(const char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spool_io_printer_info_level_2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("servername_ptr", ps, depth, &il->servername_ptr))
- return False;
- if(!prs_uint32("printername_ptr", ps, depth, &il->printername_ptr))
- return False;
- if(!prs_uint32("sharename_ptr", ps, depth, &il->sharename_ptr))
- return False;
- if(!prs_uint32("portname_ptr", ps, depth, &il->portname_ptr))
- return False;
-
- if(!prs_uint32("drivername_ptr", ps, depth, &il->drivername_ptr))
- return False;
- if(!prs_uint32("comment_ptr", ps, depth, &il->comment_ptr))
- return False;
- if(!prs_uint32("location_ptr", ps, depth, &il->location_ptr))
- return False;
- if(!prs_uint32("devmode_ptr", ps, depth, &il->devmode_ptr))
- return False;
- if(!prs_uint32("sepfile_ptr", ps, depth, &il->sepfile_ptr))
- return False;
- if(!prs_uint32("printprocessor_ptr", ps, depth, &il->printprocessor_ptr))
- return False;
- if(!prs_uint32("datatype_ptr", ps, depth, &il->datatype_ptr))
- return False;
- if(!prs_uint32("parameters_ptr", ps, depth, &il->parameters_ptr))
- return False;
- if(!prs_uint32("secdesc_ptr", ps, depth, &il->secdesc_ptr))
- return False;
-
- if(!prs_uint32("attributes", ps, depth, &il->attributes))
- return False;
- if(!prs_uint32("priority", ps, depth, &il->priority))
- return False;
- if(!prs_uint32("default_priority", ps, depth, &il->default_priority))
- return False;
- if(!prs_uint32("starttime", ps, depth, &il->starttime))
- return False;
- if(!prs_uint32("untiltime", ps, depth, &il->untiltime))
- return False;
- if(!prs_uint32("status", ps, depth, &il->status))
- return False;
- if(!prs_uint32("cjobs", ps, depth, &il->cjobs))
- return False;
- if(!prs_uint32("averageppm", ps, depth, &il->averageppm))
- return False;
-
- if(!smb_io_unistr2("servername", &il->servername, il->servername_ptr, ps, depth))
- return False;
- if(!smb_io_unistr2("printername", &il->printername, il->printername_ptr, ps, depth))
- return False;
- if(!smb_io_unistr2("sharename", &il->sharename, il->sharename_ptr, ps, depth))
- return False;
- if(!smb_io_unistr2("portname", &il->portname, il->portname_ptr, ps, depth))
- return False;
- if(!smb_io_unistr2("drivername", &il->drivername, il->drivername_ptr, ps, depth))
- return False;
- if(!smb_io_unistr2("comment", &il->comment, il->comment_ptr, ps, depth))
- return False;
- if(!smb_io_unistr2("location", &il->location, il->location_ptr, ps, depth))
- return False;
- if(!smb_io_unistr2("sepfile", &il->sepfile, il->sepfile_ptr, ps, depth))
- return False;
- if(!smb_io_unistr2("printprocessor", &il->printprocessor, il->printprocessor_ptr, ps, depth))
- return False;
- if(!smb_io_unistr2("datatype", &il->datatype, il->datatype_ptr, ps, depth))
- return False;
- if(!smb_io_unistr2("parameters", &il->parameters, il->parameters_ptr, ps, depth))
- return False;
-
- return True;
-}
-
-bool spool_io_printer_info_level_7(const char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spool_io_printer_info_level_7");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("guid_ptr", ps, depth, &il->guid_ptr))
- return False;
- if(!prs_uint32("action", ps, depth, &il->action))
- return False;
-
- if(!smb_io_unistr2("servername", &il->guid, il->guid_ptr, ps, depth))
- return False;
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spool_io_printer_info_level");
- depth++;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("level", ps, depth, &il->level))
- return False;
- if(!prs_uint32("info_ptr", ps, depth, &il->info_ptr))
- return False;
-
- /* if no struct inside just return */
- if (il->info_ptr==0) {
- if (UNMARSHALLING(ps)) {
- il->info_1=NULL;
- il->info_2=NULL;
- }
- return True;
- }
-
- switch (il->level) {
- /*
- * level 0 is used by setprinter when managing the queue
- * (hold, stop, start a queue)
- */
- case 0:
- break;
- /* DOCUMENT ME!!! What is level 1 used for? */
- case 1:
- {
- if (UNMARSHALLING(ps)) {
- if ((il->info_1=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_INFO_LEVEL_1,1)) == NULL)
- return False;
- }
- if (!spool_io_printer_info_level_1("", il->info_1, ps, depth))
- return False;
- break;
- }
- /*
- * level 2 is used by addprinter
- * and by setprinter when updating printer's info
- */
- case 2:
- if (UNMARSHALLING(ps)) {
- if ((il->info_2=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_INFO_LEVEL_2,1)) == NULL)
- return False;
- }
- if (!spool_io_printer_info_level_2("", il->info_2, ps, depth))
- return False;
- break;
- /* DOCUMENT ME!!! What is level 3 used for? */
- case 3:
- {
- if (UNMARSHALLING(ps)) {
- if ((il->info_3=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_INFO_LEVEL_3,1)) == NULL)
- return False;
- }
- if (!spool_io_printer_info_level_3("", il->info_3, ps, depth))
- return False;
- break;
- }
- case 7:
- if (UNMARSHALLING(ps))
- if ((il->info_7=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_INFO_LEVEL_7,1)) == NULL)
- return False;
- if (!spool_io_printer_info_level_7("", il->info_7, ps, depth))
- return False;
- break;
- }
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth)
-{
- uint32 ptr_sec_desc = 0;
-
- prs_debug(ps, depth, desc, "spoolss_io_q_addprinterex");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (!prs_io_unistr2_p("ptr", ps, depth, &q_u->server_name))
- return False;
- if (!prs_io_unistr2("servername", ps, depth, q_u->server_name))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("info_level", ps, depth, &q_u->level))
- return False;
-
- if(!spool_io_printer_info_level("", &q_u->info, ps, depth))
- return False;
-
- if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- switch (q_u->level) {
- case 2:
- ptr_sec_desc = q_u->info.info_2->secdesc_ptr;
- break;
- case 3:
- ptr_sec_desc = q_u->info.info_3->secdesc_ptr;
- break;
- }
- if (ptr_sec_desc) {
- if (!sec_io_desc_buf(desc, &q_u->secdesc_ctr, ps, depth))
- return False;
- } else {
- uint32 dummy = 0;
-
- /* Parse a NULL security descriptor. This should really
- happen inside the sec_io_desc_buf() function. */
-
- prs_debug(ps, depth, "", "sec_io_desc_buf");
- if (!prs_uint32("size", ps, depth + 1, &dummy))
- return False;
- if (!prs_uint32("ptr", ps, depth + 1, &dummy))
- return False;
- }
-
- if(!prs_uint32("user_switch", ps, depth, &q_u->user_switch))
- return False;
- if(!spool_io_user_level("", &q_u->user_ctr, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex");
- depth++;
-
- if(!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- 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;
-}
-
-/*******************************************************************
- init a SPOOL_Q_ADDPRINTERDRIVER struct
- ******************************************************************/
-
-bool make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx,
- SPOOL_Q_ADDPRINTERDRIVER *q_u, const char* srv_name,
- uint32 level, PRINTER_DRIVER_CTR *info)
-{
- DEBUG(5,("make_spoolss_q_addprinterdriver\n"));
-
- if (!srv_name || !info) {
- return False;
- }
-
- q_u->server_name_ptr = 1; /* srv_name is != NULL, see above */
- init_unistr2(&q_u->server_name, srv_name, UNI_STR_TERMINATE);
-
- q_u->level = level;
-
- q_u->info.level = level;
- q_u->info.ptr = 1; /* Info is != NULL, see above */
- switch (level)
- {
- /* info level 3 is supported by Windows 95/98, WinNT and Win2k */
- case 3 :
- make_spoolss_driver_info_3(mem_ctx, &q_u->info.info_3, info->info3);
- break;
-
- default:
- DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown info level [%d]\n", level));
- break;
- }
-
- return True;
-}
-
-bool make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx,
- SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **spool_drv_info,
- DRIVER_INFO_3 *info3)
-{
- uint32 len = 0;
- SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *inf;
-
- if (!(inf=TALLOC_ZERO_P(mem_ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)))
- return False;
-
- inf->cversion = info3->version;
- inf->name_ptr = (info3->name.buffer!=NULL)?1:0;
- inf->environment_ptr = (info3->architecture.buffer!=NULL)?1:0;
- inf->driverpath_ptr = (info3->driverpath.buffer!=NULL)?1:0;
- inf->datafile_ptr = (info3->datafile.buffer!=NULL)?1:0;
- inf->configfile_ptr = (info3->configfile.buffer!=NULL)?1:0;
- inf->helpfile_ptr = (info3->helpfile.buffer!=NULL)?1:0;
- inf->monitorname_ptr = (info3->monitorname.buffer!=NULL)?1:0;
- inf->defaultdatatype_ptr = (info3->defaultdatatype.buffer!=NULL)?1:0;
-
- init_unistr2_from_unistr(inf, &inf->name, &info3->name);
- init_unistr2_from_unistr(inf, &inf->environment, &info3->architecture);
- init_unistr2_from_unistr(inf, &inf->driverpath, &info3->driverpath);
- init_unistr2_from_unistr(inf, &inf->datafile, &info3->datafile);
- init_unistr2_from_unistr(inf, &inf->configfile, &info3->configfile);
- init_unistr2_from_unistr(inf, &inf->helpfile, &info3->helpfile);
- init_unistr2_from_unistr(inf, &inf->monitorname, &info3->monitorname);
- init_unistr2_from_unistr(inf, &inf->defaultdatatype, &info3->defaultdatatype);
-
- if (info3->dependentfiles) {
- bool done = False;
- bool null_char = False;
- uint16 *ptr = info3->dependentfiles;
-
- while (!done) {
- switch (*ptr) {
- case 0:
- /* the null_char bool is used to help locate
- two '\0's back to back */
- if (null_char) {
- done = True;
- } else {
- null_char = True;
- }
- break;
-
- default:
- null_char = False;
- break;
- }
- len++;
- ptr++;
- }
- }
-
- inf->dependentfiles_ptr = (info3->dependentfiles != NULL) ? 1 : 0;
- inf->dependentfilessize = (info3->dependentfiles != NULL) ? len : 0;
- if(!make_spoolss_buffer5(mem_ctx, &inf->dependentfiles, len, info3->dependentfiles)) {
- SAFE_FREE(inf);
- return False;
- }
-
- *spool_drv_info = inf;
-
- return True;
-}
-
-/*******************************************************************
make a BUFFER5 struct from a uint16*
******************************************************************/
@@ -4042,79 +2324,6 @@ bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16
}
/*******************************************************************
- 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;
-}
-
-/*******************************************************************
- ********************************************************************/
-
-bool uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni,
- NT_PRINTER_INFO_LEVEL_2 *d)
-{
- DEBUG(7,("Converting from UNICODE to ASCII\n"));
-
- d->attributes=uni->attributes;
- d->priority=uni->priority;
- d->default_priority=uni->default_priority;
- d->starttime=uni->starttime;
- d->untiltime=uni->untiltime;
- d->status=uni->status;
- d->cjobs=uni->cjobs;
-
- unistr2_to_ascii(d->servername, &uni->servername, sizeof(d->servername));
- unistr2_to_ascii(d->printername, &uni->printername, sizeof(d->printername));
- unistr2_to_ascii(d->sharename, &uni->sharename, sizeof(d->sharename));
- unistr2_to_ascii(d->portname, &uni->portname, sizeof(d->portname));
- unistr2_to_ascii(d->drivername, &uni->drivername, sizeof(d->drivername));
- unistr2_to_ascii(d->comment, &uni->comment, sizeof(d->comment));
- unistr2_to_ascii(d->location, &uni->location, sizeof(d->location));
- unistr2_to_ascii(d->sepfile, &uni->sepfile, sizeof(d->sepfile));
- unistr2_to_ascii(d->printprocessor, &uni->printprocessor, sizeof(d->printprocessor));
- unistr2_to_ascii(d->datatype, &uni->datatype, sizeof(d->datatype));
- unistr2_to_ascii(d->parameters, &uni->parameters, sizeof(d->parameters));
-
- return True;
-}
-
-/*******************************************************************
********************************************************************/
bool spoolss_io_r_enumprintprocessors(const char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth)
@@ -4619,170 +2828,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; i<n; i++) {
- int len;
- uint16 *s = NULL;
-
- if (src->size != 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 */
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd,
- uint32 change_low, uint32 change_high,
- SPOOL_NOTIFY_INFO *info)
-{
- if (q_u == NULL)
- return False;
-
- memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
-
- q_u->change_low=change_low;
- q_u->change_high=change_high;
-
- q_u->unknown0=0x0;
- q_u->unknown1=0x0;
-
- q_u->info_ptr=0x0FF0ADDE;
-
- q_u->info.version=2;
-
- if (info->count) {
- DEBUG(10,("make_spoolss_q_reply_rrpcn: [%d] PRINTER_NOTIFY_INFO_DATA\n",
- info->count));
- q_u->info.version = info->version;
- q_u->info.flags = info->flags;
- q_u->info.count = info->count;
- /* pointer field - be careful! */
- q_u->info.data = info->data;
- }
- else {
- q_u->info.flags=PRINTER_NOTIFY_INFO_DISCARDED;
- q_u->info.count=0;
- }
-
- return True;
-}
-
-/*******************************************************************
- Parse a SPOOL_Q_REPLY_RRPCN structure.
-********************************************************************/
-
-bool spoolss_io_q_reply_rrpcn(const char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spoolss_io_q_reply_rrpcn");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth))
- return False;
-
- if (!prs_uint32("change_low", ps, depth, &q_u->change_low))
- return False;
-
- if (!prs_uint32("change_high", ps, depth, &q_u->change_high))
- return False;
-
- if (!prs_uint32("unknown0", ps, depth, &q_u->unknown0))
- return False;
-
- if (!prs_uint32("unknown1", ps, depth, &q_u->unknown1))
- return False;
-
- if (!prs_uint32("info_ptr", ps, depth, &q_u->info_ptr))
- return False;
-
- if(q_u->info_ptr!=0)
- if(!smb_io_notify_info(desc, &q_u->info, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Parse a SPOOL_R_REPLY_RRPCN structure.
-********************************************************************/
-
-bool spoolss_io_r_reply_rrpcn(const char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spoolss_io_r_reply_rrpcn");
- depth++;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("unknown0", ps, depth, &r_u->unknown0))
- return False;
-
- if (!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
/*******************************************************************
* read a structure.
********************************************************************/
@@ -5054,47 +3099,3 @@ bool make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS *q_u, POLICY_HND *handle,
return True;
}
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_getjob(SPOOL_Q_GETJOB *q_u, POLICY_HND *handle,
- uint32 jobid, uint32 level, RPC_BUFFER *buffer,
- uint32 offered)
-{
- memcpy(&q_u->handle, handle, sizeof(POLICY_HND));
- q_u->jobid = jobid;
- q_u->level = level;
- q_u->buffer = buffer;
- q_u->offered = offered;
-
- return True;
-}
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle,
- uint32 flags, uint32 options, const char *localmachine,
- uint32 printerlocal, SPOOL_NOTIFY_OPTION *option)
-{
- memcpy(&q_u->handle, handle, sizeof(POLICY_HND));
-
- q_u->flags = flags;
- q_u->options = options;
-
- q_u->localmachine_ptr = 1;
-
- init_unistr2(&q_u->localmachine, localmachine, UNI_STR_TERMINATE);
-
- q_u->printerlocal = printerlocal;
-
- if (option)
- q_u->option_ptr = 1;
-
- q_u->option = option;
-
- return True;
-}