2 Unix SMB/CIFS implementation.
4 endpoint server for the spoolss pipe
6 Copyright (C) Tim Potter 2004
7 Copyright (C) Stefan Metzmacher 2005
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include "rpc_server/dcerpc_server.h"
25 #include "librpc/gen_ndr/ndr_spoolss.h"
26 #include "ntptr/ntptr.h"
27 #include "lib/socket/socket.h"
28 #include "librpc/gen_ndr/ndr_spoolss_c.h"
29 #include "auth/credentials/credentials.h"
30 #include "param/param.h"
36 #define SPOOLSS_BUFFER_UNION(fn,ic,info,level) \
37 ((info)?ndr_size_##fn(info, level, ic, 0):0)
39 #define SPOOLSS_BUFFER_UNION_ARRAY(fn,ic,info,level,count) \
40 ((info)?ndr_size_##fn##_info(dce_call, ic, level, count, info):0)
42 #define SPOOLSS_BUFFER_OK(val_true,val_false) ((r->in.offered >= *r->out.needed)?val_true:val_false)
44 static WERROR
dcesrv_spoolss_parse_printer_name(TALLOC_CTX
*mem_ctx
, const char *name
,
45 const char **_server_name
,
46 const char **_object_name
,
47 enum ntptr_HandleType
*_object_type
)
51 char *server_unc
= NULL
;
52 const char *object
= name
;
54 /* no printername is there it's like open server */
58 *_object_type
= NTPTR_HANDLE_SERVER
;
62 /* just "\\" is invalid */
63 if (strequal("\\\\", name
)) {
64 return WERR_INVALID_PRINTER_NAME
;
67 if (strncmp("\\\\", name
, 2) == 0) {
68 server_unc
= talloc_strdup(mem_ctx
, name
);
69 W_ERROR_HAVE_NO_MEMORY(server_unc
);
70 server
= server_unc
+ 2;
72 /* here we know we have "\\" in front not followed
73 * by '\0', now see if we have another "\" in the string
75 p
= strchr_m(server
, '\\');
77 /* there's no other "\", so it's ("\\%s",server)
79 *_server_name
= server_unc
;
81 *_object_type
= NTPTR_HANDLE_SERVER
;
84 /* here we know that we have ("\\%s\",server),
85 * if we have '\0' as next then it's an invalid name
86 * otherwise the printer_name
89 /* everything that follows is the printer name */
93 /* just "" as server is invalid */
94 if (strequal(server
, "")) {
95 return WERR_INVALID_PRINTER_NAME
;
99 /* just "" is invalid */
100 if (strequal(object
, "")) {
101 return WERR_INVALID_PRINTER_NAME
;
104 #define XCV_PORT ",XcvPort "
105 #define XCV_MONITOR ",XcvMonitor "
106 if (strncmp(object
, XCV_PORT
, strlen(XCV_PORT
)) == 0) {
107 object
+= strlen(XCV_PORT
);
109 /* just "" is invalid */
110 if (strequal(object
, "")) {
111 return WERR_INVALID_PRINTER_NAME
;
114 *_server_name
= server_unc
;
115 *_object_name
= object
;
116 *_object_type
= NTPTR_HANDLE_PORT
;
118 } else if (strncmp(object
, XCV_MONITOR
, strlen(XCV_MONITOR
)) == 0) {
119 object
+= strlen(XCV_MONITOR
);
121 /* just "" is invalid */
122 if (strequal(object
, "")) {
123 return WERR_INVALID_PRINTER_NAME
;
126 *_server_name
= server_unc
;
127 *_object_name
= object
;
128 *_object_type
= NTPTR_HANDLE_MONITOR
;
132 *_server_name
= server_unc
;
133 *_object_name
= object
;
134 *_object_type
= NTPTR_HANDLE_PRINTER
;
139 * Check server_name is:
140 * - "" , functions that don't allow "",
141 * should check that on their own, before calling this function
142 * - our name (only netbios yet, TODO: need to test dns name!)
143 * - our ip address of the current use socket
144 * otherwise return WERR_INVALID_PRINTER_NAME
146 static WERROR
dcesrv_spoolss_check_server_name(struct dcesrv_call_state
*dce_call
,
148 const char *server_name
)
151 struct socket_address
*myaddr
;
152 const char **aliases
;
156 if (!server_name
) return WERR_OK
;
159 ret
= strequal("",server_name
);
160 if (ret
) return WERR_OK
;
162 /* just "\\" is invalid */
163 if (strequal("\\\\", server_name
)) {
164 return WERR_INVALID_PRINTER_NAME
;
167 /* then we need "\\" */
168 if (strncmp("\\\\", server_name
, 2) != 0) {
169 return WERR_INVALID_PRINTER_NAME
;
174 /* NETBIOS NAME is ok */
175 ret
= strequal(lp_netbios_name(dce_call
->conn
->dce_ctx
->lp_ctx
), server_name
);
176 if (ret
) return WERR_OK
;
178 aliases
= lp_netbios_aliases(dce_call
->conn
->dce_ctx
->lp_ctx
);
180 for (i
=0; aliases
&& aliases
[i
]; i
++) {
181 if (strequal(aliases
[i
], server_name
)) {
187 * TODO: we need to check if aliases are also ok
189 if (lp_realm(dce_call
->conn
->dce_ctx
->lp_ctx
)) {
192 str
= talloc_asprintf(mem_ctx
, "%s.%s",
193 lp_netbios_name(dce_call
->conn
->dce_ctx
->lp_ctx
),
194 lp_realm(dce_call
->conn
->dce_ctx
->lp_ctx
));
195 W_ERROR_HAVE_NO_MEMORY(str
);
197 ret
= strequal(str
, server_name
);
199 if (ret
) return WERR_OK
;
202 myaddr
= dcesrv_connection_get_my_addr(dce_call
->conn
, mem_ctx
);
203 W_ERROR_HAVE_NO_MEMORY(myaddr
);
205 ret
= strequal(myaddr
->addr
, server_name
);
207 if (ret
) return WERR_OK
;
209 return WERR_INVALID_PRINTER_NAME
;
212 static NTSTATUS
dcerpc_spoolss_bind(struct dcesrv_call_state
*dce_call
, const struct dcesrv_interface
*iface
)
215 struct ntptr_context
*ntptr
;
217 status
= ntptr_init_context(dce_call
->context
, dce_call
->conn
->event_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
,
218 lp_ntptr_providor(dce_call
->conn
->dce_ctx
->lp_ctx
), &ntptr
);
219 NT_STATUS_NOT_OK_RETURN(status
);
221 dce_call
->context
->private_data
= ntptr
;
226 #define DCESRV_INTERFACE_SPOOLSS_BIND dcerpc_spoolss_bind
231 static WERROR
dcesrv_spoolss_EnumPrinters(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
232 struct spoolss_EnumPrinters
*r
)
234 struct ntptr_context
*ntptr
= talloc_get_type(dce_call
->context
->private_data
, struct ntptr_context
);
236 struct smb_iconv_convenience
*ic
= lp_iconv_convenience(ntptr
->lp_ctx
);
238 status
= dcesrv_spoolss_check_server_name(dce_call
, mem_ctx
, r
->in
.server
);
239 W_ERROR_NOT_OK_RETURN(status
);
241 status
= ntptr_EnumPrinters(ntptr
, mem_ctx
, r
);
242 W_ERROR_NOT_OK_RETURN(status
);
244 *r
->out
.needed
= SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumPrinters
, ic
, *r
->out
.info
, r
->in
.level
, *r
->out
.count
);
245 *r
->out
.info
= SPOOLSS_BUFFER_OK(*r
->out
.info
, NULL
);
246 *r
->out
.count
= SPOOLSS_BUFFER_OK(*r
->out
.count
, 0);
247 return SPOOLSS_BUFFER_OK(WERR_OK
, WERR_INSUFFICIENT_BUFFER
);
250 static WERROR
dcesrv_spoolss_OpenPrinterEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
251 struct spoolss_OpenPrinterEx
*r
);
255 static WERROR
dcesrv_spoolss_OpenPrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
256 struct spoolss_OpenPrinter
*r
)
259 struct spoolss_OpenPrinterEx
*r2
;
261 r2
= talloc(mem_ctx
, struct spoolss_OpenPrinterEx
);
262 W_ERROR_HAVE_NO_MEMORY(r2
);
264 r2
->in
.printername
= r
->in
.printername
;
265 r2
->in
.datatype
= r
->in
.datatype
;
266 r2
->in
.devmode_ctr
= r
->in
.devmode_ctr
;
267 r2
->in
.access_mask
= r
->in
.access_mask
;
269 r2
->in
.userlevel
.level1
= NULL
;
271 r2
->out
.handle
= r
->out
.handle
;
273 /* TODO: we should take care about async replies here,
274 if spoolss_OpenPrinterEx() would be async!
276 status
= dcesrv_spoolss_OpenPrinterEx(dce_call
, mem_ctx
, r2
);
278 r
->out
.handle
= r2
->out
.handle
;
287 static WERROR
dcesrv_spoolss_SetJob(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
288 struct spoolss_SetJob
*r
)
290 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
297 static WERROR
dcesrv_spoolss_GetJob(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
298 struct spoolss_GetJob
*r
)
300 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
307 static WERROR
dcesrv_spoolss_EnumJobs(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
308 struct spoolss_EnumJobs
*r
)
317 static WERROR
dcesrv_spoolss_AddPrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
318 struct spoolss_AddPrinter
*r
)
320 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
325 spoolss_DeletePrinter
327 static WERROR
dcesrv_spoolss_DeletePrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
328 struct spoolss_DeletePrinter
*r
)
330 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
337 static WERROR
dcesrv_spoolss_SetPrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
338 struct spoolss_SetPrinter
*r
)
340 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
347 static WERROR
dcesrv_spoolss_GetPrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
348 struct spoolss_GetPrinter
*r
)
350 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
355 spoolss_AddPrinterDriver
357 static WERROR
dcesrv_spoolss_AddPrinterDriver(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
358 struct spoolss_AddPrinterDriver
*r
)
360 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
365 spoolss_EnumPrinterDrivers
367 static WERROR
dcesrv_spoolss_EnumPrinterDrivers(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
368 struct spoolss_EnumPrinterDrivers
*r
)
370 struct ntptr_context
*ntptr
= talloc_get_type(dce_call
->context
->private_data
, struct ntptr_context
);
372 struct smb_iconv_convenience
*ic
= lp_iconv_convenience(ntptr
->lp_ctx
);
374 status
= dcesrv_spoolss_check_server_name(dce_call
, mem_ctx
, r
->in
.server
);
375 W_ERROR_NOT_OK_RETURN(status
);
377 status
= ntptr_EnumPrinterDrivers(ntptr
, mem_ctx
, r
);
378 W_ERROR_NOT_OK_RETURN(status
);
380 *r
->out
.needed
= SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumPrinterDrivers
, ic
, *r
->out
.info
, r
->in
.level
, *r
->out
.count
);
381 *r
->out
.info
= SPOOLSS_BUFFER_OK(*r
->out
.info
, NULL
);
382 *r
->out
.count
= SPOOLSS_BUFFER_OK(*r
->out
.count
, 0);
383 return SPOOLSS_BUFFER_OK(WERR_OK
, WERR_INSUFFICIENT_BUFFER
);
388 spoolss_GetPrinterDriver
390 static WERROR
dcesrv_spoolss_GetPrinterDriver(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
391 struct spoolss_GetPrinterDriver
*r
)
393 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
398 spoolss_GetPrinterDriverDirectory
400 static WERROR
dcesrv_spoolss_GetPrinterDriverDirectory(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
401 struct spoolss_GetPrinterDriverDirectory
*r
)
403 struct ntptr_context
*ntptr
= talloc_get_type(dce_call
->context
->private_data
, struct ntptr_context
);
405 struct smb_iconv_convenience
*ic
= lp_iconv_convenience(ntptr
->lp_ctx
);
407 status
= dcesrv_spoolss_check_server_name(dce_call
, mem_ctx
, r
->in
.server
);
408 W_ERROR_NOT_OK_RETURN(status
);
410 status
= ntptr_GetPrinterDriverDirectory(ntptr
, mem_ctx
, r
);
411 W_ERROR_NOT_OK_RETURN(status
);
413 *r
->out
.needed
= SPOOLSS_BUFFER_UNION(spoolss_DriverDirectoryInfo
, ic
, r
->out
.info
, r
->in
.level
);
414 r
->out
.info
= SPOOLSS_BUFFER_OK(r
->out
.info
, NULL
);
415 return SPOOLSS_BUFFER_OK(WERR_OK
, WERR_INSUFFICIENT_BUFFER
);
420 spoolss_DeletePrinterDriver
422 static WERROR
dcesrv_spoolss_DeletePrinterDriver(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
423 struct spoolss_DeletePrinterDriver
*r
)
425 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
430 spoolss_AddPrintProcessor
432 static WERROR
dcesrv_spoolss_AddPrintProcessor(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
433 struct spoolss_AddPrintProcessor
*r
)
435 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
440 spoolss_EnumPrintProcessors
442 static WERROR
dcesrv_spoolss_EnumPrintProcessors(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
443 struct spoolss_EnumPrintProcessors
*r
)
450 spoolss_GetPrintProcessorDirectory
452 static WERROR
dcesrv_spoolss_GetPrintProcessorDirectory(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
453 struct spoolss_GetPrintProcessorDirectory
*r
)
455 struct ntptr_context
*ntptr
= talloc_get_type(dce_call
->context
->private_data
, struct ntptr_context
);
457 struct smb_iconv_convenience
*ic
= lp_iconv_convenience(ntptr
->lp_ctx
);
459 status
= dcesrv_spoolss_check_server_name(dce_call
, mem_ctx
, r
->in
.server
);
460 W_ERROR_NOT_OK_RETURN(status
);
462 status
= ntptr_GetPrintProcessorDirectory(ntptr
, mem_ctx
, r
);
463 W_ERROR_NOT_OK_RETURN(status
);
465 *r
->out
.needed
= SPOOLSS_BUFFER_UNION(spoolss_PrintProcessorDirectoryInfo
, ic
, r
->out
.info
, r
->in
.level
);
466 r
->out
.info
= SPOOLSS_BUFFER_OK(r
->out
.info
, NULL
);
467 return SPOOLSS_BUFFER_OK(WERR_OK
, WERR_INSUFFICIENT_BUFFER
);
472 spoolss_StartDocPrinter
474 static WERROR
dcesrv_spoolss_StartDocPrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
475 struct spoolss_StartDocPrinter
*r
)
477 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
482 spoolss_StartPagePrinter
484 static WERROR
dcesrv_spoolss_StartPagePrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
485 struct spoolss_StartPagePrinter
*r
)
487 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
494 static WERROR
dcesrv_spoolss_WritePrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
495 struct spoolss_WritePrinter
*r
)
497 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
502 spoolss_EndPagePrinter
504 static WERROR
dcesrv_spoolss_EndPagePrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
505 struct spoolss_EndPagePrinter
*r
)
507 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
514 static WERROR
dcesrv_spoolss_AbortPrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
515 struct spoolss_AbortPrinter
*r
)
517 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
524 static WERROR
dcesrv_spoolss_ReadPrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
525 struct spoolss_ReadPrinter
*r
)
527 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
532 spoolss_EndDocPrinter
534 static WERROR
dcesrv_spoolss_EndDocPrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
535 struct spoolss_EndDocPrinter
*r
)
537 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
544 static WERROR
dcesrv_spoolss_AddJob(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
545 struct spoolss_AddJob
*r
)
547 if (r
->in
.level
!= 1) {
548 return WERR_UNKNOWN_LEVEL
;
551 return WERR_INVALID_PARAM
;
558 static WERROR
dcesrv_spoolss_ScheduleJob(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
559 struct spoolss_ScheduleJob
*r
)
561 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
566 spoolss_GetPrinterData
568 static WERROR
dcesrv_spoolss_GetPrinterData(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
569 struct spoolss_GetPrinterData
*r
)
571 struct ntptr_GenericHandle
*handle
;
572 struct dcesrv_handle
*h
;
574 struct smb_iconv_convenience
*ic
= lp_iconv_convenience(dce_call
->conn
->dce_ctx
->lp_ctx
);
576 r
->out
.type
= talloc_zero(mem_ctx
, enum winreg_Type
);
577 W_ERROR_HAVE_NO_MEMORY(r
->out
.type
);
579 r
->out
.needed
= talloc_zero(mem_ctx
, uint32_t);
580 W_ERROR_HAVE_NO_MEMORY(r
->out
.needed
);
582 r
->out
.data
= talloc_zero_array(mem_ctx
, uint8_t, r
->in
.needed
);
583 W_ERROR_HAVE_NO_MEMORY(r
->out
.data
);
585 DCESRV_PULL_HANDLE_WERR(h
, r
->in
.handle
, DCESRV_HANDLE_ANY
);
586 handle
= talloc_get_type(h
->data
, struct ntptr_GenericHandle
);
590 switch (handle
->type
) {
591 case NTPTR_HANDLE_SERVER
:
592 status
= ntptr_GetPrintServerData(handle
, mem_ctx
, r
);
595 status
= WERR_FOOBAR
;
599 W_ERROR_NOT_OK_RETURN(status
);
601 *r
->out
.type
= SPOOLSS_BUFFER_OK(*r
->out
.type
, REG_NONE
);
602 r
->out
.data
= SPOOLSS_BUFFER_OK(r
->out
.data
, r
->out
.data
);
603 return SPOOLSS_BUFFER_OK(WERR_OK
, WERR_MORE_DATA
);
608 spoolss_SetPrinterData
610 static WERROR
dcesrv_spoolss_SetPrinterData(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
611 struct spoolss_SetPrinterData
*r
)
613 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
618 spoolss_WaitForPrinterChange
620 static WERROR
dcesrv_spoolss_WaitForPrinterChange(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
621 struct spoolss_WaitForPrinterChange
*r
)
623 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
630 static WERROR
dcesrv_spoolss_ClosePrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
631 struct spoolss_ClosePrinter
*r
)
633 struct dcesrv_handle
*h
;
635 *r
->out
.handle
= *r
->in
.handle
;
637 DCESRV_PULL_HANDLE_WERR(h
, r
->in
.handle
, DCESRV_HANDLE_ANY
);
641 ZERO_STRUCTP(r
->out
.handle
);
650 static WERROR
dcesrv_spoolss_AddForm(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
651 struct spoolss_AddForm
*r
)
653 struct ntptr_GenericHandle
*handle
;
654 struct dcesrv_handle
*h
;
657 DCESRV_PULL_HANDLE_WERR(h
, r
->in
.handle
, DCESRV_HANDLE_ANY
);
658 handle
= talloc_get_type(h
->data
, struct ntptr_GenericHandle
);
662 switch (handle
->type
) {
663 case NTPTR_HANDLE_SERVER
:
664 status
= ntptr_AddPrintServerForm(handle
, mem_ctx
, r
);
665 W_ERROR_NOT_OK_RETURN(status
);
667 case NTPTR_HANDLE_PRINTER
:
668 status
= ntptr_AddPrinterForm(handle
, mem_ctx
, r
);
669 W_ERROR_NOT_OK_RETURN(status
);
682 static WERROR
dcesrv_spoolss_DeleteForm(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
683 struct spoolss_DeleteForm
*r
)
685 struct ntptr_GenericHandle
*handle
;
686 struct dcesrv_handle
*h
;
689 DCESRV_PULL_HANDLE_WERR(h
, r
->in
.handle
, DCESRV_HANDLE_ANY
);
690 handle
= talloc_get_type(h
->data
, struct ntptr_GenericHandle
);
694 switch (handle
->type
) {
695 case NTPTR_HANDLE_SERVER
:
696 status
= ntptr_DeletePrintServerForm(handle
, mem_ctx
, r
);
697 W_ERROR_NOT_OK_RETURN(status
);
699 case NTPTR_HANDLE_PRINTER
:
700 status
= ntptr_DeletePrinterForm(handle
, mem_ctx
, r
);
701 W_ERROR_NOT_OK_RETURN(status
);
714 static WERROR
dcesrv_spoolss_GetForm(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
715 struct spoolss_GetForm
*r
)
717 struct ntptr_GenericHandle
*handle
;
718 struct dcesrv_handle
*h
;
720 struct smb_iconv_convenience
*ic
= lp_iconv_convenience(dce_call
->conn
->dce_ctx
->lp_ctx
);
722 DCESRV_PULL_HANDLE_WERR(h
, r
->in
.handle
, DCESRV_HANDLE_ANY
);
723 handle
= talloc_get_type(h
->data
, struct ntptr_GenericHandle
);
727 switch (handle
->type
) {
728 case NTPTR_HANDLE_SERVER
:
730 * stupid, but w2k3 returns WERR_BADFID here?
733 case NTPTR_HANDLE_PRINTER
:
734 status
= ntptr_GetPrinterForm(handle
, mem_ctx
, r
);
735 W_ERROR_NOT_OK_RETURN(status
);
741 *r
->out
.needed
= SPOOLSS_BUFFER_UNION(spoolss_FormInfo
, ic
, r
->out
.info
, r
->in
.level
);
742 r
->out
.info
= SPOOLSS_BUFFER_OK(r
->out
.info
, NULL
);
743 return SPOOLSS_BUFFER_OK(WERR_OK
, WERR_INSUFFICIENT_BUFFER
);
750 static WERROR
dcesrv_spoolss_SetForm(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
751 struct spoolss_SetForm
*r
)
753 struct ntptr_GenericHandle
*handle
;
754 struct dcesrv_handle
*h
;
757 DCESRV_PULL_HANDLE_WERR(h
, r
->in
.handle
, DCESRV_HANDLE_ANY
);
758 handle
= talloc_get_type(h
->data
, struct ntptr_GenericHandle
);
762 switch (handle
->type
) {
763 case NTPTR_HANDLE_SERVER
:
764 status
= ntptr_SetPrintServerForm(handle
, mem_ctx
, r
);
765 W_ERROR_NOT_OK_RETURN(status
);
767 case NTPTR_HANDLE_PRINTER
:
768 status
= ntptr_SetPrinterForm(handle
, mem_ctx
, r
);
769 W_ERROR_NOT_OK_RETURN(status
);
782 static WERROR
dcesrv_spoolss_EnumForms(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
783 struct spoolss_EnumForms
*r
)
785 struct ntptr_GenericHandle
*handle
;
786 struct dcesrv_handle
*h
;
788 struct smb_iconv_convenience
*ic
= lp_iconv_convenience(dce_call
->conn
->dce_ctx
->lp_ctx
);
790 DCESRV_PULL_HANDLE_WERR(h
, r
->in
.handle
, DCESRV_HANDLE_ANY
);
791 handle
= talloc_get_type(h
->data
, struct ntptr_GenericHandle
);
795 switch (handle
->type
) {
796 case NTPTR_HANDLE_SERVER
:
797 status
= ntptr_EnumPrintServerForms(handle
, mem_ctx
, r
);
798 W_ERROR_NOT_OK_RETURN(status
);
800 case NTPTR_HANDLE_PRINTER
:
801 status
= ntptr_EnumPrinterForms(handle
, mem_ctx
, r
);
802 W_ERROR_NOT_OK_RETURN(status
);
808 *r
->out
.needed
= SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumForms
, ic
, *r
->out
.info
, r
->in
.level
, *r
->out
.count
);
809 *r
->out
.info
= SPOOLSS_BUFFER_OK(*r
->out
.info
, NULL
);
810 *r
->out
.count
= SPOOLSS_BUFFER_OK(*r
->out
.count
, 0);
811 return SPOOLSS_BUFFER_OK(WERR_OK
, WERR_INSUFFICIENT_BUFFER
);
818 static WERROR
dcesrv_spoolss_EnumPorts(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
819 struct spoolss_EnumPorts
*r
)
821 struct ntptr_context
*ntptr
= talloc_get_type(dce_call
->context
->private_data
, struct ntptr_context
);
823 struct smb_iconv_convenience
*ic
= lp_iconv_convenience(ntptr
->lp_ctx
);
825 status
= dcesrv_spoolss_check_server_name(dce_call
, mem_ctx
, r
->in
.servername
);
826 W_ERROR_NOT_OK_RETURN(status
);
828 status
= ntptr_EnumPorts(ntptr
, mem_ctx
, r
);
829 W_ERROR_NOT_OK_RETURN(status
);
831 *r
->out
.needed
= SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumPorts
, ic
, *r
->out
.info
, r
->in
.level
, *r
->out
.count
);
832 *r
->out
.info
= SPOOLSS_BUFFER_OK(*r
->out
.info
, NULL
);
833 *r
->out
.count
= SPOOLSS_BUFFER_OK(*r
->out
.count
, 0);
834 return SPOOLSS_BUFFER_OK(WERR_OK
, WERR_INSUFFICIENT_BUFFER
);
841 static WERROR
dcesrv_spoolss_EnumMonitors(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
842 struct spoolss_EnumMonitors
*r
)
844 struct ntptr_context
*ntptr
= talloc_get_type(dce_call
->context
->private_data
, struct ntptr_context
);
846 struct smb_iconv_convenience
*ic
= lp_iconv_convenience(ntptr
->lp_ctx
);
848 status
= dcesrv_spoolss_check_server_name(dce_call
, mem_ctx
, r
->in
.servername
);
849 W_ERROR_NOT_OK_RETURN(status
);
851 status
= ntptr_EnumMonitors(ntptr
, mem_ctx
, r
);
852 W_ERROR_NOT_OK_RETURN(status
);
854 *r
->out
.needed
= SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumMonitors
, ic
, *r
->out
.info
, r
->in
.level
, *r
->out
.count
);
855 *r
->out
.info
= SPOOLSS_BUFFER_OK(*r
->out
.info
, NULL
);
856 *r
->out
.count
= SPOOLSS_BUFFER_OK(*r
->out
.count
, 0);
857 return SPOOLSS_BUFFER_OK(WERR_OK
, WERR_INSUFFICIENT_BUFFER
);
864 static WERROR
dcesrv_spoolss_AddPort(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
865 struct spoolss_AddPort
*r
)
867 return WERR_NOT_SUPPORTED
;
872 spoolss_ConfigurePort
874 static WERROR
dcesrv_spoolss_ConfigurePort(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
875 struct spoolss_ConfigurePort
*r
)
877 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
884 static WERROR
dcesrv_spoolss_DeletePort(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
885 struct spoolss_DeletePort
*r
)
887 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
892 spoolss_CreatePrinterIC
894 static WERROR
dcesrv_spoolss_CreatePrinterIC(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
895 struct spoolss_CreatePrinterIC
*r
)
897 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
902 spoolss_PlayGDIScriptOnPrinterIC
904 static WERROR
dcesrv_spoolss_PlayGDIScriptOnPrinterIC(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
905 struct spoolss_PlayGDIScriptOnPrinterIC
*r
)
907 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
912 spoolss_DeletePrinterIC
914 static WERROR
dcesrv_spoolss_DeletePrinterIC(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
915 struct spoolss_DeletePrinterIC
*r
)
917 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
922 spoolss_AddPrinterConnection
924 static WERROR
dcesrv_spoolss_AddPrinterConnection(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
925 struct spoolss_AddPrinterConnection
*r
)
927 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
932 spoolss_DeletePrinterConnection
934 static WERROR
dcesrv_spoolss_DeletePrinterConnection(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
935 struct spoolss_DeletePrinterConnection
*r
)
937 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
942 spoolss_PrinterMessageBox
944 static WERROR
dcesrv_spoolss_PrinterMessageBox(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
945 struct spoolss_PrinterMessageBox
*r
)
947 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
954 static WERROR
dcesrv_spoolss_AddMonitor(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
955 struct spoolss_AddMonitor
*r
)
957 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
962 spoolss_DeleteMonitor
964 static WERROR
dcesrv_spoolss_DeleteMonitor(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
965 struct spoolss_DeleteMonitor
*r
)
967 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
972 spoolss_DeletePrintProcessor
974 static WERROR
dcesrv_spoolss_DeletePrintProcessor(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
975 struct spoolss_DeletePrintProcessor
*r
)
977 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
982 spoolss_AddPrintProvidor
984 static WERROR
dcesrv_spoolss_AddPrintProvidor(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
985 struct spoolss_AddPrintProvidor
*r
)
987 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
992 spoolss_DeletePrintProvidor
994 static WERROR
dcesrv_spoolss_DeletePrintProvidor(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
995 struct spoolss_DeletePrintProvidor
*r
)
997 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1002 spoolss_EnumPrintProcDataTypes
1004 static WERROR
dcesrv_spoolss_EnumPrintProcDataTypes(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1005 struct spoolss_EnumPrintProcDataTypes
*r
)
1012 spoolss_ResetPrinter
1014 static WERROR
dcesrv_spoolss_ResetPrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1015 struct spoolss_ResetPrinter
*r
)
1017 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1022 spoolss_GetPrinterDriver2
1024 static WERROR
dcesrv_spoolss_GetPrinterDriver2(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1025 struct spoolss_GetPrinterDriver2
*r
)
1027 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1032 spoolss_FindFirstPrinterChangeNotification
1034 static WERROR
dcesrv_spoolss_FindFirstPrinterChangeNotification(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1035 struct spoolss_FindFirstPrinterChangeNotification
*r
)
1037 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1042 spoolss_FindNextPrinterChangeNotification
1044 static WERROR
dcesrv_spoolss_FindNextPrinterChangeNotification(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1045 struct spoolss_FindNextPrinterChangeNotification
*r
)
1047 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1052 spoolss_FindClosePrinterNotify
1054 static WERROR
dcesrv_spoolss_FindClosePrinterNotify(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1055 struct spoolss_FindClosePrinterNotify
*r
)
1057 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1062 spoolss_RouterFindFirstPrinterChangeNotificationOld
1064 static WERROR
dcesrv_spoolss_RouterFindFirstPrinterChangeNotificationOld(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1065 struct spoolss_RouterFindFirstPrinterChangeNotificationOld
*r
)
1067 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1072 spoolss_ReplyOpenPrinter
1074 static WERROR
dcesrv_spoolss_ReplyOpenPrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1075 struct spoolss_ReplyOpenPrinter
*r
)
1077 struct dcesrv_handle
*handle
;
1079 handle
= dcesrv_handle_new(dce_call
->context
, SPOOLSS_NOTIFY
);
1080 W_ERROR_HAVE_NO_MEMORY(handle
);
1082 /* For now, just return a handle */
1084 *r
->out
.handle
= handle
->wire_handle
;
1091 spoolss_RouterReplyPrinter
1093 static WERROR
dcesrv_spoolss_RouterReplyPrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1094 struct spoolss_RouterReplyPrinter
*r
)
1096 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1101 spoolss_ReplyClosePrinter
1103 static WERROR
dcesrv_spoolss_ReplyClosePrinter(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1104 struct spoolss_ReplyClosePrinter
*r
)
1106 struct dcesrv_handle
*handle
;
1108 DCESRV_PULL_HANDLE_WERR(handle
, r
->in
.handle
, SPOOLSS_NOTIFY
);
1110 talloc_free(handle
);
1112 ZERO_STRUCTP(r
->out
.handle
);
1120 static WERROR
dcesrv_spoolss_AddPortEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1121 struct spoolss_AddPortEx
*r
)
1123 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1128 spoolss_RouterFindFirstPrinterChangeNotification
1130 static WERROR
dcesrv_spoolss_RouterFindFirstPrinterChangeNotification(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1131 struct spoolss_RouterFindFirstPrinterChangeNotification
*r
)
1133 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1140 static WERROR
dcesrv_spoolss_SpoolerInit(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1141 struct spoolss_SpoolerInit
*r
)
1143 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1148 spoolss_ResetPrinterEx
1150 static WERROR
dcesrv_spoolss_ResetPrinterEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1151 struct spoolss_ResetPrinterEx
*r
)
1153 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1158 spoolss_RemoteFindFirstPrinterChangeNotifyEx
1160 static WERROR
dcesrv_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1161 struct spoolss_RemoteFindFirstPrinterChangeNotifyEx
*r
)
1163 struct dcerpc_pipe
*p
;
1164 struct dcerpc_binding
*binding
;
1166 struct spoolss_ReplyOpenPrinter rop
;
1167 struct cli_credentials
*creds
;
1168 struct policy_handle notify_handle
;
1170 DEBUG(2, ("Received RFFPCNex from %s\n", r
->in
.local_machine
));
1173 * TODO: for now just open a connection to the client and drop it again
1174 * to keep the w2k3 PrintServer
1175 * happy to allow to open the Add Printer GUI
1176 * and the torture suite passing
1179 binding
= talloc_zero(mem_ctx
, struct dcerpc_binding
);
1181 binding
->transport
= NCACN_NP
;
1182 if (strncmp(r
->in
.local_machine
, "\\\\", 2))
1183 return WERR_INVALID_COMPUTERNAME
;
1184 binding
->host
= r
->in
.local_machine
+2;
1186 creds
= cli_credentials_init_anon(mem_ctx
); /* FIXME: Use machine credentials instead ? */
1188 status
= dcerpc_pipe_connect_b(mem_ctx
, &p
, binding
, &ndr_table_spoolss
,
1189 creds
, dce_call
->event_ctx
,
1190 dce_call
->conn
->dce_ctx
->lp_ctx
);
1192 if (NT_STATUS_IS_ERR(status
)) {
1193 DEBUG(0, ("unable to call back to %s\n", r
->in
.local_machine
));
1194 return WERR_SERVER_UNAVAILABLE
;
1198 rop
.in
.server_name
= lp_netbios_name(dce_call
->conn
->dce_ctx
->lp_ctx
);
1199 W_ERROR_HAVE_NO_MEMORY(rop
.in
.server_name
);
1200 rop
.in
.printer_local
= 0;
1201 rop
.in
.type
= REG_NONE
;
1203 rop
.in
.buffer
= NULL
;
1204 rop
.out
.handle
= ¬ify_handle
;
1206 status
= dcerpc_spoolss_ReplyOpenPrinter(p
, mem_ctx
, &rop
);
1207 if (NT_STATUS_IS_ERR(status
)) {
1208 DEBUG(0, ("unable to open remote printer %s\n",
1209 r
->in
.local_machine
));
1210 return WERR_SERVER_UNAVAILABLE
;
1220 spoolss_RouterReplyPrinterEx
1222 static WERROR
dcesrv_spoolss_RouterReplyPrinterEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1223 struct spoolss_RouterReplyPrinterEx
*r
)
1225 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1230 spoolss_RouterRefreshPrinterChangeNotify
1232 static WERROR
dcesrv_spoolss_RouterRefreshPrinterChangeNotify(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1233 struct spoolss_RouterRefreshPrinterChangeNotify
*r
)
1235 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1242 static WERROR
dcesrv_spoolss_44(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1243 struct spoolss_44
*r
)
1245 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1249 spoolss_OpenPrinterEx
1251 static WERROR
dcesrv_spoolss_OpenPrinterEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1252 struct spoolss_OpenPrinterEx
*r
)
1254 struct ntptr_context
*ntptr
= talloc_get_type(dce_call
->context
->private_data
, struct ntptr_context
);
1255 struct ntptr_GenericHandle
*handle
;
1256 struct dcesrv_handle
*h
;
1259 enum ntptr_HandleType type
;
1262 ZERO_STRUCTP(r
->out
.handle
);
1264 status
= dcesrv_spoolss_parse_printer_name(mem_ctx
, r
->in
.printername
, &server
, &object
, &type
);
1265 W_ERROR_NOT_OK_RETURN(status
);
1267 status
= dcesrv_spoolss_check_server_name(dce_call
, mem_ctx
, server
);
1268 W_ERROR_NOT_OK_RETURN(status
);
1271 case NTPTR_HANDLE_SERVER
:
1272 status
= ntptr_OpenPrintServer(ntptr
, mem_ctx
, r
, server
, &handle
);
1273 W_ERROR_NOT_OK_RETURN(status
);
1275 case NTPTR_HANDLE_PORT
:
1276 status
= ntptr_OpenPort(ntptr
, mem_ctx
, r
, object
, &handle
);
1277 W_ERROR_NOT_OK_RETURN(status
);
1279 case NTPTR_HANDLE_MONITOR
:
1280 status
= ntptr_OpenMonitor(ntptr
, mem_ctx
, r
, object
, &handle
);
1281 W_ERROR_NOT_OK_RETURN(status
);
1283 case NTPTR_HANDLE_PRINTER
:
1284 status
= ntptr_OpenPrinter(ntptr
, mem_ctx
, r
, object
, &handle
);
1285 W_ERROR_NOT_OK_RETURN(status
);
1291 h
= dcesrv_handle_new(dce_call
->context
, handle
->type
);
1292 W_ERROR_HAVE_NO_MEMORY(h
);
1294 h
->data
= talloc_steal(h
, handle
);
1296 *r
->out
.handle
= h
->wire_handle
;
1302 spoolss_AddPrinterEx
1304 static WERROR
dcesrv_spoolss_AddPrinterEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1305 struct spoolss_AddPrinterEx
*r
)
1307 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1314 static WERROR
dcesrv_spoolss_47(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1315 struct spoolss_47
*r
)
1317 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1322 spoolss_EnumPrinterData
1324 static WERROR
dcesrv_spoolss_EnumPrinterData(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1325 struct spoolss_EnumPrinterData
*r
)
1327 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1332 spoolss_DeletePrinterData
1334 static WERROR
dcesrv_spoolss_DeletePrinterData(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1335 struct spoolss_DeletePrinterData
*r
)
1337 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1344 static WERROR
dcesrv_spoolss_4a(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1345 struct spoolss_4a
*r
)
1347 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1354 static WERROR
dcesrv_spoolss_4b(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1355 struct spoolss_4b
*r
)
1357 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1364 static WERROR
dcesrv_spoolss_4c(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1365 struct spoolss_4c
*r
)
1367 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1372 spoolss_SetPrinterDataEx
1374 static WERROR
dcesrv_spoolss_SetPrinterDataEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1375 struct spoolss_SetPrinterDataEx
*r
)
1377 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1382 spoolss_GetPrinterDataEx
1384 static WERROR
dcesrv_spoolss_GetPrinterDataEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1385 struct spoolss_GetPrinterDataEx
*r
)
1387 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1392 spoolss_EnumPrinterDataEx
1394 static WERROR
dcesrv_spoolss_EnumPrinterDataEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1395 struct spoolss_EnumPrinterDataEx
*r
)
1397 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1402 spoolss_EnumPrinterKey
1404 static WERROR
dcesrv_spoolss_EnumPrinterKey(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1405 struct spoolss_EnumPrinterKey
*r
)
1407 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1412 spoolss_DeletePrinterDataEx
1414 static WERROR
dcesrv_spoolss_DeletePrinterDataEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1415 struct spoolss_DeletePrinterDataEx
*r
)
1417 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1422 spoolss_DeletePrinterKey
1424 static WERROR
dcesrv_spoolss_DeletePrinterKey(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1425 struct spoolss_DeletePrinterKey
*r
)
1427 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1434 static WERROR
dcesrv_spoolss_53(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1435 struct spoolss_53
*r
)
1437 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1442 spoolss_DeletePrinterDriverEx
1444 static WERROR
dcesrv_spoolss_DeletePrinterDriverEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1445 struct spoolss_DeletePrinterDriverEx
*r
)
1447 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1454 static WERROR
dcesrv_spoolss_55(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1455 struct spoolss_55
*r
)
1457 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1464 static WERROR
dcesrv_spoolss_56(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1465 struct spoolss_56
*r
)
1467 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1474 static WERROR
dcesrv_spoolss_57(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1475 struct spoolss_57
*r
)
1477 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1484 static WERROR
dcesrv_spoolss_XcvData(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1485 struct spoolss_XcvData
*r
)
1487 struct ntptr_GenericHandle
*handle
;
1488 struct dcesrv_handle
*h
;
1491 DCESRV_PULL_HANDLE_WERR(h
, r
->in
.handle
, DCESRV_HANDLE_ANY
);
1492 handle
= talloc_get_type(h
->data
, struct ntptr_GenericHandle
);
1494 switch (handle
->type
) {
1495 case NTPTR_HANDLE_SERVER
:
1496 status
= ntptr_XcvDataPrintServer(handle
, mem_ctx
, r
);
1497 W_ERROR_NOT_OK_RETURN(status
);
1499 case NTPTR_HANDLE_PRINTER
:
1500 status
= ntptr_XcvDataPrinter(handle
, mem_ctx
, r
);
1501 W_ERROR_NOT_OK_RETURN(status
);
1503 case NTPTR_HANDLE_PORT
:
1504 status
= ntptr_XcvDataPort(handle
, mem_ctx
, r
);
1505 W_ERROR_NOT_OK_RETURN(status
);
1507 case NTPTR_HANDLE_MONITOR
:
1508 status
= ntptr_XcvDataMonitor(handle
, mem_ctx
, r
);
1509 W_ERROR_NOT_OK_RETURN(status
);
1515 /* TODO: handle the buffer sizes here! */
1521 spoolss_AddPrinterDriverEx
1523 static WERROR
dcesrv_spoolss_AddPrinterDriverEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1524 struct spoolss_AddPrinterDriverEx
*r
)
1526 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1533 static WERROR
dcesrv_spoolss_5a(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1534 struct spoolss_5a
*r
)
1536 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1543 static WERROR
dcesrv_spoolss_5b(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1544 struct spoolss_5b
*r
)
1546 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1553 static WERROR
dcesrv_spoolss_5c(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1554 struct spoolss_5c
*r
)
1556 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1563 static WERROR
dcesrv_spoolss_5d(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1564 struct spoolss_5d
*r
)
1566 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1573 static WERROR
dcesrv_spoolss_5e(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1574 struct spoolss_5e
*r
)
1576 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1583 static WERROR
dcesrv_spoolss_5f(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1584 struct spoolss_5f
*r
)
1586 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1592 static WERROR
dcesrv_spoolss_60(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1593 struct spoolss_60
*r
)
1595 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1602 static WERROR
dcesrv_spoolss_61(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1603 struct spoolss_61
*r
)
1605 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1612 static WERROR
dcesrv_spoolss_62(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1613 struct spoolss_62
*r
)
1615 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1622 static WERROR
dcesrv_spoolss_63(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1623 struct spoolss_63
*r
)
1625 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1632 static WERROR
dcesrv_spoolss_64(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1633 struct spoolss_64
*r
)
1635 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1642 static WERROR
dcesrv_spoolss_65(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1643 struct spoolss_65
*r
)
1645 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1650 spoolss_GetCorePrinterDrivers
1652 static WERROR
dcesrv_spoolss_GetCorePrinterDrivers(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1653 struct spoolss_GetCorePrinterDrivers
*r
)
1655 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1662 static WERROR
dcesrv_spoolss_67(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1663 struct spoolss_67
*r
)
1665 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1670 spoolss_GetPrinterDriverPackagePath
1672 static WERROR
dcesrv_spoolss_GetPrinterDriverPackagePath(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1673 struct spoolss_GetPrinterDriverPackagePath
*r
)
1675 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1682 static WERROR
dcesrv_spoolss_69(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1683 struct spoolss_69
*r
)
1685 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1692 static WERROR
dcesrv_spoolss_6a(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1693 struct spoolss_6a
*r
)
1695 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1702 static WERROR
dcesrv_spoolss_6b(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1703 struct spoolss_6b
*r
)
1705 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1712 static WERROR
dcesrv_spoolss_6c(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1713 struct spoolss_6c
*r
)
1715 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1722 static WERROR
dcesrv_spoolss_6d(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1723 struct spoolss_6d
*r
)
1725 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1730 /* include the generated boilerplate */
1731 #include "librpc/gen_ndr/ndr_spoolss_s.c"