From a14938377e42344eb04a3d3003199b231e88dc8d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 23 Apr 2010 03:04:47 +0200 Subject: s3-spoolss: make sure AddPrinterDriver calls into AddPrinterDriverEx. Not vice versa. Also disable some info levels in AddPrinterDriver according to MS-RPRN 3.1.4.4.1. Found by torture test. Guenther --- source3/rpc_server/srv_spoolss_nt.c | 46 ++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 19 deletions(-) (limited to 'source3') diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 72499d8ad0..e8b5f8e85b 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -7370,11 +7370,11 @@ WERROR _spoolss_AddPrinter(pipes_struct *p, } /**************************************************************** - _spoolss_AddPrinterDriver + _spoolss_AddPrinterDriverEx ****************************************************************/ -WERROR _spoolss_AddPrinterDriver(pipes_struct *p, - struct spoolss_AddPrinterDriver *r) +WERROR _spoolss_AddPrinterDriverEx(pipes_struct *p, + struct spoolss_AddPrinterDriverEx *r) { WERROR err = WERR_OK; char *driver_name = NULL; @@ -7392,6 +7392,18 @@ WERROR _spoolss_AddPrinterDriver(pipes_struct *p, return WERR_INVALID_PARAM; } + /* + * we only support the semantics of AddPrinterDriver() + * i.e. only copy files that are newer than existing ones + */ + + if (r->in.flags == 0) { + return WERR_INVALID_PARAM; + } + + if (r->in.flags != APD_COPY_NEW_FILES) { + return WERR_ACCESS_DENIED; + } /* FIXME */ if (r->in.info_ctr->level != 3 && r->in.info_ctr->level != 6) { @@ -7498,31 +7510,27 @@ done: } /**************************************************************** - _spoolss_AddPrinterDriverEx + _spoolss_AddPrinterDriver ****************************************************************/ -WERROR _spoolss_AddPrinterDriverEx(pipes_struct *p, - struct spoolss_AddPrinterDriverEx *r) +WERROR _spoolss_AddPrinterDriver(pipes_struct *p, + struct spoolss_AddPrinterDriver *r) { - struct spoolss_AddPrinterDriver a; - - /* - * we only support the semantics of AddPrinterDriver() - * i.e. only copy files that are newer than existing ones - */ - - if (r->in.flags == 0) { - return WERR_INVALID_PARAM; - } + struct spoolss_AddPrinterDriverEx a; - if (r->in.flags != APD_COPY_NEW_FILES) { - return WERR_ACCESS_DENIED; + switch (r->in.info_ctr->level) { + case 6: + case 8: + return WERR_UNKNOWN_LEVEL; + default: + break; } a.in.servername = r->in.servername; a.in.info_ctr = r->in.info_ctr; + a.in.flags = APD_COPY_NEW_FILES; - return _spoolss_AddPrinterDriver(p, &a); + return _spoolss_AddPrinterDriverEx(p, &a); } /**************************************************************************** -- cgit