summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/librpc/idl/spoolss.idl11
-rw-r--r--source4/ntptr/ntptr.h13
-rw-r--r--source4/ntptr/ntptr_interface.c51
-rw-r--r--source4/ntptr/simple_ldb/ntptr_simple_ldb.c6
-rw-r--r--source4/rpc_server/spoolss/dcesrv_spoolss.c37
5 files changed, 108 insertions, 10 deletions
diff --git a/source4/librpc/idl/spoolss.idl b/source4/librpc/idl/spoolss.idl
index b09690b278..02e6ff3f37 100644
--- a/source4/librpc/idl/spoolss.idl
+++ b/source4/librpc/idl/spoolss.idl
@@ -1368,7 +1368,16 @@
/******************/
/* Function: 0x58 */
- WERROR spoolss_58(
+ WERROR spoolss_XcvData(
+ [in,ref] policy_handle *handle,
+ [in] [string,charset(UTF16)] uint16 function_name[],
+ [in] DATA_BLOB in_data,
+ [in,value(r->in.in_data.length)] uint32 _in_data_length,
+ [in] uint32 offered,
+ [in] uint32 unknown1,
+ [out] DATA_BLOB out_data,
+ [out] uint32 needed,
+ [out] uint32 unknown2
);
/******************/
diff --git a/source4/ntptr/ntptr.h b/source4/ntptr/ntptr.h
index 6dace6031d..ce5e3e01ae 100644
--- a/source4/ntptr/ntptr.h
+++ b/source4/ntptr/ntptr.h
@@ -74,6 +74,7 @@ struct spoolss_EnumPrinters;
struct spoolss_EnumForms;
struct spoolss_EnumPorts;
struct spoolss_EnumPrintProcessors;
+struct spoolss_XcvData;
/* the ntptr operations structure - contains function pointers to
the backend implementations of each operation */
@@ -88,6 +89,8 @@ struct ntptr_ops {
struct spoolss_OpenPrinterEx *r,
const char *printer_name,
struct ntptr_GenericHandle **server);
+ WERROR (*XcvDataPrintServer)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
+ struct spoolss_XcvData *r);
/* PrintServer PrinterData functions */
WERROR (*EnumPrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
@@ -125,8 +128,10 @@ struct ntptr_ops {
WERROR (*OpenPort)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
struct spoolss_OpenPrinterEx *r,
const char *port_name,
- struct ntptr_GenericHandle **prt);
-
+ struct ntptr_GenericHandle **port);
+ WERROR (*XcvDataPort)(struct ntptr_GenericHandle *port, TALLOC_CTX *mem_ctx,
+ struct spoolss_XcvData *r);
+
/* Monitor functions */
WERROR (*EnumMonitors)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
struct spoolss_EnumMonitors *r);
@@ -134,6 +139,8 @@ struct ntptr_ops {
struct spoolss_OpenPrinterEx *r,
const char *monitor_name,
struct ntptr_GenericHandle **monitor);
+ WERROR (*XcvDataMonitor)(struct ntptr_GenericHandle *monitor, TALLOC_CTX *mem_ctx,
+ struct spoolss_XcvData *r);
/* PrintProcessor functions */
WERROR (*EnumPrintProcessors)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
@@ -155,6 +162,8 @@ struct ntptr_ops {
struct spoolss_SetPrinter *r);
WERROR (*DeletePrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
struct spoolss_DeletePrinter *r);
+ WERROR (*XcvDataPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
+ struct spoolss_XcvData *r);
/* Printer Driver functions */
WERROR (*GetPrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
diff --git a/source4/ntptr/ntptr_interface.c b/source4/ntptr/ntptr_interface.c
index 1920b37f21..56c3a61659 100644
--- a/source4/ntptr/ntptr_interface.c
+++ b/source4/ntptr/ntptr_interface.c
@@ -36,6 +36,18 @@ WERROR ntptr_OpenPrintServer(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
return ntptr->ops->OpenPrintServer(ntptr, mem_ctx, r, printer_name, server);
}
+WERROR ntptr_XcvDataPrintServer(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
+ struct spoolss_XcvData *r)
+{
+ if (server->type != NTPTR_HANDLE_SERVER) {
+ return WERR_FOOBAR;
+ }
+ if (!server->ntptr->ops->XcvDataPrintServer) {
+ return WERR_NOT_SUPPORTED;
+ }
+ return server->ntptr->ops->XcvDataPrintServer(server, mem_ctx, r);
+}
+
/* PrintServer PrinterData functions */
WERROR ntptr_EnumPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
@@ -188,14 +200,25 @@ WERROR ntptr_EnumPorts(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
WERROR ntptr_OpenPort(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
struct spoolss_OpenPrinterEx *r,
const char *port_name,
- struct ntptr_GenericHandle **prt)
+ struct ntptr_GenericHandle **port)
{
if (!ntptr->ops->OpenPort) {
return WERR_NOT_SUPPORTED;
}
- return ntptr->ops->OpenPort(ntptr, mem_ctx, r, port_name, prt);
+ return ntptr->ops->OpenPort(ntptr, mem_ctx, r, port_name, port);
}
+WERROR ntptr_XcvDataPort(struct ntptr_GenericHandle *port, TALLOC_CTX *mem_ctx,
+ struct spoolss_XcvData *r)
+{
+ if (port->type != NTPTR_HANDLE_PORT) {
+ return WERR_FOOBAR;
+ }
+ if (!port->ntptr->ops->XcvDataPort) {
+ return WERR_NOT_SUPPORTED;
+ }
+ return port->ntptr->ops->XcvDataPort(port, mem_ctx, r);
+}
/* Monitor functions */
WERROR ntptr_EnumMonitors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
@@ -218,6 +241,18 @@ WERROR ntptr_OpenMonitor(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
return ntptr->ops->OpenMonitor(ntptr, mem_ctx, r, monitor_name, monitor);
}
+WERROR ntptr_XcvDataMonitor(struct ntptr_GenericHandle *monitor, TALLOC_CTX *mem_ctx,
+ struct spoolss_XcvData *r)
+{
+ if (monitor->type != NTPTR_HANDLE_MONITOR) {
+ return WERR_FOOBAR;
+ }
+ if (!monitor->ntptr->ops->XcvDataMonitor) {
+ return WERR_NOT_SUPPORTED;
+ }
+ return monitor->ntptr->ops->XcvDataMonitor(monitor, mem_ctx, r);
+}
+
/* PrintProcessor functions */
WERROR ntptr_EnumPrintProcessors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
@@ -288,6 +323,18 @@ WERROR ntptr_DeletePrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
return ntptr->ops->DeletePrinter(ntptr, mem_ctx, r);
}
+WERROR ntptr_XcvDataPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
+ struct spoolss_XcvData *r)
+{
+ if (printer->type != NTPTR_HANDLE_PRINTER) {
+ return WERR_FOOBAR;
+ }
+ if (!printer->ntptr->ops->XcvDataPrinter) {
+ return WERR_NOT_SUPPORTED;
+ }
+ return printer->ntptr->ops->XcvDataPrinter(printer, mem_ctx, r);
+}
+
/* Printer Driver functions */
WERROR ntptr_GetPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
index c9b6a700aa..136dae352a 100644
--- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
+++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
@@ -761,7 +761,8 @@ static const struct ntptr_ops ntptr_simple_ldb_ops = {
/* PrintServer functions */
.OpenPrintServer = sptr_OpenPrintServer,
-
+/* .XcvDataPrintServer = sptr_XcvDataPrintServer,
+*/
/* PrintServer PrinterData functions */
/* .EnumPrintServerData = sptr_EnumPrintServerData,
*/ .GetPrintServerData = sptr_GetPrintServerData,
@@ -783,10 +784,12 @@ static const struct ntptr_ops ntptr_simple_ldb_ops = {
/* Port functions */
.EnumPorts = sptr_EnumPorts,
/* .OpenPort = sptr_OpenPort,
+ .XcvDataPort = sptr_XcvDataPort,
*/
/* Monitor functions */
.EnumMonitors = sptr_EnumMonitors,
/* .OpenMonitor = sptr_OpenMonitor,
+ .XcvDataMonitor = sptr_XcvDataMonitor,
*/
/* PrintProcessor functions */
/* .EnumPrintProcessors = sptr_EnumPrintProcessors,
@@ -798,6 +801,7 @@ static const struct ntptr_ops ntptr_simple_ldb_ops = {
.GetPrinter = sptr_GetPrinter,
.SetPrinter = sptr_SetPrinter,
.DeletePrinter = sptr_DeletePrinter,
+ .XcvDataPrinter = sptr_XcvDataPrinter,
*/
/* Printer Driver functions */
/* .GetPrinterDriver = sptr_GetPrinterDriver,
diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c
index 9ff2bcf635..7c821032ab 100644
--- a/source4/rpc_server/spoolss/dcesrv_spoolss.c
+++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c
@@ -1379,12 +1379,41 @@ static WERROR spoolss_57(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx
/*
- spoolss_58
+ spoolss_XcvData
*/
-static WERROR spoolss_58(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct spoolss_58 *r)
+static WERROR spoolss_XcvData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct spoolss_XcvData *r)
{
- DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+ struct ntptr_GenericHandle *handle;
+ struct dcesrv_handle *h;
+ WERROR status;
+
+ DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY);
+ handle = talloc_get_type(h->data, struct ntptr_GenericHandle);
+
+ switch (handle->type) {
+ case NTPTR_HANDLE_SERVER:
+ status = ntptr_XcvDataPrintServer(handle, mem_ctx, r);
+ W_ERROR_NOT_OK_RETURN(status);
+ break;
+ case NTPTR_HANDLE_PRINTER:
+ status = ntptr_XcvDataPrinter(handle, mem_ctx, r);
+ W_ERROR_NOT_OK_RETURN(status);
+ break;
+ case NTPTR_HANDLE_PORT:
+ status = ntptr_XcvDataPort(handle, mem_ctx, r);
+ W_ERROR_NOT_OK_RETURN(status);
+ break;
+ case NTPTR_HANDLE_MONITOR:
+ status = ntptr_XcvDataMonitor(handle, mem_ctx, r);
+ W_ERROR_NOT_OK_RETURN(status);
+ break;
+ default:
+ return WERR_FOOBAR;
+ }
+
+ /* TODO: handle the buffer sizes here! */
+ return WERR_OK;
}