s3/net: Display error message if user does not exist.
[Samba/gebeck_regimport.git] / source4 / ntptr / ntptr_interface.c
blob109a9f560b4552e270bb6f19e691accb13654ead
1 /*
2 Unix SMB/CIFS implementation.
4 NTPTR interface functions
6 Copyright (C) Stefan (metze) Metzmacher 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "includes.h"
23 #include "ntptr/ntptr.h"
26 /* PrintServer functions */
27 WERROR ntptr_OpenPrintServer(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
28 struct spoolss_OpenPrinterEx *r,
29 const char *printer_name,
30 struct ntptr_GenericHandle **server)
32 if (!ntptr->ops->OpenPrintServer) {
33 return WERR_NOT_SUPPORTED;
35 return ntptr->ops->OpenPrintServer(ntptr, mem_ctx, r, printer_name, server);
38 WERROR ntptr_XcvDataPrintServer(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
39 struct spoolss_XcvData *r)
41 if (server->type != NTPTR_HANDLE_SERVER) {
42 return WERR_FOOBAR;
44 if (!server->ntptr->ops->XcvDataPrintServer) {
45 return WERR_NOT_SUPPORTED;
47 return server->ntptr->ops->XcvDataPrintServer(server, mem_ctx, r);
51 /* PrintServer PrinterData functions */
52 WERROR ntptr_EnumPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
53 struct spoolss_EnumPrinterData *r)
55 if (server->type != NTPTR_HANDLE_SERVER) {
56 return WERR_FOOBAR;
58 if (!server->ntptr->ops->EnumPrintServerData) {
59 return WERR_NOT_SUPPORTED;
61 return server->ntptr->ops->EnumPrintServerData(server, mem_ctx, r);
64 WERROR ntptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
65 struct spoolss_GetPrinterData *r)
67 if (server->type != NTPTR_HANDLE_SERVER) {
68 return WERR_FOOBAR;
70 if (!server->ntptr->ops->GetPrintServerData) {
71 return WERR_NOT_SUPPORTED;
73 return server->ntptr->ops->GetPrintServerData(server, mem_ctx, r);
76 WERROR ntptr_SetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
77 struct spoolss_SetPrinterData *r)
79 if (server->type != NTPTR_HANDLE_SERVER) {
80 return WERR_FOOBAR;
82 if (!server->ntptr->ops->SetPrintServerData) {
83 return WERR_NOT_SUPPORTED;
85 return server->ntptr->ops->SetPrintServerData(server, mem_ctx, r);
88 WERROR ntptr_DeletePrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
89 struct spoolss_DeletePrinterData *r)
91 if (server->type != NTPTR_HANDLE_SERVER) {
92 return WERR_FOOBAR;
94 if (!server->ntptr->ops->DeletePrintServerData) {
95 return WERR_NOT_SUPPORTED;
97 return server->ntptr->ops->DeletePrintServerData(server, mem_ctx, r);
101 /* PrintServer Form functions */
102 WERROR ntptr_EnumPrintServerForms(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
103 struct spoolss_EnumForms *r)
105 if (server->type != NTPTR_HANDLE_SERVER) {
106 return WERR_FOOBAR;
108 if (!server->ntptr->ops->EnumPrintServerForms) {
109 return WERR_NOT_SUPPORTED;
111 return server->ntptr->ops->EnumPrintServerForms(server, mem_ctx, r);
114 WERROR ntptr_AddPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
115 struct spoolss_AddForm *r)
117 if (server->type != NTPTR_HANDLE_SERVER) {
118 return WERR_FOOBAR;
120 if (!server->ntptr->ops->AddPrintServerForm) {
121 return WERR_NOT_SUPPORTED;
123 return server->ntptr->ops->AddPrintServerForm(server, mem_ctx, r);
126 WERROR ntptr_SetPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
127 struct spoolss_SetForm *r)
129 if (server->type != NTPTR_HANDLE_SERVER) {
130 return WERR_FOOBAR;
132 if (!server->ntptr->ops->SetPrintServerForm) {
133 return WERR_NOT_SUPPORTED;
135 return server->ntptr->ops->SetPrintServerForm(server, mem_ctx, r);
138 WERROR ntptr_DeletePrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
139 struct spoolss_DeleteForm *r)
141 if (server->type != NTPTR_HANDLE_SERVER) {
142 return WERR_FOOBAR;
144 if (!server->ntptr->ops->DeletePrintServerForm) {
145 return WERR_NOT_SUPPORTED;
147 return server->ntptr->ops->DeletePrintServerForm(server, mem_ctx, r);
151 /* PrintServer Driver functions */
152 WERROR ntptr_EnumPrinterDrivers(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
153 struct spoolss_EnumPrinterDrivers *r)
155 if (!ntptr->ops->EnumPrinterDrivers) {
156 return WERR_NOT_SUPPORTED;
158 return ntptr->ops->EnumPrinterDrivers(ntptr, mem_ctx, r);
161 WERROR ntptr_AddPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
162 struct spoolss_AddPrinterDriver *r)
164 if (!ntptr->ops->AddPrinterDriver) {
165 return WERR_NOT_SUPPORTED;
167 return ntptr->ops->AddPrinterDriver(ntptr, mem_ctx, r);
170 WERROR ntptr_DeletePrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
171 struct spoolss_DeletePrinterDriver *r)
173 if (!ntptr->ops->DeletePrinterDriver) {
174 return WERR_NOT_SUPPORTED;
176 return ntptr->ops->DeletePrinterDriver(ntptr, mem_ctx, r);
179 WERROR ntptr_GetPrinterDriverDirectory(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
180 struct spoolss_GetPrinterDriverDirectory *r)
182 if (!ntptr->ops->GetPrinterDriverDirectory) {
183 return WERR_NOT_SUPPORTED;
185 return ntptr->ops->GetPrinterDriverDirectory(ntptr, mem_ctx, r);
189 /* Port functions */
190 WERROR ntptr_EnumPorts(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
191 struct spoolss_EnumPorts *r)
193 if (!ntptr->ops->EnumPorts) {
194 return WERR_NOT_SUPPORTED;
196 return ntptr->ops->EnumPorts(ntptr, mem_ctx, r);
199 WERROR ntptr_OpenPort(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
200 struct spoolss_OpenPrinterEx *r,
201 const char *port_name,
202 struct ntptr_GenericHandle **port)
204 if (!ntptr->ops->OpenPort) {
205 return WERR_NOT_SUPPORTED;
207 return ntptr->ops->OpenPort(ntptr, mem_ctx, r, port_name, port);
210 WERROR ntptr_XcvDataPort(struct ntptr_GenericHandle *port, TALLOC_CTX *mem_ctx,
211 struct spoolss_XcvData *r)
213 if (port->type != NTPTR_HANDLE_PORT) {
214 return WERR_FOOBAR;
216 if (!port->ntptr->ops->XcvDataPort) {
217 return WERR_NOT_SUPPORTED;
219 return port->ntptr->ops->XcvDataPort(port, mem_ctx, r);
222 /* Monitor functions */
223 WERROR ntptr_EnumMonitors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
224 struct spoolss_EnumMonitors *r)
226 if (!ntptr->ops->EnumMonitors) {
227 return WERR_NOT_SUPPORTED;
229 return ntptr->ops->EnumMonitors(ntptr, mem_ctx, r);
232 WERROR ntptr_OpenMonitor(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
233 struct spoolss_OpenPrinterEx *r,
234 const char *monitor_name,
235 struct ntptr_GenericHandle **monitor)
237 if (!ntptr->ops->OpenMonitor) {
238 return WERR_NOT_SUPPORTED;
240 return ntptr->ops->OpenMonitor(ntptr, mem_ctx, r, monitor_name, monitor);
243 WERROR ntptr_XcvDataMonitor(struct ntptr_GenericHandle *monitor, TALLOC_CTX *mem_ctx,
244 struct spoolss_XcvData *r)
246 if (monitor->type != NTPTR_HANDLE_MONITOR) {
247 return WERR_FOOBAR;
249 if (!monitor->ntptr->ops->XcvDataMonitor) {
250 return WERR_NOT_SUPPORTED;
252 return monitor->ntptr->ops->XcvDataMonitor(monitor, mem_ctx, r);
256 /* PrintProcessor functions */
257 WERROR ntptr_EnumPrintProcessors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
258 struct spoolss_EnumPrintProcessors *r)
260 if (!ntptr->ops->EnumPrintProcessors) {
261 return WERR_NOT_SUPPORTED;
263 return ntptr->ops->EnumPrintProcessors(ntptr, mem_ctx, r);
267 /* Printer functions */
268 WERROR ntptr_EnumPrinters(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
269 struct spoolss_EnumPrinters *r)
271 if (!ntptr->ops->EnumPrinters) {
272 return WERR_NOT_SUPPORTED;
274 return ntptr->ops->EnumPrinters(ntptr, mem_ctx, r);
277 WERROR ntptr_OpenPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
278 struct spoolss_OpenPrinterEx *r,
279 const char *printer_name,
280 struct ntptr_GenericHandle **printer)
282 if (!ntptr->ops->OpenPrinter) {
283 return WERR_NOT_SUPPORTED;
285 return ntptr->ops->OpenPrinter(ntptr, mem_ctx, r, printer_name, printer);
288 WERROR ntptr_AddPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
289 struct spoolss_AddPrinter *r,
290 struct ntptr_GenericHandle **printer)
292 if (!ntptr->ops->AddPrinter) {
293 return WERR_NOT_SUPPORTED;
295 return ntptr->ops->AddPrinter(ntptr, mem_ctx, r, printer);
298 WERROR ntptr_GetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
299 struct spoolss_GetPrinter *r)
301 if (!ntptr->ops->GetPrinter) {
302 return WERR_NOT_SUPPORTED;
304 return ntptr->ops->GetPrinter(ntptr, mem_ctx, r);
307 WERROR ntptr_SetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
308 struct spoolss_SetPrinter *r)
310 if (!ntptr->ops->SetPrinter) {
311 return WERR_NOT_SUPPORTED;
313 return ntptr->ops->SetPrinter(ntptr, mem_ctx, r);
316 WERROR ntptr_DeletePrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
317 struct spoolss_DeletePrinter *r)
319 if (!ntptr->ops->DeletePrinter) {
320 return WERR_NOT_SUPPORTED;
322 return ntptr->ops->DeletePrinter(ntptr, mem_ctx, r);
325 WERROR ntptr_XcvDataPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
326 struct spoolss_XcvData *r)
328 if (printer->type != NTPTR_HANDLE_PRINTER) {
329 return WERR_FOOBAR;
331 if (!printer->ntptr->ops->XcvDataPrinter) {
332 return WERR_NOT_SUPPORTED;
334 return printer->ntptr->ops->XcvDataPrinter(printer, mem_ctx, r);
338 /* Printer Driver functions */
339 WERROR ntptr_GetPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
340 struct spoolss_GetPrinterDriver *r)
342 if (!ntptr->ops->GetPrinterDriver) {
343 return WERR_NOT_SUPPORTED;
345 return ntptr->ops->GetPrinterDriver(ntptr, mem_ctx, r);
349 /* Printer PrinterData functions */
350 WERROR ntptr_EnumPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
351 struct spoolss_EnumPrinterData *r)
353 if (printer->type != NTPTR_HANDLE_PRINTER) {
354 return WERR_FOOBAR;
356 if (!printer->ntptr->ops->EnumPrinterData) {
357 return WERR_NOT_SUPPORTED;
359 return printer->ntptr->ops->EnumPrinterData(printer, mem_ctx, r);
362 WERROR ntptr_GetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
363 struct spoolss_GetPrinterData *r)
365 if (printer->type != NTPTR_HANDLE_PRINTER) {
366 return WERR_FOOBAR;
368 if (!printer->ntptr->ops->GetPrinterData) {
369 return WERR_NOT_SUPPORTED;
371 return printer->ntptr->ops->GetPrinterData(printer, mem_ctx, r);
374 WERROR ntptr_SetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
375 struct spoolss_SetPrinterData *r)
377 if (printer->type != NTPTR_HANDLE_PRINTER) {
378 return WERR_FOOBAR;
380 if (!printer->ntptr->ops->SetPrinterData) {
381 return WERR_NOT_SUPPORTED;
383 return printer->ntptr->ops->SetPrinterData(printer, mem_ctx, r);
386 WERROR ntptr_DeletePrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
387 struct spoolss_DeletePrinterData *r)
389 if (printer->type != NTPTR_HANDLE_PRINTER) {
390 return WERR_FOOBAR;
392 if (!printer->ntptr->ops->DeletePrinterData) {
393 return WERR_NOT_SUPPORTED;
395 return printer->ntptr->ops->DeletePrinterData(printer, mem_ctx, r);
399 /* Printer Form functions */
400 WERROR ntptr_EnumPrinterForms(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
401 struct spoolss_EnumForms *r)
403 if (printer->type != NTPTR_HANDLE_PRINTER) {
404 return WERR_FOOBAR;
406 if (!printer->ntptr->ops->EnumPrinterForms) {
407 return WERR_NOT_SUPPORTED;
409 return printer->ntptr->ops->EnumPrinterForms(printer, mem_ctx, r);
412 WERROR ntptr_AddPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
413 struct spoolss_AddForm *r)
415 if (printer->type != NTPTR_HANDLE_PRINTER) {
416 return WERR_FOOBAR;
418 if (!printer->ntptr->ops->AddPrinterForm) {
419 return WERR_NOT_SUPPORTED;
421 return printer->ntptr->ops->AddPrinterForm(printer, mem_ctx, r);
424 WERROR ntptr_GetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
425 struct spoolss_GetForm *r)
427 if (printer->type != NTPTR_HANDLE_PRINTER) {
428 return WERR_FOOBAR;
430 if (!printer->ntptr->ops->GetPrinterForm) {
431 return WERR_NOT_SUPPORTED;
433 return printer->ntptr->ops->GetPrinterForm(printer, mem_ctx, r);
436 WERROR ntptr_SetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
437 struct spoolss_SetForm *r)
439 if (printer->type != NTPTR_HANDLE_PRINTER) {
440 return WERR_FOOBAR;
442 if (!printer->ntptr->ops->SetPrinterForm) {
443 return WERR_NOT_SUPPORTED;
445 return printer->ntptr->ops->SetPrinterForm(printer, mem_ctx, r);
448 WERROR ntptr_DeletePrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
449 struct spoolss_DeleteForm *r)
451 if (printer->type != NTPTR_HANDLE_PRINTER) {
452 return WERR_FOOBAR;
454 if (!printer->ntptr->ops->DeletePrinterForm) {
455 return WERR_NOT_SUPPORTED;
457 return printer->ntptr->ops->DeletePrinterForm(printer, mem_ctx, r);
461 /* Printer Job functions */
462 WERROR ntptr_EnumJobs(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
463 struct spoolss_EnumJobs *r)
465 if (printer->type != NTPTR_HANDLE_PRINTER) {
466 return WERR_FOOBAR;
468 if (!printer->ntptr->ops->EnumJobs) {
469 return WERR_NOT_SUPPORTED;
471 return printer->ntptr->ops->EnumJobs(printer, mem_ctx, r);
474 WERROR ntptr_AddJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
475 struct spoolss_AddJob *r)
477 if (printer->type != NTPTR_HANDLE_PRINTER) {
478 return WERR_FOOBAR;
480 if (!printer->ntptr->ops->AddJob) {
481 return WERR_NOT_SUPPORTED;
483 return printer->ntptr->ops->AddJob(printer, mem_ctx, r);
486 WERROR ntptr_ScheduleJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
487 struct spoolss_ScheduleJob *r)
489 if (printer->type != NTPTR_HANDLE_PRINTER) {
490 return WERR_FOOBAR;
492 if (!printer->ntptr->ops->ScheduleJob) {
493 return WERR_NOT_SUPPORTED;
495 return printer->ntptr->ops->ScheduleJob(printer, mem_ctx, r);
498 WERROR ntptr_GetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
499 struct spoolss_GetJob *r)
501 if (printer->type != NTPTR_HANDLE_PRINTER) {
502 return WERR_FOOBAR;
504 if (!printer->ntptr->ops->GetJob) {
505 return WERR_NOT_SUPPORTED;
507 return printer->ntptr->ops->GetJob(printer, mem_ctx, r);
510 WERROR ntptr_SetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
511 struct spoolss_SetJob *r)
513 if (printer->type != NTPTR_HANDLE_PRINTER) {
514 return WERR_FOOBAR;
516 if (!printer->ntptr->ops->SetJob) {
517 return WERR_NOT_SUPPORTED;
519 return printer->ntptr->ops->SetJob(printer, mem_ctx, r);
523 /* Printer Printing functions */
524 WERROR ntptr_StartDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
525 struct spoolss_StartDocPrinter *r)
527 if (printer->type != NTPTR_HANDLE_PRINTER) {
528 return WERR_FOOBAR;
530 if (!printer->ntptr->ops->StartDocPrinter) {
531 return WERR_NOT_SUPPORTED;
533 return printer->ntptr->ops->StartDocPrinter(printer, mem_ctx, r);
536 WERROR ntptr_EndDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
537 struct spoolss_EndDocPrinter *r)
539 if (printer->type != NTPTR_HANDLE_PRINTER) {
540 return WERR_FOOBAR;
542 if (!printer->ntptr->ops->EndDocPrinter) {
543 return WERR_NOT_SUPPORTED;
545 return printer->ntptr->ops->EndDocPrinter(printer, mem_ctx, r);
548 WERROR ntptr_StartPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
549 struct spoolss_StartPagePrinter *r)
551 if (printer->type != NTPTR_HANDLE_PRINTER) {
552 return WERR_FOOBAR;
554 if (!printer->ntptr->ops->StartPagePrinter) {
555 return WERR_NOT_SUPPORTED;
557 return printer->ntptr->ops->StartPagePrinter(printer, mem_ctx, r);
560 WERROR ntptr_EndPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
561 struct spoolss_EndPagePrinter *r)
563 if (printer->type != NTPTR_HANDLE_PRINTER) {
564 return WERR_FOOBAR;
566 if (!printer->ntptr->ops->EndPagePrinter) {
567 return WERR_NOT_SUPPORTED;
569 return printer->ntptr->ops->EndPagePrinter(printer, mem_ctx, r);
572 WERROR ntptr_WritePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
573 struct spoolss_WritePrinter *r)
575 if (printer->type != NTPTR_HANDLE_PRINTER) {
576 return WERR_FOOBAR;
578 if (!printer->ntptr->ops->WritePrinter) {
579 return WERR_NOT_SUPPORTED;
581 return printer->ntptr->ops->WritePrinter(printer, mem_ctx, r);
584 WERROR ntptr_ReadPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
585 struct spoolss_ReadPrinter *r)
587 if (printer->type != NTPTR_HANDLE_PRINTER) {
588 return WERR_FOOBAR;
590 if (!printer->ntptr->ops->ReadPrinter) {
591 return WERR_NOT_SUPPORTED;
593 return printer->ntptr->ops->ReadPrinter(printer, mem_ctx, r);