From 0068abe716c32fe02f9925bfdc8ab327d54bb4a7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 12 Mar 2009 12:50:20 +0100 Subject: s3-spoolss: remove some unused functions. Guenther --- source3/rpc_server/srv_spoolss_nt.c | 405 ------------------------------------ 1 file changed, 405 deletions(-) diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index f830f38ab4..950dc013b2 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -4001,47 +4001,6 @@ static WERROR construct_printer_info0(TALLOC_CTX *mem_ctx, return WERR_OK; } -/******************************************************************** - * construct_printer_info_1 - * fill a printer_info_1 struct - ********************************************************************/ -static bool construct_printer_info_1(Printer_entry *print_hnd, uint32 flags, PRINTER_INFO_1 *printer, int snum) -{ - char *chaine = NULL; - NT_PRINTER_INFO_LEVEL *ntprinter = NULL; - TALLOC_CTX *ctx = talloc_tos(); - - if (!W_ERROR_IS_OK(get_a_printer(print_hnd, &ntprinter, 2, lp_const_servicename(snum)))) - return false; - - printer->flags=flags; - - if (*ntprinter->info_2->comment == '\0') { - init_unistr(&printer->comment, lp_comment(snum)); - chaine = talloc_asprintf(ctx, - "%s,%s,%s", ntprinter->info_2->printername, - ntprinter->info_2->drivername, lp_comment(snum)); - } - else { - init_unistr(&printer->comment, ntprinter->info_2->comment); /* saved comment. */ - chaine = talloc_asprintf(ctx, - "%s,%s,%s", ntprinter->info_2->printername, - ntprinter->info_2->drivername, ntprinter->info_2->comment); - } - - if (!chaine) { - free_a_printer(&ntprinter,2); - return false; - } - - init_unistr(&printer->description, chaine); - init_unistr(&printer->name, ntprinter->info_2->printername); - - free_a_printer(&ntprinter,2); - - return True; -} - /**************************************************************************** Free a DEVMODE struct. ****************************************************************************/ @@ -4252,71 +4211,6 @@ done: return devmode; } -/******************************************************************** - * construct_printer_info_2 - * fill a printer_info_2 struct - ********************************************************************/ - -static bool construct_printer_info_2(Printer_entry *print_hnd, PRINTER_INFO_2 *printer, int snum) -{ - int count; - NT_PRINTER_INFO_LEVEL *ntprinter = NULL; - - print_status_struct status; - - if (!W_ERROR_IS_OK(get_a_printer(print_hnd, &ntprinter, 2, lp_const_servicename(snum)))) - return False; - - count = print_queue_length(snum, &status); - - init_unistr(&printer->servername, ntprinter->info_2->servername); /* servername*/ - init_unistr(&printer->printername, ntprinter->info_2->printername); /* printername*/ - init_unistr(&printer->sharename, lp_servicename(snum)); /* sharename */ - init_unistr(&printer->portname, ntprinter->info_2->portname); /* port */ - init_unistr(&printer->drivername, ntprinter->info_2->drivername); /* drivername */ - - if (*ntprinter->info_2->comment == '\0') - init_unistr(&printer->comment, lp_comment(snum)); /* comment */ - else - init_unistr(&printer->comment, ntprinter->info_2->comment); /* saved comment. */ - - init_unistr(&printer->location, ntprinter->info_2->location); /* location */ - init_unistr(&printer->sepfile, ntprinter->info_2->sepfile); /* separator file */ - init_unistr(&printer->printprocessor, ntprinter->info_2->printprocessor);/* print processor */ - init_unistr(&printer->datatype, ntprinter->info_2->datatype); /* datatype */ - init_unistr(&printer->parameters, ntprinter->info_2->parameters); /* parameters (of print processor) */ - - printer->attributes = ntprinter->info_2->attributes; - - printer->priority = ntprinter->info_2->priority; /* priority */ - printer->defaultpriority = ntprinter->info_2->default_priority; /* default priority */ - printer->starttime = ntprinter->info_2->starttime; /* starttime */ - printer->untiltime = ntprinter->info_2->untiltime; /* untiltime */ - printer->status = nt_printq_status(status.status); /* status */ - printer->cjobs = count; /* jobs */ - printer->averageppm = ntprinter->info_2->averageppm; /* average pages per minute */ - - if ( !(printer->devmode = construct_dev_mode( - lp_const_servicename(snum))) ) - DEBUG(8, ("Returning NULL Devicemode!\n")); - - printer->secdesc = NULL; - - if ( ntprinter->info_2->secdesc_buf - && ntprinter->info_2->secdesc_buf->sd_size != 0 ) - { - /* don't use talloc_steal() here unless you do a deep steal of all - the SEC_DESC members */ - - printer->secdesc = dup_sec_desc( talloc_tos(), - ntprinter->info_2->secdesc_buf->sd ); - } - - free_a_printer(&ntprinter, 2); - - return True; -} - /******************************************************************** * construct_printer_info3 * fill a spoolss_PrinterInfo3 struct @@ -4962,305 +4856,6 @@ WERROR _spoolss_EnumPrinters(pipes_struct *p, return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER); } -/**************************************************************************** -****************************************************************************/ - -static WERROR getprinter_level_0(Printer_entry *print_hnd, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed) -{ - PRINTER_INFO_0 *printer=NULL; - WERROR result = WERR_OK; - - if((printer=SMB_MALLOC_P(PRINTER_INFO_0)) == NULL) - return WERR_NOMEM; - - construct_printer_info_0(print_hnd, printer, snum); - - /* check the required size. */ - *needed += spoolss_size_printer_info_0(printer); - - if (*needed > offered) { - result = WERR_INSUFFICIENT_BUFFER; - goto out; - } - - if (!rpcbuf_alloc_size(buffer, *needed)) { - result = WERR_NOMEM; - goto out; - } - - /* fill the buffer with the structures */ - smb_io_printer_info_0("", buffer, printer, 0); - -out: - /* clear memory */ - - SAFE_FREE(printer); - - return result; -} - -/**************************************************************************** -****************************************************************************/ - -static WERROR getprinter_level_1(Printer_entry *print_hnd, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed) -{ - PRINTER_INFO_1 *printer=NULL; - WERROR result = WERR_OK; - - if((printer=SMB_MALLOC_P(PRINTER_INFO_1)) == NULL) - return WERR_NOMEM; - - construct_printer_info_1(print_hnd, PRINTER_ENUM_ICON8, printer, snum); - - /* check the required size. */ - *needed += spoolss_size_printer_info_1(printer); - - if (*needed > offered) { - result = WERR_INSUFFICIENT_BUFFER; - goto out; - } - - if (!rpcbuf_alloc_size(buffer, *needed)) { - result = WERR_NOMEM; - goto out; - } - - /* fill the buffer with the structures */ - smb_io_printer_info_1("", buffer, printer, 0); - -out: - /* clear memory */ - SAFE_FREE(printer); - - return result; -} - -/**************************************************************************** -****************************************************************************/ - -static WERROR getprinter_level_2(Printer_entry *print_hnd, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed) -{ - PRINTER_INFO_2 *printer=NULL; - WERROR result = WERR_OK; - - if((printer=SMB_MALLOC_P(PRINTER_INFO_2))==NULL) - return WERR_NOMEM; - - construct_printer_info_2(print_hnd, printer, snum); - - /* check the required size. */ - *needed += spoolss_size_printer_info_2(printer); - - if (*needed > offered) { - result = WERR_INSUFFICIENT_BUFFER; - goto out; - } - - if (!rpcbuf_alloc_size(buffer, *needed)) { - result = WERR_NOMEM; - goto out; - } - - /* fill the buffer with the structures */ - if (!smb_io_printer_info_2("", buffer, printer, 0)) - result = WERR_NOMEM; - -out: - /* clear memory */ - free_printer_info_2(printer); - - return result; -} - -/**************************************************************************** -****************************************************************************/ - -static WERROR getprinter_level_3(Printer_entry *print_hnd, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed) -{ - PRINTER_INFO_3 *printer=NULL; - WERROR result = WERR_OK; - - if (!construct_printer_info_3(print_hnd, &printer, snum)) - return WERR_NOMEM; - - /* check the required size. */ - *needed += spoolss_size_printer_info_3(printer); - - if (*needed > offered) { - result = WERR_INSUFFICIENT_BUFFER; - goto out; - } - - if (!rpcbuf_alloc_size(buffer, *needed)) { - result = WERR_NOMEM; - goto out; - } - - /* fill the buffer with the structures */ - smb_io_printer_info_3("", buffer, printer, 0); - -out: - /* clear memory */ - free_printer_info_3(printer); - - return result; -} - -/**************************************************************************** -****************************************************************************/ - -static WERROR getprinter_level_4(Printer_entry *print_hnd, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed) -{ - PRINTER_INFO_4 *printer=NULL; - WERROR result = WERR_OK; - - if((printer=SMB_MALLOC_P(PRINTER_INFO_4))==NULL) - return WERR_NOMEM; - - if (!construct_printer_info_4(print_hnd, printer, snum)) { - SAFE_FREE(printer); - return WERR_NOMEM; - } - - /* check the required size. */ - *needed += spoolss_size_printer_info_4(printer); - - if (*needed > offered) { - result = WERR_INSUFFICIENT_BUFFER; - goto out; - } - - if (!rpcbuf_alloc_size(buffer, *needed)) { - result = WERR_NOMEM; - goto out; - } - - /* fill the buffer with the structures */ - smb_io_printer_info_4("", buffer, printer, 0); - -out: - /* clear memory */ - free_printer_info_4(printer); - - return result; -} - -/**************************************************************************** -****************************************************************************/ - -static WERROR getprinter_level_5(Printer_entry *print_hnd, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed) -{ - PRINTER_INFO_5 *printer=NULL; - WERROR result = WERR_OK; - - if((printer=SMB_MALLOC_P(PRINTER_INFO_5))==NULL) - return WERR_NOMEM; - - if (!construct_printer_info_5(print_hnd, printer, snum)) { - free_printer_info_5(printer); - return WERR_NOMEM; - } - - /* check the required size. */ - *needed += spoolss_size_printer_info_5(printer); - - if (*needed > offered) { - result = WERR_INSUFFICIENT_BUFFER; - goto out; - } - - if (!rpcbuf_alloc_size(buffer, *needed)) { - result = WERR_NOMEM; - goto out; - } - - /* fill the buffer with the structures */ - smb_io_printer_info_5("", buffer, printer, 0); - -out: - /* clear memory */ - free_printer_info_5(printer); - - return result; -} - -static WERROR getprinter_level_6(Printer_entry *print_hnd, - int snum, - RPC_BUFFER *buffer, uint32 offered, - uint32 *needed) -{ - PRINTER_INFO_6 *printer; - WERROR result = WERR_OK; - - if ((printer = SMB_MALLOC_P(PRINTER_INFO_6)) == NULL) { - return WERR_NOMEM; - } - - if (!construct_printer_info_6(print_hnd, printer, snum)) { - free_printer_info_6(printer); - return WERR_NOMEM; - } - - /* check the required size. */ - *needed += spoolss_size_printer_info_6(printer); - - if (*needed > offered) { - result = WERR_INSUFFICIENT_BUFFER; - goto out; - } - - if (!rpcbuf_alloc_size(buffer, *needed)) { - result = WERR_NOMEM; - goto out; - } - - /* fill the buffer with the structures */ - smb_io_printer_info_6("", buffer, printer, 0); - -out: - /* clear memory */ - free_printer_info_6(printer); - - return result; -} - -static WERROR getprinter_level_7(Printer_entry *print_hnd, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed) -{ - PRINTER_INFO_7 *printer=NULL; - WERROR result = WERR_OK; - - if((printer=SMB_MALLOC_P(PRINTER_INFO_7))==NULL) - return WERR_NOMEM; - - if (!construct_printer_info_7(print_hnd, printer, snum)) { - result = WERR_NOMEM; - goto out; - } - - /* check the required size. */ - *needed += spoolss_size_printer_info_7(printer); - - if (*needed > offered) { - result = WERR_INSUFFICIENT_BUFFER; - goto out; - } - - if (!rpcbuf_alloc_size(buffer, *needed)) { - result = WERR_NOMEM; - goto out; - - } - - /* fill the buffer with the structures */ - smb_io_printer_info_7("", buffer, printer, 0); - -out: - /* clear memory */ - free_printer_info_7(printer); - - return result; -} - /**************************************************************** _spoolss_GetPrinter ****************************************************************/ -- cgit