From 8f85427d6d8fa7e6bfd76ed5335c8dbe7dd14afe Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 16 Jun 2005 17:27:57 +0000 Subject: r7643: This patch adds a new NTPTR subsystem: - this is an abstraction layer for print services, like out NTVFS subsystem for file services - all protocol specific details are still in rpc_server/spoolss/ - like the stupid in and out Buffer handling - checking of the r->in.server_name - ... - this subsystem can have multiple implementation selected by the "ntptr providor" global-section parameter - I currently added a "simple_ldb" backend, that stores Printers, Forms, Ports, Monitors, ... in the spoolss.db, and does no real printing this backend is basicly for testing, how the spoolss protocol works - the interface is just a prototype and will be changed a bit the next days or weeks, till the simple_ldb backend can handle all calls that are used by normal w2k3/xp clients - I'll also make the api async, as the ntvfs api this will make things like the RemoteFindFirstPrinterChangeNotifyEx(), that opens a connection back to the client, easier to implement, as we should not block the whole smbd for that - the idea is to later implement a "unix" backend that works like the current samba3 code - and maybe some embedded print server vendors can write there own backend that can directly talk to a printer without having cups or something like this - the default settings are (it currently makes no sense to change them :-): ntptr providor = simple_ldb spoolss database = $private_dir/spoolss.db metze (This used to be commit 455b5536d41bc31ebef8290812f45d4a38afa8e9) --- source4/ntptr/ntptr_interface.c | 561 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 561 insertions(+) create mode 100644 source4/ntptr/ntptr_interface.c (limited to 'source4/ntptr/ntptr_interface.c') diff --git a/source4/ntptr/ntptr_interface.c b/source4/ntptr/ntptr_interface.c new file mode 100644 index 0000000000..b389a5b894 --- /dev/null +++ b/source4/ntptr/ntptr_interface.c @@ -0,0 +1,561 @@ +/* + Unix SMB/CIFS implementation. + + NTPTR interface functions + + Copyright (C) Stefan (metze) Metzmacher 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "ntptr/ntptr.h" + + +/* PrintServer functions */ +WERROR ntptr_OpenPrintServer(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_OpenPrinterEx *r, + const char *printer_name, + struct ntptr_GenericHandle **server) +{ + if (!ntptr->ops->OpenPrintServer) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->OpenPrintServer(ntptr, mem_ctx, r, printer_name, server); +} + + +/* PrintServer PrinterData functions */ +WERROR ntptr_EnumPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, + struct spoolss_EnumPrinterData *r) +{ + if (server->type != NTPTR_HANDLE_SERVER) { + return WERR_FOOBAR; + } + if (!server->ntptr->ops->EnumPrintServerData) { + return WERR_NOT_SUPPORTED; + } + return server->ntptr->ops->EnumPrintServerData(server, mem_ctx, r); +} + +WERROR ntptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, + struct spoolss_GetPrinterData *r) +{ + if (server->type != NTPTR_HANDLE_SERVER) { + return WERR_FOOBAR; + } + if (!server->ntptr->ops->GetPrintServerData) { + return WERR_NOT_SUPPORTED; + } + return server->ntptr->ops->GetPrintServerData(server, mem_ctx, r); +} + +WERROR ntptr_SetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, + struct spoolss_SetPrinterData *r) +{ + if (server->type != NTPTR_HANDLE_SERVER) { + return WERR_FOOBAR; + } + if (!server->ntptr->ops->SetPrintServerData) { + return WERR_NOT_SUPPORTED; + } + return server->ntptr->ops->SetPrintServerData(server, mem_ctx, r); +} + +WERROR ntptr_DeletePrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, + struct spoolss_DeletePrinterData *r) +{ + if (server->type != NTPTR_HANDLE_SERVER) { + return WERR_FOOBAR; + } + if (!server->ntptr->ops->DeletePrintServerData) { + return WERR_NOT_SUPPORTED; + } + return server->ntptr->ops->DeletePrintServerData(server, mem_ctx, r); +} + + +/* PrintServer Form functions */ +WERROR ntptr_EnumPrintServerForms(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, + struct spoolss_EnumForms *r) +{ + if (server->type != NTPTR_HANDLE_SERVER) { + return WERR_FOOBAR; + } + if (!server->ntptr->ops->EnumPrintServerForms) { + return WERR_NOT_SUPPORTED; + } + return server->ntptr->ops->EnumPrintServerForms(server, mem_ctx, r); +} + +WERROR ntptr_AddPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, + struct spoolss_AddForm *r) +{ + if (server->type != NTPTR_HANDLE_SERVER) { + return WERR_FOOBAR; + } + if (!server->ntptr->ops->AddPrintServerForm) { + return WERR_NOT_SUPPORTED; + } + return server->ntptr->ops->AddPrintServerForm(server, mem_ctx, r); +} + +WERROR ntptr_GetPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, + struct spoolss_GetForm *r) +{ + if (server->type != NTPTR_HANDLE_SERVER) { + return WERR_FOOBAR; + } + if (!server->ntptr->ops->GetPrintServerForm) { + return WERR_NOT_SUPPORTED; + } + return server->ntptr->ops->GetPrintServerForm(server, mem_ctx, r); +} + +WERROR ntptr_SetPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, + struct spoolss_SetForm *r) +{ + if (server->type != NTPTR_HANDLE_SERVER) { + return WERR_FOOBAR; + } + if (!server->ntptr->ops->SetPrintServerForm) { + return WERR_NOT_SUPPORTED; + } + return server->ntptr->ops->SetPrintServerForm(server, mem_ctx, r); +} + +WERROR ntptr_DeletePrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, + struct spoolss_DeleteForm *r) +{ + if (server->type != NTPTR_HANDLE_SERVER) { + return WERR_FOOBAR; + } + if (!server->ntptr->ops->DeletePrintServerForm) { + return WERR_NOT_SUPPORTED; + } + return server->ntptr->ops->DeletePrintServerForm(server, mem_ctx, r); +} + + +/* PrintServer Driver functions */ +WERROR ntptr_EnumPrinterDrivers(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_EnumPrinterDrivers *r) +{ + if (!ntptr->ops->EnumPrinterDrivers) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->EnumPrinterDrivers(ntptr, mem_ctx, r); +} + +WERROR ntptr_AddPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_AddPrinterDriver *r) +{ + if (!ntptr->ops->AddPrinterDriver) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->AddPrinterDriver(ntptr, mem_ctx, r); +} + +WERROR ntptr_DeletePrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_DeletePrinterDriver *r) +{ + if (!ntptr->ops->DeletePrinterDriver) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->DeletePrinterDriver(ntptr, mem_ctx, r); +} + +WERROR ntptr_GetPrinterDriverDirectory(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_GetPrinterDriverDirectory *r) +{ + if (!ntptr->ops->GetPrinterDriverDirectory) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->GetPrinterDriverDirectory(ntptr, mem_ctx, r); +} + + +/* Port functions */ +WERROR ntptr_EnumPorts(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_EnumPorts *r) +{ + if (!ntptr->ops->EnumPorts) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->EnumPorts(ntptr, mem_ctx, r); +} + +WERROR ntptr_OpenPort(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_OpenPrinterEx *r, + const char *port_name, + struct ntptr_GenericHandle **prt) +{ + if (!ntptr->ops->OpenPort) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->OpenPort(ntptr, mem_ctx, r, port_name, prt); +} + + +/* Monitor functions */ +WERROR ntptr_EnumMonitors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_EnumMonitors *r) +{ + if (!ntptr->ops->EnumMonitors) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->EnumMonitors(ntptr, mem_ctx, r); +} + +WERROR ntptr_OpenMonitor(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_OpenPrinterEx *r, + const char *monitor_name, + struct ntptr_GenericHandle **monitor) +{ + if (!ntptr->ops->OpenMonitor) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->OpenMonitor(ntptr, mem_ctx, r, monitor_name, monitor); +} + + +/* PrintProcessor functions */ +WERROR ntptr_EnumPrintProcessors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_EnumPrintProcessors *r) +{ + if (!ntptr->ops->EnumPrintProcessors) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->EnumPrintProcessors(ntptr, mem_ctx, r); +} + + +/* Printer functions */ +WERROR ntptr_EnumPrinters(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_EnumPrinters *r) +{ + if (!ntptr->ops->EnumPrinters) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->EnumPrinters(ntptr, mem_ctx, r); +} + +WERROR ntptr_OpenPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_OpenPrinterEx *r, + const char *printer_name, + struct ntptr_GenericHandle **printer) +{ + if (!ntptr->ops->OpenPrinter) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->OpenPrinter(ntptr, mem_ctx, r, printer_name, printer); +} + +WERROR ntptr_AddPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_AddPrinter *r, + struct ntptr_GenericHandle **printer) +{ + if (!ntptr->ops->AddPrinter) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->AddPrinter(ntptr, mem_ctx, r, printer); +} + +WERROR ntptr_GetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_GetPrinter *r) +{ + if (!ntptr->ops->GetPrinter) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->GetPrinter(ntptr, mem_ctx, r); +} + +WERROR ntptr_SetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_SetPrinter *r) +{ + if (!ntptr->ops->SetPrinter) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->SetPrinter(ntptr, mem_ctx, r); +} + +WERROR ntptr_DeletePrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_DeletePrinter *r) +{ + if (!ntptr->ops->DeletePrinter) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->DeletePrinter(ntptr, mem_ctx, r); +} + + +/* Printer Driver functions */ +WERROR ntptr_GetPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_GetPrinterDriver *r) +{ + if (!ntptr->ops->GetPrinterDriver) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->GetPrinterDriver(ntptr, mem_ctx, r); +} + + +/* Printer PrinterData functions */ +WERROR ntptr_EnumPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_EnumPrinterData *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->EnumPrinterData) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->EnumPrinterData(printer, mem_ctx, r); +} + +WERROR ntptr_GetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_GetPrinterData *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->GetPrinterData) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->GetPrinterData(printer, mem_ctx, r); +} + +WERROR ntptr_SetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_SetPrinterData *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->SetPrinterData) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->SetPrinterData(printer, mem_ctx, r); +} + +WERROR ntptr_DeletePrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_DeletePrinterData *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->DeletePrinterData) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->DeletePrinterData(printer, mem_ctx, r); +} + + +/* Printer Form functions */ +WERROR ntptr_EnumPrinterForms(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_EnumForms *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->EnumPrinterForms) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->EnumPrinterForms(printer, mem_ctx, r); +} + +WERROR ntptr_AddPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_AddForm *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->AddPrinterForm) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->AddPrinterForm(printer, mem_ctx, r); +} + +WERROR ntptr_GetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_GetForm *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->GetPrinterForm) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->GetPrinterForm(printer, mem_ctx, r); +} + +WERROR ntptr_SetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_SetForm *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->SetPrinterForm) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->SetPrinterForm(printer, mem_ctx, r); +} + +WERROR ntptr_DeletePrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_DeleteForm *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->DeletePrinterForm) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->DeletePrinterForm(printer, mem_ctx, r); +} + + +/* Printer Job functions */ +WERROR ntptr_EnumJobs(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_EnumJobs *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->EnumJobs) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->EnumJobs(printer, mem_ctx, r); +} + +WERROR ntptr_AddJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_AddJob *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->AddJob) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->AddJob(printer, mem_ctx, r); +} + +WERROR ntptr_ScheduleJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_ScheduleJob *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->ScheduleJob) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->ScheduleJob(printer, mem_ctx, r); +} + +WERROR ntptr_GetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_GetJob *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->GetJob) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->GetJob(printer, mem_ctx, r); +} + +WERROR ntptr_SetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_SetJob *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->SetJob) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->SetJob(printer, mem_ctx, r); +} + + +/* Printer Printing functions */ +WERROR ntptr_StartDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_StartDocPrinter *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->StartDocPrinter) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->StartDocPrinter(printer, mem_ctx, r); +} + +WERROR ntptr_EndDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_EndDocPrinter *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->EndDocPrinter) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->EndDocPrinter(printer, mem_ctx, r); +} + +WERROR ntptr_StartPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_StartPagePrinter *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->StartPagePrinter) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->StartPagePrinter(printer, mem_ctx, r); +} + +WERROR ntptr_EndPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_EndPagePrinter *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->EndPagePrinter) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->EndPagePrinter(printer, mem_ctx, r); +} + +WERROR ntptr_WritePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_WritePrinter *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->WritePrinter) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->WritePrinter(printer, mem_ctx, r); +} + +WERROR ntptr_ReadPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, + struct spoolss_ReadPrinter *r) +{ + if (printer->type != NTPTR_HANDLE_PRINTER) { + return WERR_FOOBAR; + } + if (!printer->ntptr->ops->ReadPrinter) { + return WERR_NOT_SUPPORTED; + } + return printer->ntptr->ops->ReadPrinter(printer, mem_ctx, r); +} + -- cgit From fe94ba6e71eb8d3273d593763f6b6d03fa90113d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 1 Jul 2005 09:05:10 +0000 Subject: r8046: - add somemore failure checks in the RPC-SPOOLSS test - test AddForm on the PrintServer object - GetForm() isn't allowed on the PrintServer object so remove NTPTR function for it - accept the dns name as servername in the spoolss server metze (This used to be commit d8c308a4653d59514915021607fe55c5f2b38749) --- source4/ntptr/ntptr_interface.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'source4/ntptr/ntptr_interface.c') diff --git a/source4/ntptr/ntptr_interface.c b/source4/ntptr/ntptr_interface.c index b389a5b894..1920b37f21 100644 --- a/source4/ntptr/ntptr_interface.c +++ b/source4/ntptr/ntptr_interface.c @@ -112,18 +112,6 @@ WERROR ntptr_AddPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX * return server->ntptr->ops->AddPrintServerForm(server, mem_ctx, r); } -WERROR ntptr_GetPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, - struct spoolss_GetForm *r) -{ - if (server->type != NTPTR_HANDLE_SERVER) { - return WERR_FOOBAR; - } - if (!server->ntptr->ops->GetPrintServerForm) { - return WERR_NOT_SUPPORTED; - } - return server->ntptr->ops->GetPrintServerForm(server, mem_ctx, r); -} - WERROR ntptr_SetPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, struct spoolss_SetForm *r) { -- cgit From b22ddfd61d5a3e477ea4401b3800d44709d56f82 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 26 Jun 2006 18:31:39 +0000 Subject: r16523: pass spoolss_XcvData calls to the ntptr backends... I wrote this code last year and found it in a working tree... metze (This used to be commit 9a685c5beff6936d354d541e875899d33b735ba9) --- source4/ntptr/ntptr_interface.c | 51 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'source4/ntptr/ntptr_interface.c') 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, -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/ntptr/ntptr_interface.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/ntptr/ntptr_interface.c') diff --git a/source4/ntptr/ntptr_interface.c b/source4/ntptr/ntptr_interface.c index 56c3a61659..109a9f560b 100644 --- a/source4/ntptr/ntptr_interface.c +++ b/source4/ntptr/ntptr_interface.c @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit