1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-29 13:49:30 +03:00

s3-spoolss: use pidl for _spoolss_EnumPrintProcessors.

Guenther
This commit is contained in:
Günther Deschner
2009-03-06 20:22:17 +01:00
parent 9f27a0813c
commit f48ccec957
3 changed files with 51 additions and 74 deletions

View File

@ -6123,7 +6123,6 @@ WERROR enumports_hook(TALLOC_CTX *ctx, int *count, char ***lines );
WERROR _spoolss_enumports( pipes_struct *p, SPOOL_Q_ENUMPORTS *q_u, SPOOL_R_ENUMPORTS *r_u); WERROR _spoolss_enumports( pipes_struct *p, SPOOL_Q_ENUMPORTS *q_u, SPOOL_R_ENUMPORTS *r_u);
WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, SPOOL_R_ENUMPRINTERDATA *r_u); WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, SPOOL_R_ENUMPRINTERDATA *r_u);
WERROR _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SPOOL_R_SETPRINTERDATA *r_u); WERROR _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SPOOL_R_SETPRINTERDATA *r_u);
WERROR _spoolss_enumprintprocessors(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, SPOOL_R_ENUMPRINTPROCESSORS *r_u);
WERROR _spoolss_enumprintprocdatatypes(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u); WERROR _spoolss_enumprintprocdatatypes(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u);
WERROR _spoolss_enumprintmonitors(pipes_struct *p, SPOOL_Q_ENUMPRINTMONITORS *q_u, SPOOL_R_ENUMPRINTMONITORS *r_u); WERROR _spoolss_enumprintmonitors(pipes_struct *p, SPOOL_Q_ENUMPRINTMONITORS *q_u, SPOOL_R_ENUMPRINTMONITORS *r_u);
WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_u); WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_u);

View File

@ -577,27 +577,7 @@ static bool api_spoolss_setform(pipes_struct *p)
static bool api_spoolss_enumprintprocessors(pipes_struct *p) static bool api_spoolss_enumprintprocessors(pipes_struct *p)
{ {
SPOOL_Q_ENUMPRINTPROCESSORS q_u; return proxy_spoolss_call(p, NDR_SPOOLSS_ENUMPRINTPROCESSORS);
SPOOL_R_ENUMPRINTPROCESSORS r_u;
prs_struct *data = &p->in_data.data;
prs_struct *rdata = &p->out_data.rdata;
ZERO_STRUCT(q_u);
ZERO_STRUCT(r_u);
if(!spoolss_io_q_enumprintprocessors("", &q_u, data, 0)) {
DEBUG(0,("spoolss_io_q_enumprintprocessors: unable to unmarshall SPOOL_Q_ENUMPRINTPROCESSORS.\n"));
return False;
}
r_u.status = _spoolss_enumprintprocessors(p, &q_u, &r_u);
if(!spoolss_io_r_enumprintprocessors("", &r_u, rdata, 0)) {
DEBUG(0,("spoolss_io_r_enumprintprocessors: unable to marshall SPOOL_R_ENUMPRINTPROCESSORS.\n"));
return False;
}
return True;
} }
/**************************************************************************** /****************************************************************************

View File

@ -8730,70 +8730,76 @@ done:
return status; return status;
} }
/****************************************************************************
fill_print_processor1
****************************************************************************/
static WERROR fill_print_processor1(TALLOC_CTX *mem_ctx,
struct spoolss_PrintProcessorInfo1 *r,
const char *print_processor_name)
{
r->print_processor_name = talloc_strdup(mem_ctx, print_processor_name);
W_ERROR_HAVE_NO_MEMORY(r->print_processor_name);
return WERR_OK;
}
/**************************************************************************** /****************************************************************************
enumprintprocessors level 1. enumprintprocessors level 1.
****************************************************************************/ ****************************************************************************/
static WERROR enumprintprocessors_level_1(RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned) static WERROR enumprintprocessors_level_1(TALLOC_CTX *mem_ctx,
union spoolss_PrintProcessorInfo **info_p,
uint32_t offered,
uint32_t *needed,
uint32_t *count)
{ {
PRINTPROCESSOR_1 *info_1=NULL; union spoolss_PrintProcessorInfo *info;
WERROR result = WERR_OK; WERROR result;
if((info_1 = SMB_MALLOC_P(PRINTPROCESSOR_1)) == NULL) info = TALLOC_ARRAY(mem_ctx, union spoolss_PrintProcessorInfo, 1);
return WERR_NOMEM; W_ERROR_HAVE_NO_MEMORY(info);
(*returned) = 0x1; *count = 1;
init_unistr(&info_1->name, "winprint"); result = fill_print_processor1(info, &info[0].info1, "winprint");
if (!W_ERROR_IS_OK(result)) {
goto out;
}
*needed += spoolss_size_printprocessor_info_1(info_1); *needed += ndr_size_spoolss_PrintProcessorInfo1(&info[0].info1, NULL, 0);
if (*needed > offered) { if (*needed > offered) {
result = WERR_INSUFFICIENT_BUFFER; result = WERR_INSUFFICIENT_BUFFER;
goto out; goto out;
} }
if (!rpcbuf_alloc_size(buffer, *needed)) { out:
result = WERR_NOMEM; if (!W_ERROR_IS_OK(result)) {
goto out; TALLOC_FREE(info);
*count = 0;
return result;
} }
smb_io_printprocessor_info_1("", buffer, info_1, 0); *info_p = info;
out: return WERR_OK;
SAFE_FREE(info_1);
if ( !W_ERROR_IS_OK(result) )
*returned = 0;
return result;
} }
/**************************************************************************** /****************************************************************
****************************************************************************/ _spoolss_EnumPrintProcessors
****************************************************************/
WERROR _spoolss_enumprintprocessors(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, SPOOL_R_ENUMPRINTPROCESSORS *r_u) WERROR _spoolss_EnumPrintProcessors(pipes_struct *p,
struct spoolss_EnumPrintProcessors *r)
{ {
uint32 level = q_u->level;
RPC_BUFFER *buffer = NULL;
uint32 offered = q_u->offered;
uint32 *needed = &r_u->needed;
uint32 *returned = &r_u->returned;
/* that's an [in out] buffer */ /* that's an [in out] buffer */
if (!q_u->buffer && (offered!=0)) { if (!r->in.buffer && (r->in.offered != 0)) {
return WERR_INVALID_PARAM; return WERR_INVALID_PARAM;
} }
if (offered > MAX_RPC_DATA_SIZE) { DEBUG(5,("_spoolss_EnumPrintProcessors\n"));
return WERR_INVALID_PARAM;
}
rpcbuf_move(q_u->buffer, &r_u->buffer);
buffer = r_u->buffer;
DEBUG(5,("spoolss_enumprintprocessors\n"));
/* /*
* Enumerate the print processors ... * Enumerate the print processors ...
@ -8802,12 +8808,15 @@ WERROR _spoolss_enumprintprocessors(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCESSORS
* and I can use my nice printer checker. * and I can use my nice printer checker.
*/ */
*returned=0; *r->out.count = 0;
*needed=0; *r->out.needed = 0;
*r->out.info = NULL;
switch (level) { switch (r->in.level) {
case 1: case 1:
return enumprintprocessors_level_1(buffer, offered, needed, returned); return enumprintprocessors_level_1(p->mem_ctx, r->out.info,
r->in.offered, r->out.needed,
r->out.count);
default: default:
return WERR_UNKNOWN_LEVEL; return WERR_UNKNOWN_LEVEL;
} }
@ -10218,17 +10227,6 @@ WERROR _spoolss_GetPrinterDriver(pipes_struct *p,
return WERR_NOT_SUPPORTED; return WERR_NOT_SUPPORTED;
} }
/****************************************************************
_spoolss_EnumPrintProcessors
****************************************************************/
WERROR _spoolss_EnumPrintProcessors(pipes_struct *p,
struct spoolss_EnumPrintProcessors *r)
{
p->rng_fault_state = true;
return WERR_NOT_SUPPORTED;
}
/**************************************************************** /****************************************************************
_spoolss_ReadPrinter _spoolss_ReadPrinter
****************************************************************/ ****************************************************************/