diff options
author | Günther Deschner <gd@samba.org> | 2009-02-13 00:10:10 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-02-14 01:42:07 +0100 |
commit | cd2af58af9f04ffaa59c482df8fdf5991cae4156 (patch) | |
tree | 04ebb64dee9e68db717352dceea60ad003c00de6 | |
parent | fbcccbc410ce23eb0f78f47fe5c7ee4a64e78a0c (diff) | |
download | samba-cd2af58af9f04ffaa59c482df8fdf5991cae4156.tar.gz samba-cd2af58af9f04ffaa59c482df8fdf5991cae4156.tar.bz2 samba-cd2af58af9f04ffaa59c482df8fdf5991cae4156.zip |
s3-spoolss: use pidl for _spoolss_SetPrinter.
Guenther
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss.c | 22 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 69 |
3 files changed, 31 insertions, 61 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 9f3c04e649..bfbf972be7 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -6245,7 +6245,6 @@ WERROR _spoolss_getprinter(pipes_struct *p, SPOOL_Q_GETPRINTER *q_u, SPOOL_R_GET WERROR _spoolss_getprinterdriver2(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVER2 *q_u, SPOOL_R_GETPRINTERDRIVER2 *r_u); WERROR add_port_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *portname, const char *uri ); bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, NT_PRINTER_INFO_LEVEL *printer); -WERROR _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SETPRINTER *r_u); WERROR _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJOBS *r_u); WERROR _spoolss_enumprinterdrivers( pipes_struct *p, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, SPOOL_R_ENUMPRINTERDRIVERS *r_u); WERROR _spoolss_enumforms(pipes_struct *p, SPOOL_Q_ENUMFORMS *q_u, SPOOL_R_ENUMFORMS *r_u); diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c index 02b3220367..4a29e1963b 100644 --- a/source3/rpc_server/srv_spoolss.c +++ b/source3/rpc_server/srv_spoolss.c @@ -370,27 +370,7 @@ static bool api_spoolss_writeprinter(pipes_struct *p) static bool api_spoolss_setprinter(pipes_struct *p) { - SPOOL_Q_SETPRINTER q_u; - SPOOL_R_SETPRINTER 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_setprinter("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_setprinter: unable to unmarshall SPOOL_Q_SETPRINTER.\n")); - return False; - } - - r_u.status = _spoolss_setprinter(p, &q_u, &r_u); - - if(!spoolss_io_r_setprinter("",&r_u,rdata,0)) { - DEBUG(0,("spoolss_io_r_setprinter: unable to marshall SPOOL_R_SETPRINTER.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_SETPRINTER); } /**************************************************************************** diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index aeedf099d6..a43d9dff64 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -6061,8 +6061,7 @@ WERROR _spoolss_AbortPrinter(pipes_struct *p, * when updating a printer description ********************************************************************/ -static WERROR update_printer_sec(POLICY_HND *handle, uint32 level, - const SPOOL_PRINTER_INFO_LEVEL *info, +static WERROR update_printer_sec(POLICY_HND *handle, pipes_struct *p, SEC_DESC_BUF *secdesc_ctr) { SEC_DESC_BUF *new_secdesc_ctr = NULL, *old_secdesc_ctr = NULL; @@ -6348,9 +6347,9 @@ bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, NT_PRINTER_INFO_LEV * when updating a printer description. ********************************************************************/ -static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level, - const SPOOL_PRINTER_INFO_LEVEL *info, - DEVICEMODE *devmode) +static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, + struct spoolss_SetPrinterInfoCtr *info_ctr, + struct spoolss_DeviceMode *devmode) { int snum; NT_PRINTER_INFO_LEVEL *printer = NULL, *old_printer = NULL; @@ -6387,7 +6386,7 @@ static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level, * just read from the tdb in the pointer 'printer'. */ - if (!convert_printer_info(info, printer, level)) { + if (!convert_printer_info_new(info_ctr, printer)) { result = WERR_NOMEM; goto done; } @@ -6397,8 +6396,9 @@ static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level, convert it and link it*/ DEBUGADD(8,("update_printer: Converting the devicemode struct\n")); - if (!convert_devicemode(printer->info_2->printername, devmode, - &printer->info_2->devmode)) { + if (!convert_devicemode_new(printer->info_2->printername, + devmode, + &printer->info_2->devmode)) { result = WERR_NOMEM; goto done; } @@ -6542,10 +6542,9 @@ done: /**************************************************************************** ****************************************************************************/ static WERROR publish_or_unpublish_printer(pipes_struct *p, POLICY_HND *handle, - const SPOOL_PRINTER_INFO_LEVEL *info) + struct spoolss_SetPrinterInfo7 *info7) { #ifdef HAVE_ADS - SPOOL_PRINTER_INFO_LEVEL_7 *info7 = info->info_7; int snum; Printer_entry *Printer; @@ -6570,42 +6569,45 @@ static WERROR publish_or_unpublish_printer(pipes_struct *p, POLICY_HND *handle, return WERR_UNKNOWN_LEVEL; #endif } -/**************************************************************************** -****************************************************************************/ -WERROR _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SETPRINTER *r_u) +/**************************************************************** + _spoolss_SetPrinter +****************************************************************/ + +WERROR _spoolss_SetPrinter(pipes_struct *p, + struct spoolss_SetPrinter *r) { - POLICY_HND *handle = &q_u->handle; - uint32 level = q_u->level; - SPOOL_PRINTER_INFO_LEVEL *info = &q_u->info; - DEVMODE_CTR devmode_ctr = q_u->devmode_ctr; - SEC_DESC_BUF *secdesc_ctr = q_u->secdesc_ctr; - uint32 command = q_u->command; + POLICY_HND *handle = r->in.handle; WERROR result; Printer_entry *Printer = find_printer_index_by_hnd(p, handle); if (!Printer) { - DEBUG(2,("_spoolss_setprinter: Invalid handle (%s:%u:%u)\n", OUR_HANDLE(handle))); + DEBUG(2,("_spoolss_SetPrinter: Invalid handle (%s:%u:%u)\n", + OUR_HANDLE(handle))); return WERR_BADFID; } /* check the level */ - switch (level) { + switch (r->in.info_ctr->level) { case 0: - return control_printer(handle, command, p); + return control_printer(handle, r->in.command, p); case 2: - result = update_printer(p, handle, level, info, devmode_ctr.devmode); + result = update_printer(p, handle, + r->in.info_ctr, + r->in.devmode_ctr->devmode); if (!W_ERROR_IS_OK(result)) return result; - if (secdesc_ctr) - result = update_printer_sec(handle, level, info, p, secdesc_ctr); + if (r->in.secdesc_ctr->sd) + result = update_printer_sec(handle, p, + r->in.secdesc_ctr); return result; case 3: - return update_printer_sec(handle, level, info, p, - secdesc_ctr); + return update_printer_sec(handle, p, + r->in.secdesc_ctr); case 7: - return publish_or_unpublish_printer(p, handle, info); + return publish_or_unpublish_printer(p, handle, + r->in.info_ctr->info.info7); default: return WERR_UNKNOWN_LEVEL; } @@ -10106,17 +10108,6 @@ WERROR _spoolss_AddPrinter(pipes_struct *p, } /**************************************************************** - _spoolss_SetPrinter -****************************************************************/ - -WERROR _spoolss_SetPrinter(pipes_struct *p, - struct spoolss_SetPrinter *r) -{ - p->rng_fault_state = true; - return WERR_NOT_SUPPORTED; -} - -/**************************************************************** _spoolss_GetPrinter ****************************************************************/ |