1 /*
2 Unix SMB/CIFS implementation.
3
4 NTPTR interface functions
5
6 Copyright (C) Stefan (metze) Metzmacher 2005
7
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 2 of the License, or
11 (at your option) any later version.
12
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.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #include "includes.h"
24 #include "ntptr/ntptr.h"
25
26
27 /* PrintServer functions */
ntptr_OpenPrintServer(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_OpenPrinterEx * r,const char * printer_name,struct ntptr_GenericHandle ** server)28 WERROR ntptr_OpenPrintServer(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
29 struct spoolss_OpenPrinterEx *r,
30 const char *printer_name,
31 struct ntptr_GenericHandle **server)
32 {
33 if (!ntptr->ops->OpenPrintServer) {
34 return WERR_NOT_SUPPORTED;
35 }
36 return ntptr->ops->OpenPrintServer(ntptr, mem_ctx, r, printer_name, server);
37 }
38
ntptr_XcvDataPrintServer(struct ntptr_GenericHandle * server,TALLOC_CTX * mem_ctx,struct spoolss_XcvData * r)39 WERROR ntptr_XcvDataPrintServer(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
40 struct spoolss_XcvData *r)
41 {
42 if (server->type != NTPTR_HANDLE_SERVER) {
43 return WERR_FOOBAR;
44 }
45 if (!server->ntptr->ops->XcvDataPrintServer) {
46 return WERR_NOT_SUPPORTED;
47 }
48 return server->ntptr->ops->XcvDataPrintServer(server, mem_ctx, r);
49 }
50
51
52 /* PrintServer PrinterData functions */
ntptr_EnumPrintServerData(struct ntptr_GenericHandle * server,TALLOC_CTX * mem_ctx,struct spoolss_EnumPrinterData * r)53 WERROR ntptr_EnumPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
54 struct spoolss_EnumPrinterData *r)
55 {
56 if (server->type != NTPTR_HANDLE_SERVER) {
57 return WERR_FOOBAR;
58 }
59 if (!server->ntptr->ops->EnumPrintServerData) {
60 return WERR_NOT_SUPPORTED;
61 }
62 return server->ntptr->ops->EnumPrintServerData(server, mem_ctx, r);
63 }
64
ntptr_GetPrintServerData(struct ntptr_GenericHandle * server,TALLOC_CTX * mem_ctx,struct spoolss_GetPrinterData * r)65 WERROR ntptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
66 struct spoolss_GetPrinterData *r)
67 {
68 if (server->type != NTPTR_HANDLE_SERVER) {
69 return WERR_FOOBAR;
70 }
71 if (!server->ntptr->ops->GetPrintServerData) {
72 return WERR_NOT_SUPPORTED;
73 }
74 return server->ntptr->ops->GetPrintServerData(server, mem_ctx, r);
75 }
76
ntptr_SetPrintServerData(struct ntptr_GenericHandle * server,TALLOC_CTX * mem_ctx,struct spoolss_SetPrinterData * r)77 WERROR ntptr_SetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
78 struct spoolss_SetPrinterData *r)
79 {
80 if (server->type != NTPTR_HANDLE_SERVER) {
81 return WERR_FOOBAR;
82 }
83 if (!server->ntptr->ops->SetPrintServerData) {
84 return WERR_NOT_SUPPORTED;
85 }
86 return server->ntptr->ops->SetPrintServerData(server, mem_ctx, r);
87 }
88
ntptr_DeletePrintServerData(struct ntptr_GenericHandle * server,TALLOC_CTX * mem_ctx,struct spoolss_DeletePrinterData * r)89 WERROR ntptr_DeletePrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
90 struct spoolss_DeletePrinterData *r)
91 {
92 if (server->type != NTPTR_HANDLE_SERVER) {
93 return WERR_FOOBAR;
94 }
95 if (!server->ntptr->ops->DeletePrintServerData) {
96 return WERR_NOT_SUPPORTED;
97 }
98 return server->ntptr->ops->DeletePrintServerData(server, mem_ctx, r);
99 }
100
101
102 /* PrintServer Form functions */
ntptr_EnumPrintServerForms(struct ntptr_GenericHandle * server,TALLOC_CTX * mem_ctx,struct spoolss_EnumForms * r)103 WERROR ntptr_EnumPrintServerForms(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
104 struct spoolss_EnumForms *r)
105 {
106 if (server->type != NTPTR_HANDLE_SERVER) {
107 return WERR_FOOBAR;
108 }
109 if (!server->ntptr->ops->EnumPrintServerForms) {
110 return WERR_NOT_SUPPORTED;
111 }
112 return server->ntptr->ops->EnumPrintServerForms(server, mem_ctx, r);
113 }
114
ntptr_AddPrintServerForm(struct ntptr_GenericHandle * server,TALLOC_CTX * mem_ctx,struct spoolss_AddForm * r)115 WERROR ntptr_AddPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
116 struct spoolss_AddForm *r)
117 {
118 if (server->type != NTPTR_HANDLE_SERVER) {
119 return WERR_FOOBAR;
120 }
121 if (!server->ntptr->ops->AddPrintServerForm) {
122 return WERR_NOT_SUPPORTED;
123 }
124 return server->ntptr->ops->AddPrintServerForm(server, mem_ctx, r);
125 }
126
ntptr_SetPrintServerForm(struct ntptr_GenericHandle * server,TALLOC_CTX * mem_ctx,struct spoolss_SetForm * r)127 WERROR ntptr_SetPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
128 struct spoolss_SetForm *r)
129 {
130 if (server->type != NTPTR_HANDLE_SERVER) {
131 return WERR_FOOBAR;
132 }
133 if (!server->ntptr->ops->SetPrintServerForm) {
134 return WERR_NOT_SUPPORTED;
135 }
136 return server->ntptr->ops->SetPrintServerForm(server, mem_ctx, r);
137 }
138
ntptr_DeletePrintServerForm(struct ntptr_GenericHandle * server,TALLOC_CTX * mem_ctx,struct spoolss_DeleteForm * r)139 WERROR ntptr_DeletePrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
140 struct spoolss_DeleteForm *r)
141 {
142 if (server->type != NTPTR_HANDLE_SERVER) {
143 return WERR_FOOBAR;
144 }
145 if (!server->ntptr->ops->DeletePrintServerForm) {
146 return WERR_NOT_SUPPORTED;
147 }
148 return server->ntptr->ops->DeletePrintServerForm(server, mem_ctx, r);
149 }
150
151
152 /* PrintServer Driver functions */
ntptr_EnumPrinterDrivers(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_EnumPrinterDrivers * r)153 WERROR ntptr_EnumPrinterDrivers(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
154 struct spoolss_EnumPrinterDrivers *r)
155 {
156 if (!ntptr->ops->EnumPrinterDrivers) {
157 return WERR_NOT_SUPPORTED;
158 }
159 return ntptr->ops->EnumPrinterDrivers(ntptr, mem_ctx, r);
160 }
161
ntptr_AddPrinterDriver(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_AddPrinterDriver * r)162 WERROR ntptr_AddPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
163 struct spoolss_AddPrinterDriver *r)
164 {
165 if (!ntptr->ops->AddPrinterDriver) {
166 return WERR_NOT_SUPPORTED;
167 }
168 return ntptr->ops->AddPrinterDriver(ntptr, mem_ctx, r);
169 }
170
ntptr_DeletePrinterDriver(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_DeletePrinterDriver * r)171 WERROR ntptr_DeletePrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
172 struct spoolss_DeletePrinterDriver *r)
173 {
174 if (!ntptr->ops->DeletePrinterDriver) {
175 return WERR_NOT_SUPPORTED;
176 }
177 return ntptr->ops->DeletePrinterDriver(ntptr, mem_ctx, r);
178 }
179
ntptr_GetPrinterDriverDirectory(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_GetPrinterDriverDirectory * r)180 WERROR ntptr_GetPrinterDriverDirectory(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
181 struct spoolss_GetPrinterDriverDirectory *r)
182 {
183 if (!ntptr->ops->GetPrinterDriverDirectory) {
184 return WERR_NOT_SUPPORTED;
185 }
186 return ntptr->ops->GetPrinterDriverDirectory(ntptr, mem_ctx, r);
187 }
188
189
190 /* Port functions */
ntptr_EnumPorts(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_EnumPorts * r)191 WERROR ntptr_EnumPorts(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
192 struct spoolss_EnumPorts *r)
193 {
194 if (!ntptr->ops->EnumPorts) {
195 return WERR_NOT_SUPPORTED;
196 }
197 return ntptr->ops->EnumPorts(ntptr, mem_ctx, r);
198 }
199
ntptr_OpenPort(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_OpenPrinterEx * r,const char * port_name,struct ntptr_GenericHandle ** port)200 WERROR ntptr_OpenPort(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
201 struct spoolss_OpenPrinterEx *r,
202 const char *port_name,
203 struct ntptr_GenericHandle **port)
204 {
205 if (!ntptr->ops->OpenPort) {
206 return WERR_NOT_SUPPORTED;
207 }
208 return ntptr->ops->OpenPort(ntptr, mem_ctx, r, port_name, port);
209 }
210
ntptr_XcvDataPort(struct ntptr_GenericHandle * port,TALLOC_CTX * mem_ctx,struct spoolss_XcvData * r)211 WERROR ntptr_XcvDataPort(struct ntptr_GenericHandle *port, TALLOC_CTX *mem_ctx,
212 struct spoolss_XcvData *r)
213 {
214 if (port->type != NTPTR_HANDLE_PORT) {
215 return WERR_FOOBAR;
216 }
217 if (!port->ntptr->ops->XcvDataPort) {
218 return WERR_NOT_SUPPORTED;
219 }
220 return port->ntptr->ops->XcvDataPort(port, mem_ctx, r);
221 }
222
223 /* Monitor functions */
ntptr_EnumMonitors(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_EnumMonitors * r)224 WERROR ntptr_EnumMonitors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
225 struct spoolss_EnumMonitors *r)
226 {
227 if (!ntptr->ops->EnumMonitors) {
228 return WERR_NOT_SUPPORTED;
229 }
230 return ntptr->ops->EnumMonitors(ntptr, mem_ctx, r);
231 }
232
ntptr_OpenMonitor(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_OpenPrinterEx * r,const char * monitor_name,struct ntptr_GenericHandle ** monitor)233 WERROR ntptr_OpenMonitor(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
234 struct spoolss_OpenPrinterEx *r,
235 const char *monitor_name,
236 struct ntptr_GenericHandle **monitor)
237 {
238 if (!ntptr->ops->OpenMonitor) {
239 return WERR_NOT_SUPPORTED;
240 }
241 return ntptr->ops->OpenMonitor(ntptr, mem_ctx, r, monitor_name, monitor);
242 }
243
ntptr_XcvDataMonitor(struct ntptr_GenericHandle * monitor,TALLOC_CTX * mem_ctx,struct spoolss_XcvData * r)244 WERROR ntptr_XcvDataMonitor(struct ntptr_GenericHandle *monitor, TALLOC_CTX *mem_ctx,
245 struct spoolss_XcvData *r)
246 {
247 if (monitor->type != NTPTR_HANDLE_MONITOR) {
248 return WERR_FOOBAR;
249 }
250 if (!monitor->ntptr->ops->XcvDataMonitor) {
251 return WERR_NOT_SUPPORTED;
252 }
253 return monitor->ntptr->ops->XcvDataMonitor(monitor, mem_ctx, r);
254 }
255
256
257 /* PrintProcessor functions */
ntptr_EnumPrintProcessors(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_EnumPrintProcessors * r)258 WERROR ntptr_EnumPrintProcessors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
259 struct spoolss_EnumPrintProcessors *r)
260 {
261 if (!ntptr->ops->EnumPrintProcessors) {
262 return WERR_NOT_SUPPORTED;
263 }
264 return ntptr->ops->EnumPrintProcessors(ntptr, mem_ctx, r);
265 }
266
267
268 /* Printer functions */
ntptr_EnumPrinters(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_EnumPrinters * r)269 WERROR ntptr_EnumPrinters(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
270 struct spoolss_EnumPrinters *r)
271 {
272 if (!ntptr->ops->EnumPrinters) {
273 return WERR_NOT_SUPPORTED;
274 }
275 return ntptr->ops->EnumPrinters(ntptr, mem_ctx, r);
276 }
277
ntptr_OpenPrinter(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_OpenPrinterEx * r,const char * printer_name,struct ntptr_GenericHandle ** printer)278 WERROR ntptr_OpenPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
279 struct spoolss_OpenPrinterEx *r,
280 const char *printer_name,
281 struct ntptr_GenericHandle **printer)
282 {
283 if (!ntptr->ops->OpenPrinter) {
284 return WERR_NOT_SUPPORTED;
285 }
286 return ntptr->ops->OpenPrinter(ntptr, mem_ctx, r, printer_name, printer);
287 }
288
ntptr_AddPrinter(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_AddPrinter * r,struct ntptr_GenericHandle ** printer)289 WERROR ntptr_AddPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
290 struct spoolss_AddPrinter *r,
291 struct ntptr_GenericHandle **printer)
292 {
293 if (!ntptr->ops->AddPrinter) {
294 return WERR_NOT_SUPPORTED;
295 }
296 return ntptr->ops->AddPrinter(ntptr, mem_ctx, r, printer);
297 }
298
ntptr_GetPrinter(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_GetPrinter * r)299 WERROR ntptr_GetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
300 struct spoolss_GetPrinter *r)
301 {
302 if (!ntptr->ops->GetPrinter) {
303 return WERR_NOT_SUPPORTED;
304 }
305 return ntptr->ops->GetPrinter(ntptr, mem_ctx, r);
306 }
307
ntptr_SetPrinter(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_SetPrinter * r)308 WERROR ntptr_SetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
309 struct spoolss_SetPrinter *r)
310 {
311 if (!ntptr->ops->SetPrinter) {
312 return WERR_NOT_SUPPORTED;
313 }
314 return ntptr->ops->SetPrinter(ntptr, mem_ctx, r);
315 }
316
ntptr_DeletePrinter(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_DeletePrinter * r)317 WERROR ntptr_DeletePrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
318 struct spoolss_DeletePrinter *r)
319 {
320 if (!ntptr->ops->DeletePrinter) {
321 return WERR_NOT_SUPPORTED;
322 }
323 return ntptr->ops->DeletePrinter(ntptr, mem_ctx, r);
324 }
325
ntptr_XcvDataPrinter(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_XcvData * r)326 WERROR ntptr_XcvDataPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
327 struct spoolss_XcvData *r)
328 {
329 if (printer->type != NTPTR_HANDLE_PRINTER) {
330 return WERR_FOOBAR;
331 }
332 if (!printer->ntptr->ops->XcvDataPrinter) {
333 return WERR_NOT_SUPPORTED;
334 }
335 return printer->ntptr->ops->XcvDataPrinter(printer, mem_ctx, r);
336 }
337
338
339 /* Printer Driver functions */
ntptr_GetPrinterDriver(struct ntptr_context * ntptr,TALLOC_CTX * mem_ctx,struct spoolss_GetPrinterDriver * r)340 WERROR ntptr_GetPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
341 struct spoolss_GetPrinterDriver *r)
342 {
343 if (!ntptr->ops->GetPrinterDriver) {
344 return WERR_NOT_SUPPORTED;
345 }
346 return ntptr->ops->GetPrinterDriver(ntptr, mem_ctx, r);
347 }
348
349
350 /* Printer PrinterData functions */
ntptr_EnumPrinterData(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_EnumPrinterData * r)351 WERROR ntptr_EnumPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
352 struct spoolss_EnumPrinterData *r)
353 {
354 if (printer->type != NTPTR_HANDLE_PRINTER) {
355 return WERR_FOOBAR;
356 }
357 if (!printer->ntptr->ops->EnumPrinterData) {
358 return WERR_NOT_SUPPORTED;
359 }
360 return printer->ntptr->ops->EnumPrinterData(printer, mem_ctx, r);
361 }
362
ntptr_GetPrinterData(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_GetPrinterData * r)363 WERROR ntptr_GetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
364 struct spoolss_GetPrinterData *r)
365 {
366 if (printer->type != NTPTR_HANDLE_PRINTER) {
367 return WERR_FOOBAR;
368 }
369 if (!printer->ntptr->ops->GetPrinterData) {
370 return WERR_NOT_SUPPORTED;
371 }
372 return printer->ntptr->ops->GetPrinterData(printer, mem_ctx, r);
373 }
374
ntptr_SetPrinterData(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_SetPrinterData * r)375 WERROR ntptr_SetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
376 struct spoolss_SetPrinterData *r)
377 {
378 if (printer->type != NTPTR_HANDLE_PRINTER) {
379 return WERR_FOOBAR;
380 }
381 if (!printer->ntptr->ops->SetPrinterData) {
382 return WERR_NOT_SUPPORTED;
383 }
384 return printer->ntptr->ops->SetPrinterData(printer, mem_ctx, r);
385 }
386
ntptr_DeletePrinterData(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_DeletePrinterData * r)387 WERROR ntptr_DeletePrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
388 struct spoolss_DeletePrinterData *r)
389 {
390 if (printer->type != NTPTR_HANDLE_PRINTER) {
391 return WERR_FOOBAR;
392 }
393 if (!printer->ntptr->ops->DeletePrinterData) {
394 return WERR_NOT_SUPPORTED;
395 }
396 return printer->ntptr->ops->DeletePrinterData(printer, mem_ctx, r);
397 }
398
399
400 /* Printer Form functions */
ntptr_EnumPrinterForms(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_EnumForms * r)401 WERROR ntptr_EnumPrinterForms(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
402 struct spoolss_EnumForms *r)
403 {
404 if (printer->type != NTPTR_HANDLE_PRINTER) {
405 return WERR_FOOBAR;
406 }
407 if (!printer->ntptr->ops->EnumPrinterForms) {
408 return WERR_NOT_SUPPORTED;
409 }
410 return printer->ntptr->ops->EnumPrinterForms(printer, mem_ctx, r);
411 }
412
ntptr_AddPrinterForm(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_AddForm * r)413 WERROR ntptr_AddPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
414 struct spoolss_AddForm *r)
415 {
416 if (printer->type != NTPTR_HANDLE_PRINTER) {
417 return WERR_FOOBAR;
418 }
419 if (!printer->ntptr->ops->AddPrinterForm) {
420 return WERR_NOT_SUPPORTED;
421 }
422 return printer->ntptr->ops->AddPrinterForm(printer, mem_ctx, r);
423 }
424
ntptr_GetPrinterForm(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_GetForm * r)425 WERROR ntptr_GetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
426 struct spoolss_GetForm *r)
427 {
428 if (printer->type != NTPTR_HANDLE_PRINTER) {
429 return WERR_FOOBAR;
430 }
431 if (!printer->ntptr->ops->GetPrinterForm) {
432 return WERR_NOT_SUPPORTED;
433 }
434 return printer->ntptr->ops->GetPrinterForm(printer, mem_ctx, r);
435 }
436
ntptr_SetPrinterForm(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_SetForm * r)437 WERROR ntptr_SetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
438 struct spoolss_SetForm *r)
439 {
440 if (printer->type != NTPTR_HANDLE_PRINTER) {
441 return WERR_FOOBAR;
442 }
443 if (!printer->ntptr->ops->SetPrinterForm) {
444 return WERR_NOT_SUPPORTED;
445 }
446 return printer->ntptr->ops->SetPrinterForm(printer, mem_ctx, r);
447 }
448
ntptr_DeletePrinterForm(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_DeleteForm * r)449 WERROR ntptr_DeletePrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
450 struct spoolss_DeleteForm *r)
451 {
452 if (printer->type != NTPTR_HANDLE_PRINTER) {
453 return WERR_FOOBAR;
454 }
455 if (!printer->ntptr->ops->DeletePrinterForm) {
456 return WERR_NOT_SUPPORTED;
457 }
458 return printer->ntptr->ops->DeletePrinterForm(printer, mem_ctx, r);
459 }
460
461
462 /* Printer Job functions */
ntptr_EnumJobs(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_EnumJobs * r)463 WERROR ntptr_EnumJobs(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
464 struct spoolss_EnumJobs *r)
465 {
466 if (printer->type != NTPTR_HANDLE_PRINTER) {
467 return WERR_FOOBAR;
468 }
469 if (!printer->ntptr->ops->EnumJobs) {
470 return WERR_NOT_SUPPORTED;
471 }
472 return printer->ntptr->ops->EnumJobs(printer, mem_ctx, r);
473 }
474
ntptr_AddJob(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_AddJob * r)475 WERROR ntptr_AddJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
476 struct spoolss_AddJob *r)
477 {
478 if (printer->type != NTPTR_HANDLE_PRINTER) {
479 return WERR_FOOBAR;
480 }
481 if (!printer->ntptr->ops->AddJob) {
482 return WERR_NOT_SUPPORTED;
483 }
484 return printer->ntptr->ops->AddJob(printer, mem_ctx, r);
485 }
486
ntptr_ScheduleJob(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_ScheduleJob * r)487 WERROR ntptr_ScheduleJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
488 struct spoolss_ScheduleJob *r)
489 {
490 if (printer->type != NTPTR_HANDLE_PRINTER) {
491 return WERR_FOOBAR;
492 }
493 if (!printer->ntptr->ops->ScheduleJob) {
494 return WERR_NOT_SUPPORTED;
495 }
496 return printer->ntptr->ops->ScheduleJob(printer, mem_ctx, r);
497 }
498
ntptr_GetJob(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_GetJob * r)499 WERROR ntptr_GetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
500 struct spoolss_GetJob *r)
501 {
502 if (printer->type != NTPTR_HANDLE_PRINTER) {
503 return WERR_FOOBAR;
504 }
505 if (!printer->ntptr->ops->GetJob) {
506 return WERR_NOT_SUPPORTED;
507 }
508 return printer->ntptr->ops->GetJob(printer, mem_ctx, r);
509 }
510
ntptr_SetJob(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_SetJob * r)511 WERROR ntptr_SetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
512 struct spoolss_SetJob *r)
513 {
514 if (printer->type != NTPTR_HANDLE_PRINTER) {
515 return WERR_FOOBAR;
516 }
517 if (!printer->ntptr->ops->SetJob) {
518 return WERR_NOT_SUPPORTED;
519 }
520 return printer->ntptr->ops->SetJob(printer, mem_ctx, r);
521 }
522
523
524 /* Printer Printing functions */
ntptr_StartDocPrinter(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_StartDocPrinter * r)525 WERROR ntptr_StartDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
526 struct spoolss_StartDocPrinter *r)
527 {
528 if (printer->type != NTPTR_HANDLE_PRINTER) {
529 return WERR_FOOBAR;
530 }
531 if (!printer->ntptr->ops->StartDocPrinter) {
532 return WERR_NOT_SUPPORTED;
533 }
534 return printer->ntptr->ops->StartDocPrinter(printer, mem_ctx, r);
535 }
536
ntptr_EndDocPrinter(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_EndDocPrinter * r)537 WERROR ntptr_EndDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
538 struct spoolss_EndDocPrinter *r)
539 {
540 if (printer->type != NTPTR_HANDLE_PRINTER) {
541 return WERR_FOOBAR;
542 }
543 if (!printer->ntptr->ops->EndDocPrinter) {
544 return WERR_NOT_SUPPORTED;
545 }
546 return printer->ntptr->ops->EndDocPrinter(printer, mem_ctx, r);
547 }
548
ntptr_StartPagePrinter(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_StartPagePrinter * r)549 WERROR ntptr_StartPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
550 struct spoolss_StartPagePrinter *r)
551 {
552 if (printer->type != NTPTR_HANDLE_PRINTER) {
553 return WERR_FOOBAR;
554 }
555 if (!printer->ntptr->ops->StartPagePrinter) {
556 return WERR_NOT_SUPPORTED;
557 }
558 return printer->ntptr->ops->StartPagePrinter(printer, mem_ctx, r);
559 }
560
ntptr_EndPagePrinter(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_EndPagePrinter * r)561 WERROR ntptr_EndPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
562 struct spoolss_EndPagePrinter *r)
563 {
564 if (printer->type != NTPTR_HANDLE_PRINTER) {
565 return WERR_FOOBAR;
566 }
567 if (!printer->ntptr->ops->EndPagePrinter) {
568 return WERR_NOT_SUPPORTED;
569 }
570 return printer->ntptr->ops->EndPagePrinter(printer, mem_ctx, r);
571 }
572
ntptr_WritePrinter(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_WritePrinter * r)573 WERROR ntptr_WritePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
574 struct spoolss_WritePrinter *r)
575 {
576 if (printer->type != NTPTR_HANDLE_PRINTER) {
577 return WERR_FOOBAR;
578 }
579 if (!printer->ntptr->ops->WritePrinter) {
580 return WERR_NOT_SUPPORTED;
581 }
582 return printer->ntptr->ops->WritePrinter(printer, mem_ctx, r);
583 }
584
ntptr_ReadPrinter(struct ntptr_GenericHandle * printer,TALLOC_CTX * mem_ctx,struct spoolss_ReadPrinter * r)585 WERROR ntptr_ReadPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
586 struct spoolss_ReadPrinter *r)
587 {
588 if (printer->type != NTPTR_HANDLE_PRINTER) {
589 return WERR_FOOBAR;
590 }
591 if (!printer->ntptr->ops->ReadPrinter) {
592 return WERR_NOT_SUPPORTED;
593 }
594 return printer->ntptr->ops->ReadPrinter(printer, mem_ctx, r);
595 }
596
597