summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/rpc_server/srv_spoolss.c22
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c79
2 files changed, 20 insertions, 81 deletions
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index 34b66effe4..a006031595 100644
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -54,27 +54,7 @@ static bool proxy_spoolss_call(pipes_struct *p, uint8_t opnum)
static bool api_spoolss_open_printer(pipes_struct *p)
{
- SPOOL_Q_OPEN_PRINTER q_u;
- SPOOL_R_OPEN_PRINTER 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_open_printer("", &q_u, data, 0)) {
- DEBUG(0,("spoolss_io_q_open_printer: unable to unmarshall SPOOL_Q_OPEN_PRINTER.\n"));
- return False;
- }
-
- r_u.status = _spoolss_open_printer( p, &q_u, &r_u);
-
- if (!spoolss_io_r_open_printer("",&r_u,rdata,0)){
- DEBUG(0,("spoolss_io_r_open_printer: unable to marshall SPOOL_R_OPEN_PRINTER.\n"));
- return False;
- }
-
- return True;
+ return proxy_spoolss_call(p, NDR_SPOOLSS_OPENPRINTER);
}
/********************************************************************
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 6f6d9ce0c0..b1c551b41b 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -1399,67 +1399,37 @@ void reset_all_printerdata(struct messaging_context *msg,
return;
}
-/********************************************************************
- * Convert a SPOOL_Q_OPEN_PRINTER structure to a
- * SPOOL_Q_OPEN_PRINTER_EX structure
- ********************************************************************/
-
-static WERROR convert_to_openprinterex(TALLOC_CTX *ctx, SPOOL_Q_OPEN_PRINTER_EX *q_u_ex, SPOOL_Q_OPEN_PRINTER *q_u)
-{
- if (!q_u_ex || !q_u)
- return WERR_OK;
-
- DEBUG(8,("convert_to_openprinterex\n"));
-
- if ( q_u->printername ) {
- q_u_ex->printername = TALLOC_ZERO_P( ctx, UNISTR2 );
- if (q_u_ex->printername == NULL)
- return WERR_NOMEM;
- copy_unistr2(q_u_ex->printername, q_u->printername);
- }
-
- copy_printer_default(ctx, &q_u_ex->printer_default, &q_u->printer_default);
-
- return WERR_OK;
-}
-
-/********************************************************************
- * spoolss_open_printer
- *
- * called from the spoolss dispatcher
- ********************************************************************/
+/****************************************************************
+ _spoolss_OpenPrinter
+****************************************************************/
-WERROR _spoolss_open_printer(pipes_struct *p, SPOOL_Q_OPEN_PRINTER *q_u, SPOOL_R_OPEN_PRINTER *r_u)
+WERROR _spoolss_OpenPrinter(pipes_struct *p,
+ struct spoolss_OpenPrinter *r)
{
- SPOOL_Q_OPEN_PRINTER_EX q_u_ex;
- SPOOL_R_OPEN_PRINTER_EX r_u_ex;
-
- if (!q_u || !r_u)
- return WERR_NOMEM;
+ struct spoolss_OpenPrinterEx e;
+ WERROR werr;
- ZERO_STRUCT(q_u_ex);
- ZERO_STRUCT(r_u_ex);
+ ZERO_STRUCT(e.in.userlevel);
- /* convert the OpenPrinter() call to OpenPrinterEx() */
+ e.in.printername = r->in.printername;
+ e.in.datatype = r->in.datatype;
+ e.in.devmode_ctr = r->in.devmode_ctr;
+ e.in.access_mask = r->in.access_mask;
+ e.in.level = 0;
- r_u_ex.status = convert_to_openprinterex(p->mem_ctx, &q_u_ex, q_u);
- if (!W_ERROR_IS_OK(r_u_ex.status))
- return r_u_ex.status;
+ e.out.handle = r->out.handle;
- r_u_ex.status = _spoolss_open_printer_ex(p, &q_u_ex, &r_u_ex);
+ werr = _spoolss_OpenPrinterEx(p, &e);
- /* convert back to OpenPrinter() */
-
- memcpy(r_u, &r_u_ex, sizeof(*r_u));
-
- if (W_ERROR_EQUAL(r_u->status, WERR_INVALID_PARAM)) {
+ if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) {
/* OpenPrinterEx returns this for a bad
* printer name. We must return WERR_INVALID_PRINTER_NAME
* instead.
*/
- r_u->status = WERR_INVALID_PRINTER_NAME;
+ werr = WERR_INVALID_PRINTER_NAME;
}
- return r_u->status;
+
+ return werr;
}
/********************************************************************
@@ -9995,17 +9965,6 @@ WERROR _spoolss_EnumPrinters(pipes_struct *p,
}
/****************************************************************
- _spoolss_OpenPrinter
-****************************************************************/
-
-WERROR _spoolss_OpenPrinter(pipes_struct *p,
- struct spoolss_OpenPrinter *r)
-{
- p->rng_fault_state = true;
- return WERR_NOT_SUPPORTED;
-}
-
-/****************************************************************
_spoolss_GetJob
****************************************************************/