Merge branch 'master' of ssh://git.samba.org/data/git/samba
[samba.git] / librpc / gen_ndr / srv_spoolss.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * server auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "../librpc/gen_ndr/srv_spoolss.h"
8
9 static bool api_spoolss_EnumPrinters(pipes_struct *p)
10 {
11         const struct ndr_interface_call *call;
12         struct ndr_pull *pull;
13         struct ndr_push *push;
14         enum ndr_err_code ndr_err;
15         DATA_BLOB blob;
16         struct spoolss_EnumPrinters *r;
17
18         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERS];
19
20         r = talloc(talloc_tos(), struct spoolss_EnumPrinters);
21         if (r == NULL) {
22                 return false;
23         }
24
25         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
26                 talloc_free(r);
27                 return false;
28         }
29
30         pull = ndr_pull_init_blob(&blob, r, NULL);
31         if (pull == NULL) {
32                 talloc_free(r);
33                 return false;
34         }
35
36         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
37         ndr_err = call->ndr_pull(pull, NDR_IN, r);
38         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
39                 talloc_free(r);
40                 return false;
41         }
42
43         if (DEBUGLEVEL >= 10) {
44                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinters, r);
45         }
46
47         ZERO_STRUCT(r->out);
48         r->out.info = talloc_zero_array(r, union spoolss_PrinterInfo, r->out.count);
49         if (r->out.info == NULL) {
50                 talloc_free(r);
51                 return false;
52         }
53
54         r->out.needed = talloc_zero(r, uint32_t);
55         if (r->out.needed == NULL) {
56                 talloc_free(r);
57                 return false;
58         }
59
60         r->out.result = _spoolss_EnumPrinters(p, r);
61
62         if (p->rng_fault_state) {
63                 talloc_free(r);
64                 /* Return true here, srv_pipe_hnd.c will take care */
65                 return true;
66         }
67
68         if (DEBUGLEVEL >= 10) {
69                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinters, r);
70         }
71
72         push = ndr_push_init_ctx(r, NULL);
73         if (push == NULL) {
74                 talloc_free(r);
75                 return false;
76         }
77
78         ndr_err = call->ndr_push(push, NDR_OUT, r);
79         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
80                 talloc_free(r);
81                 return false;
82         }
83
84         blob = ndr_push_blob(push);
85         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
86                 talloc_free(r);
87                 return false;
88         }
89
90         talloc_free(r);
91
92         return true;
93 }
94
95 static bool api_spoolss_OpenPrinter(pipes_struct *p)
96 {
97         const struct ndr_interface_call *call;
98         struct ndr_pull *pull;
99         struct ndr_push *push;
100         enum ndr_err_code ndr_err;
101         DATA_BLOB blob;
102         struct spoolss_OpenPrinter *r;
103
104         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_OPENPRINTER];
105
106         r = talloc(talloc_tos(), struct spoolss_OpenPrinter);
107         if (r == NULL) {
108                 return false;
109         }
110
111         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
112                 talloc_free(r);
113                 return false;
114         }
115
116         pull = ndr_pull_init_blob(&blob, r, NULL);
117         if (pull == NULL) {
118                 talloc_free(r);
119                 return false;
120         }
121
122         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
123         ndr_err = call->ndr_pull(pull, NDR_IN, r);
124         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
125                 talloc_free(r);
126                 return false;
127         }
128
129         if (DEBUGLEVEL >= 10) {
130                 NDR_PRINT_IN_DEBUG(spoolss_OpenPrinter, r);
131         }
132
133         ZERO_STRUCT(r->out);
134         r->out.handle = talloc_zero(r, struct policy_handle);
135         if (r->out.handle == NULL) {
136                 talloc_free(r);
137                 return false;
138         }
139
140         r->out.result = _spoolss_OpenPrinter(p, r);
141
142         if (p->rng_fault_state) {
143                 talloc_free(r);
144                 /* Return true here, srv_pipe_hnd.c will take care */
145                 return true;
146         }
147
148         if (DEBUGLEVEL >= 10) {
149                 NDR_PRINT_OUT_DEBUG(spoolss_OpenPrinter, r);
150         }
151
152         push = ndr_push_init_ctx(r, NULL);
153         if (push == NULL) {
154                 talloc_free(r);
155                 return false;
156         }
157
158         ndr_err = call->ndr_push(push, NDR_OUT, r);
159         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
160                 talloc_free(r);
161                 return false;
162         }
163
164         blob = ndr_push_blob(push);
165         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
166                 talloc_free(r);
167                 return false;
168         }
169
170         talloc_free(r);
171
172         return true;
173 }
174
175 static bool api_spoolss_SetJob(pipes_struct *p)
176 {
177         const struct ndr_interface_call *call;
178         struct ndr_pull *pull;
179         struct ndr_push *push;
180         enum ndr_err_code ndr_err;
181         DATA_BLOB blob;
182         struct spoolss_SetJob *r;
183
184         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETJOB];
185
186         r = talloc(talloc_tos(), struct spoolss_SetJob);
187         if (r == NULL) {
188                 return false;
189         }
190
191         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
192                 talloc_free(r);
193                 return false;
194         }
195
196         pull = ndr_pull_init_blob(&blob, r, NULL);
197         if (pull == NULL) {
198                 talloc_free(r);
199                 return false;
200         }
201
202         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
203         ndr_err = call->ndr_pull(pull, NDR_IN, r);
204         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
205                 talloc_free(r);
206                 return false;
207         }
208
209         if (DEBUGLEVEL >= 10) {
210                 NDR_PRINT_IN_DEBUG(spoolss_SetJob, r);
211         }
212
213         r->out.result = _spoolss_SetJob(p, r);
214
215         if (p->rng_fault_state) {
216                 talloc_free(r);
217                 /* Return true here, srv_pipe_hnd.c will take care */
218                 return true;
219         }
220
221         if (DEBUGLEVEL >= 10) {
222                 NDR_PRINT_OUT_DEBUG(spoolss_SetJob, r);
223         }
224
225         push = ndr_push_init_ctx(r, NULL);
226         if (push == NULL) {
227                 talloc_free(r);
228                 return false;
229         }
230
231         ndr_err = call->ndr_push(push, NDR_OUT, r);
232         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
233                 talloc_free(r);
234                 return false;
235         }
236
237         blob = ndr_push_blob(push);
238         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
239                 talloc_free(r);
240                 return false;
241         }
242
243         talloc_free(r);
244
245         return true;
246 }
247
248 static bool api_spoolss_GetJob(pipes_struct *p)
249 {
250         const struct ndr_interface_call *call;
251         struct ndr_pull *pull;
252         struct ndr_push *push;
253         enum ndr_err_code ndr_err;
254         DATA_BLOB blob;
255         struct spoolss_GetJob *r;
256
257         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETJOB];
258
259         r = talloc(talloc_tos(), struct spoolss_GetJob);
260         if (r == NULL) {
261                 return false;
262         }
263
264         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
265                 talloc_free(r);
266                 return false;
267         }
268
269         pull = ndr_pull_init_blob(&blob, r, NULL);
270         if (pull == NULL) {
271                 talloc_free(r);
272                 return false;
273         }
274
275         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
276         ndr_err = call->ndr_pull(pull, NDR_IN, r);
277         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
278                 talloc_free(r);
279                 return false;
280         }
281
282         if (DEBUGLEVEL >= 10) {
283                 NDR_PRINT_IN_DEBUG(spoolss_GetJob, r);
284         }
285
286         ZERO_STRUCT(r->out);
287         r->out.info = talloc_zero(r, union spoolss_JobInfo);
288         if (r->out.info == NULL) {
289                 talloc_free(r);
290                 return false;
291         }
292
293         r->out.needed = talloc_zero(r, uint32_t);
294         if (r->out.needed == NULL) {
295                 talloc_free(r);
296                 return false;
297         }
298
299         r->out.result = _spoolss_GetJob(p, r);
300
301         if (p->rng_fault_state) {
302                 talloc_free(r);
303                 /* Return true here, srv_pipe_hnd.c will take care */
304                 return true;
305         }
306
307         if (DEBUGLEVEL >= 10) {
308                 NDR_PRINT_OUT_DEBUG(spoolss_GetJob, r);
309         }
310
311         push = ndr_push_init_ctx(r, NULL);
312         if (push == NULL) {
313                 talloc_free(r);
314                 return false;
315         }
316
317         ndr_err = call->ndr_push(push, NDR_OUT, r);
318         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
319                 talloc_free(r);
320                 return false;
321         }
322
323         blob = ndr_push_blob(push);
324         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
325                 talloc_free(r);
326                 return false;
327         }
328
329         talloc_free(r);
330
331         return true;
332 }
333
334 static bool api_spoolss_EnumJobs(pipes_struct *p)
335 {
336         const struct ndr_interface_call *call;
337         struct ndr_pull *pull;
338         struct ndr_push *push;
339         enum ndr_err_code ndr_err;
340         DATA_BLOB blob;
341         struct spoolss_EnumJobs *r;
342
343         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMJOBS];
344
345         r = talloc(talloc_tos(), struct spoolss_EnumJobs);
346         if (r == NULL) {
347                 return false;
348         }
349
350         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
351                 talloc_free(r);
352                 return false;
353         }
354
355         pull = ndr_pull_init_blob(&blob, r, NULL);
356         if (pull == NULL) {
357                 talloc_free(r);
358                 return false;
359         }
360
361         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
362         ndr_err = call->ndr_pull(pull, NDR_IN, r);
363         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
364                 talloc_free(r);
365                 return false;
366         }
367
368         if (DEBUGLEVEL >= 10) {
369                 NDR_PRINT_IN_DEBUG(spoolss_EnumJobs, r);
370         }
371
372         ZERO_STRUCT(r->out);
373         r->out.info = talloc_zero_array(r, union spoolss_JobInfo, r->out.count);
374         if (r->out.info == NULL) {
375                 talloc_free(r);
376                 return false;
377         }
378
379         r->out.needed = talloc_zero(r, uint32_t);
380         if (r->out.needed == NULL) {
381                 talloc_free(r);
382                 return false;
383         }
384
385         r->out.result = _spoolss_EnumJobs(p, r);
386
387         if (p->rng_fault_state) {
388                 talloc_free(r);
389                 /* Return true here, srv_pipe_hnd.c will take care */
390                 return true;
391         }
392
393         if (DEBUGLEVEL >= 10) {
394                 NDR_PRINT_OUT_DEBUG(spoolss_EnumJobs, r);
395         }
396
397         push = ndr_push_init_ctx(r, NULL);
398         if (push == NULL) {
399                 talloc_free(r);
400                 return false;
401         }
402
403         ndr_err = call->ndr_push(push, NDR_OUT, r);
404         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
405                 talloc_free(r);
406                 return false;
407         }
408
409         blob = ndr_push_blob(push);
410         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
411                 talloc_free(r);
412                 return false;
413         }
414
415         talloc_free(r);
416
417         return true;
418 }
419
420 static bool api_spoolss_AddPrinter(pipes_struct *p)
421 {
422         const struct ndr_interface_call *call;
423         struct ndr_pull *pull;
424         struct ndr_push *push;
425         enum ndr_err_code ndr_err;
426         DATA_BLOB blob;
427         struct spoolss_AddPrinter *r;
428
429         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTER];
430
431         r = talloc(talloc_tos(), struct spoolss_AddPrinter);
432         if (r == NULL) {
433                 return false;
434         }
435
436         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
437                 talloc_free(r);
438                 return false;
439         }
440
441         pull = ndr_pull_init_blob(&blob, r, NULL);
442         if (pull == NULL) {
443                 talloc_free(r);
444                 return false;
445         }
446
447         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
448         ndr_err = call->ndr_pull(pull, NDR_IN, r);
449         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
450                 talloc_free(r);
451                 return false;
452         }
453
454         if (DEBUGLEVEL >= 10) {
455                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinter, r);
456         }
457
458         r->out.result = _spoolss_AddPrinter(p, r);
459
460         if (p->rng_fault_state) {
461                 talloc_free(r);
462                 /* Return true here, srv_pipe_hnd.c will take care */
463                 return true;
464         }
465
466         if (DEBUGLEVEL >= 10) {
467                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinter, r);
468         }
469
470         push = ndr_push_init_ctx(r, NULL);
471         if (push == NULL) {
472                 talloc_free(r);
473                 return false;
474         }
475
476         ndr_err = call->ndr_push(push, NDR_OUT, r);
477         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
478                 talloc_free(r);
479                 return false;
480         }
481
482         blob = ndr_push_blob(push);
483         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
484                 talloc_free(r);
485                 return false;
486         }
487
488         talloc_free(r);
489
490         return true;
491 }
492
493 static bool api_spoolss_DeletePrinter(pipes_struct *p)
494 {
495         const struct ndr_interface_call *call;
496         struct ndr_pull *pull;
497         struct ndr_push *push;
498         enum ndr_err_code ndr_err;
499         DATA_BLOB blob;
500         struct spoolss_DeletePrinter *r;
501
502         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTER];
503
504         r = talloc(talloc_tos(), struct spoolss_DeletePrinter);
505         if (r == NULL) {
506                 return false;
507         }
508
509         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
510                 talloc_free(r);
511                 return false;
512         }
513
514         pull = ndr_pull_init_blob(&blob, r, NULL);
515         if (pull == NULL) {
516                 talloc_free(r);
517                 return false;
518         }
519
520         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
521         ndr_err = call->ndr_pull(pull, NDR_IN, r);
522         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
523                 talloc_free(r);
524                 return false;
525         }
526
527         if (DEBUGLEVEL >= 10) {
528                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinter, r);
529         }
530
531         r->out.result = _spoolss_DeletePrinter(p, r);
532
533         if (p->rng_fault_state) {
534                 talloc_free(r);
535                 /* Return true here, srv_pipe_hnd.c will take care */
536                 return true;
537         }
538
539         if (DEBUGLEVEL >= 10) {
540                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinter, r);
541         }
542
543         push = ndr_push_init_ctx(r, NULL);
544         if (push == NULL) {
545                 talloc_free(r);
546                 return false;
547         }
548
549         ndr_err = call->ndr_push(push, NDR_OUT, r);
550         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
551                 talloc_free(r);
552                 return false;
553         }
554
555         blob = ndr_push_blob(push);
556         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
557                 talloc_free(r);
558                 return false;
559         }
560
561         talloc_free(r);
562
563         return true;
564 }
565
566 static bool api_spoolss_SetPrinter(pipes_struct *p)
567 {
568         const struct ndr_interface_call *call;
569         struct ndr_pull *pull;
570         struct ndr_push *push;
571         enum ndr_err_code ndr_err;
572         DATA_BLOB blob;
573         struct spoolss_SetPrinter *r;
574
575         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETPRINTER];
576
577         r = talloc(talloc_tos(), struct spoolss_SetPrinter);
578         if (r == NULL) {
579                 return false;
580         }
581
582         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
583                 talloc_free(r);
584                 return false;
585         }
586
587         pull = ndr_pull_init_blob(&blob, r, NULL);
588         if (pull == NULL) {
589                 talloc_free(r);
590                 return false;
591         }
592
593         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
594         ndr_err = call->ndr_pull(pull, NDR_IN, r);
595         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
596                 talloc_free(r);
597                 return false;
598         }
599
600         if (DEBUGLEVEL >= 10) {
601                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinter, r);
602         }
603
604         r->out.result = _spoolss_SetPrinter(p, r);
605
606         if (p->rng_fault_state) {
607                 talloc_free(r);
608                 /* Return true here, srv_pipe_hnd.c will take care */
609                 return true;
610         }
611
612         if (DEBUGLEVEL >= 10) {
613                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinter, r);
614         }
615
616         push = ndr_push_init_ctx(r, NULL);
617         if (push == NULL) {
618                 talloc_free(r);
619                 return false;
620         }
621
622         ndr_err = call->ndr_push(push, NDR_OUT, r);
623         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
624                 talloc_free(r);
625                 return false;
626         }
627
628         blob = ndr_push_blob(push);
629         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
630                 talloc_free(r);
631                 return false;
632         }
633
634         talloc_free(r);
635
636         return true;
637 }
638
639 static bool api_spoolss_GetPrinter(pipes_struct *p)
640 {
641         const struct ndr_interface_call *call;
642         struct ndr_pull *pull;
643         struct ndr_push *push;
644         enum ndr_err_code ndr_err;
645         DATA_BLOB blob;
646         struct spoolss_GetPrinter *r;
647
648         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTER];
649
650         r = talloc(talloc_tos(), struct spoolss_GetPrinter);
651         if (r == NULL) {
652                 return false;
653         }
654
655         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
656                 talloc_free(r);
657                 return false;
658         }
659
660         pull = ndr_pull_init_blob(&blob, r, NULL);
661         if (pull == NULL) {
662                 talloc_free(r);
663                 return false;
664         }
665
666         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
667         ndr_err = call->ndr_pull(pull, NDR_IN, r);
668         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
669                 talloc_free(r);
670                 return false;
671         }
672
673         if (DEBUGLEVEL >= 10) {
674                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinter, r);
675         }
676
677         ZERO_STRUCT(r->out);
678         r->out.info = talloc_zero(r, union spoolss_PrinterInfo);
679         if (r->out.info == NULL) {
680                 talloc_free(r);
681                 return false;
682         }
683
684         r->out.needed = talloc_zero(r, uint32_t);
685         if (r->out.needed == NULL) {
686                 talloc_free(r);
687                 return false;
688         }
689
690         r->out.result = _spoolss_GetPrinter(p, r);
691
692         if (p->rng_fault_state) {
693                 talloc_free(r);
694                 /* Return true here, srv_pipe_hnd.c will take care */
695                 return true;
696         }
697
698         if (DEBUGLEVEL >= 10) {
699                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinter, r);
700         }
701
702         push = ndr_push_init_ctx(r, NULL);
703         if (push == NULL) {
704                 talloc_free(r);
705                 return false;
706         }
707
708         ndr_err = call->ndr_push(push, NDR_OUT, r);
709         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
710                 talloc_free(r);
711                 return false;
712         }
713
714         blob = ndr_push_blob(push);
715         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
716                 talloc_free(r);
717                 return false;
718         }
719
720         talloc_free(r);
721
722         return true;
723 }
724
725 static bool api_spoolss_AddPrinterDriver(pipes_struct *p)
726 {
727         const struct ndr_interface_call *call;
728         struct ndr_pull *pull;
729         struct ndr_push *push;
730         enum ndr_err_code ndr_err;
731         DATA_BLOB blob;
732         struct spoolss_AddPrinterDriver *r;
733
734         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTERDRIVER];
735
736         r = talloc(talloc_tos(), struct spoolss_AddPrinterDriver);
737         if (r == NULL) {
738                 return false;
739         }
740
741         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
742                 talloc_free(r);
743                 return false;
744         }
745
746         pull = ndr_pull_init_blob(&blob, r, NULL);
747         if (pull == NULL) {
748                 talloc_free(r);
749                 return false;
750         }
751
752         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
753         ndr_err = call->ndr_pull(pull, NDR_IN, r);
754         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
755                 talloc_free(r);
756                 return false;
757         }
758
759         if (DEBUGLEVEL >= 10) {
760                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterDriver, r);
761         }
762
763         r->out.result = _spoolss_AddPrinterDriver(p, r);
764
765         if (p->rng_fault_state) {
766                 talloc_free(r);
767                 /* Return true here, srv_pipe_hnd.c will take care */
768                 return true;
769         }
770
771         if (DEBUGLEVEL >= 10) {
772                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterDriver, r);
773         }
774
775         push = ndr_push_init_ctx(r, NULL);
776         if (push == NULL) {
777                 talloc_free(r);
778                 return false;
779         }
780
781         ndr_err = call->ndr_push(push, NDR_OUT, r);
782         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
783                 talloc_free(r);
784                 return false;
785         }
786
787         blob = ndr_push_blob(push);
788         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
789                 talloc_free(r);
790                 return false;
791         }
792
793         talloc_free(r);
794
795         return true;
796 }
797
798 static bool api_spoolss_EnumPrinterDrivers(pipes_struct *p)
799 {
800         const struct ndr_interface_call *call;
801         struct ndr_pull *pull;
802         struct ndr_push *push;
803         enum ndr_err_code ndr_err;
804         DATA_BLOB blob;
805         struct spoolss_EnumPrinterDrivers *r;
806
807         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERDRIVERS];
808
809         r = talloc(talloc_tos(), struct spoolss_EnumPrinterDrivers);
810         if (r == NULL) {
811                 return false;
812         }
813
814         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
815                 talloc_free(r);
816                 return false;
817         }
818
819         pull = ndr_pull_init_blob(&blob, r, NULL);
820         if (pull == NULL) {
821                 talloc_free(r);
822                 return false;
823         }
824
825         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
826         ndr_err = call->ndr_pull(pull, NDR_IN, r);
827         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
828                 talloc_free(r);
829                 return false;
830         }
831
832         if (DEBUGLEVEL >= 10) {
833                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterDrivers, r);
834         }
835
836         ZERO_STRUCT(r->out);
837         r->out.info = talloc_zero_array(r, union spoolss_DriverInfo, r->out.count);
838         if (r->out.info == NULL) {
839                 talloc_free(r);
840                 return false;
841         }
842
843         r->out.needed = talloc_zero(r, uint32_t);
844         if (r->out.needed == NULL) {
845                 talloc_free(r);
846                 return false;
847         }
848
849         r->out.result = _spoolss_EnumPrinterDrivers(p, r);
850
851         if (p->rng_fault_state) {
852                 talloc_free(r);
853                 /* Return true here, srv_pipe_hnd.c will take care */
854                 return true;
855         }
856
857         if (DEBUGLEVEL >= 10) {
858                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterDrivers, r);
859         }
860
861         push = ndr_push_init_ctx(r, NULL);
862         if (push == NULL) {
863                 talloc_free(r);
864                 return false;
865         }
866
867         ndr_err = call->ndr_push(push, NDR_OUT, r);
868         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
869                 talloc_free(r);
870                 return false;
871         }
872
873         blob = ndr_push_blob(push);
874         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
875                 talloc_free(r);
876                 return false;
877         }
878
879         talloc_free(r);
880
881         return true;
882 }
883
884 static bool api_spoolss_GetPrinterDriver(pipes_struct *p)
885 {
886         const struct ndr_interface_call *call;
887         struct ndr_pull *pull;
888         struct ndr_push *push;
889         enum ndr_err_code ndr_err;
890         DATA_BLOB blob;
891         struct spoolss_GetPrinterDriver *r;
892
893         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDRIVER];
894
895         r = talloc(talloc_tos(), struct spoolss_GetPrinterDriver);
896         if (r == NULL) {
897                 return false;
898         }
899
900         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
901                 talloc_free(r);
902                 return false;
903         }
904
905         pull = ndr_pull_init_blob(&blob, r, NULL);
906         if (pull == NULL) {
907                 talloc_free(r);
908                 return false;
909         }
910
911         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
912         ndr_err = call->ndr_pull(pull, NDR_IN, r);
913         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
914                 talloc_free(r);
915                 return false;
916         }
917
918         if (DEBUGLEVEL >= 10) {
919                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriver, r);
920         }
921
922         r->out.result = _spoolss_GetPrinterDriver(p, r);
923
924         if (p->rng_fault_state) {
925                 talloc_free(r);
926                 /* Return true here, srv_pipe_hnd.c will take care */
927                 return true;
928         }
929
930         if (DEBUGLEVEL >= 10) {
931                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriver, r);
932         }
933
934         push = ndr_push_init_ctx(r, NULL);
935         if (push == NULL) {
936                 talloc_free(r);
937                 return false;
938         }
939
940         ndr_err = call->ndr_push(push, NDR_OUT, r);
941         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
942                 talloc_free(r);
943                 return false;
944         }
945
946         blob = ndr_push_blob(push);
947         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
948                 talloc_free(r);
949                 return false;
950         }
951
952         talloc_free(r);
953
954         return true;
955 }
956
957 static bool api_spoolss_GetPrinterDriverDirectory(pipes_struct *p)
958 {
959         const struct ndr_interface_call *call;
960         struct ndr_pull *pull;
961         struct ndr_push *push;
962         enum ndr_err_code ndr_err;
963         DATA_BLOB blob;
964         struct spoolss_GetPrinterDriverDirectory *r;
965
966         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY];
967
968         r = talloc(talloc_tos(), struct spoolss_GetPrinterDriverDirectory);
969         if (r == NULL) {
970                 return false;
971         }
972
973         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
974                 talloc_free(r);
975                 return false;
976         }
977
978         pull = ndr_pull_init_blob(&blob, r, NULL);
979         if (pull == NULL) {
980                 talloc_free(r);
981                 return false;
982         }
983
984         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
985         ndr_err = call->ndr_pull(pull, NDR_IN, r);
986         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
987                 talloc_free(r);
988                 return false;
989         }
990
991         if (DEBUGLEVEL >= 10) {
992                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriverDirectory, r);
993         }
994
995         ZERO_STRUCT(r->out);
996         r->out.info = talloc_zero(r, union spoolss_DriverDirectoryInfo);
997         if (r->out.info == NULL) {
998                 talloc_free(r);
999                 return false;
1000         }
1001
1002         r->out.needed = talloc_zero(r, uint32_t);
1003         if (r->out.needed == NULL) {
1004                 talloc_free(r);
1005                 return false;
1006         }
1007
1008         r->out.result = _spoolss_GetPrinterDriverDirectory(p, r);
1009
1010         if (p->rng_fault_state) {
1011                 talloc_free(r);
1012                 /* Return true here, srv_pipe_hnd.c will take care */
1013                 return true;
1014         }
1015
1016         if (DEBUGLEVEL >= 10) {
1017                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriverDirectory, r);
1018         }
1019
1020         push = ndr_push_init_ctx(r, NULL);
1021         if (push == NULL) {
1022                 talloc_free(r);
1023                 return false;
1024         }
1025
1026         ndr_err = call->ndr_push(push, NDR_OUT, r);
1027         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1028                 talloc_free(r);
1029                 return false;
1030         }
1031
1032         blob = ndr_push_blob(push);
1033         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1034                 talloc_free(r);
1035                 return false;
1036         }
1037
1038         talloc_free(r);
1039
1040         return true;
1041 }
1042
1043 static bool api_spoolss_DeletePrinterDriver(pipes_struct *p)
1044 {
1045         const struct ndr_interface_call *call;
1046         struct ndr_pull *pull;
1047         struct ndr_push *push;
1048         enum ndr_err_code ndr_err;
1049         DATA_BLOB blob;
1050         struct spoolss_DeletePrinterDriver *r;
1051
1052         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDRIVER];
1053
1054         r = talloc(talloc_tos(), struct spoolss_DeletePrinterDriver);
1055         if (r == NULL) {
1056                 return false;
1057         }
1058
1059         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1060                 talloc_free(r);
1061                 return false;
1062         }
1063
1064         pull = ndr_pull_init_blob(&blob, r, NULL);
1065         if (pull == NULL) {
1066                 talloc_free(r);
1067                 return false;
1068         }
1069
1070         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1071         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1072         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1073                 talloc_free(r);
1074                 return false;
1075         }
1076
1077         if (DEBUGLEVEL >= 10) {
1078                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDriver, r);
1079         }
1080
1081         r->out.result = _spoolss_DeletePrinterDriver(p, r);
1082
1083         if (p->rng_fault_state) {
1084                 talloc_free(r);
1085                 /* Return true here, srv_pipe_hnd.c will take care */
1086                 return true;
1087         }
1088
1089         if (DEBUGLEVEL >= 10) {
1090                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDriver, r);
1091         }
1092
1093         push = ndr_push_init_ctx(r, NULL);
1094         if (push == NULL) {
1095                 talloc_free(r);
1096                 return false;
1097         }
1098
1099         ndr_err = call->ndr_push(push, NDR_OUT, r);
1100         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1101                 talloc_free(r);
1102                 return false;
1103         }
1104
1105         blob = ndr_push_blob(push);
1106         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1107                 talloc_free(r);
1108                 return false;
1109         }
1110
1111         talloc_free(r);
1112
1113         return true;
1114 }
1115
1116 static bool api_spoolss_AddPrintProcessor(pipes_struct *p)
1117 {
1118         const struct ndr_interface_call *call;
1119         struct ndr_pull *pull;
1120         struct ndr_push *push;
1121         enum ndr_err_code ndr_err;
1122         DATA_BLOB blob;
1123         struct spoolss_AddPrintProcessor *r;
1124
1125         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTPROCESSOR];
1126
1127         r = talloc(talloc_tos(), struct spoolss_AddPrintProcessor);
1128         if (r == NULL) {
1129                 return false;
1130         }
1131
1132         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1133                 talloc_free(r);
1134                 return false;
1135         }
1136
1137         pull = ndr_pull_init_blob(&blob, r, NULL);
1138         if (pull == NULL) {
1139                 talloc_free(r);
1140                 return false;
1141         }
1142
1143         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1144         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1145         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1146                 talloc_free(r);
1147                 return false;
1148         }
1149
1150         if (DEBUGLEVEL >= 10) {
1151                 NDR_PRINT_IN_DEBUG(spoolss_AddPrintProcessor, r);
1152         }
1153
1154         r->out.result = _spoolss_AddPrintProcessor(p, r);
1155
1156         if (p->rng_fault_state) {
1157                 talloc_free(r);
1158                 /* Return true here, srv_pipe_hnd.c will take care */
1159                 return true;
1160         }
1161
1162         if (DEBUGLEVEL >= 10) {
1163                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrintProcessor, r);
1164         }
1165
1166         push = ndr_push_init_ctx(r, NULL);
1167         if (push == NULL) {
1168                 talloc_free(r);
1169                 return false;
1170         }
1171
1172         ndr_err = call->ndr_push(push, NDR_OUT, r);
1173         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1174                 talloc_free(r);
1175                 return false;
1176         }
1177
1178         blob = ndr_push_blob(push);
1179         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1180                 talloc_free(r);
1181                 return false;
1182         }
1183
1184         talloc_free(r);
1185
1186         return true;
1187 }
1188
1189 static bool api_spoolss_EnumPrintProcessors(pipes_struct *p)
1190 {
1191         const struct ndr_interface_call *call;
1192         struct ndr_pull *pull;
1193         struct ndr_push *push;
1194         enum ndr_err_code ndr_err;
1195         DATA_BLOB blob;
1196         struct spoolss_EnumPrintProcessors *r;
1197
1198         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTPROCESSORS];
1199
1200         r = talloc(talloc_tos(), struct spoolss_EnumPrintProcessors);
1201         if (r == NULL) {
1202                 return false;
1203         }
1204
1205         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1206                 talloc_free(r);
1207                 return false;
1208         }
1209
1210         pull = ndr_pull_init_blob(&blob, r, NULL);
1211         if (pull == NULL) {
1212                 talloc_free(r);
1213                 return false;
1214         }
1215
1216         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1217         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1218         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1219                 talloc_free(r);
1220                 return false;
1221         }
1222
1223         if (DEBUGLEVEL >= 10) {
1224                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrintProcessors, r);
1225         }
1226
1227         ZERO_STRUCT(r->out);
1228         r->out.info = talloc_zero_array(r, union spoolss_PrintProcessorInfo, r->out.count);
1229         if (r->out.info == NULL) {
1230                 talloc_free(r);
1231                 return false;
1232         }
1233
1234         r->out.needed = talloc_zero(r, uint32_t);
1235         if (r->out.needed == NULL) {
1236                 talloc_free(r);
1237                 return false;
1238         }
1239
1240         r->out.result = _spoolss_EnumPrintProcessors(p, r);
1241
1242         if (p->rng_fault_state) {
1243                 talloc_free(r);
1244                 /* Return true here, srv_pipe_hnd.c will take care */
1245                 return true;
1246         }
1247
1248         if (DEBUGLEVEL >= 10) {
1249                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrintProcessors, r);
1250         }
1251
1252         push = ndr_push_init_ctx(r, NULL);
1253         if (push == NULL) {
1254                 talloc_free(r);
1255                 return false;
1256         }
1257
1258         ndr_err = call->ndr_push(push, NDR_OUT, r);
1259         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1260                 talloc_free(r);
1261                 return false;
1262         }
1263
1264         blob = ndr_push_blob(push);
1265         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1266                 talloc_free(r);
1267                 return false;
1268         }
1269
1270         talloc_free(r);
1271
1272         return true;
1273 }
1274
1275 static bool api_spoolss_GetPrintProcessorDirectory(pipes_struct *p)
1276 {
1277         const struct ndr_interface_call *call;
1278         struct ndr_pull *pull;
1279         struct ndr_push *push;
1280         enum ndr_err_code ndr_err;
1281         DATA_BLOB blob;
1282         struct spoolss_GetPrintProcessorDirectory *r;
1283
1284         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY];
1285
1286         r = talloc(talloc_tos(), struct spoolss_GetPrintProcessorDirectory);
1287         if (r == NULL) {
1288                 return false;
1289         }
1290
1291         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1292                 talloc_free(r);
1293                 return false;
1294         }
1295
1296         pull = ndr_pull_init_blob(&blob, r, NULL);
1297         if (pull == NULL) {
1298                 talloc_free(r);
1299                 return false;
1300         }
1301
1302         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1303         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1304         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1305                 talloc_free(r);
1306                 return false;
1307         }
1308
1309         if (DEBUGLEVEL >= 10) {
1310                 NDR_PRINT_IN_DEBUG(spoolss_GetPrintProcessorDirectory, r);
1311         }
1312
1313         r->out.result = _spoolss_GetPrintProcessorDirectory(p, r);
1314
1315         if (p->rng_fault_state) {
1316                 talloc_free(r);
1317                 /* Return true here, srv_pipe_hnd.c will take care */
1318                 return true;
1319         }
1320
1321         if (DEBUGLEVEL >= 10) {
1322                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrintProcessorDirectory, r);
1323         }
1324
1325         push = ndr_push_init_ctx(r, NULL);
1326         if (push == NULL) {
1327                 talloc_free(r);
1328                 return false;
1329         }
1330
1331         ndr_err = call->ndr_push(push, NDR_OUT, r);
1332         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1333                 talloc_free(r);
1334                 return false;
1335         }
1336
1337         blob = ndr_push_blob(push);
1338         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1339                 talloc_free(r);
1340                 return false;
1341         }
1342
1343         talloc_free(r);
1344
1345         return true;
1346 }
1347
1348 static bool api_spoolss_StartDocPrinter(pipes_struct *p)
1349 {
1350         const struct ndr_interface_call *call;
1351         struct ndr_pull *pull;
1352         struct ndr_push *push;
1353         enum ndr_err_code ndr_err;
1354         DATA_BLOB blob;
1355         struct spoolss_StartDocPrinter *r;
1356
1357         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_STARTDOCPRINTER];
1358
1359         r = talloc(talloc_tos(), struct spoolss_StartDocPrinter);
1360         if (r == NULL) {
1361                 return false;
1362         }
1363
1364         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1365                 talloc_free(r);
1366                 return false;
1367         }
1368
1369         pull = ndr_pull_init_blob(&blob, r, NULL);
1370         if (pull == NULL) {
1371                 talloc_free(r);
1372                 return false;
1373         }
1374
1375         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1376         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1377         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1378                 talloc_free(r);
1379                 return false;
1380         }
1381
1382         if (DEBUGLEVEL >= 10) {
1383                 NDR_PRINT_IN_DEBUG(spoolss_StartDocPrinter, r);
1384         }
1385
1386         ZERO_STRUCT(r->out);
1387         r->out.job_id = talloc_zero(r, uint32_t);
1388         if (r->out.job_id == NULL) {
1389                 talloc_free(r);
1390                 return false;
1391         }
1392
1393         r->out.result = _spoolss_StartDocPrinter(p, r);
1394
1395         if (p->rng_fault_state) {
1396                 talloc_free(r);
1397                 /* Return true here, srv_pipe_hnd.c will take care */
1398                 return true;
1399         }
1400
1401         if (DEBUGLEVEL >= 10) {
1402                 NDR_PRINT_OUT_DEBUG(spoolss_StartDocPrinter, r);
1403         }
1404
1405         push = ndr_push_init_ctx(r, NULL);
1406         if (push == NULL) {
1407                 talloc_free(r);
1408                 return false;
1409         }
1410
1411         ndr_err = call->ndr_push(push, NDR_OUT, r);
1412         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1413                 talloc_free(r);
1414                 return false;
1415         }
1416
1417         blob = ndr_push_blob(push);
1418         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1419                 talloc_free(r);
1420                 return false;
1421         }
1422
1423         talloc_free(r);
1424
1425         return true;
1426 }
1427
1428 static bool api_spoolss_StartPagePrinter(pipes_struct *p)
1429 {
1430         const struct ndr_interface_call *call;
1431         struct ndr_pull *pull;
1432         struct ndr_push *push;
1433         enum ndr_err_code ndr_err;
1434         DATA_BLOB blob;
1435         struct spoolss_StartPagePrinter *r;
1436
1437         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_STARTPAGEPRINTER];
1438
1439         r = talloc(talloc_tos(), struct spoolss_StartPagePrinter);
1440         if (r == NULL) {
1441                 return false;
1442         }
1443
1444         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1445                 talloc_free(r);
1446                 return false;
1447         }
1448
1449         pull = ndr_pull_init_blob(&blob, r, NULL);
1450         if (pull == NULL) {
1451                 talloc_free(r);
1452                 return false;
1453         }
1454
1455         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1456         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1457         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1458                 talloc_free(r);
1459                 return false;
1460         }
1461
1462         if (DEBUGLEVEL >= 10) {
1463                 NDR_PRINT_IN_DEBUG(spoolss_StartPagePrinter, r);
1464         }
1465
1466         r->out.result = _spoolss_StartPagePrinter(p, r);
1467
1468         if (p->rng_fault_state) {
1469                 talloc_free(r);
1470                 /* Return true here, srv_pipe_hnd.c will take care */
1471                 return true;
1472         }
1473
1474         if (DEBUGLEVEL >= 10) {
1475                 NDR_PRINT_OUT_DEBUG(spoolss_StartPagePrinter, r);
1476         }
1477
1478         push = ndr_push_init_ctx(r, NULL);
1479         if (push == NULL) {
1480                 talloc_free(r);
1481                 return false;
1482         }
1483
1484         ndr_err = call->ndr_push(push, NDR_OUT, r);
1485         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1486                 talloc_free(r);
1487                 return false;
1488         }
1489
1490         blob = ndr_push_blob(push);
1491         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1492                 talloc_free(r);
1493                 return false;
1494         }
1495
1496         talloc_free(r);
1497
1498         return true;
1499 }
1500
1501 static bool api_spoolss_WritePrinter(pipes_struct *p)
1502 {
1503         const struct ndr_interface_call *call;
1504         struct ndr_pull *pull;
1505         struct ndr_push *push;
1506         enum ndr_err_code ndr_err;
1507         DATA_BLOB blob;
1508         struct spoolss_WritePrinter *r;
1509
1510         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_WRITEPRINTER];
1511
1512         r = talloc(talloc_tos(), struct spoolss_WritePrinter);
1513         if (r == NULL) {
1514                 return false;
1515         }
1516
1517         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1518                 talloc_free(r);
1519                 return false;
1520         }
1521
1522         pull = ndr_pull_init_blob(&blob, r, NULL);
1523         if (pull == NULL) {
1524                 talloc_free(r);
1525                 return false;
1526         }
1527
1528         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1529         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1530         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1531                 talloc_free(r);
1532                 return false;
1533         }
1534
1535         if (DEBUGLEVEL >= 10) {
1536                 NDR_PRINT_IN_DEBUG(spoolss_WritePrinter, r);
1537         }
1538
1539         ZERO_STRUCT(r->out);
1540         r->out.num_written = talloc_zero(r, uint32_t);
1541         if (r->out.num_written == NULL) {
1542                 talloc_free(r);
1543                 return false;
1544         }
1545
1546         r->out.result = _spoolss_WritePrinter(p, r);
1547
1548         if (p->rng_fault_state) {
1549                 talloc_free(r);
1550                 /* Return true here, srv_pipe_hnd.c will take care */
1551                 return true;
1552         }
1553
1554         if (DEBUGLEVEL >= 10) {
1555                 NDR_PRINT_OUT_DEBUG(spoolss_WritePrinter, r);
1556         }
1557
1558         push = ndr_push_init_ctx(r, NULL);
1559         if (push == NULL) {
1560                 talloc_free(r);
1561                 return false;
1562         }
1563
1564         ndr_err = call->ndr_push(push, NDR_OUT, r);
1565         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1566                 talloc_free(r);
1567                 return false;
1568         }
1569
1570         blob = ndr_push_blob(push);
1571         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1572                 talloc_free(r);
1573                 return false;
1574         }
1575
1576         talloc_free(r);
1577
1578         return true;
1579 }
1580
1581 static bool api_spoolss_EndPagePrinter(pipes_struct *p)
1582 {
1583         const struct ndr_interface_call *call;
1584         struct ndr_pull *pull;
1585         struct ndr_push *push;
1586         enum ndr_err_code ndr_err;
1587         DATA_BLOB blob;
1588         struct spoolss_EndPagePrinter *r;
1589
1590         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENDPAGEPRINTER];
1591
1592         r = talloc(talloc_tos(), struct spoolss_EndPagePrinter);
1593         if (r == NULL) {
1594                 return false;
1595         }
1596
1597         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1598                 talloc_free(r);
1599                 return false;
1600         }
1601
1602         pull = ndr_pull_init_blob(&blob, r, NULL);
1603         if (pull == NULL) {
1604                 talloc_free(r);
1605                 return false;
1606         }
1607
1608         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1609         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1610         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1611                 talloc_free(r);
1612                 return false;
1613         }
1614
1615         if (DEBUGLEVEL >= 10) {
1616                 NDR_PRINT_IN_DEBUG(spoolss_EndPagePrinter, r);
1617         }
1618
1619         r->out.result = _spoolss_EndPagePrinter(p, r);
1620
1621         if (p->rng_fault_state) {
1622                 talloc_free(r);
1623                 /* Return true here, srv_pipe_hnd.c will take care */
1624                 return true;
1625         }
1626
1627         if (DEBUGLEVEL >= 10) {
1628                 NDR_PRINT_OUT_DEBUG(spoolss_EndPagePrinter, r);
1629         }
1630
1631         push = ndr_push_init_ctx(r, NULL);
1632         if (push == NULL) {
1633                 talloc_free(r);
1634                 return false;
1635         }
1636
1637         ndr_err = call->ndr_push(push, NDR_OUT, r);
1638         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1639                 talloc_free(r);
1640                 return false;
1641         }
1642
1643         blob = ndr_push_blob(push);
1644         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1645                 talloc_free(r);
1646                 return false;
1647         }
1648
1649         talloc_free(r);
1650
1651         return true;
1652 }
1653
1654 static bool api_spoolss_AbortPrinter(pipes_struct *p)
1655 {
1656         const struct ndr_interface_call *call;
1657         struct ndr_pull *pull;
1658         struct ndr_push *push;
1659         enum ndr_err_code ndr_err;
1660         DATA_BLOB blob;
1661         struct spoolss_AbortPrinter *r;
1662
1663         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ABORTPRINTER];
1664
1665         r = talloc(talloc_tos(), struct spoolss_AbortPrinter);
1666         if (r == NULL) {
1667                 return false;
1668         }
1669
1670         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1671                 talloc_free(r);
1672                 return false;
1673         }
1674
1675         pull = ndr_pull_init_blob(&blob, r, NULL);
1676         if (pull == NULL) {
1677                 talloc_free(r);
1678                 return false;
1679         }
1680
1681         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1682         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1683         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1684                 talloc_free(r);
1685                 return false;
1686         }
1687
1688         if (DEBUGLEVEL >= 10) {
1689                 NDR_PRINT_IN_DEBUG(spoolss_AbortPrinter, r);
1690         }
1691
1692         r->out.result = _spoolss_AbortPrinter(p, r);
1693
1694         if (p->rng_fault_state) {
1695                 talloc_free(r);
1696                 /* Return true here, srv_pipe_hnd.c will take care */
1697                 return true;
1698         }
1699
1700         if (DEBUGLEVEL >= 10) {
1701                 NDR_PRINT_OUT_DEBUG(spoolss_AbortPrinter, r);
1702         }
1703
1704         push = ndr_push_init_ctx(r, NULL);
1705         if (push == NULL) {
1706                 talloc_free(r);
1707                 return false;
1708         }
1709
1710         ndr_err = call->ndr_push(push, NDR_OUT, r);
1711         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1712                 talloc_free(r);
1713                 return false;
1714         }
1715
1716         blob = ndr_push_blob(push);
1717         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1718                 talloc_free(r);
1719                 return false;
1720         }
1721
1722         talloc_free(r);
1723
1724         return true;
1725 }
1726
1727 static bool api_spoolss_ReadPrinter(pipes_struct *p)
1728 {
1729         const struct ndr_interface_call *call;
1730         struct ndr_pull *pull;
1731         struct ndr_push *push;
1732         enum ndr_err_code ndr_err;
1733         DATA_BLOB blob;
1734         struct spoolss_ReadPrinter *r;
1735
1736         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_READPRINTER];
1737
1738         r = talloc(talloc_tos(), struct spoolss_ReadPrinter);
1739         if (r == NULL) {
1740                 return false;
1741         }
1742
1743         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1744                 talloc_free(r);
1745                 return false;
1746         }
1747
1748         pull = ndr_pull_init_blob(&blob, r, NULL);
1749         if (pull == NULL) {
1750                 talloc_free(r);
1751                 return false;
1752         }
1753
1754         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1755         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1756         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1757                 talloc_free(r);
1758                 return false;
1759         }
1760
1761         if (DEBUGLEVEL >= 10) {
1762                 NDR_PRINT_IN_DEBUG(spoolss_ReadPrinter, r);
1763         }
1764
1765         ZERO_STRUCT(r->out);
1766         r->out.data = talloc_zero_array(r, uint8_t, r->in.data_size);
1767         if (r->out.data == NULL) {
1768                 talloc_free(r);
1769                 return false;
1770         }
1771
1772         r->out._data_size = talloc_zero(r, uint32_t);
1773         if (r->out._data_size == NULL) {
1774                 talloc_free(r);
1775                 return false;
1776         }
1777
1778         r->out.result = _spoolss_ReadPrinter(p, r);
1779
1780         if (p->rng_fault_state) {
1781                 talloc_free(r);
1782                 /* Return true here, srv_pipe_hnd.c will take care */
1783                 return true;
1784         }
1785
1786         if (DEBUGLEVEL >= 10) {
1787                 NDR_PRINT_OUT_DEBUG(spoolss_ReadPrinter, r);
1788         }
1789
1790         push = ndr_push_init_ctx(r, NULL);
1791         if (push == NULL) {
1792                 talloc_free(r);
1793                 return false;
1794         }
1795
1796         ndr_err = call->ndr_push(push, NDR_OUT, r);
1797         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1798                 talloc_free(r);
1799                 return false;
1800         }
1801
1802         blob = ndr_push_blob(push);
1803         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1804                 talloc_free(r);
1805                 return false;
1806         }
1807
1808         talloc_free(r);
1809
1810         return true;
1811 }
1812
1813 static bool api_spoolss_EndDocPrinter(pipes_struct *p)
1814 {
1815         const struct ndr_interface_call *call;
1816         struct ndr_pull *pull;
1817         struct ndr_push *push;
1818         enum ndr_err_code ndr_err;
1819         DATA_BLOB blob;
1820         struct spoolss_EndDocPrinter *r;
1821
1822         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENDDOCPRINTER];
1823
1824         r = talloc(talloc_tos(), struct spoolss_EndDocPrinter);
1825         if (r == NULL) {
1826                 return false;
1827         }
1828
1829         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1830                 talloc_free(r);
1831                 return false;
1832         }
1833
1834         pull = ndr_pull_init_blob(&blob, r, NULL);
1835         if (pull == NULL) {
1836                 talloc_free(r);
1837                 return false;
1838         }
1839
1840         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1841         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1842         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1843                 talloc_free(r);
1844                 return false;
1845         }
1846
1847         if (DEBUGLEVEL >= 10) {
1848                 NDR_PRINT_IN_DEBUG(spoolss_EndDocPrinter, r);
1849         }
1850
1851         r->out.result = _spoolss_EndDocPrinter(p, r);
1852
1853         if (p->rng_fault_state) {
1854                 talloc_free(r);
1855                 /* Return true here, srv_pipe_hnd.c will take care */
1856                 return true;
1857         }
1858
1859         if (DEBUGLEVEL >= 10) {
1860                 NDR_PRINT_OUT_DEBUG(spoolss_EndDocPrinter, r);
1861         }
1862
1863         push = ndr_push_init_ctx(r, NULL);
1864         if (push == NULL) {
1865                 talloc_free(r);
1866                 return false;
1867         }
1868
1869         ndr_err = call->ndr_push(push, NDR_OUT, r);
1870         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1871                 talloc_free(r);
1872                 return false;
1873         }
1874
1875         blob = ndr_push_blob(push);
1876         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1877                 talloc_free(r);
1878                 return false;
1879         }
1880
1881         talloc_free(r);
1882
1883         return true;
1884 }
1885
1886 static bool api_spoolss_AddJob(pipes_struct *p)
1887 {
1888         const struct ndr_interface_call *call;
1889         struct ndr_pull *pull;
1890         struct ndr_push *push;
1891         enum ndr_err_code ndr_err;
1892         DATA_BLOB blob;
1893         struct spoolss_AddJob *r;
1894
1895         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDJOB];
1896
1897         r = talloc(talloc_tos(), struct spoolss_AddJob);
1898         if (r == NULL) {
1899                 return false;
1900         }
1901
1902         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1903                 talloc_free(r);
1904                 return false;
1905         }
1906
1907         pull = ndr_pull_init_blob(&blob, r, NULL);
1908         if (pull == NULL) {
1909                 talloc_free(r);
1910                 return false;
1911         }
1912
1913         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1914         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1915         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1916                 talloc_free(r);
1917                 return false;
1918         }
1919
1920         if (DEBUGLEVEL >= 10) {
1921                 NDR_PRINT_IN_DEBUG(spoolss_AddJob, r);
1922         }
1923
1924         ZERO_STRUCT(r->out);
1925         r->out.buffer = r->in.buffer;
1926         r->out.needed = talloc_zero(r, uint32_t);
1927         if (r->out.needed == NULL) {
1928                 talloc_free(r);
1929                 return false;
1930         }
1931
1932         r->out.result = _spoolss_AddJob(p, r);
1933
1934         if (p->rng_fault_state) {
1935                 talloc_free(r);
1936                 /* Return true here, srv_pipe_hnd.c will take care */
1937                 return true;
1938         }
1939
1940         if (DEBUGLEVEL >= 10) {
1941                 NDR_PRINT_OUT_DEBUG(spoolss_AddJob, r);
1942         }
1943
1944         push = ndr_push_init_ctx(r, NULL);
1945         if (push == NULL) {
1946                 talloc_free(r);
1947                 return false;
1948         }
1949
1950         ndr_err = call->ndr_push(push, NDR_OUT, r);
1951         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1952                 talloc_free(r);
1953                 return false;
1954         }
1955
1956         blob = ndr_push_blob(push);
1957         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1958                 talloc_free(r);
1959                 return false;
1960         }
1961
1962         talloc_free(r);
1963
1964         return true;
1965 }
1966
1967 static bool api_spoolss_ScheduleJob(pipes_struct *p)
1968 {
1969         const struct ndr_interface_call *call;
1970         struct ndr_pull *pull;
1971         struct ndr_push *push;
1972         enum ndr_err_code ndr_err;
1973         DATA_BLOB blob;
1974         struct spoolss_ScheduleJob *r;
1975
1976         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SCHEDULEJOB];
1977
1978         r = talloc(talloc_tos(), struct spoolss_ScheduleJob);
1979         if (r == NULL) {
1980                 return false;
1981         }
1982
1983         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1984                 talloc_free(r);
1985                 return false;
1986         }
1987
1988         pull = ndr_pull_init_blob(&blob, r, NULL);
1989         if (pull == NULL) {
1990                 talloc_free(r);
1991                 return false;
1992         }
1993
1994         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1995         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1996         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1997                 talloc_free(r);
1998                 return false;
1999         }
2000
2001         if (DEBUGLEVEL >= 10) {
2002                 NDR_PRINT_IN_DEBUG(spoolss_ScheduleJob, r);
2003         }
2004
2005         r->out.result = _spoolss_ScheduleJob(p, r);
2006
2007         if (p->rng_fault_state) {
2008                 talloc_free(r);
2009                 /* Return true here, srv_pipe_hnd.c will take care */
2010                 return true;
2011         }
2012
2013         if (DEBUGLEVEL >= 10) {
2014                 NDR_PRINT_OUT_DEBUG(spoolss_ScheduleJob, r);
2015         }
2016
2017         push = ndr_push_init_ctx(r, NULL);
2018         if (push == NULL) {
2019                 talloc_free(r);
2020                 return false;
2021         }
2022
2023         ndr_err = call->ndr_push(push, NDR_OUT, r);
2024         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2025                 talloc_free(r);
2026                 return false;
2027         }
2028
2029         blob = ndr_push_blob(push);
2030         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2031                 talloc_free(r);
2032                 return false;
2033         }
2034
2035         talloc_free(r);
2036
2037         return true;
2038 }
2039
2040 static bool api_spoolss_GetPrinterData(pipes_struct *p)
2041 {
2042         const struct ndr_interface_call *call;
2043         struct ndr_pull *pull;
2044         struct ndr_push *push;
2045         enum ndr_err_code ndr_err;
2046         DATA_BLOB blob;
2047         struct spoolss_GetPrinterData *r;
2048
2049         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDATA];
2050
2051         r = talloc(talloc_tos(), struct spoolss_GetPrinterData);
2052         if (r == NULL) {
2053                 return false;
2054         }
2055
2056         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2057                 talloc_free(r);
2058                 return false;
2059         }
2060
2061         pull = ndr_pull_init_blob(&blob, r, NULL);
2062         if (pull == NULL) {
2063                 talloc_free(r);
2064                 return false;
2065         }
2066
2067         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2068         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2069         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2070                 talloc_free(r);
2071                 return false;
2072         }
2073
2074         if (DEBUGLEVEL >= 10) {
2075                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterData, r);
2076         }
2077
2078         ZERO_STRUCT(r->out);
2079         r->out.type = talloc_zero(r, enum spoolss_PrinterDataType);
2080         if (r->out.type == NULL) {
2081                 talloc_free(r);
2082                 return false;
2083         }
2084
2085         r->out.needed = talloc_zero(r, uint32_t);
2086         if (r->out.needed == NULL) {
2087                 talloc_free(r);
2088                 return false;
2089         }
2090
2091         r->out.result = _spoolss_GetPrinterData(p, r);
2092
2093         if (p->rng_fault_state) {
2094                 talloc_free(r);
2095                 /* Return true here, srv_pipe_hnd.c will take care */
2096                 return true;
2097         }
2098
2099         if (DEBUGLEVEL >= 10) {
2100                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterData, r);
2101         }
2102
2103         push = ndr_push_init_ctx(r, NULL);
2104         if (push == NULL) {
2105                 talloc_free(r);
2106                 return false;
2107         }
2108
2109         ndr_err = call->ndr_push(push, NDR_OUT, r);
2110         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2111                 talloc_free(r);
2112                 return false;
2113         }
2114
2115         blob = ndr_push_blob(push);
2116         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2117                 talloc_free(r);
2118                 return false;
2119         }
2120
2121         talloc_free(r);
2122
2123         return true;
2124 }
2125
2126 static bool api_spoolss_SetPrinterData(pipes_struct *p)
2127 {
2128         const struct ndr_interface_call *call;
2129         struct ndr_pull *pull;
2130         struct ndr_push *push;
2131         enum ndr_err_code ndr_err;
2132         DATA_BLOB blob;
2133         struct spoolss_SetPrinterData *r;
2134
2135         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETPRINTERDATA];
2136
2137         r = talloc(talloc_tos(), struct spoolss_SetPrinterData);
2138         if (r == NULL) {
2139                 return false;
2140         }
2141
2142         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2143                 talloc_free(r);
2144                 return false;
2145         }
2146
2147         pull = ndr_pull_init_blob(&blob, r, NULL);
2148         if (pull == NULL) {
2149                 talloc_free(r);
2150                 return false;
2151         }
2152
2153         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2154         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2155         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2156                 talloc_free(r);
2157                 return false;
2158         }
2159
2160         if (DEBUGLEVEL >= 10) {
2161                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinterData, r);
2162         }
2163
2164         r->out.result = _spoolss_SetPrinterData(p, r);
2165
2166         if (p->rng_fault_state) {
2167                 talloc_free(r);
2168                 /* Return true here, srv_pipe_hnd.c will take care */
2169                 return true;
2170         }
2171
2172         if (DEBUGLEVEL >= 10) {
2173                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinterData, r);
2174         }
2175
2176         push = ndr_push_init_ctx(r, NULL);
2177         if (push == NULL) {
2178                 talloc_free(r);
2179                 return false;
2180         }
2181
2182         ndr_err = call->ndr_push(push, NDR_OUT, r);
2183         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2184                 talloc_free(r);
2185                 return false;
2186         }
2187
2188         blob = ndr_push_blob(push);
2189         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2190                 talloc_free(r);
2191                 return false;
2192         }
2193
2194         talloc_free(r);
2195
2196         return true;
2197 }
2198
2199 static bool api_spoolss_WaitForPrinterChange(pipes_struct *p)
2200 {
2201         const struct ndr_interface_call *call;
2202         struct ndr_pull *pull;
2203         struct ndr_push *push;
2204         enum ndr_err_code ndr_err;
2205         DATA_BLOB blob;
2206         struct spoolss_WaitForPrinterChange *r;
2207
2208         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_WAITFORPRINTERCHANGE];
2209
2210         r = talloc(talloc_tos(), struct spoolss_WaitForPrinterChange);
2211         if (r == NULL) {
2212                 return false;
2213         }
2214
2215         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2216                 talloc_free(r);
2217                 return false;
2218         }
2219
2220         pull = ndr_pull_init_blob(&blob, r, NULL);
2221         if (pull == NULL) {
2222                 talloc_free(r);
2223                 return false;
2224         }
2225
2226         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2227         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2228         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2229                 talloc_free(r);
2230                 return false;
2231         }
2232
2233         if (DEBUGLEVEL >= 10) {
2234                 NDR_PRINT_IN_DEBUG(spoolss_WaitForPrinterChange, r);
2235         }
2236
2237         r->out.result = _spoolss_WaitForPrinterChange(p, r);
2238
2239         if (p->rng_fault_state) {
2240                 talloc_free(r);
2241                 /* Return true here, srv_pipe_hnd.c will take care */
2242                 return true;
2243         }
2244
2245         if (DEBUGLEVEL >= 10) {
2246                 NDR_PRINT_OUT_DEBUG(spoolss_WaitForPrinterChange, r);
2247         }
2248
2249         push = ndr_push_init_ctx(r, NULL);
2250         if (push == NULL) {
2251                 talloc_free(r);
2252                 return false;
2253         }
2254
2255         ndr_err = call->ndr_push(push, NDR_OUT, r);
2256         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2257                 talloc_free(r);
2258                 return false;
2259         }
2260
2261         blob = ndr_push_blob(push);
2262         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2263                 talloc_free(r);
2264                 return false;
2265         }
2266
2267         talloc_free(r);
2268
2269         return true;
2270 }
2271
2272 static bool api_spoolss_ClosePrinter(pipes_struct *p)
2273 {
2274         const struct ndr_interface_call *call;
2275         struct ndr_pull *pull;
2276         struct ndr_push *push;
2277         enum ndr_err_code ndr_err;
2278         DATA_BLOB blob;
2279         struct spoolss_ClosePrinter *r;
2280
2281         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_CLOSEPRINTER];
2282
2283         r = talloc(talloc_tos(), struct spoolss_ClosePrinter);
2284         if (r == NULL) {
2285                 return false;
2286         }
2287
2288         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2289                 talloc_free(r);
2290                 return false;
2291         }
2292
2293         pull = ndr_pull_init_blob(&blob, r, NULL);
2294         if (pull == NULL) {
2295                 talloc_free(r);
2296                 return false;
2297         }
2298
2299         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2300         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2301         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2302                 talloc_free(r);
2303                 return false;
2304         }
2305
2306         if (DEBUGLEVEL >= 10) {
2307                 NDR_PRINT_IN_DEBUG(spoolss_ClosePrinter, r);
2308         }
2309
2310         ZERO_STRUCT(r->out);
2311         r->out.handle = r->in.handle;
2312         r->out.result = _spoolss_ClosePrinter(p, r);
2313
2314         if (p->rng_fault_state) {
2315                 talloc_free(r);
2316                 /* Return true here, srv_pipe_hnd.c will take care */
2317                 return true;
2318         }
2319
2320         if (DEBUGLEVEL >= 10) {
2321                 NDR_PRINT_OUT_DEBUG(spoolss_ClosePrinter, r);
2322         }
2323
2324         push = ndr_push_init_ctx(r, NULL);
2325         if (push == NULL) {
2326                 talloc_free(r);
2327                 return false;
2328         }
2329
2330         ndr_err = call->ndr_push(push, NDR_OUT, r);
2331         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2332                 talloc_free(r);
2333                 return false;
2334         }
2335
2336         blob = ndr_push_blob(push);
2337         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2338                 talloc_free(r);
2339                 return false;
2340         }
2341
2342         talloc_free(r);
2343
2344         return true;
2345 }
2346
2347 static bool api_spoolss_AddForm(pipes_struct *p)
2348 {
2349         const struct ndr_interface_call *call;
2350         struct ndr_pull *pull;
2351         struct ndr_push *push;
2352         enum ndr_err_code ndr_err;
2353         DATA_BLOB blob;
2354         struct spoolss_AddForm *r;
2355
2356         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDFORM];
2357
2358         r = talloc(talloc_tos(), struct spoolss_AddForm);
2359         if (r == NULL) {
2360                 return false;
2361         }
2362
2363         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2364                 talloc_free(r);
2365                 return false;
2366         }
2367
2368         pull = ndr_pull_init_blob(&blob, r, NULL);
2369         if (pull == NULL) {
2370                 talloc_free(r);
2371                 return false;
2372         }
2373
2374         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2375         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2376         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2377                 talloc_free(r);
2378                 return false;
2379         }
2380
2381         if (DEBUGLEVEL >= 10) {
2382                 NDR_PRINT_IN_DEBUG(spoolss_AddForm, r);
2383         }
2384
2385         r->out.result = _spoolss_AddForm(p, r);
2386
2387         if (p->rng_fault_state) {
2388                 talloc_free(r);
2389                 /* Return true here, srv_pipe_hnd.c will take care */
2390                 return true;
2391         }
2392
2393         if (DEBUGLEVEL >= 10) {
2394                 NDR_PRINT_OUT_DEBUG(spoolss_AddForm, r);
2395         }
2396
2397         push = ndr_push_init_ctx(r, NULL);
2398         if (push == NULL) {
2399                 talloc_free(r);
2400                 return false;
2401         }
2402
2403         ndr_err = call->ndr_push(push, NDR_OUT, r);
2404         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2405                 talloc_free(r);
2406                 return false;
2407         }
2408
2409         blob = ndr_push_blob(push);
2410         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2411                 talloc_free(r);
2412                 return false;
2413         }
2414
2415         talloc_free(r);
2416
2417         return true;
2418 }
2419
2420 static bool api_spoolss_DeleteForm(pipes_struct *p)
2421 {
2422         const struct ndr_interface_call *call;
2423         struct ndr_pull *pull;
2424         struct ndr_push *push;
2425         enum ndr_err_code ndr_err;
2426         DATA_BLOB blob;
2427         struct spoolss_DeleteForm *r;
2428
2429         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEFORM];
2430
2431         r = talloc(talloc_tos(), struct spoolss_DeleteForm);
2432         if (r == NULL) {
2433                 return false;
2434         }
2435
2436         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2437                 talloc_free(r);
2438                 return false;
2439         }
2440
2441         pull = ndr_pull_init_blob(&blob, r, NULL);
2442         if (pull == NULL) {
2443                 talloc_free(r);
2444                 return false;
2445         }
2446
2447         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2448         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2449         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2450                 talloc_free(r);
2451                 return false;
2452         }
2453
2454         if (DEBUGLEVEL >= 10) {
2455                 NDR_PRINT_IN_DEBUG(spoolss_DeleteForm, r);
2456         }
2457
2458         r->out.result = _spoolss_DeleteForm(p, r);
2459
2460         if (p->rng_fault_state) {
2461                 talloc_free(r);
2462                 /* Return true here, srv_pipe_hnd.c will take care */
2463                 return true;
2464         }
2465
2466         if (DEBUGLEVEL >= 10) {
2467                 NDR_PRINT_OUT_DEBUG(spoolss_DeleteForm, r);
2468         }
2469
2470         push = ndr_push_init_ctx(r, NULL);
2471         if (push == NULL) {
2472                 talloc_free(r);
2473                 return false;
2474         }
2475
2476         ndr_err = call->ndr_push(push, NDR_OUT, r);
2477         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2478                 talloc_free(r);
2479                 return false;
2480         }
2481
2482         blob = ndr_push_blob(push);
2483         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2484                 talloc_free(r);
2485                 return false;
2486         }
2487
2488         talloc_free(r);
2489
2490         return true;
2491 }
2492
2493 static bool api_spoolss_GetForm(pipes_struct *p)
2494 {
2495         const struct ndr_interface_call *call;
2496         struct ndr_pull *pull;
2497         struct ndr_push *push;
2498         enum ndr_err_code ndr_err;
2499         DATA_BLOB blob;
2500         struct spoolss_GetForm *r;
2501
2502         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETFORM];
2503
2504         r = talloc(talloc_tos(), struct spoolss_GetForm);
2505         if (r == NULL) {
2506                 return false;
2507         }
2508
2509         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2510                 talloc_free(r);
2511                 return false;
2512         }
2513
2514         pull = ndr_pull_init_blob(&blob, r, NULL);
2515         if (pull == NULL) {
2516                 talloc_free(r);
2517                 return false;
2518         }
2519
2520         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2521         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2522         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2523                 talloc_free(r);
2524                 return false;
2525         }
2526
2527         if (DEBUGLEVEL >= 10) {
2528                 NDR_PRINT_IN_DEBUG(spoolss_GetForm, r);
2529         }
2530
2531         ZERO_STRUCT(r->out);
2532         r->out.info = talloc_zero(r, union spoolss_FormInfo);
2533         if (r->out.info == NULL) {
2534                 talloc_free(r);
2535                 return false;
2536         }
2537
2538         r->out.needed = talloc_zero(r, uint32_t);
2539         if (r->out.needed == NULL) {
2540                 talloc_free(r);
2541                 return false;
2542         }
2543
2544         r->out.result = _spoolss_GetForm(p, r);
2545
2546         if (p->rng_fault_state) {
2547                 talloc_free(r);
2548                 /* Return true here, srv_pipe_hnd.c will take care */
2549                 return true;
2550         }
2551
2552         if (DEBUGLEVEL >= 10) {
2553                 NDR_PRINT_OUT_DEBUG(spoolss_GetForm, r);
2554         }
2555
2556         push = ndr_push_init_ctx(r, NULL);
2557         if (push == NULL) {
2558                 talloc_free(r);
2559                 return false;
2560         }
2561
2562         ndr_err = call->ndr_push(push, NDR_OUT, r);
2563         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2564                 talloc_free(r);
2565                 return false;
2566         }
2567
2568         blob = ndr_push_blob(push);
2569         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2570                 talloc_free(r);
2571                 return false;
2572         }
2573
2574         talloc_free(r);
2575
2576         return true;
2577 }
2578
2579 static bool api_spoolss_SetForm(pipes_struct *p)
2580 {
2581         const struct ndr_interface_call *call;
2582         struct ndr_pull *pull;
2583         struct ndr_push *push;
2584         enum ndr_err_code ndr_err;
2585         DATA_BLOB blob;
2586         struct spoolss_SetForm *r;
2587
2588         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETFORM];
2589
2590         r = talloc(talloc_tos(), struct spoolss_SetForm);
2591         if (r == NULL) {
2592                 return false;
2593         }
2594
2595         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2596                 talloc_free(r);
2597                 return false;
2598         }
2599
2600         pull = ndr_pull_init_blob(&blob, r, NULL);
2601         if (pull == NULL) {
2602                 talloc_free(r);
2603                 return false;
2604         }
2605
2606         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2607         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2608         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2609                 talloc_free(r);
2610                 return false;
2611         }
2612
2613         if (DEBUGLEVEL >= 10) {
2614                 NDR_PRINT_IN_DEBUG(spoolss_SetForm, r);
2615         }
2616
2617         r->out.result = _spoolss_SetForm(p, r);
2618
2619         if (p->rng_fault_state) {
2620                 talloc_free(r);
2621                 /* Return true here, srv_pipe_hnd.c will take care */
2622                 return true;
2623         }
2624
2625         if (DEBUGLEVEL >= 10) {
2626                 NDR_PRINT_OUT_DEBUG(spoolss_SetForm, r);
2627         }
2628
2629         push = ndr_push_init_ctx(r, NULL);
2630         if (push == NULL) {
2631                 talloc_free(r);
2632                 return false;
2633         }
2634
2635         ndr_err = call->ndr_push(push, NDR_OUT, r);
2636         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2637                 talloc_free(r);
2638                 return false;
2639         }
2640
2641         blob = ndr_push_blob(push);
2642         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2643                 talloc_free(r);
2644                 return false;
2645         }
2646
2647         talloc_free(r);
2648
2649         return true;
2650 }
2651
2652 static bool api_spoolss_EnumForms(pipes_struct *p)
2653 {
2654         const struct ndr_interface_call *call;
2655         struct ndr_pull *pull;
2656         struct ndr_push *push;
2657         enum ndr_err_code ndr_err;
2658         DATA_BLOB blob;
2659         struct spoolss_EnumForms *r;
2660
2661         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMFORMS];
2662
2663         r = talloc(talloc_tos(), struct spoolss_EnumForms);
2664         if (r == NULL) {
2665                 return false;
2666         }
2667
2668         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2669                 talloc_free(r);
2670                 return false;
2671         }
2672
2673         pull = ndr_pull_init_blob(&blob, r, NULL);
2674         if (pull == NULL) {
2675                 talloc_free(r);
2676                 return false;
2677         }
2678
2679         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2680         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2681         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2682                 talloc_free(r);
2683                 return false;
2684         }
2685
2686         if (DEBUGLEVEL >= 10) {
2687                 NDR_PRINT_IN_DEBUG(spoolss_EnumForms, r);
2688         }
2689
2690         ZERO_STRUCT(r->out);
2691         r->out.info = talloc_zero_array(r, union spoolss_FormInfo, r->out.count);
2692         if (r->out.info == NULL) {
2693                 talloc_free(r);
2694                 return false;
2695         }
2696
2697         r->out.needed = talloc_zero(r, uint32_t);
2698         if (r->out.needed == NULL) {
2699                 talloc_free(r);
2700                 return false;
2701         }
2702
2703         r->out.result = _spoolss_EnumForms(p, r);
2704
2705         if (p->rng_fault_state) {
2706                 talloc_free(r);
2707                 /* Return true here, srv_pipe_hnd.c will take care */
2708                 return true;
2709         }
2710
2711         if (DEBUGLEVEL >= 10) {
2712                 NDR_PRINT_OUT_DEBUG(spoolss_EnumForms, r);
2713         }
2714
2715         push = ndr_push_init_ctx(r, NULL);
2716         if (push == NULL) {
2717                 talloc_free(r);
2718                 return false;
2719         }
2720
2721         ndr_err = call->ndr_push(push, NDR_OUT, r);
2722         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2723                 talloc_free(r);
2724                 return false;
2725         }
2726
2727         blob = ndr_push_blob(push);
2728         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2729                 talloc_free(r);
2730                 return false;
2731         }
2732
2733         talloc_free(r);
2734
2735         return true;
2736 }
2737
2738 static bool api_spoolss_EnumPorts(pipes_struct *p)
2739 {
2740         const struct ndr_interface_call *call;
2741         struct ndr_pull *pull;
2742         struct ndr_push *push;
2743         enum ndr_err_code ndr_err;
2744         DATA_BLOB blob;
2745         struct spoolss_EnumPorts *r;
2746
2747         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPORTS];
2748
2749         r = talloc(talloc_tos(), struct spoolss_EnumPorts);
2750         if (r == NULL) {
2751                 return false;
2752         }
2753
2754         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2755                 talloc_free(r);
2756                 return false;
2757         }
2758
2759         pull = ndr_pull_init_blob(&blob, r, NULL);
2760         if (pull == NULL) {
2761                 talloc_free(r);
2762                 return false;
2763         }
2764
2765         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2766         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2767         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2768                 talloc_free(r);
2769                 return false;
2770         }
2771
2772         if (DEBUGLEVEL >= 10) {
2773                 NDR_PRINT_IN_DEBUG(spoolss_EnumPorts, r);
2774         }
2775
2776         ZERO_STRUCT(r->out);
2777         r->out.info = talloc_zero_array(r, union spoolss_PortInfo, r->out.count);
2778         if (r->out.info == NULL) {
2779                 talloc_free(r);
2780                 return false;
2781         }
2782
2783         r->out.needed = talloc_zero(r, uint32_t);
2784         if (r->out.needed == NULL) {
2785                 talloc_free(r);
2786                 return false;
2787         }
2788
2789         r->out.result = _spoolss_EnumPorts(p, r);
2790
2791         if (p->rng_fault_state) {
2792                 talloc_free(r);
2793                 /* Return true here, srv_pipe_hnd.c will take care */
2794                 return true;
2795         }
2796
2797         if (DEBUGLEVEL >= 10) {
2798                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPorts, r);
2799         }
2800
2801         push = ndr_push_init_ctx(r, NULL);
2802         if (push == NULL) {
2803                 talloc_free(r);
2804                 return false;
2805         }
2806
2807         ndr_err = call->ndr_push(push, NDR_OUT, r);
2808         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2809                 talloc_free(r);
2810                 return false;
2811         }
2812
2813         blob = ndr_push_blob(push);
2814         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2815                 talloc_free(r);
2816                 return false;
2817         }
2818
2819         talloc_free(r);
2820
2821         return true;
2822 }
2823
2824 static bool api_spoolss_EnumMonitors(pipes_struct *p)
2825 {
2826         const struct ndr_interface_call *call;
2827         struct ndr_pull *pull;
2828         struct ndr_push *push;
2829         enum ndr_err_code ndr_err;
2830         DATA_BLOB blob;
2831         struct spoolss_EnumMonitors *r;
2832
2833         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMMONITORS];
2834
2835         r = talloc(talloc_tos(), struct spoolss_EnumMonitors);
2836         if (r == NULL) {
2837                 return false;
2838         }
2839
2840         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2841                 talloc_free(r);
2842                 return false;
2843         }
2844
2845         pull = ndr_pull_init_blob(&blob, r, NULL);
2846         if (pull == NULL) {
2847                 talloc_free(r);
2848                 return false;
2849         }
2850
2851         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2852         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2853         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2854                 talloc_free(r);
2855                 return false;
2856         }
2857
2858         if (DEBUGLEVEL >= 10) {
2859                 NDR_PRINT_IN_DEBUG(spoolss_EnumMonitors, r);
2860         }
2861
2862         ZERO_STRUCT(r->out);
2863         r->out.info = talloc_zero_array(r, union spoolss_MonitorInfo, r->out.count);
2864         if (r->out.info == NULL) {
2865                 talloc_free(r);
2866                 return false;
2867         }
2868
2869         r->out.needed = talloc_zero(r, uint32_t);
2870         if (r->out.needed == NULL) {
2871                 talloc_free(r);
2872                 return false;
2873         }
2874
2875         r->out.result = _spoolss_EnumMonitors(p, r);
2876
2877         if (p->rng_fault_state) {
2878                 talloc_free(r);
2879                 /* Return true here, srv_pipe_hnd.c will take care */
2880                 return true;
2881         }
2882
2883         if (DEBUGLEVEL >= 10) {
2884                 NDR_PRINT_OUT_DEBUG(spoolss_EnumMonitors, r);
2885         }
2886
2887         push = ndr_push_init_ctx(r, NULL);
2888         if (push == NULL) {
2889                 talloc_free(r);
2890                 return false;
2891         }
2892
2893         ndr_err = call->ndr_push(push, NDR_OUT, r);
2894         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2895                 talloc_free(r);
2896                 return false;
2897         }
2898
2899         blob = ndr_push_blob(push);
2900         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2901                 talloc_free(r);
2902                 return false;
2903         }
2904
2905         talloc_free(r);
2906
2907         return true;
2908 }
2909
2910 static bool api_spoolss_AddPort(pipes_struct *p)
2911 {
2912         const struct ndr_interface_call *call;
2913         struct ndr_pull *pull;
2914         struct ndr_push *push;
2915         enum ndr_err_code ndr_err;
2916         DATA_BLOB blob;
2917         struct spoolss_AddPort *r;
2918
2919         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPORT];
2920
2921         r = talloc(talloc_tos(), struct spoolss_AddPort);
2922         if (r == NULL) {
2923                 return false;
2924         }
2925
2926         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2927                 talloc_free(r);
2928                 return false;
2929         }
2930
2931         pull = ndr_pull_init_blob(&blob, r, NULL);
2932         if (pull == NULL) {
2933                 talloc_free(r);
2934                 return false;
2935         }
2936
2937         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2938         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2939         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2940                 talloc_free(r);
2941                 return false;
2942         }
2943
2944         if (DEBUGLEVEL >= 10) {
2945                 NDR_PRINT_IN_DEBUG(spoolss_AddPort, r);
2946         }
2947
2948         r->out.result = _spoolss_AddPort(p, r);
2949
2950         if (p->rng_fault_state) {
2951                 talloc_free(r);
2952                 /* Return true here, srv_pipe_hnd.c will take care */
2953                 return true;
2954         }
2955
2956         if (DEBUGLEVEL >= 10) {
2957                 NDR_PRINT_OUT_DEBUG(spoolss_AddPort, r);
2958         }
2959
2960         push = ndr_push_init_ctx(r, NULL);
2961         if (push == NULL) {
2962                 talloc_free(r);
2963                 return false;
2964         }
2965
2966         ndr_err = call->ndr_push(push, NDR_OUT, r);
2967         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2968                 talloc_free(r);
2969                 return false;
2970         }
2971
2972         blob = ndr_push_blob(push);
2973         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2974                 talloc_free(r);
2975                 return false;
2976         }
2977
2978         talloc_free(r);
2979
2980         return true;
2981 }
2982
2983 static bool api_spoolss_ConfigurePort(pipes_struct *p)
2984 {
2985         const struct ndr_interface_call *call;
2986         struct ndr_pull *pull;
2987         struct ndr_push *push;
2988         enum ndr_err_code ndr_err;
2989         DATA_BLOB blob;
2990         struct spoolss_ConfigurePort *r;
2991
2992         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_CONFIGUREPORT];
2993
2994         r = talloc(talloc_tos(), struct spoolss_ConfigurePort);
2995         if (r == NULL) {
2996                 return false;
2997         }
2998
2999         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3000                 talloc_free(r);
3001                 return false;
3002         }
3003
3004         pull = ndr_pull_init_blob(&blob, r, NULL);
3005         if (pull == NULL) {
3006                 talloc_free(r);
3007                 return false;
3008         }
3009
3010         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3011         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3012         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3013                 talloc_free(r);
3014                 return false;
3015         }
3016
3017         if (DEBUGLEVEL >= 10) {
3018                 NDR_PRINT_IN_DEBUG(spoolss_ConfigurePort, r);
3019         }
3020
3021         r->out.result = _spoolss_ConfigurePort(p, r);
3022
3023         if (p->rng_fault_state) {
3024                 talloc_free(r);
3025                 /* Return true here, srv_pipe_hnd.c will take care */
3026                 return true;
3027         }
3028
3029         if (DEBUGLEVEL >= 10) {
3030                 NDR_PRINT_OUT_DEBUG(spoolss_ConfigurePort, r);
3031         }
3032
3033         push = ndr_push_init_ctx(r, NULL);
3034         if (push == NULL) {
3035                 talloc_free(r);
3036                 return false;
3037         }
3038
3039         ndr_err = call->ndr_push(push, NDR_OUT, r);
3040         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3041                 talloc_free(r);
3042                 return false;
3043         }
3044
3045         blob = ndr_push_blob(push);
3046         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3047                 talloc_free(r);
3048                 return false;
3049         }
3050
3051         talloc_free(r);
3052
3053         return true;
3054 }
3055
3056 static bool api_spoolss_DeletePort(pipes_struct *p)
3057 {
3058         const struct ndr_interface_call *call;
3059         struct ndr_pull *pull;
3060         struct ndr_push *push;
3061         enum ndr_err_code ndr_err;
3062         DATA_BLOB blob;
3063         struct spoolss_DeletePort *r;
3064
3065         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPORT];
3066
3067         r = talloc(talloc_tos(), struct spoolss_DeletePort);
3068         if (r == NULL) {
3069                 return false;
3070         }
3071
3072         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3073                 talloc_free(r);
3074                 return false;
3075         }
3076
3077         pull = ndr_pull_init_blob(&blob, r, NULL);
3078         if (pull == NULL) {
3079                 talloc_free(r);
3080                 return false;
3081         }
3082
3083         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3084         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3085         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3086                 talloc_free(r);
3087                 return false;
3088         }
3089
3090         if (DEBUGLEVEL >= 10) {
3091                 NDR_PRINT_IN_DEBUG(spoolss_DeletePort, r);
3092         }
3093
3094         r->out.result = _spoolss_DeletePort(p, r);
3095
3096         if (p->rng_fault_state) {
3097                 talloc_free(r);
3098                 /* Return true here, srv_pipe_hnd.c will take care */
3099                 return true;
3100         }
3101
3102         if (DEBUGLEVEL >= 10) {
3103                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePort, r);
3104         }
3105
3106         push = ndr_push_init_ctx(r, NULL);
3107         if (push == NULL) {
3108                 talloc_free(r);
3109                 return false;
3110         }
3111
3112         ndr_err = call->ndr_push(push, NDR_OUT, r);
3113         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3114                 talloc_free(r);
3115                 return false;
3116         }
3117
3118         blob = ndr_push_blob(push);
3119         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3120                 talloc_free(r);
3121                 return false;
3122         }
3123
3124         talloc_free(r);
3125
3126         return true;
3127 }
3128
3129 static bool api_spoolss_CreatePrinterIC(pipes_struct *p)
3130 {
3131         const struct ndr_interface_call *call;
3132         struct ndr_pull *pull;
3133         struct ndr_push *push;
3134         enum ndr_err_code ndr_err;
3135         DATA_BLOB blob;
3136         struct spoolss_CreatePrinterIC *r;
3137
3138         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_CREATEPRINTERIC];
3139
3140         r = talloc(talloc_tos(), struct spoolss_CreatePrinterIC);
3141         if (r == NULL) {
3142                 return false;
3143         }
3144
3145         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3146                 talloc_free(r);
3147                 return false;
3148         }
3149
3150         pull = ndr_pull_init_blob(&blob, r, NULL);
3151         if (pull == NULL) {
3152                 talloc_free(r);
3153                 return false;
3154         }
3155
3156         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3157         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3158         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3159                 talloc_free(r);
3160                 return false;
3161         }
3162
3163         if (DEBUGLEVEL >= 10) {
3164                 NDR_PRINT_IN_DEBUG(spoolss_CreatePrinterIC, r);
3165         }
3166
3167         r->out.result = _spoolss_CreatePrinterIC(p, r);
3168
3169         if (p->rng_fault_state) {
3170                 talloc_free(r);
3171                 /* Return true here, srv_pipe_hnd.c will take care */
3172                 return true;
3173         }
3174
3175         if (DEBUGLEVEL >= 10) {
3176                 NDR_PRINT_OUT_DEBUG(spoolss_CreatePrinterIC, r);
3177         }
3178
3179         push = ndr_push_init_ctx(r, NULL);
3180         if (push == NULL) {
3181                 talloc_free(r);
3182                 return false;
3183         }
3184
3185         ndr_err = call->ndr_push(push, NDR_OUT, r);
3186         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3187                 talloc_free(r);
3188                 return false;
3189         }
3190
3191         blob = ndr_push_blob(push);
3192         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3193                 talloc_free(r);
3194                 return false;
3195         }
3196
3197         talloc_free(r);
3198
3199         return true;
3200 }
3201
3202 static bool api_spoolss_PlayGDIScriptOnPrinterIC(pipes_struct *p)
3203 {
3204         const struct ndr_interface_call *call;
3205         struct ndr_pull *pull;
3206         struct ndr_push *push;
3207         enum ndr_err_code ndr_err;
3208         DATA_BLOB blob;
3209         struct spoolss_PlayGDIScriptOnPrinterIC *r;
3210
3211         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC];
3212
3213         r = talloc(talloc_tos(), struct spoolss_PlayGDIScriptOnPrinterIC);
3214         if (r == NULL) {
3215                 return false;
3216         }
3217
3218         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3219                 talloc_free(r);
3220                 return false;
3221         }
3222
3223         pull = ndr_pull_init_blob(&blob, r, NULL);
3224         if (pull == NULL) {
3225                 talloc_free(r);
3226                 return false;
3227         }
3228
3229         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3230         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3231         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3232                 talloc_free(r);
3233                 return false;
3234         }
3235
3236         if (DEBUGLEVEL >= 10) {
3237                 NDR_PRINT_IN_DEBUG(spoolss_PlayGDIScriptOnPrinterIC, r);
3238         }
3239
3240         r->out.result = _spoolss_PlayGDIScriptOnPrinterIC(p, r);
3241
3242         if (p->rng_fault_state) {
3243                 talloc_free(r);
3244                 /* Return true here, srv_pipe_hnd.c will take care */
3245                 return true;
3246         }
3247
3248         if (DEBUGLEVEL >= 10) {
3249                 NDR_PRINT_OUT_DEBUG(spoolss_PlayGDIScriptOnPrinterIC, r);
3250         }
3251
3252         push = ndr_push_init_ctx(r, NULL);
3253         if (push == NULL) {
3254                 talloc_free(r);
3255                 return false;
3256         }
3257
3258         ndr_err = call->ndr_push(push, NDR_OUT, r);
3259         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3260                 talloc_free(r);
3261                 return false;
3262         }
3263
3264         blob = ndr_push_blob(push);
3265         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3266                 talloc_free(r);
3267                 return false;
3268         }
3269
3270         talloc_free(r);
3271
3272         return true;
3273 }
3274
3275 static bool api_spoolss_DeletePrinterIC(pipes_struct *p)
3276 {
3277         const struct ndr_interface_call *call;
3278         struct ndr_pull *pull;
3279         struct ndr_push *push;
3280         enum ndr_err_code ndr_err;
3281         DATA_BLOB blob;
3282         struct spoolss_DeletePrinterIC *r;
3283
3284         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERIC];
3285
3286         r = talloc(talloc_tos(), struct spoolss_DeletePrinterIC);
3287         if (r == NULL) {
3288                 return false;
3289         }
3290
3291         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3292                 talloc_free(r);
3293                 return false;
3294         }
3295
3296         pull = ndr_pull_init_blob(&blob, r, NULL);
3297         if (pull == NULL) {
3298                 talloc_free(r);
3299                 return false;
3300         }
3301
3302         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3303         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3304         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3305                 talloc_free(r);
3306                 return false;
3307         }
3308
3309         if (DEBUGLEVEL >= 10) {
3310                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterIC, r);
3311         }
3312
3313         r->out.result = _spoolss_DeletePrinterIC(p, r);
3314
3315         if (p->rng_fault_state) {
3316                 talloc_free(r);
3317                 /* Return true here, srv_pipe_hnd.c will take care */
3318                 return true;
3319         }
3320
3321         if (DEBUGLEVEL >= 10) {
3322                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterIC, r);
3323         }
3324
3325         push = ndr_push_init_ctx(r, NULL);
3326         if (push == NULL) {
3327                 talloc_free(r);
3328                 return false;
3329         }
3330
3331         ndr_err = call->ndr_push(push, NDR_OUT, r);
3332         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3333                 talloc_free(r);
3334                 return false;
3335         }
3336
3337         blob = ndr_push_blob(push);
3338         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3339                 talloc_free(r);
3340                 return false;
3341         }
3342
3343         talloc_free(r);
3344
3345         return true;
3346 }
3347
3348 static bool api_spoolss_AddPrinterConnection(pipes_struct *p)
3349 {
3350         const struct ndr_interface_call *call;
3351         struct ndr_pull *pull;
3352         struct ndr_push *push;
3353         enum ndr_err_code ndr_err;
3354         DATA_BLOB blob;
3355         struct spoolss_AddPrinterConnection *r;
3356
3357         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTERCONNECTION];
3358
3359         r = talloc(talloc_tos(), struct spoolss_AddPrinterConnection);
3360         if (r == NULL) {
3361                 return false;
3362         }
3363
3364         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3365                 talloc_free(r);
3366                 return false;
3367         }
3368
3369         pull = ndr_pull_init_blob(&blob, r, NULL);
3370         if (pull == NULL) {
3371                 talloc_free(r);
3372                 return false;
3373         }
3374
3375         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3376         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3377         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3378                 talloc_free(r);
3379                 return false;
3380         }
3381
3382         if (DEBUGLEVEL >= 10) {
3383                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterConnection, r);
3384         }
3385
3386         r->out.result = _spoolss_AddPrinterConnection(p, r);
3387
3388         if (p->rng_fault_state) {
3389                 talloc_free(r);
3390                 /* Return true here, srv_pipe_hnd.c will take care */
3391                 return true;
3392         }
3393
3394         if (DEBUGLEVEL >= 10) {
3395                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterConnection, r);
3396         }
3397
3398         push = ndr_push_init_ctx(r, NULL);
3399         if (push == NULL) {
3400                 talloc_free(r);
3401                 return false;
3402         }
3403
3404         ndr_err = call->ndr_push(push, NDR_OUT, r);
3405         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3406                 talloc_free(r);
3407                 return false;
3408         }
3409
3410         blob = ndr_push_blob(push);
3411         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3412                 talloc_free(r);
3413                 return false;
3414         }
3415
3416         talloc_free(r);
3417
3418         return true;
3419 }
3420
3421 static bool api_spoolss_DeletePrinterConnection(pipes_struct *p)
3422 {
3423         const struct ndr_interface_call *call;
3424         struct ndr_pull *pull;
3425         struct ndr_push *push;
3426         enum ndr_err_code ndr_err;
3427         DATA_BLOB blob;
3428         struct spoolss_DeletePrinterConnection *r;
3429
3430         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERCONNECTION];
3431
3432         r = talloc(talloc_tos(), struct spoolss_DeletePrinterConnection);
3433         if (r == NULL) {
3434                 return false;
3435         }
3436
3437         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3438                 talloc_free(r);
3439                 return false;
3440         }
3441
3442         pull = ndr_pull_init_blob(&blob, r, NULL);
3443         if (pull == NULL) {
3444                 talloc_free(r);
3445                 return false;
3446         }
3447
3448         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3449         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3450         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3451                 talloc_free(r);
3452                 return false;
3453         }
3454
3455         if (DEBUGLEVEL >= 10) {
3456                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterConnection, r);
3457         }
3458
3459         r->out.result = _spoolss_DeletePrinterConnection(p, r);
3460
3461         if (p->rng_fault_state) {
3462                 talloc_free(r);
3463                 /* Return true here, srv_pipe_hnd.c will take care */
3464                 return true;
3465         }
3466
3467         if (DEBUGLEVEL >= 10) {
3468                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterConnection, r);
3469         }
3470
3471         push = ndr_push_init_ctx(r, NULL);
3472         if (push == NULL) {
3473                 talloc_free(r);
3474                 return false;
3475         }
3476
3477         ndr_err = call->ndr_push(push, NDR_OUT, r);
3478         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3479                 talloc_free(r);
3480                 return false;
3481         }
3482
3483         blob = ndr_push_blob(push);
3484         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3485                 talloc_free(r);
3486                 return false;
3487         }
3488
3489         talloc_free(r);
3490
3491         return true;
3492 }
3493
3494 static bool api_spoolss_PrinterMessageBox(pipes_struct *p)
3495 {
3496         const struct ndr_interface_call *call;
3497         struct ndr_pull *pull;
3498         struct ndr_push *push;
3499         enum ndr_err_code ndr_err;
3500         DATA_BLOB blob;
3501         struct spoolss_PrinterMessageBox *r;
3502
3503         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_PRINTERMESSAGEBOX];
3504
3505         r = talloc(talloc_tos(), struct spoolss_PrinterMessageBox);
3506         if (r == NULL) {
3507                 return false;
3508         }
3509
3510         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3511                 talloc_free(r);
3512                 return false;
3513         }
3514
3515         pull = ndr_pull_init_blob(&blob, r, NULL);
3516         if (pull == NULL) {
3517                 talloc_free(r);
3518                 return false;
3519         }
3520
3521         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3522         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3523         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3524                 talloc_free(r);
3525                 return false;
3526         }
3527
3528         if (DEBUGLEVEL >= 10) {
3529                 NDR_PRINT_IN_DEBUG(spoolss_PrinterMessageBox, r);
3530         }
3531
3532         r->out.result = _spoolss_PrinterMessageBox(p, r);
3533
3534         if (p->rng_fault_state) {
3535                 talloc_free(r);
3536                 /* Return true here, srv_pipe_hnd.c will take care */
3537                 return true;
3538         }
3539
3540         if (DEBUGLEVEL >= 10) {
3541                 NDR_PRINT_OUT_DEBUG(spoolss_PrinterMessageBox, r);
3542         }
3543
3544         push = ndr_push_init_ctx(r, NULL);
3545         if (push == NULL) {
3546                 talloc_free(r);
3547                 return false;
3548         }
3549
3550         ndr_err = call->ndr_push(push, NDR_OUT, r);
3551         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3552                 talloc_free(r);
3553                 return false;
3554         }
3555
3556         blob = ndr_push_blob(push);
3557         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3558                 talloc_free(r);
3559                 return false;
3560         }
3561
3562         talloc_free(r);
3563
3564         return true;
3565 }
3566
3567 static bool api_spoolss_AddMonitor(pipes_struct *p)
3568 {
3569         const struct ndr_interface_call *call;
3570         struct ndr_pull *pull;
3571         struct ndr_push *push;
3572         enum ndr_err_code ndr_err;
3573         DATA_BLOB blob;
3574         struct spoolss_AddMonitor *r;
3575
3576         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDMONITOR];
3577
3578         r = talloc(talloc_tos(), struct spoolss_AddMonitor);
3579         if (r == NULL) {
3580                 return false;
3581         }
3582
3583         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3584                 talloc_free(r);
3585                 return false;
3586         }
3587
3588         pull = ndr_pull_init_blob(&blob, r, NULL);
3589         if (pull == NULL) {
3590                 talloc_free(r);
3591                 return false;
3592         }
3593
3594         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3595         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3596         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3597                 talloc_free(r);
3598                 return false;
3599         }
3600
3601         if (DEBUGLEVEL >= 10) {
3602                 NDR_PRINT_IN_DEBUG(spoolss_AddMonitor, r);
3603         }
3604
3605         r->out.result = _spoolss_AddMonitor(p, r);
3606
3607         if (p->rng_fault_state) {
3608                 talloc_free(r);
3609                 /* Return true here, srv_pipe_hnd.c will take care */
3610                 return true;
3611         }
3612
3613         if (DEBUGLEVEL >= 10) {
3614                 NDR_PRINT_OUT_DEBUG(spoolss_AddMonitor, r);
3615         }
3616
3617         push = ndr_push_init_ctx(r, NULL);
3618         if (push == NULL) {
3619                 talloc_free(r);
3620                 return false;
3621         }
3622
3623         ndr_err = call->ndr_push(push, NDR_OUT, r);
3624         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3625                 talloc_free(r);
3626                 return false;
3627         }
3628
3629         blob = ndr_push_blob(push);
3630         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3631                 talloc_free(r);
3632                 return false;
3633         }
3634
3635         talloc_free(r);
3636
3637         return true;
3638 }
3639
3640 static bool api_spoolss_DeleteMonitor(pipes_struct *p)
3641 {
3642         const struct ndr_interface_call *call;
3643         struct ndr_pull *pull;
3644         struct ndr_push *push;
3645         enum ndr_err_code ndr_err;
3646         DATA_BLOB blob;
3647         struct spoolss_DeleteMonitor *r;
3648
3649         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEMONITOR];
3650
3651         r = talloc(talloc_tos(), struct spoolss_DeleteMonitor);
3652         if (r == NULL) {
3653                 return false;
3654         }
3655
3656         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3657                 talloc_free(r);
3658                 return false;
3659         }
3660
3661         pull = ndr_pull_init_blob(&blob, r, NULL);
3662         if (pull == NULL) {
3663                 talloc_free(r);
3664                 return false;
3665         }
3666
3667         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3668         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3669         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3670                 talloc_free(r);
3671                 return false;
3672         }
3673
3674         if (DEBUGLEVEL >= 10) {
3675                 NDR_PRINT_IN_DEBUG(spoolss_DeleteMonitor, r);
3676         }
3677
3678         r->out.result = _spoolss_DeleteMonitor(p, r);
3679
3680         if (p->rng_fault_state) {
3681                 talloc_free(r);
3682                 /* Return true here, srv_pipe_hnd.c will take care */
3683                 return true;
3684         }
3685
3686         if (DEBUGLEVEL >= 10) {
3687                 NDR_PRINT_OUT_DEBUG(spoolss_DeleteMonitor, r);
3688         }
3689
3690         push = ndr_push_init_ctx(r, NULL);
3691         if (push == NULL) {
3692                 talloc_free(r);
3693                 return false;
3694         }
3695
3696         ndr_err = call->ndr_push(push, NDR_OUT, r);
3697         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3698                 talloc_free(r);
3699                 return false;
3700         }
3701
3702         blob = ndr_push_blob(push);
3703         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3704                 talloc_free(r);
3705                 return false;
3706         }
3707
3708         talloc_free(r);
3709
3710         return true;
3711 }
3712
3713 static bool api_spoolss_DeletePrintProcessor(pipes_struct *p)
3714 {
3715         const struct ndr_interface_call *call;
3716         struct ndr_pull *pull;
3717         struct ndr_push *push;
3718         enum ndr_err_code ndr_err;
3719         DATA_BLOB blob;
3720         struct spoolss_DeletePrintProcessor *r;
3721
3722         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTPROCESSOR];
3723
3724         r = talloc(talloc_tos(), struct spoolss_DeletePrintProcessor);
3725         if (r == NULL) {
3726                 return false;
3727         }
3728
3729         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3730                 talloc_free(r);
3731                 return false;
3732         }
3733
3734         pull = ndr_pull_init_blob(&blob, r, NULL);
3735         if (pull == NULL) {
3736                 talloc_free(r);
3737                 return false;
3738         }
3739
3740         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3741         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3742         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3743                 talloc_free(r);
3744                 return false;
3745         }
3746
3747         if (DEBUGLEVEL >= 10) {
3748                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrintProcessor, r);
3749         }
3750
3751         r->out.result = _spoolss_DeletePrintProcessor(p, r);
3752
3753         if (p->rng_fault_state) {
3754                 talloc_free(r);
3755                 /* Return true here, srv_pipe_hnd.c will take care */
3756                 return true;
3757         }
3758
3759         if (DEBUGLEVEL >= 10) {
3760                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrintProcessor, r);
3761         }
3762
3763         push = ndr_push_init_ctx(r, NULL);
3764         if (push == NULL) {
3765                 talloc_free(r);
3766                 return false;
3767         }
3768
3769         ndr_err = call->ndr_push(push, NDR_OUT, r);
3770         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3771                 talloc_free(r);
3772                 return false;
3773         }
3774
3775         blob = ndr_push_blob(push);
3776         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3777                 talloc_free(r);
3778                 return false;
3779         }
3780
3781         talloc_free(r);
3782
3783         return true;
3784 }
3785
3786 static bool api_spoolss_AddPrintProvidor(pipes_struct *p)
3787 {
3788         const struct ndr_interface_call *call;
3789         struct ndr_pull *pull;
3790         struct ndr_push *push;
3791         enum ndr_err_code ndr_err;
3792         DATA_BLOB blob;
3793         struct spoolss_AddPrintProvidor *r;
3794
3795         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTPROVIDOR];
3796
3797         r = talloc(talloc_tos(), struct spoolss_AddPrintProvidor);
3798         if (r == NULL) {
3799                 return false;
3800         }
3801
3802         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3803                 talloc_free(r);
3804                 return false;
3805         }
3806
3807         pull = ndr_pull_init_blob(&blob, r, NULL);
3808         if (pull == NULL) {
3809                 talloc_free(r);
3810                 return false;
3811         }
3812
3813         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3814         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3815         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3816                 talloc_free(r);
3817                 return false;
3818         }
3819
3820         if (DEBUGLEVEL >= 10) {
3821                 NDR_PRINT_IN_DEBUG(spoolss_AddPrintProvidor, r);
3822         }
3823
3824         r->out.result = _spoolss_AddPrintProvidor(p, r);
3825
3826         if (p->rng_fault_state) {
3827                 talloc_free(r);
3828                 /* Return true here, srv_pipe_hnd.c will take care */
3829                 return true;
3830         }
3831
3832         if (DEBUGLEVEL >= 10) {
3833                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrintProvidor, r);
3834         }
3835
3836         push = ndr_push_init_ctx(r, NULL);
3837         if (push == NULL) {
3838                 talloc_free(r);
3839                 return false;
3840         }
3841
3842         ndr_err = call->ndr_push(push, NDR_OUT, r);
3843         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3844                 talloc_free(r);
3845                 return false;
3846         }
3847
3848         blob = ndr_push_blob(push);
3849         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3850                 talloc_free(r);
3851                 return false;
3852         }
3853
3854         talloc_free(r);
3855
3856         return true;
3857 }
3858
3859 static bool api_spoolss_DeletePrintProvidor(pipes_struct *p)
3860 {
3861         const struct ndr_interface_call *call;
3862         struct ndr_pull *pull;
3863         struct ndr_push *push;
3864         enum ndr_err_code ndr_err;
3865         DATA_BLOB blob;
3866         struct spoolss_DeletePrintProvidor *r;
3867
3868         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTPROVIDOR];
3869
3870         r = talloc(talloc_tos(), struct spoolss_DeletePrintProvidor);
3871         if (r == NULL) {
3872                 return false;
3873         }
3874
3875         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3876                 talloc_free(r);
3877                 return false;
3878         }
3879
3880         pull = ndr_pull_init_blob(&blob, r, NULL);
3881         if (pull == NULL) {
3882                 talloc_free(r);
3883                 return false;
3884         }
3885
3886         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3887         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3888         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3889                 talloc_free(r);
3890                 return false;
3891         }
3892
3893         if (DEBUGLEVEL >= 10) {
3894                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrintProvidor, r);
3895         }
3896
3897         r->out.result = _spoolss_DeletePrintProvidor(p, r);
3898
3899         if (p->rng_fault_state) {
3900                 talloc_free(r);
3901                 /* Return true here, srv_pipe_hnd.c will take care */
3902                 return true;
3903         }
3904
3905         if (DEBUGLEVEL >= 10) {
3906                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrintProvidor, r);
3907         }
3908
3909         push = ndr_push_init_ctx(r, NULL);
3910         if (push == NULL) {
3911                 talloc_free(r);
3912                 return false;
3913         }
3914
3915         ndr_err = call->ndr_push(push, NDR_OUT, r);
3916         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3917                 talloc_free(r);
3918                 return false;
3919         }
3920
3921         blob = ndr_push_blob(push);
3922         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3923                 talloc_free(r);
3924                 return false;
3925         }
3926
3927         talloc_free(r);
3928
3929         return true;
3930 }
3931
3932 static bool api_spoolss_EnumPrintProcDataTypes(pipes_struct *p)
3933 {
3934         const struct ndr_interface_call *call;
3935         struct ndr_pull *pull;
3936         struct ndr_push *push;
3937         enum ndr_err_code ndr_err;
3938         DATA_BLOB blob;
3939         struct spoolss_EnumPrintProcDataTypes *r;
3940
3941         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTPROCDATATYPES];
3942
3943         r = talloc(talloc_tos(), struct spoolss_EnumPrintProcDataTypes);
3944         if (r == NULL) {
3945                 return false;
3946         }
3947
3948         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3949                 talloc_free(r);
3950                 return false;
3951         }
3952
3953         pull = ndr_pull_init_blob(&blob, r, NULL);
3954         if (pull == NULL) {
3955                 talloc_free(r);
3956                 return false;
3957         }
3958
3959         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3960         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3961         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3962                 talloc_free(r);
3963                 return false;
3964         }
3965
3966         if (DEBUGLEVEL >= 10) {
3967                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrintProcDataTypes, r);
3968         }
3969
3970         r->out.result = _spoolss_EnumPrintProcDataTypes(p, r);
3971
3972         if (p->rng_fault_state) {
3973                 talloc_free(r);
3974                 /* Return true here, srv_pipe_hnd.c will take care */
3975                 return true;
3976         }
3977
3978         if (DEBUGLEVEL >= 10) {
3979                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrintProcDataTypes, r);
3980         }
3981
3982         push = ndr_push_init_ctx(r, NULL);
3983         if (push == NULL) {
3984                 talloc_free(r);
3985                 return false;
3986         }
3987
3988         ndr_err = call->ndr_push(push, NDR_OUT, r);
3989         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3990                 talloc_free(r);
3991                 return false;
3992         }
3993
3994         blob = ndr_push_blob(push);
3995         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3996                 talloc_free(r);
3997                 return false;
3998         }
3999
4000         talloc_free(r);
4001
4002         return true;
4003 }
4004
4005 static bool api_spoolss_ResetPrinter(pipes_struct *p)
4006 {
4007         const struct ndr_interface_call *call;
4008         struct ndr_pull *pull;
4009         struct ndr_push *push;
4010         enum ndr_err_code ndr_err;
4011         DATA_BLOB blob;
4012         struct spoolss_ResetPrinter *r;
4013
4014         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_RESETPRINTER];
4015
4016         r = talloc(talloc_tos(), struct spoolss_ResetPrinter);
4017         if (r == NULL) {
4018                 return false;
4019         }
4020
4021         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4022                 talloc_free(r);
4023                 return false;
4024         }
4025
4026         pull = ndr_pull_init_blob(&blob, r, NULL);
4027         if (pull == NULL) {
4028                 talloc_free(r);
4029                 return false;
4030         }
4031
4032         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4033         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4034         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4035                 talloc_free(r);
4036                 return false;
4037         }
4038
4039         if (DEBUGLEVEL >= 10) {
4040                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinter, r);
4041         }
4042
4043         r->out.result = _spoolss_ResetPrinter(p, r);
4044
4045         if (p->rng_fault_state) {
4046                 talloc_free(r);
4047                 /* Return true here, srv_pipe_hnd.c will take care */
4048                 return true;
4049         }
4050
4051         if (DEBUGLEVEL >= 10) {
4052                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinter, r);
4053         }
4054
4055         push = ndr_push_init_ctx(r, NULL);
4056         if (push == NULL) {
4057                 talloc_free(r);
4058                 return false;
4059         }
4060
4061         ndr_err = call->ndr_push(push, NDR_OUT, r);
4062         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4063                 talloc_free(r);
4064                 return false;
4065         }
4066
4067         blob = ndr_push_blob(push);
4068         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4069                 talloc_free(r);
4070                 return false;
4071         }
4072
4073         talloc_free(r);
4074
4075         return true;
4076 }
4077
4078 static bool api_spoolss_GetPrinterDriver2(pipes_struct *p)
4079 {
4080         const struct ndr_interface_call *call;
4081         struct ndr_pull *pull;
4082         struct ndr_push *push;
4083         enum ndr_err_code ndr_err;
4084         DATA_BLOB blob;
4085         struct spoolss_GetPrinterDriver2 *r;
4086
4087         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDRIVER2];
4088
4089         r = talloc(talloc_tos(), struct spoolss_GetPrinterDriver2);
4090         if (r == NULL) {
4091                 return false;
4092         }
4093
4094         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4095                 talloc_free(r);
4096                 return false;
4097         }
4098
4099         pull = ndr_pull_init_blob(&blob, r, NULL);
4100         if (pull == NULL) {
4101                 talloc_free(r);
4102                 return false;
4103         }
4104
4105         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4106         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4107         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4108                 talloc_free(r);
4109                 return false;
4110         }
4111
4112         if (DEBUGLEVEL >= 10) {
4113                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriver2, r);
4114         }
4115
4116         ZERO_STRUCT(r->out);
4117         r->out.info = talloc_zero(r, DATA_BLOB);
4118         if (r->out.info == NULL) {
4119                 talloc_free(r);
4120                 return false;
4121         }
4122
4123         r->out.needed = talloc_zero(r, uint32_t);
4124         if (r->out.needed == NULL) {
4125                 talloc_free(r);
4126                 return false;
4127         }
4128
4129         r->out.server_major_version = talloc_zero(r, uint32_t);
4130         if (r->out.server_major_version == NULL) {
4131                 talloc_free(r);
4132                 return false;
4133         }
4134
4135         r->out.server_minor_version = talloc_zero(r, uint32_t);
4136         if (r->out.server_minor_version == NULL) {
4137                 talloc_free(r);
4138                 return false;
4139         }
4140
4141         r->out.result = _spoolss_GetPrinterDriver2(p, r);
4142
4143         if (p->rng_fault_state) {
4144                 talloc_free(r);
4145                 /* Return true here, srv_pipe_hnd.c will take care */
4146                 return true;
4147         }
4148
4149         if (DEBUGLEVEL >= 10) {
4150                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriver2, r);
4151         }
4152
4153         push = ndr_push_init_ctx(r, NULL);
4154         if (push == NULL) {
4155                 talloc_free(r);
4156                 return false;
4157         }
4158
4159         ndr_err = call->ndr_push(push, NDR_OUT, r);
4160         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4161                 talloc_free(r);
4162                 return false;
4163         }
4164
4165         blob = ndr_push_blob(push);
4166         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4167                 talloc_free(r);
4168                 return false;
4169         }
4170
4171         talloc_free(r);
4172
4173         return true;
4174 }
4175
4176 static bool api_spoolss_FindFirstPrinterChangeNotification(pipes_struct *p)
4177 {
4178         const struct ndr_interface_call *call;
4179         struct ndr_pull *pull;
4180         struct ndr_push *push;
4181         enum ndr_err_code ndr_err;
4182         DATA_BLOB blob;
4183         struct spoolss_FindFirstPrinterChangeNotification *r;
4184
4185         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION];
4186
4187         r = talloc(talloc_tos(), struct spoolss_FindFirstPrinterChangeNotification);
4188         if (r == NULL) {
4189                 return false;
4190         }
4191
4192         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4193                 talloc_free(r);
4194                 return false;
4195         }
4196
4197         pull = ndr_pull_init_blob(&blob, r, NULL);
4198         if (pull == NULL) {
4199                 talloc_free(r);
4200                 return false;
4201         }
4202
4203         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4204         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4205         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4206                 talloc_free(r);
4207                 return false;
4208         }
4209
4210         if (DEBUGLEVEL >= 10) {
4211                 NDR_PRINT_IN_DEBUG(spoolss_FindFirstPrinterChangeNotification, r);
4212         }
4213
4214         r->out.result = _spoolss_FindFirstPrinterChangeNotification(p, r);
4215
4216         if (p->rng_fault_state) {
4217                 talloc_free(r);
4218                 /* Return true here, srv_pipe_hnd.c will take care */
4219                 return true;
4220         }
4221
4222         if (DEBUGLEVEL >= 10) {
4223                 NDR_PRINT_OUT_DEBUG(spoolss_FindFirstPrinterChangeNotification, r);
4224         }
4225
4226         push = ndr_push_init_ctx(r, NULL);
4227         if (push == NULL) {
4228                 talloc_free(r);
4229                 return false;
4230         }
4231
4232         ndr_err = call->ndr_push(push, NDR_OUT, r);
4233         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4234                 talloc_free(r);
4235                 return false;
4236         }
4237
4238         blob = ndr_push_blob(push);
4239         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4240                 talloc_free(r);
4241                 return false;
4242         }
4243
4244         talloc_free(r);
4245
4246         return true;
4247 }
4248
4249 static bool api_spoolss_FindNextPrinterChangeNotification(pipes_struct *p)
4250 {
4251         const struct ndr_interface_call *call;
4252         struct ndr_pull *pull;
4253         struct ndr_push *push;
4254         enum ndr_err_code ndr_err;
4255         DATA_BLOB blob;
4256         struct spoolss_FindNextPrinterChangeNotification *r;
4257
4258         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION];
4259
4260         r = talloc(talloc_tos(), struct spoolss_FindNextPrinterChangeNotification);
4261         if (r == NULL) {
4262                 return false;
4263         }
4264
4265         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4266                 talloc_free(r);
4267                 return false;
4268         }
4269
4270         pull = ndr_pull_init_blob(&blob, r, NULL);
4271         if (pull == NULL) {
4272                 talloc_free(r);
4273                 return false;
4274         }
4275
4276         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4277         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4278         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4279                 talloc_free(r);
4280                 return false;
4281         }
4282
4283         if (DEBUGLEVEL >= 10) {
4284                 NDR_PRINT_IN_DEBUG(spoolss_FindNextPrinterChangeNotification, r);
4285         }
4286
4287         r->out.result = _spoolss_FindNextPrinterChangeNotification(p, r);
4288
4289         if (p->rng_fault_state) {
4290                 talloc_free(r);
4291                 /* Return true here, srv_pipe_hnd.c will take care */
4292                 return true;
4293         }
4294
4295         if (DEBUGLEVEL >= 10) {
4296                 NDR_PRINT_OUT_DEBUG(spoolss_FindNextPrinterChangeNotification, r);
4297         }
4298
4299         push = ndr_push_init_ctx(r, NULL);
4300         if (push == NULL) {
4301                 talloc_free(r);
4302                 return false;
4303         }
4304
4305         ndr_err = call->ndr_push(push, NDR_OUT, r);
4306         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4307                 talloc_free(r);
4308                 return false;
4309         }
4310
4311         blob = ndr_push_blob(push);
4312         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4313                 talloc_free(r);
4314                 return false;
4315         }
4316
4317         talloc_free(r);
4318
4319         return true;
4320 }
4321
4322 static bool api_spoolss_FindClosePrinterNotify(pipes_struct *p)
4323 {
4324         const struct ndr_interface_call *call;
4325         struct ndr_pull *pull;
4326         struct ndr_push *push;
4327         enum ndr_err_code ndr_err;
4328         DATA_BLOB blob;
4329         struct spoolss_FindClosePrinterNotify *r;
4330
4331         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY];
4332
4333         r = talloc(talloc_tos(), struct spoolss_FindClosePrinterNotify);
4334         if (r == NULL) {
4335                 return false;
4336         }
4337
4338         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4339                 talloc_free(r);
4340                 return false;
4341         }
4342
4343         pull = ndr_pull_init_blob(&blob, r, NULL);
4344         if (pull == NULL) {
4345                 talloc_free(r);
4346                 return false;
4347         }
4348
4349         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4350         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4351         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4352                 talloc_free(r);
4353                 return false;
4354         }
4355
4356         if (DEBUGLEVEL >= 10) {
4357                 NDR_PRINT_IN_DEBUG(spoolss_FindClosePrinterNotify, r);
4358         }
4359
4360         r->out.result = _spoolss_FindClosePrinterNotify(p, r);
4361
4362         if (p->rng_fault_state) {
4363                 talloc_free(r);
4364                 /* Return true here, srv_pipe_hnd.c will take care */
4365                 return true;
4366         }
4367
4368         if (DEBUGLEVEL >= 10) {
4369                 NDR_PRINT_OUT_DEBUG(spoolss_FindClosePrinterNotify, r);
4370         }
4371
4372         push = ndr_push_init_ctx(r, NULL);
4373         if (push == NULL) {
4374                 talloc_free(r);
4375                 return false;
4376         }
4377
4378         ndr_err = call->ndr_push(push, NDR_OUT, r);
4379         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4380                 talloc_free(r);
4381                 return false;
4382         }
4383
4384         blob = ndr_push_blob(push);
4385         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4386                 talloc_free(r);
4387                 return false;
4388         }
4389
4390         talloc_free(r);
4391
4392         return true;
4393 }
4394
4395 static bool api_spoolss_RouterFindFirstPrinterChangeNotificationOld(pipes_struct *p)
4396 {
4397         const struct ndr_interface_call *call;
4398         struct ndr_pull *pull;
4399         struct ndr_push *push;
4400         enum ndr_err_code ndr_err;
4401         DATA_BLOB blob;
4402         struct spoolss_RouterFindFirstPrinterChangeNotificationOld *r;
4403
4404         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD];
4405
4406         r = talloc(talloc_tos(), struct spoolss_RouterFindFirstPrinterChangeNotificationOld);
4407         if (r == NULL) {
4408                 return false;
4409         }
4410
4411         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4412                 talloc_free(r);
4413                 return false;
4414         }
4415
4416         pull = ndr_pull_init_blob(&blob, r, NULL);
4417         if (pull == NULL) {
4418                 talloc_free(r);
4419                 return false;
4420         }
4421
4422         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4423         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4424         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4425                 talloc_free(r);
4426                 return false;
4427         }
4428
4429         if (DEBUGLEVEL >= 10) {
4430                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, r);
4431         }
4432
4433         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotificationOld(p, r);
4434
4435         if (p->rng_fault_state) {
4436                 talloc_free(r);
4437                 /* Return true here, srv_pipe_hnd.c will take care */
4438                 return true;
4439         }
4440
4441         if (DEBUGLEVEL >= 10) {
4442                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, r);
4443         }
4444
4445         push = ndr_push_init_ctx(r, NULL);
4446         if (push == NULL) {
4447                 talloc_free(r);
4448                 return false;
4449         }
4450
4451         ndr_err = call->ndr_push(push, NDR_OUT, r);
4452         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4453                 talloc_free(r);
4454                 return false;
4455         }
4456
4457         blob = ndr_push_blob(push);
4458         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4459                 talloc_free(r);
4460                 return false;
4461         }
4462
4463         talloc_free(r);
4464
4465         return true;
4466 }
4467
4468 static bool api_spoolss_ReplyOpenPrinter(pipes_struct *p)
4469 {
4470         const struct ndr_interface_call *call;
4471         struct ndr_pull *pull;
4472         struct ndr_push *push;
4473         enum ndr_err_code ndr_err;
4474         DATA_BLOB blob;
4475         struct spoolss_ReplyOpenPrinter *r;
4476
4477         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REPLYOPENPRINTER];
4478
4479         r = talloc(talloc_tos(), struct spoolss_ReplyOpenPrinter);
4480         if (r == NULL) {
4481                 return false;
4482         }
4483
4484         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4485                 talloc_free(r);
4486                 return false;
4487         }
4488
4489         pull = ndr_pull_init_blob(&blob, r, NULL);
4490         if (pull == NULL) {
4491                 talloc_free(r);
4492                 return false;
4493         }
4494
4495         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4496         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4497         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4498                 talloc_free(r);
4499                 return false;
4500         }
4501
4502         if (DEBUGLEVEL >= 10) {
4503                 NDR_PRINT_IN_DEBUG(spoolss_ReplyOpenPrinter, r);
4504         }
4505
4506         ZERO_STRUCT(r->out);
4507         r->out.handle = talloc_zero(r, struct policy_handle);
4508         if (r->out.handle == NULL) {
4509                 talloc_free(r);
4510                 return false;
4511         }
4512
4513         r->out.result = _spoolss_ReplyOpenPrinter(p, r);
4514
4515         if (p->rng_fault_state) {
4516                 talloc_free(r);
4517                 /* Return true here, srv_pipe_hnd.c will take care */
4518                 return true;
4519         }
4520
4521         if (DEBUGLEVEL >= 10) {
4522                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyOpenPrinter, r);
4523         }
4524
4525         push = ndr_push_init_ctx(r, NULL);
4526         if (push == NULL) {
4527                 talloc_free(r);
4528                 return false;
4529         }
4530
4531         ndr_err = call->ndr_push(push, NDR_OUT, r);
4532         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4533                 talloc_free(r);
4534                 return false;
4535         }
4536
4537         blob = ndr_push_blob(push);
4538         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4539                 talloc_free(r);
4540                 return false;
4541         }
4542
4543         talloc_free(r);
4544
4545         return true;
4546 }
4547
4548 static bool api_spoolss_RouterReplyPrinter(pipes_struct *p)
4549 {
4550         const struct ndr_interface_call *call;
4551         struct ndr_pull *pull;
4552         struct ndr_push *push;
4553         enum ndr_err_code ndr_err;
4554         DATA_BLOB blob;
4555         struct spoolss_RouterReplyPrinter *r;
4556
4557         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREPLYPRINTER];
4558
4559         r = talloc(talloc_tos(), struct spoolss_RouterReplyPrinter);
4560         if (r == NULL) {
4561                 return false;
4562         }
4563
4564         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4565                 talloc_free(r);
4566                 return false;
4567         }
4568
4569         pull = ndr_pull_init_blob(&blob, r, NULL);
4570         if (pull == NULL) {
4571                 talloc_free(r);
4572                 return false;
4573         }
4574
4575         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4576         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4577         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4578                 talloc_free(r);
4579                 return false;
4580         }
4581
4582         if (DEBUGLEVEL >= 10) {
4583                 NDR_PRINT_IN_DEBUG(spoolss_RouterReplyPrinter, r);
4584         }
4585
4586         r->out.result = _spoolss_RouterReplyPrinter(p, r);
4587
4588         if (p->rng_fault_state) {
4589                 talloc_free(r);
4590                 /* Return true here, srv_pipe_hnd.c will take care */
4591                 return true;
4592         }
4593
4594         if (DEBUGLEVEL >= 10) {
4595                 NDR_PRINT_OUT_DEBUG(spoolss_RouterReplyPrinter, r);
4596         }
4597
4598         push = ndr_push_init_ctx(r, NULL);
4599         if (push == NULL) {
4600                 talloc_free(r);
4601                 return false;
4602         }
4603
4604         ndr_err = call->ndr_push(push, NDR_OUT, r);
4605         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4606                 talloc_free(r);
4607                 return false;
4608         }
4609
4610         blob = ndr_push_blob(push);
4611         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4612                 talloc_free(r);
4613                 return false;
4614         }
4615
4616         talloc_free(r);
4617
4618         return true;
4619 }
4620
4621 static bool api_spoolss_ReplyClosePrinter(pipes_struct *p)
4622 {
4623         const struct ndr_interface_call *call;
4624         struct ndr_pull *pull;
4625         struct ndr_push *push;
4626         enum ndr_err_code ndr_err;
4627         DATA_BLOB blob;
4628         struct spoolss_ReplyClosePrinter *r;
4629
4630         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REPLYCLOSEPRINTER];
4631
4632         r = talloc(talloc_tos(), struct spoolss_ReplyClosePrinter);
4633         if (r == NULL) {
4634                 return false;
4635         }
4636
4637         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4638                 talloc_free(r);
4639                 return false;
4640         }
4641
4642         pull = ndr_pull_init_blob(&blob, r, NULL);
4643         if (pull == NULL) {
4644                 talloc_free(r);
4645                 return false;
4646         }
4647
4648         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4649         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4650         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4651                 talloc_free(r);
4652                 return false;
4653         }
4654
4655         if (DEBUGLEVEL >= 10) {
4656                 NDR_PRINT_IN_DEBUG(spoolss_ReplyClosePrinter, r);
4657         }
4658
4659         ZERO_STRUCT(r->out);
4660         r->out.handle = r->in.handle;
4661         r->out.result = _spoolss_ReplyClosePrinter(p, r);
4662
4663         if (p->rng_fault_state) {
4664                 talloc_free(r);
4665                 /* Return true here, srv_pipe_hnd.c will take care */
4666                 return true;
4667         }
4668
4669         if (DEBUGLEVEL >= 10) {
4670                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyClosePrinter, r);
4671         }
4672
4673         push = ndr_push_init_ctx(r, NULL);
4674         if (push == NULL) {
4675                 talloc_free(r);
4676                 return false;
4677         }
4678
4679         ndr_err = call->ndr_push(push, NDR_OUT, r);
4680         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4681                 talloc_free(r);
4682                 return false;
4683         }
4684
4685         blob = ndr_push_blob(push);
4686         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4687                 talloc_free(r);
4688                 return false;
4689         }
4690
4691         talloc_free(r);
4692
4693         return true;
4694 }
4695
4696 static bool api_spoolss_AddPortEx(pipes_struct *p)
4697 {
4698         const struct ndr_interface_call *call;
4699         struct ndr_pull *pull;
4700         struct ndr_push *push;
4701         enum ndr_err_code ndr_err;
4702         DATA_BLOB blob;
4703         struct spoolss_AddPortEx *r;
4704
4705         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPORTEX];
4706
4707         r = talloc(talloc_tos(), struct spoolss_AddPortEx);
4708         if (r == NULL) {
4709                 return false;
4710         }
4711
4712         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4713                 talloc_free(r);
4714                 return false;
4715         }
4716
4717         pull = ndr_pull_init_blob(&blob, r, NULL);
4718         if (pull == NULL) {
4719                 talloc_free(r);
4720                 return false;
4721         }
4722
4723         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4724         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4725         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4726                 talloc_free(r);
4727                 return false;
4728         }
4729
4730         if (DEBUGLEVEL >= 10) {
4731                 NDR_PRINT_IN_DEBUG(spoolss_AddPortEx, r);
4732         }
4733
4734         r->out.result = _spoolss_AddPortEx(p, r);
4735
4736         if (p->rng_fault_state) {
4737                 talloc_free(r);
4738                 /* Return true here, srv_pipe_hnd.c will take care */
4739                 return true;
4740         }
4741
4742         if (DEBUGLEVEL >= 10) {
4743                 NDR_PRINT_OUT_DEBUG(spoolss_AddPortEx, r);
4744         }
4745
4746         push = ndr_push_init_ctx(r, NULL);
4747         if (push == NULL) {
4748                 talloc_free(r);
4749                 return false;
4750         }
4751
4752         ndr_err = call->ndr_push(push, NDR_OUT, r);
4753         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4754                 talloc_free(r);
4755                 return false;
4756         }
4757
4758         blob = ndr_push_blob(push);
4759         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4760                 talloc_free(r);
4761                 return false;
4762         }
4763
4764         talloc_free(r);
4765
4766         return true;
4767 }
4768
4769 static bool api_spoolss_RouterFindFirstPrinterChangeNotification(pipes_struct *p)
4770 {
4771         const struct ndr_interface_call *call;
4772         struct ndr_pull *pull;
4773         struct ndr_push *push;
4774         enum ndr_err_code ndr_err;
4775         DATA_BLOB blob;
4776         struct spoolss_RouterFindFirstPrinterChangeNotification *r;
4777
4778         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION];
4779
4780         r = talloc(talloc_tos(), struct spoolss_RouterFindFirstPrinterChangeNotification);
4781         if (r == NULL) {
4782                 return false;
4783         }
4784
4785         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4786                 talloc_free(r);
4787                 return false;
4788         }
4789
4790         pull = ndr_pull_init_blob(&blob, r, NULL);
4791         if (pull == NULL) {
4792                 talloc_free(r);
4793                 return false;
4794         }
4795
4796         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4797         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4798         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4799                 talloc_free(r);
4800                 return false;
4801         }
4802
4803         if (DEBUGLEVEL >= 10) {
4804                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, r);
4805         }
4806
4807         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotification(p, r);
4808
4809         if (p->rng_fault_state) {
4810                 talloc_free(r);
4811                 /* Return true here, srv_pipe_hnd.c will take care */
4812                 return true;
4813         }
4814
4815         if (DEBUGLEVEL >= 10) {
4816                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, r);
4817         }
4818
4819         push = ndr_push_init_ctx(r, NULL);
4820         if (push == NULL) {
4821                 talloc_free(r);
4822                 return false;
4823         }
4824
4825         ndr_err = call->ndr_push(push, NDR_OUT, r);
4826         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4827                 talloc_free(r);
4828                 return false;
4829         }
4830
4831         blob = ndr_push_blob(push);
4832         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4833                 talloc_free(r);
4834                 return false;
4835         }
4836
4837         talloc_free(r);
4838
4839         return true;
4840 }
4841
4842 static bool api_spoolss_SpoolerInit(pipes_struct *p)
4843 {
4844         const struct ndr_interface_call *call;
4845         struct ndr_pull *pull;
4846         struct ndr_push *push;
4847         enum ndr_err_code ndr_err;
4848         DATA_BLOB blob;
4849         struct spoolss_SpoolerInit *r;
4850
4851         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SPOOLERINIT];
4852
4853         r = talloc(talloc_tos(), struct spoolss_SpoolerInit);
4854         if (r == NULL) {
4855                 return false;
4856         }
4857
4858         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4859                 talloc_free(r);
4860                 return false;
4861         }
4862
4863         pull = ndr_pull_init_blob(&blob, r, NULL);
4864         if (pull == NULL) {
4865                 talloc_free(r);
4866                 return false;
4867         }
4868
4869         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4870         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4871         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4872                 talloc_free(r);
4873                 return false;
4874         }
4875
4876         if (DEBUGLEVEL >= 10) {
4877                 NDR_PRINT_IN_DEBUG(spoolss_SpoolerInit, r);
4878         }
4879
4880         r->out.result = _spoolss_SpoolerInit(p, r);
4881
4882         if (p->rng_fault_state) {
4883                 talloc_free(r);
4884                 /* Return true here, srv_pipe_hnd.c will take care */
4885                 return true;
4886         }
4887
4888         if (DEBUGLEVEL >= 10) {
4889                 NDR_PRINT_OUT_DEBUG(spoolss_SpoolerInit, r);
4890         }
4891
4892         push = ndr_push_init_ctx(r, NULL);
4893         if (push == NULL) {
4894                 talloc_free(r);
4895                 return false;
4896         }
4897
4898         ndr_err = call->ndr_push(push, NDR_OUT, r);
4899         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4900                 talloc_free(r);
4901                 return false;
4902         }
4903
4904         blob = ndr_push_blob(push);
4905         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4906                 talloc_free(r);
4907                 return false;
4908         }
4909
4910         talloc_free(r);
4911
4912         return true;
4913 }
4914
4915 static bool api_spoolss_ResetPrinterEx(pipes_struct *p)
4916 {
4917         const struct ndr_interface_call *call;
4918         struct ndr_pull *pull;
4919         struct ndr_push *push;
4920         enum ndr_err_code ndr_err;
4921         DATA_BLOB blob;
4922         struct spoolss_ResetPrinterEx *r;
4923
4924         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_RESETPRINTEREX];
4925
4926         r = talloc(talloc_tos(), struct spoolss_ResetPrinterEx);
4927         if (r == NULL) {
4928                 return false;
4929         }
4930
4931         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4932                 talloc_free(r);
4933                 return false;
4934         }
4935
4936         pull = ndr_pull_init_blob(&blob, r, NULL);
4937         if (pull == NULL) {
4938                 talloc_free(r);
4939                 return false;
4940         }
4941
4942         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4943         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4944         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4945                 talloc_free(r);
4946                 return false;
4947         }
4948
4949         if (DEBUGLEVEL >= 10) {
4950                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinterEx, r);
4951         }
4952
4953         r->out.result = _spoolss_ResetPrinterEx(p, r);
4954
4955         if (p->rng_fault_state) {
4956                 talloc_free(r);
4957                 /* Return true here, srv_pipe_hnd.c will take care */
4958                 return true;
4959         }
4960
4961         if (DEBUGLEVEL >= 10) {
4962                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinterEx, r);
4963         }
4964
4965         push = ndr_push_init_ctx(r, NULL);
4966         if (push == NULL) {
4967                 talloc_free(r);
4968                 return false;
4969         }
4970
4971         ndr_err = call->ndr_push(push, NDR_OUT, r);
4972         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4973                 talloc_free(r);
4974                 return false;
4975         }
4976
4977         blob = ndr_push_blob(push);
4978         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4979                 talloc_free(r);
4980                 return false;
4981         }
4982
4983         talloc_free(r);
4984
4985         return true;
4986 }
4987
4988 static bool api_spoolss_RemoteFindFirstPrinterChangeNotifyEx(pipes_struct *p)
4989 {
4990         const struct ndr_interface_call *call;
4991         struct ndr_pull *pull;
4992         struct ndr_push *push;
4993         enum ndr_err_code ndr_err;
4994         DATA_BLOB blob;
4995         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r;
4996
4997         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX];
4998
4999         r = talloc(talloc_tos(), struct spoolss_RemoteFindFirstPrinterChangeNotifyEx);
5000         if (r == NULL) {
5001                 return false;
5002         }
5003
5004         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5005                 talloc_free(r);
5006                 return false;
5007         }
5008
5009         pull = ndr_pull_init_blob(&blob, r, NULL);
5010         if (pull == NULL) {
5011                 talloc_free(r);
5012                 return false;
5013         }
5014
5015         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5016         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5017         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5018                 talloc_free(r);
5019                 return false;
5020         }
5021
5022         if (DEBUGLEVEL >= 10) {
5023                 NDR_PRINT_IN_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, r);
5024         }
5025
5026         r->out.result = _spoolss_RemoteFindFirstPrinterChangeNotifyEx(p, r);
5027
5028         if (p->rng_fault_state) {
5029                 talloc_free(r);
5030                 /* Return true here, srv_pipe_hnd.c will take care */
5031                 return true;
5032         }
5033
5034         if (DEBUGLEVEL >= 10) {
5035                 NDR_PRINT_OUT_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, r);
5036         }
5037
5038         push = ndr_push_init_ctx(r, NULL);
5039         if (push == NULL) {
5040                 talloc_free(r);
5041                 return false;
5042         }
5043
5044         ndr_err = call->ndr_push(push, NDR_OUT, r);
5045         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5046                 talloc_free(r);
5047                 return false;
5048         }
5049
5050         blob = ndr_push_blob(push);
5051         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5052                 talloc_free(r);
5053                 return false;
5054         }
5055
5056         talloc_free(r);
5057
5058         return true;
5059 }
5060
5061 static bool api_spoolss_RouterReplyPrinterEx(pipes_struct *p)
5062 {
5063         const struct ndr_interface_call *call;
5064         struct ndr_pull *pull;
5065         struct ndr_push *push;
5066         enum ndr_err_code ndr_err;
5067         DATA_BLOB blob;
5068         struct spoolss_RouterReplyPrinterEx *r;
5069
5070         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREPLYPRINTEREX];
5071
5072         r = talloc(talloc_tos(), struct spoolss_RouterReplyPrinterEx);
5073         if (r == NULL) {
5074                 return false;
5075         }
5076
5077         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5078                 talloc_free(r);
5079                 return false;
5080         }
5081
5082         pull = ndr_pull_init_blob(&blob, r, NULL);
5083         if (pull == NULL) {
5084                 talloc_free(r);
5085                 return false;
5086         }
5087
5088         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5089         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5090         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5091                 talloc_free(r);
5092                 return false;
5093         }
5094
5095         if (DEBUGLEVEL >= 10) {
5096                 NDR_PRINT_IN_DEBUG(spoolss_RouterReplyPrinterEx, r);
5097         }
5098
5099         ZERO_STRUCT(r->out);
5100         r->out.reply_result = talloc_zero(r, uint32_t);
5101         if (r->out.reply_result == NULL) {
5102                 talloc_free(r);
5103                 return false;
5104         }
5105
5106         r->out.result = _spoolss_RouterReplyPrinterEx(p, r);
5107
5108         if (p->rng_fault_state) {
5109                 talloc_free(r);
5110                 /* Return true here, srv_pipe_hnd.c will take care */
5111                 return true;
5112         }
5113
5114         if (DEBUGLEVEL >= 10) {
5115                 NDR_PRINT_OUT_DEBUG(spoolss_RouterReplyPrinterEx, r);
5116         }
5117
5118         push = ndr_push_init_ctx(r, NULL);
5119         if (push == NULL) {
5120                 talloc_free(r);
5121                 return false;
5122         }
5123
5124         ndr_err = call->ndr_push(push, NDR_OUT, r);
5125         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5126                 talloc_free(r);
5127                 return false;
5128         }
5129
5130         blob = ndr_push_blob(push);
5131         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5132                 talloc_free(r);
5133                 return false;
5134         }
5135
5136         talloc_free(r);
5137
5138         return true;
5139 }
5140
5141 static bool api_spoolss_RouterRefreshPrinterChangeNotify(pipes_struct *p)
5142 {
5143         const struct ndr_interface_call *call;
5144         struct ndr_pull *pull;
5145         struct ndr_push *push;
5146         enum ndr_err_code ndr_err;
5147         DATA_BLOB blob;
5148         struct spoolss_RouterRefreshPrinterChangeNotify *r;
5149
5150         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY];
5151
5152         r = talloc(talloc_tos(), struct spoolss_RouterRefreshPrinterChangeNotify);
5153         if (r == NULL) {
5154                 return false;
5155         }
5156
5157         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5158                 talloc_free(r);
5159                 return false;
5160         }
5161
5162         pull = ndr_pull_init_blob(&blob, r, NULL);
5163         if (pull == NULL) {
5164                 talloc_free(r);
5165                 return false;
5166         }
5167
5168         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5169         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5170         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5171                 talloc_free(r);
5172                 return false;
5173         }
5174
5175         if (DEBUGLEVEL >= 10) {
5176                 NDR_PRINT_IN_DEBUG(spoolss_RouterRefreshPrinterChangeNotify, r);
5177         }
5178
5179         ZERO_STRUCT(r->out);
5180         r->out.info = talloc_zero(r, struct spoolss_NotifyInfo *);
5181         if (r->out.info == NULL) {
5182                 talloc_free(r);
5183                 return false;
5184         }
5185
5186         r->out.result = _spoolss_RouterRefreshPrinterChangeNotify(p, r);
5187
5188         if (p->rng_fault_state) {
5189                 talloc_free(r);
5190                 /* Return true here, srv_pipe_hnd.c will take care */
5191                 return true;
5192         }
5193
5194         if (DEBUGLEVEL >= 10) {
5195                 NDR_PRINT_OUT_DEBUG(spoolss_RouterRefreshPrinterChangeNotify, r);
5196         }
5197
5198         push = ndr_push_init_ctx(r, NULL);
5199         if (push == NULL) {
5200                 talloc_free(r);
5201                 return false;
5202         }
5203
5204         ndr_err = call->ndr_push(push, NDR_OUT, r);
5205         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5206                 talloc_free(r);
5207                 return false;
5208         }
5209
5210         blob = ndr_push_blob(push);
5211         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5212                 talloc_free(r);
5213                 return false;
5214         }
5215
5216         talloc_free(r);
5217
5218         return true;
5219 }
5220
5221 static bool api_spoolss_44(pipes_struct *p)
5222 {
5223         const struct ndr_interface_call *call;
5224         struct ndr_pull *pull;
5225         struct ndr_push *push;
5226         enum ndr_err_code ndr_err;
5227         DATA_BLOB blob;
5228         struct spoolss_44 *r;
5229
5230         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_44];
5231
5232         r = talloc(talloc_tos(), struct spoolss_44);
5233         if (r == NULL) {
5234                 return false;
5235         }
5236
5237         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5238                 talloc_free(r);
5239                 return false;
5240         }
5241
5242         pull = ndr_pull_init_blob(&blob, r, NULL);
5243         if (pull == NULL) {
5244                 talloc_free(r);
5245                 return false;
5246         }
5247
5248         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5249         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5250         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5251                 talloc_free(r);
5252                 return false;
5253         }
5254
5255         if (DEBUGLEVEL >= 10) {
5256                 NDR_PRINT_IN_DEBUG(spoolss_44, r);
5257         }
5258
5259         r->out.result = _spoolss_44(p, r);
5260
5261         if (p->rng_fault_state) {
5262                 talloc_free(r);
5263                 /* Return true here, srv_pipe_hnd.c will take care */
5264                 return true;
5265         }
5266
5267         if (DEBUGLEVEL >= 10) {
5268                 NDR_PRINT_OUT_DEBUG(spoolss_44, r);
5269         }
5270
5271         push = ndr_push_init_ctx(r, NULL);
5272         if (push == NULL) {
5273                 talloc_free(r);
5274                 return false;
5275         }
5276
5277         ndr_err = call->ndr_push(push, NDR_OUT, r);
5278         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5279                 talloc_free(r);
5280                 return false;
5281         }
5282
5283         blob = ndr_push_blob(push);
5284         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5285                 talloc_free(r);
5286                 return false;
5287         }
5288
5289         talloc_free(r);
5290
5291         return true;
5292 }
5293
5294 static bool api_spoolss_OpenPrinterEx(pipes_struct *p)
5295 {
5296         const struct ndr_interface_call *call;
5297         struct ndr_pull *pull;
5298         struct ndr_push *push;
5299         enum ndr_err_code ndr_err;
5300         DATA_BLOB blob;
5301         struct spoolss_OpenPrinterEx *r;
5302
5303         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_OPENPRINTEREX];
5304
5305         r = talloc(talloc_tos(), struct spoolss_OpenPrinterEx);
5306         if (r == NULL) {
5307                 return false;
5308         }
5309
5310         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5311                 talloc_free(r);
5312                 return false;
5313         }
5314
5315         pull = ndr_pull_init_blob(&blob, r, NULL);
5316         if (pull == NULL) {
5317                 talloc_free(r);
5318                 return false;
5319         }
5320
5321         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5322         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5323         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5324                 talloc_free(r);
5325                 return false;
5326         }
5327
5328         if (DEBUGLEVEL >= 10) {
5329                 NDR_PRINT_IN_DEBUG(spoolss_OpenPrinterEx, r);
5330         }
5331
5332         ZERO_STRUCT(r->out);
5333         r->out.handle = talloc_zero(r, struct policy_handle);
5334         if (r->out.handle == NULL) {
5335                 talloc_free(r);
5336                 return false;
5337         }
5338
5339         r->out.result = _spoolss_OpenPrinterEx(p, r);
5340
5341         if (p->rng_fault_state) {
5342                 talloc_free(r);
5343                 /* Return true here, srv_pipe_hnd.c will take care */
5344                 return true;
5345         }
5346
5347         if (DEBUGLEVEL >= 10) {
5348                 NDR_PRINT_OUT_DEBUG(spoolss_OpenPrinterEx, r);
5349         }
5350
5351         push = ndr_push_init_ctx(r, NULL);
5352         if (push == NULL) {
5353                 talloc_free(r);
5354                 return false;
5355         }
5356
5357         ndr_err = call->ndr_push(push, NDR_OUT, r);
5358         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5359                 talloc_free(r);
5360                 return false;
5361         }
5362
5363         blob = ndr_push_blob(push);
5364         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5365                 talloc_free(r);
5366                 return false;
5367         }
5368
5369         talloc_free(r);
5370
5371         return true;
5372 }
5373
5374 static bool api_spoolss_AddPrinterEx(pipes_struct *p)
5375 {
5376         const struct ndr_interface_call *call;
5377         struct ndr_pull *pull;
5378         struct ndr_push *push;
5379         enum ndr_err_code ndr_err;
5380         DATA_BLOB blob;
5381         struct spoolss_AddPrinterEx *r;
5382
5383         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTEREX];
5384
5385         r = talloc(talloc_tos(), struct spoolss_AddPrinterEx);
5386         if (r == NULL) {
5387                 return false;
5388         }
5389
5390         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5391                 talloc_free(r);
5392                 return false;
5393         }
5394
5395         pull = ndr_pull_init_blob(&blob, r, NULL);
5396         if (pull == NULL) {
5397                 talloc_free(r);
5398                 return false;
5399         }
5400
5401         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5402         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5403         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5404                 talloc_free(r);
5405                 return false;
5406         }
5407
5408         if (DEBUGLEVEL >= 10) {
5409                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterEx, r);
5410         }
5411
5412         r->out.result = _spoolss_AddPrinterEx(p, r);
5413
5414         if (p->rng_fault_state) {
5415                 talloc_free(r);
5416                 /* Return true here, srv_pipe_hnd.c will take care */
5417                 return true;
5418         }
5419
5420         if (DEBUGLEVEL >= 10) {
5421                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterEx, r);
5422         }
5423
5424         push = ndr_push_init_ctx(r, NULL);
5425         if (push == NULL) {
5426                 talloc_free(r);
5427                 return false;
5428         }
5429
5430         ndr_err = call->ndr_push(push, NDR_OUT, r);
5431         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5432                 talloc_free(r);
5433                 return false;
5434         }
5435
5436         blob = ndr_push_blob(push);
5437         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5438                 talloc_free(r);
5439                 return false;
5440         }
5441
5442         talloc_free(r);
5443
5444         return true;
5445 }
5446
5447 static bool api_spoolss_47(pipes_struct *p)
5448 {
5449         const struct ndr_interface_call *call;
5450         struct ndr_pull *pull;
5451         struct ndr_push *push;
5452         enum ndr_err_code ndr_err;
5453         DATA_BLOB blob;
5454         struct spoolss_47 *r;
5455
5456         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_47];
5457
5458         r = talloc(talloc_tos(), struct spoolss_47);
5459         if (r == NULL) {
5460                 return false;
5461         }
5462
5463         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5464                 talloc_free(r);
5465                 return false;
5466         }
5467
5468         pull = ndr_pull_init_blob(&blob, r, NULL);
5469         if (pull == NULL) {
5470                 talloc_free(r);
5471                 return false;
5472         }
5473
5474         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5475         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5476         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5477                 talloc_free(r);
5478                 return false;
5479         }
5480
5481         if (DEBUGLEVEL >= 10) {
5482                 NDR_PRINT_IN_DEBUG(spoolss_47, r);
5483         }
5484
5485         r->out.result = _spoolss_47(p, r);
5486
5487         if (p->rng_fault_state) {
5488                 talloc_free(r);
5489                 /* Return true here, srv_pipe_hnd.c will take care */
5490                 return true;
5491         }
5492
5493         if (DEBUGLEVEL >= 10) {
5494                 NDR_PRINT_OUT_DEBUG(spoolss_47, r);
5495         }
5496
5497         push = ndr_push_init_ctx(r, NULL);
5498         if (push == NULL) {
5499                 talloc_free(r);
5500                 return false;
5501         }
5502
5503         ndr_err = call->ndr_push(push, NDR_OUT, r);
5504         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5505                 talloc_free(r);
5506                 return false;
5507         }
5508
5509         blob = ndr_push_blob(push);
5510         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5511                 talloc_free(r);
5512                 return false;
5513         }
5514
5515         talloc_free(r);
5516
5517         return true;
5518 }
5519
5520 static bool api_spoolss_EnumPrinterData(pipes_struct *p)
5521 {
5522         const struct ndr_interface_call *call;
5523         struct ndr_pull *pull;
5524         struct ndr_push *push;
5525         enum ndr_err_code ndr_err;
5526         DATA_BLOB blob;
5527         struct spoolss_EnumPrinterData *r;
5528
5529         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERDATA];
5530
5531         r = talloc(talloc_tos(), struct spoolss_EnumPrinterData);
5532         if (r == NULL) {
5533                 return false;
5534         }
5535
5536         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5537                 talloc_free(r);
5538                 return false;
5539         }
5540
5541         pull = ndr_pull_init_blob(&blob, r, NULL);
5542         if (pull == NULL) {
5543                 talloc_free(r);
5544                 return false;
5545         }
5546
5547         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5548         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5549         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5550                 talloc_free(r);
5551                 return false;
5552         }
5553
5554         if (DEBUGLEVEL >= 10) {
5555                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterData, r);
5556         }
5557
5558         ZERO_STRUCT(r->out);
5559         r->out.value_name = talloc_zero_array(r, const char, r->in.value_offered / 2);
5560         if (r->out.value_name == NULL) {
5561                 talloc_free(r);
5562                 return false;
5563         }
5564
5565         r->out.value_needed = talloc_zero(r, uint32_t);
5566         if (r->out.value_needed == NULL) {
5567                 talloc_free(r);
5568                 return false;
5569         }
5570
5571         r->out.printerdata_type = talloc_zero(r, uint32_t);
5572         if (r->out.printerdata_type == NULL) {
5573                 talloc_free(r);
5574                 return false;
5575         }
5576
5577         r->out.buffer = talloc_zero(r, DATA_BLOB);
5578         if (r->out.buffer == NULL) {
5579                 talloc_free(r);
5580                 return false;
5581         }
5582
5583         r->out.data_needed = talloc_zero(r, uint32_t);
5584         if (r->out.data_needed == NULL) {
5585                 talloc_free(r);
5586                 return false;
5587         }
5588
5589         r->out.result = _spoolss_EnumPrinterData(p, r);
5590
5591         if (p->rng_fault_state) {
5592                 talloc_free(r);
5593                 /* Return true here, srv_pipe_hnd.c will take care */
5594                 return true;
5595         }
5596
5597         if (DEBUGLEVEL >= 10) {
5598                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterData, r);
5599         }
5600
5601         push = ndr_push_init_ctx(r, NULL);
5602         if (push == NULL) {
5603                 talloc_free(r);
5604                 return false;
5605         }
5606
5607         ndr_err = call->ndr_push(push, NDR_OUT, r);
5608         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5609                 talloc_free(r);
5610                 return false;
5611         }
5612
5613         blob = ndr_push_blob(push);
5614         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5615                 talloc_free(r);
5616                 return false;
5617         }
5618
5619         talloc_free(r);
5620
5621         return true;
5622 }
5623
5624 static bool api_spoolss_DeletePrinterData(pipes_struct *p)
5625 {
5626         const struct ndr_interface_call *call;
5627         struct ndr_pull *pull;
5628         struct ndr_push *push;
5629         enum ndr_err_code ndr_err;
5630         DATA_BLOB blob;
5631         struct spoolss_DeletePrinterData *r;
5632
5633         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDATA];
5634
5635         r = talloc(talloc_tos(), struct spoolss_DeletePrinterData);
5636         if (r == NULL) {
5637                 return false;
5638         }
5639
5640         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5641                 talloc_free(r);
5642                 return false;
5643         }
5644
5645         pull = ndr_pull_init_blob(&blob, r, NULL);
5646         if (pull == NULL) {
5647                 talloc_free(r);
5648                 return false;
5649         }
5650
5651         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5652         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5653         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5654                 talloc_free(r);
5655                 return false;
5656         }
5657
5658         if (DEBUGLEVEL >= 10) {
5659                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterData, r);
5660         }
5661
5662         r->out.result = _spoolss_DeletePrinterData(p, r);
5663
5664         if (p->rng_fault_state) {
5665                 talloc_free(r);
5666                 /* Return true here, srv_pipe_hnd.c will take care */
5667                 return true;
5668         }
5669
5670         if (DEBUGLEVEL >= 10) {
5671                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterData, r);
5672         }
5673
5674         push = ndr_push_init_ctx(r, NULL);
5675         if (push == NULL) {
5676                 talloc_free(r);
5677                 return false;
5678         }
5679
5680         ndr_err = call->ndr_push(push, NDR_OUT, r);
5681         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5682                 talloc_free(r);
5683                 return false;
5684         }
5685
5686         blob = ndr_push_blob(push);
5687         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5688                 talloc_free(r);
5689                 return false;
5690         }
5691
5692         talloc_free(r);
5693
5694         return true;
5695 }
5696
5697 static bool api_spoolss_4a(pipes_struct *p)
5698 {
5699         const struct ndr_interface_call *call;
5700         struct ndr_pull *pull;
5701         struct ndr_push *push;
5702         enum ndr_err_code ndr_err;
5703         DATA_BLOB blob;
5704         struct spoolss_4a *r;
5705
5706         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4A];
5707
5708         r = talloc(talloc_tos(), struct spoolss_4a);
5709         if (r == NULL) {
5710                 return false;
5711         }
5712
5713         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5714                 talloc_free(r);
5715                 return false;
5716         }
5717
5718         pull = ndr_pull_init_blob(&blob, r, NULL);
5719         if (pull == NULL) {
5720                 talloc_free(r);
5721                 return false;
5722         }
5723
5724         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5725         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5726         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5727                 talloc_free(r);
5728                 return false;
5729         }
5730
5731         if (DEBUGLEVEL >= 10) {
5732                 NDR_PRINT_IN_DEBUG(spoolss_4a, r);
5733         }
5734
5735         r->out.result = _spoolss_4a(p, r);
5736
5737         if (p->rng_fault_state) {
5738                 talloc_free(r);
5739                 /* Return true here, srv_pipe_hnd.c will take care */
5740                 return true;
5741         }
5742
5743         if (DEBUGLEVEL >= 10) {
5744                 NDR_PRINT_OUT_DEBUG(spoolss_4a, r);
5745         }
5746
5747         push = ndr_push_init_ctx(r, NULL);
5748         if (push == NULL) {
5749                 talloc_free(r);
5750                 return false;
5751         }
5752
5753         ndr_err = call->ndr_push(push, NDR_OUT, r);
5754         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5755                 talloc_free(r);
5756                 return false;
5757         }
5758
5759         blob = ndr_push_blob(push);
5760         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5761                 talloc_free(r);
5762                 return false;
5763         }
5764
5765         talloc_free(r);
5766
5767         return true;
5768 }
5769
5770 static bool api_spoolss_4b(pipes_struct *p)
5771 {
5772         const struct ndr_interface_call *call;
5773         struct ndr_pull *pull;
5774         struct ndr_push *push;
5775         enum ndr_err_code ndr_err;
5776         DATA_BLOB blob;
5777         struct spoolss_4b *r;
5778
5779         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4B];
5780
5781         r = talloc(talloc_tos(), struct spoolss_4b);
5782         if (r == NULL) {
5783                 return false;
5784         }
5785
5786         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5787                 talloc_free(r);
5788                 return false;
5789         }
5790
5791         pull = ndr_pull_init_blob(&blob, r, NULL);
5792         if (pull == NULL) {
5793                 talloc_free(r);
5794                 return false;
5795         }
5796
5797         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5798         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5799         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5800                 talloc_free(r);
5801                 return false;
5802         }
5803
5804         if (DEBUGLEVEL >= 10) {
5805                 NDR_PRINT_IN_DEBUG(spoolss_4b, r);
5806         }
5807
5808         r->out.result = _spoolss_4b(p, r);
5809
5810         if (p->rng_fault_state) {
5811                 talloc_free(r);
5812                 /* Return true here, srv_pipe_hnd.c will take care */
5813                 return true;
5814         }
5815
5816         if (DEBUGLEVEL >= 10) {
5817                 NDR_PRINT_OUT_DEBUG(spoolss_4b, r);
5818         }
5819
5820         push = ndr_push_init_ctx(r, NULL);
5821         if (push == NULL) {
5822                 talloc_free(r);
5823                 return false;
5824         }
5825
5826         ndr_err = call->ndr_push(push, NDR_OUT, r);
5827         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5828                 talloc_free(r);
5829                 return false;
5830         }
5831
5832         blob = ndr_push_blob(push);
5833         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5834                 talloc_free(r);
5835                 return false;
5836         }
5837
5838         talloc_free(r);
5839
5840         return true;
5841 }
5842
5843 static bool api_spoolss_4c(pipes_struct *p)
5844 {
5845         const struct ndr_interface_call *call;
5846         struct ndr_pull *pull;
5847         struct ndr_push *push;
5848         enum ndr_err_code ndr_err;
5849         DATA_BLOB blob;
5850         struct spoolss_4c *r;
5851
5852         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4C];
5853
5854         r = talloc(talloc_tos(), struct spoolss_4c);
5855         if (r == NULL) {
5856                 return false;
5857         }
5858
5859         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5860                 talloc_free(r);
5861                 return false;
5862         }
5863
5864         pull = ndr_pull_init_blob(&blob, r, NULL);
5865         if (pull == NULL) {
5866                 talloc_free(r);
5867                 return false;
5868         }
5869
5870         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5871         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5872         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5873                 talloc_free(r);
5874                 return false;
5875         }
5876
5877         if (DEBUGLEVEL >= 10) {
5878                 NDR_PRINT_IN_DEBUG(spoolss_4c, r);
5879         }
5880
5881         r->out.result = _spoolss_4c(p, r);
5882
5883         if (p->rng_fault_state) {
5884                 talloc_free(r);
5885                 /* Return true here, srv_pipe_hnd.c will take care */
5886                 return true;
5887         }
5888
5889         if (DEBUGLEVEL >= 10) {
5890                 NDR_PRINT_OUT_DEBUG(spoolss_4c, r);
5891         }
5892
5893         push = ndr_push_init_ctx(r, NULL);
5894         if (push == NULL) {
5895                 talloc_free(r);
5896                 return false;
5897         }
5898
5899         ndr_err = call->ndr_push(push, NDR_OUT, r);
5900         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5901                 talloc_free(r);
5902                 return false;
5903         }
5904
5905         blob = ndr_push_blob(push);
5906         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5907                 talloc_free(r);
5908                 return false;
5909         }
5910
5911         talloc_free(r);
5912
5913         return true;
5914 }
5915
5916 static bool api_spoolss_SetPrinterDataEx(pipes_struct *p)
5917 {
5918         const struct ndr_interface_call *call;
5919         struct ndr_pull *pull;
5920         struct ndr_push *push;
5921         enum ndr_err_code ndr_err;
5922         DATA_BLOB blob;
5923         struct spoolss_SetPrinterDataEx *r;
5924
5925         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETPRINTERDATAEX];
5926
5927         r = talloc(talloc_tos(), struct spoolss_SetPrinterDataEx);
5928         if (r == NULL) {
5929                 return false;
5930         }
5931
5932         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5933                 talloc_free(r);
5934                 return false;
5935         }
5936
5937         pull = ndr_pull_init_blob(&blob, r, NULL);
5938         if (pull == NULL) {
5939                 talloc_free(r);
5940                 return false;
5941         }
5942
5943         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5944         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5945         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5946                 talloc_free(r);
5947                 return false;
5948         }
5949
5950         if (DEBUGLEVEL >= 10) {
5951                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinterDataEx, r);
5952         }
5953
5954         r->out.result = _spoolss_SetPrinterDataEx(p, r);
5955
5956         if (p->rng_fault_state) {
5957                 talloc_free(r);
5958                 /* Return true here, srv_pipe_hnd.c will take care */
5959                 return true;
5960         }
5961
5962         if (DEBUGLEVEL >= 10) {
5963                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinterDataEx, r);
5964         }
5965
5966         push = ndr_push_init_ctx(r, NULL);
5967         if (push == NULL) {
5968                 talloc_free(r);
5969                 return false;
5970         }
5971
5972         ndr_err = call->ndr_push(push, NDR_OUT, r);
5973         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5974                 talloc_free(r);
5975                 return false;
5976         }
5977
5978         blob = ndr_push_blob(push);
5979         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5980                 talloc_free(r);
5981                 return false;
5982         }
5983
5984         talloc_free(r);
5985
5986         return true;
5987 }
5988
5989 static bool api_spoolss_GetPrinterDataEx(pipes_struct *p)
5990 {
5991         const struct ndr_interface_call *call;
5992         struct ndr_pull *pull;
5993         struct ndr_push *push;
5994         enum ndr_err_code ndr_err;
5995         DATA_BLOB blob;
5996         struct spoolss_GetPrinterDataEx *r;
5997
5998         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDATAEX];
5999
6000         r = talloc(talloc_tos(), struct spoolss_GetPrinterDataEx);
6001         if (r == NULL) {
6002                 return false;
6003         }
6004
6005         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6006                 talloc_free(r);
6007                 return false;
6008         }
6009
6010         pull = ndr_pull_init_blob(&blob, r, NULL);
6011         if (pull == NULL) {
6012                 talloc_free(r);
6013                 return false;
6014         }
6015
6016         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6017         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6018         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6019                 talloc_free(r);
6020                 return false;
6021         }
6022
6023         if (DEBUGLEVEL >= 10) {
6024                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDataEx, r);
6025         }
6026
6027         ZERO_STRUCT(r->out);
6028         r->out.type = talloc_zero(r, uint32_t);
6029         if (r->out.type == NULL) {
6030                 talloc_free(r);
6031                 return false;
6032         }
6033
6034         r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
6035         if (r->out.buffer == NULL) {
6036                 talloc_free(r);
6037                 return false;
6038         }
6039
6040         r->out.needed = talloc_zero(r, uint32_t);
6041         if (r->out.needed == NULL) {
6042                 talloc_free(r);
6043                 return false;
6044         }
6045
6046         r->out.result = _spoolss_GetPrinterDataEx(p, r);
6047
6048         if (p->rng_fault_state) {
6049                 talloc_free(r);
6050                 /* Return true here, srv_pipe_hnd.c will take care */
6051                 return true;
6052         }
6053
6054         if (DEBUGLEVEL >= 10) {
6055                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDataEx, r);
6056         }
6057
6058         push = ndr_push_init_ctx(r, NULL);
6059         if (push == NULL) {
6060                 talloc_free(r);
6061                 return false;
6062         }
6063
6064         ndr_err = call->ndr_push(push, NDR_OUT, r);
6065         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6066                 talloc_free(r);
6067                 return false;
6068         }
6069
6070         blob = ndr_push_blob(push);
6071         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6072                 talloc_free(r);
6073                 return false;
6074         }
6075
6076         talloc_free(r);
6077
6078         return true;
6079 }
6080
6081 static bool api_spoolss_EnumPrinterDataEx(pipes_struct *p)
6082 {
6083         const struct ndr_interface_call *call;
6084         struct ndr_pull *pull;
6085         struct ndr_push *push;
6086         enum ndr_err_code ndr_err;
6087         DATA_BLOB blob;
6088         struct spoolss_EnumPrinterDataEx *r;
6089
6090         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERDATAEX];
6091
6092         r = talloc(talloc_tos(), struct spoolss_EnumPrinterDataEx);
6093         if (r == NULL) {
6094                 return false;
6095         }
6096
6097         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6098                 talloc_free(r);
6099                 return false;
6100         }
6101
6102         pull = ndr_pull_init_blob(&blob, r, NULL);
6103         if (pull == NULL) {
6104                 talloc_free(r);
6105                 return false;
6106         }
6107
6108         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6109         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6110         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6111                 talloc_free(r);
6112                 return false;
6113         }
6114
6115         if (DEBUGLEVEL >= 10) {
6116                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterDataEx, r);
6117         }
6118
6119         ZERO_STRUCT(r->out);
6120         r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
6121         if (r->out.buffer == NULL) {
6122                 talloc_free(r);
6123                 return false;
6124         }
6125
6126         r->out.needed = talloc_zero(r, uint32_t);
6127         if (r->out.needed == NULL) {
6128                 talloc_free(r);
6129                 return false;
6130         }
6131
6132         r->out.count = talloc_zero(r, uint32_t);
6133         if (r->out.count == NULL) {
6134                 talloc_free(r);
6135                 return false;
6136         }
6137
6138         r->out.result = _spoolss_EnumPrinterDataEx(p, r);
6139
6140         if (p->rng_fault_state) {
6141                 talloc_free(r);
6142                 /* Return true here, srv_pipe_hnd.c will take care */
6143                 return true;
6144         }
6145
6146         if (DEBUGLEVEL >= 10) {
6147                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterDataEx, r);
6148         }
6149
6150         push = ndr_push_init_ctx(r, NULL);
6151         if (push == NULL) {
6152                 talloc_free(r);
6153                 return false;
6154         }
6155
6156         ndr_err = call->ndr_push(push, NDR_OUT, r);
6157         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6158                 talloc_free(r);
6159                 return false;
6160         }
6161
6162         blob = ndr_push_blob(push);
6163         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6164                 talloc_free(r);
6165                 return false;
6166         }
6167
6168         talloc_free(r);
6169
6170         return true;
6171 }
6172
6173 static bool api_spoolss_EnumPrinterKey(pipes_struct *p)
6174 {
6175         const struct ndr_interface_call *call;
6176         struct ndr_pull *pull;
6177         struct ndr_push *push;
6178         enum ndr_err_code ndr_err;
6179         DATA_BLOB blob;
6180         struct spoolss_EnumPrinterKey *r;
6181
6182         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERKEY];
6183
6184         r = talloc(talloc_tos(), struct spoolss_EnumPrinterKey);
6185         if (r == NULL) {
6186                 return false;
6187         }
6188
6189         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6190                 talloc_free(r);
6191                 return false;
6192         }
6193
6194         pull = ndr_pull_init_blob(&blob, r, NULL);
6195         if (pull == NULL) {
6196                 talloc_free(r);
6197                 return false;
6198         }
6199
6200         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6201         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6202         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6203                 talloc_free(r);
6204                 return false;
6205         }
6206
6207         if (DEBUGLEVEL >= 10) {
6208                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterKey, r);
6209         }
6210
6211         ZERO_STRUCT(r->out);
6212         r->out.key_buffer = talloc_zero_array(r, uint16_t, r->in.key_buffer_size / 2);
6213         if (r->out.key_buffer == NULL) {
6214                 talloc_free(r);
6215                 return false;
6216         }
6217
6218         r->out.needed = talloc_zero(r, uint32_t);
6219         if (r->out.needed == NULL) {
6220                 talloc_free(r);
6221                 return false;
6222         }
6223
6224         r->out.result = _spoolss_EnumPrinterKey(p, r);
6225
6226         if (p->rng_fault_state) {
6227                 talloc_free(r);
6228                 /* Return true here, srv_pipe_hnd.c will take care */
6229                 return true;
6230         }
6231
6232         if (DEBUGLEVEL >= 10) {
6233                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterKey, r);
6234         }
6235
6236         push = ndr_push_init_ctx(r, NULL);
6237         if (push == NULL) {
6238                 talloc_free(r);
6239                 return false;
6240         }
6241
6242         ndr_err = call->ndr_push(push, NDR_OUT, r);
6243         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6244                 talloc_free(r);
6245                 return false;
6246         }
6247
6248         blob = ndr_push_blob(push);
6249         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6250                 talloc_free(r);
6251                 return false;
6252         }
6253
6254         talloc_free(r);
6255
6256         return true;
6257 }
6258
6259 static bool api_spoolss_DeletePrinterDataEx(pipes_struct *p)
6260 {
6261         const struct ndr_interface_call *call;
6262         struct ndr_pull *pull;
6263         struct ndr_push *push;
6264         enum ndr_err_code ndr_err;
6265         DATA_BLOB blob;
6266         struct spoolss_DeletePrinterDataEx *r;
6267
6268         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDATAEX];
6269
6270         r = talloc(talloc_tos(), struct spoolss_DeletePrinterDataEx);
6271         if (r == NULL) {
6272                 return false;
6273         }
6274
6275         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6276                 talloc_free(r);
6277                 return false;
6278         }
6279
6280         pull = ndr_pull_init_blob(&blob, r, NULL);
6281         if (pull == NULL) {
6282                 talloc_free(r);
6283                 return false;
6284         }
6285
6286         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6287         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6288         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6289                 talloc_free(r);
6290                 return false;
6291         }
6292
6293         if (DEBUGLEVEL >= 10) {
6294                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDataEx, r);
6295         }
6296
6297         r->out.result = _spoolss_DeletePrinterDataEx(p, r);
6298
6299         if (p->rng_fault_state) {
6300                 talloc_free(r);
6301                 /* Return true here, srv_pipe_hnd.c will take care */
6302                 return true;
6303         }
6304
6305         if (DEBUGLEVEL >= 10) {
6306                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDataEx, r);
6307         }
6308
6309         push = ndr_push_init_ctx(r, NULL);
6310         if (push == NULL) {
6311                 talloc_free(r);
6312                 return false;
6313         }
6314
6315         ndr_err = call->ndr_push(push, NDR_OUT, r);
6316         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6317                 talloc_free(r);
6318                 return false;
6319         }
6320
6321         blob = ndr_push_blob(push);
6322         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6323                 talloc_free(r);
6324                 return false;
6325         }
6326
6327         talloc_free(r);
6328
6329         return true;
6330 }
6331
6332 static bool api_spoolss_DeletePrinterKey(pipes_struct *p)
6333 {
6334         const struct ndr_interface_call *call;
6335         struct ndr_pull *pull;
6336         struct ndr_push *push;
6337         enum ndr_err_code ndr_err;
6338         DATA_BLOB blob;
6339         struct spoolss_DeletePrinterKey *r;
6340
6341         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERKEY];
6342
6343         r = talloc(talloc_tos(), struct spoolss_DeletePrinterKey);
6344         if (r == NULL) {
6345                 return false;
6346         }
6347
6348         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6349                 talloc_free(r);
6350                 return false;
6351         }
6352
6353         pull = ndr_pull_init_blob(&blob, r, NULL);
6354         if (pull == NULL) {
6355                 talloc_free(r);
6356                 return false;
6357         }
6358
6359         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6360         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6361         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6362                 talloc_free(r);
6363                 return false;
6364         }
6365
6366         if (DEBUGLEVEL >= 10) {
6367                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterKey, r);
6368         }
6369
6370         r->out.result = _spoolss_DeletePrinterKey(p, r);
6371
6372         if (p->rng_fault_state) {
6373                 talloc_free(r);
6374                 /* Return true here, srv_pipe_hnd.c will take care */
6375                 return true;
6376         }
6377
6378         if (DEBUGLEVEL >= 10) {
6379                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterKey, r);
6380         }
6381
6382         push = ndr_push_init_ctx(r, NULL);
6383         if (push == NULL) {
6384                 talloc_free(r);
6385                 return false;
6386         }
6387
6388         ndr_err = call->ndr_push(push, NDR_OUT, r);
6389         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6390                 talloc_free(r);
6391                 return false;
6392         }
6393
6394         blob = ndr_push_blob(push);
6395         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6396                 talloc_free(r);
6397                 return false;
6398         }
6399
6400         talloc_free(r);
6401
6402         return true;
6403 }
6404
6405 static bool api_spoolss_53(pipes_struct *p)
6406 {
6407         const struct ndr_interface_call *call;
6408         struct ndr_pull *pull;
6409         struct ndr_push *push;
6410         enum ndr_err_code ndr_err;
6411         DATA_BLOB blob;
6412         struct spoolss_53 *r;
6413
6414         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_53];
6415
6416         r = talloc(talloc_tos(), struct spoolss_53);
6417         if (r == NULL) {
6418                 return false;
6419         }
6420
6421         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6422                 talloc_free(r);
6423                 return false;
6424         }
6425
6426         pull = ndr_pull_init_blob(&blob, r, NULL);
6427         if (pull == NULL) {
6428                 talloc_free(r);
6429                 return false;
6430         }
6431
6432         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6433         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6434         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6435                 talloc_free(r);
6436                 return false;
6437         }
6438
6439         if (DEBUGLEVEL >= 10) {
6440                 NDR_PRINT_IN_DEBUG(spoolss_53, r);
6441         }
6442
6443         r->out.result = _spoolss_53(p, r);
6444
6445         if (p->rng_fault_state) {
6446                 talloc_free(r);
6447                 /* Return true here, srv_pipe_hnd.c will take care */
6448                 return true;
6449         }
6450
6451         if (DEBUGLEVEL >= 10) {
6452                 NDR_PRINT_OUT_DEBUG(spoolss_53, r);
6453         }
6454
6455         push = ndr_push_init_ctx(r, NULL);
6456         if (push == NULL) {
6457                 talloc_free(r);
6458                 return false;
6459         }
6460
6461         ndr_err = call->ndr_push(push, NDR_OUT, r);
6462         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6463                 talloc_free(r);
6464                 return false;
6465         }
6466
6467         blob = ndr_push_blob(push);
6468         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6469                 talloc_free(r);
6470                 return false;
6471         }
6472
6473         talloc_free(r);
6474
6475         return true;
6476 }
6477
6478 static bool api_spoolss_DeletePrinterDriverEx(pipes_struct *p)
6479 {
6480         const struct ndr_interface_call *call;
6481         struct ndr_pull *pull;
6482         struct ndr_push *push;
6483         enum ndr_err_code ndr_err;
6484         DATA_BLOB blob;
6485         struct spoolss_DeletePrinterDriverEx *r;
6486
6487         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDRIVEREX];
6488
6489         r = talloc(talloc_tos(), struct spoolss_DeletePrinterDriverEx);
6490         if (r == NULL) {
6491                 return false;
6492         }
6493
6494         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6495                 talloc_free(r);
6496                 return false;
6497         }
6498
6499         pull = ndr_pull_init_blob(&blob, r, NULL);
6500         if (pull == NULL) {
6501                 talloc_free(r);
6502                 return false;
6503         }
6504
6505         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6506         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6507         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6508                 talloc_free(r);
6509                 return false;
6510         }
6511
6512         if (DEBUGLEVEL >= 10) {
6513                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDriverEx, r);
6514         }
6515
6516         r->out.result = _spoolss_DeletePrinterDriverEx(p, r);
6517
6518         if (p->rng_fault_state) {
6519                 talloc_free(r);
6520                 /* Return true here, srv_pipe_hnd.c will take care */
6521                 return true;
6522         }
6523
6524         if (DEBUGLEVEL >= 10) {
6525                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDriverEx, r);
6526         }
6527
6528         push = ndr_push_init_ctx(r, NULL);
6529         if (push == NULL) {
6530                 talloc_free(r);
6531                 return false;
6532         }
6533
6534         ndr_err = call->ndr_push(push, NDR_OUT, r);
6535         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6536                 talloc_free(r);
6537                 return false;
6538         }
6539
6540         blob = ndr_push_blob(push);
6541         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6542                 talloc_free(r);
6543                 return false;
6544         }
6545
6546         talloc_free(r);
6547
6548         return true;
6549 }
6550
6551 static bool api_spoolss_55(pipes_struct *p)
6552 {
6553         const struct ndr_interface_call *call;
6554         struct ndr_pull *pull;
6555         struct ndr_push *push;
6556         enum ndr_err_code ndr_err;
6557         DATA_BLOB blob;
6558         struct spoolss_55 *r;
6559
6560         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_55];
6561
6562         r = talloc(talloc_tos(), struct spoolss_55);
6563         if (r == NULL) {
6564                 return false;
6565         }
6566
6567         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6568                 talloc_free(r);
6569                 return false;
6570         }
6571
6572         pull = ndr_pull_init_blob(&blob, r, NULL);
6573         if (pull == NULL) {
6574                 talloc_free(r);
6575                 return false;
6576         }
6577
6578         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6579         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6580         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6581                 talloc_free(r);
6582                 return false;
6583         }
6584
6585         if (DEBUGLEVEL >= 10) {
6586                 NDR_PRINT_IN_DEBUG(spoolss_55, r);
6587         }
6588
6589         r->out.result = _spoolss_55(p, r);
6590
6591         if (p->rng_fault_state) {
6592                 talloc_free(r);
6593                 /* Return true here, srv_pipe_hnd.c will take care */
6594                 return true;
6595         }
6596
6597         if (DEBUGLEVEL >= 10) {
6598                 NDR_PRINT_OUT_DEBUG(spoolss_55, r);
6599         }
6600
6601         push = ndr_push_init_ctx(r, NULL);
6602         if (push == NULL) {
6603                 talloc_free(r);
6604                 return false;
6605         }
6606
6607         ndr_err = call->ndr_push(push, NDR_OUT, r);
6608         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6609                 talloc_free(r);
6610                 return false;
6611         }
6612
6613         blob = ndr_push_blob(push);
6614         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6615                 talloc_free(r);
6616                 return false;
6617         }
6618
6619         talloc_free(r);
6620
6621         return true;
6622 }
6623
6624 static bool api_spoolss_56(pipes_struct *p)
6625 {
6626         const struct ndr_interface_call *call;
6627         struct ndr_pull *pull;
6628         struct ndr_push *push;
6629         enum ndr_err_code ndr_err;
6630         DATA_BLOB blob;
6631         struct spoolss_56 *r;
6632
6633         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_56];
6634
6635         r = talloc(talloc_tos(), struct spoolss_56);
6636         if (r == NULL) {
6637                 return false;
6638         }
6639
6640         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6641                 talloc_free(r);
6642                 return false;
6643         }
6644
6645         pull = ndr_pull_init_blob(&blob, r, NULL);
6646         if (pull == NULL) {
6647                 talloc_free(r);
6648                 return false;
6649         }
6650
6651         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6652         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6653         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6654                 talloc_free(r);
6655                 return false;
6656         }
6657
6658         if (DEBUGLEVEL >= 10) {
6659                 NDR_PRINT_IN_DEBUG(spoolss_56, r);
6660         }
6661
6662         r->out.result = _spoolss_56(p, r);
6663
6664         if (p->rng_fault_state) {
6665                 talloc_free(r);
6666                 /* Return true here, srv_pipe_hnd.c will take care */
6667                 return true;
6668         }
6669
6670         if (DEBUGLEVEL >= 10) {
6671                 NDR_PRINT_OUT_DEBUG(spoolss_56, r);
6672         }
6673
6674         push = ndr_push_init_ctx(r, NULL);
6675         if (push == NULL) {
6676                 talloc_free(r);
6677                 return false;
6678         }
6679
6680         ndr_err = call->ndr_push(push, NDR_OUT, r);
6681         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6682                 talloc_free(r);
6683                 return false;
6684         }
6685
6686         blob = ndr_push_blob(push);
6687         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6688                 talloc_free(r);
6689                 return false;
6690         }
6691
6692         talloc_free(r);
6693
6694         return true;
6695 }
6696
6697 static bool api_spoolss_57(pipes_struct *p)
6698 {
6699         const struct ndr_interface_call *call;
6700         struct ndr_pull *pull;
6701         struct ndr_push *push;
6702         enum ndr_err_code ndr_err;
6703         DATA_BLOB blob;
6704         struct spoolss_57 *r;
6705
6706         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_57];
6707
6708         r = talloc(talloc_tos(), struct spoolss_57);
6709         if (r == NULL) {
6710                 return false;
6711         }
6712
6713         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6714                 talloc_free(r);
6715                 return false;
6716         }
6717
6718         pull = ndr_pull_init_blob(&blob, r, NULL);
6719         if (pull == NULL) {
6720                 talloc_free(r);
6721                 return false;
6722         }
6723
6724         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6725         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6726         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6727                 talloc_free(r);
6728                 return false;
6729         }
6730
6731         if (DEBUGLEVEL >= 10) {
6732                 NDR_PRINT_IN_DEBUG(spoolss_57, r);
6733         }
6734
6735         r->out.result = _spoolss_57(p, r);
6736
6737         if (p->rng_fault_state) {
6738                 talloc_free(r);
6739                 /* Return true here, srv_pipe_hnd.c will take care */
6740                 return true;
6741         }
6742
6743         if (DEBUGLEVEL >= 10) {
6744                 NDR_PRINT_OUT_DEBUG(spoolss_57, r);
6745         }
6746
6747         push = ndr_push_init_ctx(r, NULL);
6748         if (push == NULL) {
6749                 talloc_free(r);
6750                 return false;
6751         }
6752
6753         ndr_err = call->ndr_push(push, NDR_OUT, r);
6754         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6755                 talloc_free(r);
6756                 return false;
6757         }
6758
6759         blob = ndr_push_blob(push);
6760         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6761                 talloc_free(r);
6762                 return false;
6763         }
6764
6765         talloc_free(r);
6766
6767         return true;
6768 }
6769
6770 static bool api_spoolss_XcvData(pipes_struct *p)
6771 {
6772         const struct ndr_interface_call *call;
6773         struct ndr_pull *pull;
6774         struct ndr_push *push;
6775         enum ndr_err_code ndr_err;
6776         DATA_BLOB blob;
6777         struct spoolss_XcvData *r;
6778
6779         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_XCVDATA];
6780
6781         r = talloc(talloc_tos(), struct spoolss_XcvData);
6782         if (r == NULL) {
6783                 return false;
6784         }
6785
6786         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6787                 talloc_free(r);
6788                 return false;
6789         }
6790
6791         pull = ndr_pull_init_blob(&blob, r, NULL);
6792         if (pull == NULL) {
6793                 talloc_free(r);
6794                 return false;
6795         }
6796
6797         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6798         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6799         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6800                 talloc_free(r);
6801                 return false;
6802         }
6803
6804         if (DEBUGLEVEL >= 10) {
6805                 NDR_PRINT_IN_DEBUG(spoolss_XcvData, r);
6806         }
6807
6808         ZERO_STRUCT(r->out);
6809         r->out.status_code = r->in.status_code;
6810         r->out.out_data = talloc_zero_array(r, uint8_t, r->in.out_data_size);
6811         if (r->out.out_data == NULL) {
6812                 talloc_free(r);
6813                 return false;
6814         }
6815
6816         r->out.needed = talloc_zero(r, uint32_t);
6817         if (r->out.needed == NULL) {
6818                 talloc_free(r);
6819                 return false;
6820         }
6821
6822         r->out.result = _spoolss_XcvData(p, r);
6823
6824         if (p->rng_fault_state) {
6825                 talloc_free(r);
6826                 /* Return true here, srv_pipe_hnd.c will take care */
6827                 return true;
6828         }
6829
6830         if (DEBUGLEVEL >= 10) {
6831                 NDR_PRINT_OUT_DEBUG(spoolss_XcvData, r);
6832         }
6833
6834         push = ndr_push_init_ctx(r, NULL);
6835         if (push == NULL) {
6836                 talloc_free(r);
6837                 return false;
6838         }
6839
6840         ndr_err = call->ndr_push(push, NDR_OUT, r);
6841         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6842                 talloc_free(r);
6843                 return false;
6844         }
6845
6846         blob = ndr_push_blob(push);
6847         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6848                 talloc_free(r);
6849                 return false;
6850         }
6851
6852         talloc_free(r);
6853
6854         return true;
6855 }
6856
6857 static bool api_spoolss_AddPrinterDriverEx(pipes_struct *p)
6858 {
6859         const struct ndr_interface_call *call;
6860         struct ndr_pull *pull;
6861         struct ndr_push *push;
6862         enum ndr_err_code ndr_err;
6863         DATA_BLOB blob;
6864         struct spoolss_AddPrinterDriverEx *r;
6865
6866         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTERDRIVEREX];
6867
6868         r = talloc(talloc_tos(), struct spoolss_AddPrinterDriverEx);
6869         if (r == NULL) {
6870                 return false;
6871         }
6872
6873         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6874                 talloc_free(r);
6875                 return false;
6876         }
6877
6878         pull = ndr_pull_init_blob(&blob, r, NULL);
6879         if (pull == NULL) {
6880                 talloc_free(r);
6881                 return false;
6882         }
6883
6884         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6885         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6886         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6887                 talloc_free(r);
6888                 return false;
6889         }
6890
6891         if (DEBUGLEVEL >= 10) {
6892                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterDriverEx, r);
6893         }
6894
6895         r->out.result = _spoolss_AddPrinterDriverEx(p, r);
6896
6897         if (p->rng_fault_state) {
6898                 talloc_free(r);
6899                 /* Return true here, srv_pipe_hnd.c will take care */
6900                 return true;
6901         }
6902
6903         if (DEBUGLEVEL >= 10) {
6904                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterDriverEx, r);
6905         }
6906
6907         push = ndr_push_init_ctx(r, NULL);
6908         if (push == NULL) {
6909                 talloc_free(r);
6910                 return false;
6911         }
6912
6913         ndr_err = call->ndr_push(push, NDR_OUT, r);
6914         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6915                 talloc_free(r);
6916                 return false;
6917         }
6918
6919         blob = ndr_push_blob(push);
6920         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6921                 talloc_free(r);
6922                 return false;
6923         }
6924
6925         talloc_free(r);
6926
6927         return true;
6928 }
6929
6930 static bool api_spoolss_5a(pipes_struct *p)
6931 {
6932         const struct ndr_interface_call *call;
6933         struct ndr_pull *pull;
6934         struct ndr_push *push;
6935         enum ndr_err_code ndr_err;
6936         DATA_BLOB blob;
6937         struct spoolss_5a *r;
6938
6939         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5A];
6940
6941         r = talloc(talloc_tos(), struct spoolss_5a);
6942         if (r == NULL) {
6943                 return false;
6944         }
6945
6946         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6947                 talloc_free(r);
6948                 return false;
6949         }
6950
6951         pull = ndr_pull_init_blob(&blob, r, NULL);
6952         if (pull == NULL) {
6953                 talloc_free(r);
6954                 return false;
6955         }
6956
6957         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6958         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6959         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6960                 talloc_free(r);
6961                 return false;
6962         }
6963
6964         if (DEBUGLEVEL >= 10) {
6965                 NDR_PRINT_IN_DEBUG(spoolss_5a, r);
6966         }
6967
6968         r->out.result = _spoolss_5a(p, r);
6969
6970         if (p->rng_fault_state) {
6971                 talloc_free(r);
6972                 /* Return true here, srv_pipe_hnd.c will take care */
6973                 return true;
6974         }
6975
6976         if (DEBUGLEVEL >= 10) {
6977                 NDR_PRINT_OUT_DEBUG(spoolss_5a, r);
6978         }
6979
6980         push = ndr_push_init_ctx(r, NULL);
6981         if (push == NULL) {
6982                 talloc_free(r);
6983                 return false;
6984         }
6985
6986         ndr_err = call->ndr_push(push, NDR_OUT, r);
6987         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6988                 talloc_free(r);
6989                 return false;
6990         }
6991
6992         blob = ndr_push_blob(push);
6993         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6994                 talloc_free(r);
6995                 return false;
6996         }
6997
6998         talloc_free(r);
6999
7000         return true;
7001 }
7002
7003 static bool api_spoolss_5b(pipes_struct *p)
7004 {
7005         const struct ndr_interface_call *call;
7006         struct ndr_pull *pull;
7007         struct ndr_push *push;
7008         enum ndr_err_code ndr_err;
7009         DATA_BLOB blob;
7010         struct spoolss_5b *r;
7011
7012         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5B];
7013
7014         r = talloc(talloc_tos(), struct spoolss_5b);
7015         if (r == NULL) {
7016                 return false;
7017         }
7018
7019         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7020                 talloc_free(r);
7021                 return false;
7022         }
7023
7024         pull = ndr_pull_init_blob(&blob, r, NULL);
7025         if (pull == NULL) {
7026                 talloc_free(r);
7027                 return false;
7028         }
7029
7030         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7031         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7032         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7033                 talloc_free(r);
7034                 return false;
7035         }
7036
7037         if (DEBUGLEVEL >= 10) {
7038                 NDR_PRINT_IN_DEBUG(spoolss_5b, r);
7039         }
7040
7041         r->out.result = _spoolss_5b(p, r);
7042
7043         if (p->rng_fault_state) {
7044                 talloc_free(r);
7045                 /* Return true here, srv_pipe_hnd.c will take care */
7046                 return true;
7047         }
7048
7049         if (DEBUGLEVEL >= 10) {
7050                 NDR_PRINT_OUT_DEBUG(spoolss_5b, r);
7051         }
7052
7053         push = ndr_push_init_ctx(r, NULL);
7054         if (push == NULL) {
7055                 talloc_free(r);
7056                 return false;
7057         }
7058
7059         ndr_err = call->ndr_push(push, NDR_OUT, r);
7060         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7061                 talloc_free(r);
7062                 return false;
7063         }
7064
7065         blob = ndr_push_blob(push);
7066         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7067                 talloc_free(r);
7068                 return false;
7069         }
7070
7071         talloc_free(r);
7072
7073         return true;
7074 }
7075
7076 static bool api_spoolss_5c(pipes_struct *p)
7077 {
7078         const struct ndr_interface_call *call;
7079         struct ndr_pull *pull;
7080         struct ndr_push *push;
7081         enum ndr_err_code ndr_err;
7082         DATA_BLOB blob;
7083         struct spoolss_5c *r;
7084
7085         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5C];
7086
7087         r = talloc(talloc_tos(), struct spoolss_5c);
7088         if (r == NULL) {
7089                 return false;
7090         }
7091
7092         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7093                 talloc_free(r);
7094                 return false;
7095         }
7096
7097         pull = ndr_pull_init_blob(&blob, r, NULL);
7098         if (pull == NULL) {
7099                 talloc_free(r);
7100                 return false;
7101         }
7102
7103         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7104         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7105         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7106                 talloc_free(r);
7107                 return false;
7108         }
7109
7110         if (DEBUGLEVEL >= 10) {
7111                 NDR_PRINT_IN_DEBUG(spoolss_5c, r);
7112         }
7113
7114         r->out.result = _spoolss_5c(p, r);
7115
7116         if (p->rng_fault_state) {
7117                 talloc_free(r);
7118                 /* Return true here, srv_pipe_hnd.c will take care */
7119                 return true;
7120         }
7121
7122         if (DEBUGLEVEL >= 10) {
7123                 NDR_PRINT_OUT_DEBUG(spoolss_5c, r);
7124         }
7125
7126         push = ndr_push_init_ctx(r, NULL);
7127         if (push == NULL) {
7128                 talloc_free(r);
7129                 return false;
7130         }
7131
7132         ndr_err = call->ndr_push(push, NDR_OUT, r);
7133         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7134                 talloc_free(r);
7135                 return false;
7136         }
7137
7138         blob = ndr_push_blob(push);
7139         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7140                 talloc_free(r);
7141                 return false;
7142         }
7143
7144         talloc_free(r);
7145
7146         return true;
7147 }
7148
7149 static bool api_spoolss_5d(pipes_struct *p)
7150 {
7151         const struct ndr_interface_call *call;
7152         struct ndr_pull *pull;
7153         struct ndr_push *push;
7154         enum ndr_err_code ndr_err;
7155         DATA_BLOB blob;
7156         struct spoolss_5d *r;
7157
7158         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5D];
7159
7160         r = talloc(talloc_tos(), struct spoolss_5d);
7161         if (r == NULL) {
7162                 return false;
7163         }
7164
7165         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7166                 talloc_free(r);
7167                 return false;
7168         }
7169
7170         pull = ndr_pull_init_blob(&blob, r, NULL);
7171         if (pull == NULL) {
7172                 talloc_free(r);
7173                 return false;
7174         }
7175
7176         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7177         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7178         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7179                 talloc_free(r);
7180                 return false;
7181         }
7182
7183         if (DEBUGLEVEL >= 10) {
7184                 NDR_PRINT_IN_DEBUG(spoolss_5d, r);
7185         }
7186
7187         r->out.result = _spoolss_5d(p, r);
7188
7189         if (p->rng_fault_state) {
7190                 talloc_free(r);
7191                 /* Return true here, srv_pipe_hnd.c will take care */
7192                 return true;
7193         }
7194
7195         if (DEBUGLEVEL >= 10) {
7196                 NDR_PRINT_OUT_DEBUG(spoolss_5d, r);
7197         }
7198
7199         push = ndr_push_init_ctx(r, NULL);
7200         if (push == NULL) {
7201                 talloc_free(r);
7202                 return false;
7203         }
7204
7205         ndr_err = call->ndr_push(push, NDR_OUT, r);
7206         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7207                 talloc_free(r);
7208                 return false;
7209         }
7210
7211         blob = ndr_push_blob(push);
7212         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7213                 talloc_free(r);
7214                 return false;
7215         }
7216
7217         talloc_free(r);
7218
7219         return true;
7220 }
7221
7222 static bool api_spoolss_5e(pipes_struct *p)
7223 {
7224         const struct ndr_interface_call *call;
7225         struct ndr_pull *pull;
7226         struct ndr_push *push;
7227         enum ndr_err_code ndr_err;
7228         DATA_BLOB blob;
7229         struct spoolss_5e *r;
7230
7231         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5E];
7232
7233         r = talloc(talloc_tos(), struct spoolss_5e);
7234         if (r == NULL) {
7235                 return false;
7236         }
7237
7238         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7239                 talloc_free(r);
7240                 return false;
7241         }
7242
7243         pull = ndr_pull_init_blob(&blob, r, NULL);
7244         if (pull == NULL) {
7245                 talloc_free(r);
7246                 return false;
7247         }
7248
7249         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7250         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7251         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7252                 talloc_free(r);
7253                 return false;
7254         }
7255
7256         if (DEBUGLEVEL >= 10) {
7257                 NDR_PRINT_IN_DEBUG(spoolss_5e, r);
7258         }
7259
7260         r->out.result = _spoolss_5e(p, r);
7261
7262         if (p->rng_fault_state) {
7263                 talloc_free(r);
7264                 /* Return true here, srv_pipe_hnd.c will take care */
7265                 return true;
7266         }
7267
7268         if (DEBUGLEVEL >= 10) {
7269                 NDR_PRINT_OUT_DEBUG(spoolss_5e, r);
7270         }
7271
7272         push = ndr_push_init_ctx(r, NULL);
7273         if (push == NULL) {
7274                 talloc_free(r);
7275                 return false;
7276         }
7277
7278         ndr_err = call->ndr_push(push, NDR_OUT, r);
7279         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7280                 talloc_free(r);
7281                 return false;
7282         }
7283
7284         blob = ndr_push_blob(push);
7285         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7286                 talloc_free(r);
7287                 return false;
7288         }
7289
7290         talloc_free(r);
7291
7292         return true;
7293 }
7294
7295 static bool api_spoolss_5f(pipes_struct *p)
7296 {
7297         const struct ndr_interface_call *call;
7298         struct ndr_pull *pull;
7299         struct ndr_push *push;
7300         enum ndr_err_code ndr_err;
7301         DATA_BLOB blob;
7302         struct spoolss_5f *r;
7303
7304         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5F];
7305
7306         r = talloc(talloc_tos(), struct spoolss_5f);
7307         if (r == NULL) {
7308                 return false;
7309         }
7310
7311         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7312                 talloc_free(r);
7313                 return false;
7314         }
7315
7316         pull = ndr_pull_init_blob(&blob, r, NULL);
7317         if (pull == NULL) {
7318                 talloc_free(r);
7319                 return false;
7320         }
7321
7322         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7323         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7324         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7325                 talloc_free(r);
7326                 return false;
7327         }
7328
7329         if (DEBUGLEVEL >= 10) {
7330                 NDR_PRINT_IN_DEBUG(spoolss_5f, r);
7331         }
7332
7333         r->out.result = _spoolss_5f(p, r);
7334
7335         if (p->rng_fault_state) {
7336                 talloc_free(r);
7337                 /* Return true here, srv_pipe_hnd.c will take care */
7338                 return true;
7339         }
7340
7341         if (DEBUGLEVEL >= 10) {
7342                 NDR_PRINT_OUT_DEBUG(spoolss_5f, r);
7343         }
7344
7345         push = ndr_push_init_ctx(r, NULL);
7346         if (push == NULL) {
7347                 talloc_free(r);
7348                 return false;
7349         }
7350
7351         ndr_err = call->ndr_push(push, NDR_OUT, r);
7352         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7353                 talloc_free(r);
7354                 return false;
7355         }
7356
7357         blob = ndr_push_blob(push);
7358         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7359                 talloc_free(r);
7360                 return false;
7361         }
7362
7363         talloc_free(r);
7364
7365         return true;
7366 }
7367
7368
7369 /* Tables */
7370 static struct api_struct api_spoolss_cmds[] = 
7371 {
7372         {"SPOOLSS_ENUMPRINTERS", NDR_SPOOLSS_ENUMPRINTERS, api_spoolss_EnumPrinters},
7373         {"SPOOLSS_OPENPRINTER", NDR_SPOOLSS_OPENPRINTER, api_spoolss_OpenPrinter},
7374         {"SPOOLSS_SETJOB", NDR_SPOOLSS_SETJOB, api_spoolss_SetJob},
7375         {"SPOOLSS_GETJOB", NDR_SPOOLSS_GETJOB, api_spoolss_GetJob},
7376         {"SPOOLSS_ENUMJOBS", NDR_SPOOLSS_ENUMJOBS, api_spoolss_EnumJobs},
7377         {"SPOOLSS_ADDPRINTER", NDR_SPOOLSS_ADDPRINTER, api_spoolss_AddPrinter},
7378         {"SPOOLSS_DELETEPRINTER", NDR_SPOOLSS_DELETEPRINTER, api_spoolss_DeletePrinter},
7379         {"SPOOLSS_SETPRINTER", NDR_SPOOLSS_SETPRINTER, api_spoolss_SetPrinter},
7380         {"SPOOLSS_GETPRINTER", NDR_SPOOLSS_GETPRINTER, api_spoolss_GetPrinter},
7381         {"SPOOLSS_ADDPRINTERDRIVER", NDR_SPOOLSS_ADDPRINTERDRIVER, api_spoolss_AddPrinterDriver},
7382         {"SPOOLSS_ENUMPRINTERDRIVERS", NDR_SPOOLSS_ENUMPRINTERDRIVERS, api_spoolss_EnumPrinterDrivers},
7383         {"SPOOLSS_GETPRINTERDRIVER", NDR_SPOOLSS_GETPRINTERDRIVER, api_spoolss_GetPrinterDriver},
7384         {"SPOOLSS_GETPRINTERDRIVERDIRECTORY", NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY, api_spoolss_GetPrinterDriverDirectory},
7385         {"SPOOLSS_DELETEPRINTERDRIVER", NDR_SPOOLSS_DELETEPRINTERDRIVER, api_spoolss_DeletePrinterDriver},
7386         {"SPOOLSS_ADDPRINTPROCESSOR", NDR_SPOOLSS_ADDPRINTPROCESSOR, api_spoolss_AddPrintProcessor},
7387         {"SPOOLSS_ENUMPRINTPROCESSORS", NDR_SPOOLSS_ENUMPRINTPROCESSORS, api_spoolss_EnumPrintProcessors},
7388         {"SPOOLSS_GETPRINTPROCESSORDIRECTORY", NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY, api_spoolss_GetPrintProcessorDirectory},
7389         {"SPOOLSS_STARTDOCPRINTER", NDR_SPOOLSS_STARTDOCPRINTER, api_spoolss_StartDocPrinter},
7390         {"SPOOLSS_STARTPAGEPRINTER", NDR_SPOOLSS_STARTPAGEPRINTER, api_spoolss_StartPagePrinter},
7391         {"SPOOLSS_WRITEPRINTER", NDR_SPOOLSS_WRITEPRINTER, api_spoolss_WritePrinter},
7392         {"SPOOLSS_ENDPAGEPRINTER", NDR_SPOOLSS_ENDPAGEPRINTER, api_spoolss_EndPagePrinter},
7393         {"SPOOLSS_ABORTPRINTER", NDR_SPOOLSS_ABORTPRINTER, api_spoolss_AbortPrinter},
7394         {"SPOOLSS_READPRINTER", NDR_SPOOLSS_READPRINTER, api_spoolss_ReadPrinter},
7395         {"SPOOLSS_ENDDOCPRINTER", NDR_SPOOLSS_ENDDOCPRINTER, api_spoolss_EndDocPrinter},
7396         {"SPOOLSS_ADDJOB", NDR_SPOOLSS_ADDJOB, api_spoolss_AddJob},
7397         {"SPOOLSS_SCHEDULEJOB", NDR_SPOOLSS_SCHEDULEJOB, api_spoolss_ScheduleJob},
7398         {"SPOOLSS_GETPRINTERDATA", NDR_SPOOLSS_GETPRINTERDATA, api_spoolss_GetPrinterData},
7399         {"SPOOLSS_SETPRINTERDATA", NDR_SPOOLSS_SETPRINTERDATA, api_spoolss_SetPrinterData},
7400         {"SPOOLSS_WAITFORPRINTERCHANGE", NDR_SPOOLSS_WAITFORPRINTERCHANGE, api_spoolss_WaitForPrinterChange},
7401         {"SPOOLSS_CLOSEPRINTER", NDR_SPOOLSS_CLOSEPRINTER, api_spoolss_ClosePrinter},
7402         {"SPOOLSS_ADDFORM", NDR_SPOOLSS_ADDFORM, api_spoolss_AddForm},
7403         {"SPOOLSS_DELETEFORM", NDR_SPOOLSS_DELETEFORM, api_spoolss_DeleteForm},
7404         {"SPOOLSS_GETFORM", NDR_SPOOLSS_GETFORM, api_spoolss_GetForm},
7405         {"SPOOLSS_SETFORM", NDR_SPOOLSS_SETFORM, api_spoolss_SetForm},
7406         {"SPOOLSS_ENUMFORMS", NDR_SPOOLSS_ENUMFORMS, api_spoolss_EnumForms},
7407         {"SPOOLSS_ENUMPORTS", NDR_SPOOLSS_ENUMPORTS, api_spoolss_EnumPorts},
7408         {"SPOOLSS_ENUMMONITORS", NDR_SPOOLSS_ENUMMONITORS, api_spoolss_EnumMonitors},
7409         {"SPOOLSS_ADDPORT", NDR_SPOOLSS_ADDPORT, api_spoolss_AddPort},
7410         {"SPOOLSS_CONFIGUREPORT", NDR_SPOOLSS_CONFIGUREPORT, api_spoolss_ConfigurePort},
7411         {"SPOOLSS_DELETEPORT", NDR_SPOOLSS_DELETEPORT, api_spoolss_DeletePort},
7412         {"SPOOLSS_CREATEPRINTERIC", NDR_SPOOLSS_CREATEPRINTERIC, api_spoolss_CreatePrinterIC},
7413         {"SPOOLSS_PLAYGDISCRIPTONPRINTERIC", NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC, api_spoolss_PlayGDIScriptOnPrinterIC},
7414         {"SPOOLSS_DELETEPRINTERIC", NDR_SPOOLSS_DELETEPRINTERIC, api_spoolss_DeletePrinterIC},
7415         {"SPOOLSS_ADDPRINTERCONNECTION", NDR_SPOOLSS_ADDPRINTERCONNECTION, api_spoolss_AddPrinterConnection},
7416         {"SPOOLSS_DELETEPRINTERCONNECTION", NDR_SPOOLSS_DELETEPRINTERCONNECTION, api_spoolss_DeletePrinterConnection},
7417         {"SPOOLSS_PRINTERMESSAGEBOX", NDR_SPOOLSS_PRINTERMESSAGEBOX, api_spoolss_PrinterMessageBox},
7418         {"SPOOLSS_ADDMONITOR", NDR_SPOOLSS_ADDMONITOR, api_spoolss_AddMonitor},
7419         {"SPOOLSS_DELETEMONITOR", NDR_SPOOLSS_DELETEMONITOR, api_spoolss_DeleteMonitor},
7420         {"SPOOLSS_DELETEPRINTPROCESSOR", NDR_SPOOLSS_DELETEPRINTPROCESSOR, api_spoolss_DeletePrintProcessor},
7421         {"SPOOLSS_ADDPRINTPROVIDOR", NDR_SPOOLSS_ADDPRINTPROVIDOR, api_spoolss_AddPrintProvidor},
7422         {"SPOOLSS_DELETEPRINTPROVIDOR", NDR_SPOOLSS_DELETEPRINTPROVIDOR, api_spoolss_DeletePrintProvidor},
7423         {"SPOOLSS_ENUMPRINTPROCDATATYPES", NDR_SPOOLSS_ENUMPRINTPROCDATATYPES, api_spoolss_EnumPrintProcDataTypes},
7424         {"SPOOLSS_RESETPRINTER", NDR_SPOOLSS_RESETPRINTER, api_spoolss_ResetPrinter},
7425         {"SPOOLSS_GETPRINTERDRIVER2", NDR_SPOOLSS_GETPRINTERDRIVER2, api_spoolss_GetPrinterDriver2},
7426         {"SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION, api_spoolss_FindFirstPrinterChangeNotification},
7427         {"SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION, api_spoolss_FindNextPrinterChangeNotification},
7428         {"SPOOLSS_FINDCLOSEPRINTERNOTIFY", NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY, api_spoolss_FindClosePrinterNotify},
7429         {"SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD", NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD, api_spoolss_RouterFindFirstPrinterChangeNotificationOld},
7430         {"SPOOLSS_REPLYOPENPRINTER", NDR_SPOOLSS_REPLYOPENPRINTER, api_spoolss_ReplyOpenPrinter},
7431         {"SPOOLSS_ROUTERREPLYPRINTER", NDR_SPOOLSS_ROUTERREPLYPRINTER, api_spoolss_RouterReplyPrinter},
7432         {"SPOOLSS_REPLYCLOSEPRINTER", NDR_SPOOLSS_REPLYCLOSEPRINTER, api_spoolss_ReplyClosePrinter},
7433         {"SPOOLSS_ADDPORTEX", NDR_SPOOLSS_ADDPORTEX, api_spoolss_AddPortEx},
7434         {"SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION, api_spoolss_RouterFindFirstPrinterChangeNotification},
7435         {"SPOOLSS_SPOOLERINIT", NDR_SPOOLSS_SPOOLERINIT, api_spoolss_SpoolerInit},
7436         {"SPOOLSS_RESETPRINTEREX", NDR_SPOOLSS_RESETPRINTEREX, api_spoolss_ResetPrinterEx},
7437         {"SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX", NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX, api_spoolss_RemoteFindFirstPrinterChangeNotifyEx},
7438         {"SPOOLSS_ROUTERREPLYPRINTEREX", NDR_SPOOLSS_ROUTERREPLYPRINTEREX, api_spoolss_RouterReplyPrinterEx},
7439         {"SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY", NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY, api_spoolss_RouterRefreshPrinterChangeNotify},
7440         {"SPOOLSS_44", NDR_SPOOLSS_44, api_spoolss_44},
7441         {"SPOOLSS_OPENPRINTEREX", NDR_SPOOLSS_OPENPRINTEREX, api_spoolss_OpenPrinterEx},
7442         {"SPOOLSS_ADDPRINTEREX", NDR_SPOOLSS_ADDPRINTEREX, api_spoolss_AddPrinterEx},
7443         {"SPOOLSS_47", NDR_SPOOLSS_47, api_spoolss_47},
7444         {"SPOOLSS_ENUMPRINTERDATA", NDR_SPOOLSS_ENUMPRINTERDATA, api_spoolss_EnumPrinterData},
7445         {"SPOOLSS_DELETEPRINTERDATA", NDR_SPOOLSS_DELETEPRINTERDATA, api_spoolss_DeletePrinterData},
7446         {"SPOOLSS_4A", NDR_SPOOLSS_4A, api_spoolss_4a},
7447         {"SPOOLSS_4B", NDR_SPOOLSS_4B, api_spoolss_4b},
7448         {"SPOOLSS_4C", NDR_SPOOLSS_4C, api_spoolss_4c},
7449         {"SPOOLSS_SETPRINTERDATAEX", NDR_SPOOLSS_SETPRINTERDATAEX, api_spoolss_SetPrinterDataEx},
7450         {"SPOOLSS_GETPRINTERDATAEX", NDR_SPOOLSS_GETPRINTERDATAEX, api_spoolss_GetPrinterDataEx},
7451         {"SPOOLSS_ENUMPRINTERDATAEX", NDR_SPOOLSS_ENUMPRINTERDATAEX, api_spoolss_EnumPrinterDataEx},
7452         {"SPOOLSS_ENUMPRINTERKEY", NDR_SPOOLSS_ENUMPRINTERKEY, api_spoolss_EnumPrinterKey},
7453         {"SPOOLSS_DELETEPRINTERDATAEX", NDR_SPOOLSS_DELETEPRINTERDATAEX, api_spoolss_DeletePrinterDataEx},
7454         {"SPOOLSS_DELETEPRINTERKEY", NDR_SPOOLSS_DELETEPRINTERKEY, api_spoolss_DeletePrinterKey},
7455         {"SPOOLSS_53", NDR_SPOOLSS_53, api_spoolss_53},
7456         {"SPOOLSS_DELETEPRINTERDRIVEREX", NDR_SPOOLSS_DELETEPRINTERDRIVEREX, api_spoolss_DeletePrinterDriverEx},
7457         {"SPOOLSS_55", NDR_SPOOLSS_55, api_spoolss_55},
7458         {"SPOOLSS_56", NDR_SPOOLSS_56, api_spoolss_56},
7459         {"SPOOLSS_57", NDR_SPOOLSS_57, api_spoolss_57},
7460         {"SPOOLSS_XCVDATA", NDR_SPOOLSS_XCVDATA, api_spoolss_XcvData},
7461         {"SPOOLSS_ADDPRINTERDRIVEREX", NDR_SPOOLSS_ADDPRINTERDRIVEREX, api_spoolss_AddPrinterDriverEx},
7462         {"SPOOLSS_5A", NDR_SPOOLSS_5A, api_spoolss_5a},
7463         {"SPOOLSS_5B", NDR_SPOOLSS_5B, api_spoolss_5b},
7464         {"SPOOLSS_5C", NDR_SPOOLSS_5C, api_spoolss_5c},
7465         {"SPOOLSS_5D", NDR_SPOOLSS_5D, api_spoolss_5d},
7466         {"SPOOLSS_5E", NDR_SPOOLSS_5E, api_spoolss_5e},
7467         {"SPOOLSS_5F", NDR_SPOOLSS_5F, api_spoolss_5f},
7468 };
7469
7470 void spoolss_get_pipe_fns(struct api_struct **fns, int *n_fns)
7471 {
7472         *fns = api_spoolss_cmds;
7473         *n_fns = sizeof(api_spoolss_cmds) / sizeof(struct api_struct);
7474 }
7475
7476 NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
7477 {
7478         if (cli->pipes_struct == NULL) {
7479                 return NT_STATUS_INVALID_PARAMETER;
7480         }
7481
7482         switch (opnum)
7483         {
7484                 case NDR_SPOOLSS_ENUMPRINTERS: {
7485                         struct spoolss_EnumPrinters *r = (struct spoolss_EnumPrinters *)_r;
7486                         ZERO_STRUCT(r->out);
7487                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_PrinterInfo, r->out.count);
7488                         if (r->out.info == NULL) {
7489                         return NT_STATUS_NO_MEMORY;
7490                         }
7491
7492                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7493                         if (r->out.needed == NULL) {
7494                         return NT_STATUS_NO_MEMORY;
7495                         }
7496
7497                         r->out.result = _spoolss_EnumPrinters(cli->pipes_struct, r);
7498                         return NT_STATUS_OK;
7499                 }
7500
7501                 case NDR_SPOOLSS_OPENPRINTER: {
7502                         struct spoolss_OpenPrinter *r = (struct spoolss_OpenPrinter *)_r;
7503                         ZERO_STRUCT(r->out);
7504                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
7505                         if (r->out.handle == NULL) {
7506                         return NT_STATUS_NO_MEMORY;
7507                         }
7508
7509                         r->out.result = _spoolss_OpenPrinter(cli->pipes_struct, r);
7510                         return NT_STATUS_OK;
7511                 }
7512
7513                 case NDR_SPOOLSS_SETJOB: {
7514                         struct spoolss_SetJob *r = (struct spoolss_SetJob *)_r;
7515                         r->out.result = _spoolss_SetJob(cli->pipes_struct, r);
7516                         return NT_STATUS_OK;
7517                 }
7518
7519                 case NDR_SPOOLSS_GETJOB: {
7520                         struct spoolss_GetJob *r = (struct spoolss_GetJob *)_r;
7521                         ZERO_STRUCT(r->out);
7522                         r->out.info = talloc_zero(mem_ctx, union spoolss_JobInfo);
7523                         if (r->out.info == NULL) {
7524                         return NT_STATUS_NO_MEMORY;
7525                         }
7526
7527                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7528                         if (r->out.needed == NULL) {
7529                         return NT_STATUS_NO_MEMORY;
7530                         }
7531
7532                         r->out.result = _spoolss_GetJob(cli->pipes_struct, r);
7533                         return NT_STATUS_OK;
7534                 }
7535
7536                 case NDR_SPOOLSS_ENUMJOBS: {
7537                         struct spoolss_EnumJobs *r = (struct spoolss_EnumJobs *)_r;
7538                         ZERO_STRUCT(r->out);
7539                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_JobInfo, r->out.count);
7540                         if (r->out.info == NULL) {
7541                         return NT_STATUS_NO_MEMORY;
7542                         }
7543
7544                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7545                         if (r->out.needed == NULL) {
7546                         return NT_STATUS_NO_MEMORY;
7547                         }
7548
7549                         r->out.result = _spoolss_EnumJobs(cli->pipes_struct, r);
7550                         return NT_STATUS_OK;
7551                 }
7552
7553                 case NDR_SPOOLSS_ADDPRINTER: {
7554                         struct spoolss_AddPrinter *r = (struct spoolss_AddPrinter *)_r;
7555                         r->out.result = _spoolss_AddPrinter(cli->pipes_struct, r);
7556                         return NT_STATUS_OK;
7557                 }
7558
7559                 case NDR_SPOOLSS_DELETEPRINTER: {
7560                         struct spoolss_DeletePrinter *r = (struct spoolss_DeletePrinter *)_r;
7561                         r->out.result = _spoolss_DeletePrinter(cli->pipes_struct, r);
7562                         return NT_STATUS_OK;
7563                 }
7564
7565                 case NDR_SPOOLSS_SETPRINTER: {
7566                         struct spoolss_SetPrinter *r = (struct spoolss_SetPrinter *)_r;
7567                         r->out.result = _spoolss_SetPrinter(cli->pipes_struct, r);
7568                         return NT_STATUS_OK;
7569                 }
7570
7571                 case NDR_SPOOLSS_GETPRINTER: {
7572                         struct spoolss_GetPrinter *r = (struct spoolss_GetPrinter *)_r;
7573                         ZERO_STRUCT(r->out);
7574                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrinterInfo);
7575                         if (r->out.info == NULL) {
7576                         return NT_STATUS_NO_MEMORY;
7577                         }
7578
7579                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7580                         if (r->out.needed == NULL) {
7581                         return NT_STATUS_NO_MEMORY;
7582                         }
7583
7584                         r->out.result = _spoolss_GetPrinter(cli->pipes_struct, r);
7585                         return NT_STATUS_OK;
7586                 }
7587
7588                 case NDR_SPOOLSS_ADDPRINTERDRIVER: {
7589                         struct spoolss_AddPrinterDriver *r = (struct spoolss_AddPrinterDriver *)_r;
7590                         r->out.result = _spoolss_AddPrinterDriver(cli->pipes_struct, r);
7591                         return NT_STATUS_OK;
7592                 }
7593
7594                 case NDR_SPOOLSS_ENUMPRINTERDRIVERS: {
7595                         struct spoolss_EnumPrinterDrivers *r = (struct spoolss_EnumPrinterDrivers *)_r;
7596                         ZERO_STRUCT(r->out);
7597                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_DriverInfo, r->out.count);
7598                         if (r->out.info == NULL) {
7599                         return NT_STATUS_NO_MEMORY;
7600                         }
7601
7602                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7603                         if (r->out.needed == NULL) {
7604                         return NT_STATUS_NO_MEMORY;
7605                         }
7606
7607                         r->out.result = _spoolss_EnumPrinterDrivers(cli->pipes_struct, r);
7608                         return NT_STATUS_OK;
7609                 }
7610
7611                 case NDR_SPOOLSS_GETPRINTERDRIVER: {
7612                         struct spoolss_GetPrinterDriver *r = (struct spoolss_GetPrinterDriver *)_r;
7613                         r->out.result = _spoolss_GetPrinterDriver(cli->pipes_struct, r);
7614                         return NT_STATUS_OK;
7615                 }
7616
7617                 case NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY: {
7618                         struct spoolss_GetPrinterDriverDirectory *r = (struct spoolss_GetPrinterDriverDirectory *)_r;
7619                         ZERO_STRUCT(r->out);
7620                         r->out.info = talloc_zero(mem_ctx, union spoolss_DriverDirectoryInfo);
7621                         if (r->out.info == NULL) {
7622                         return NT_STATUS_NO_MEMORY;
7623                         }
7624
7625                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7626                         if (r->out.needed == NULL) {
7627                         return NT_STATUS_NO_MEMORY;
7628                         }
7629
7630                         r->out.result = _spoolss_GetPrinterDriverDirectory(cli->pipes_struct, r);
7631                         return NT_STATUS_OK;
7632                 }
7633
7634                 case NDR_SPOOLSS_DELETEPRINTERDRIVER: {
7635                         struct spoolss_DeletePrinterDriver *r = (struct spoolss_DeletePrinterDriver *)_r;
7636                         r->out.result = _spoolss_DeletePrinterDriver(cli->pipes_struct, r);
7637                         return NT_STATUS_OK;
7638                 }
7639
7640                 case NDR_SPOOLSS_ADDPRINTPROCESSOR: {
7641                         struct spoolss_AddPrintProcessor *r = (struct spoolss_AddPrintProcessor *)_r;
7642                         r->out.result = _spoolss_AddPrintProcessor(cli->pipes_struct, r);
7643                         return NT_STATUS_OK;
7644                 }
7645
7646                 case NDR_SPOOLSS_ENUMPRINTPROCESSORS: {
7647                         struct spoolss_EnumPrintProcessors *r = (struct spoolss_EnumPrintProcessors *)_r;
7648                         ZERO_STRUCT(r->out);
7649                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_PrintProcessorInfo, r->out.count);
7650                         if (r->out.info == NULL) {
7651                         return NT_STATUS_NO_MEMORY;
7652                         }
7653
7654                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7655                         if (r->out.needed == NULL) {
7656                         return NT_STATUS_NO_MEMORY;
7657                         }
7658
7659                         r->out.result = _spoolss_EnumPrintProcessors(cli->pipes_struct, r);
7660                         return NT_STATUS_OK;
7661                 }
7662
7663                 case NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY: {
7664                         struct spoolss_GetPrintProcessorDirectory *r = (struct spoolss_GetPrintProcessorDirectory *)_r;
7665                         r->out.result = _spoolss_GetPrintProcessorDirectory(cli->pipes_struct, r);
7666                         return NT_STATUS_OK;
7667                 }
7668
7669                 case NDR_SPOOLSS_STARTDOCPRINTER: {
7670                         struct spoolss_StartDocPrinter *r = (struct spoolss_StartDocPrinter *)_r;
7671                         ZERO_STRUCT(r->out);
7672                         r->out.job_id = talloc_zero(mem_ctx, uint32_t);
7673                         if (r->out.job_id == NULL) {
7674                         return NT_STATUS_NO_MEMORY;
7675                         }
7676
7677                         r->out.result = _spoolss_StartDocPrinter(cli->pipes_struct, r);
7678                         return NT_STATUS_OK;
7679                 }
7680
7681                 case NDR_SPOOLSS_STARTPAGEPRINTER: {
7682                         struct spoolss_StartPagePrinter *r = (struct spoolss_StartPagePrinter *)_r;
7683                         r->out.result = _spoolss_StartPagePrinter(cli->pipes_struct, r);
7684                         return NT_STATUS_OK;
7685                 }
7686
7687                 case NDR_SPOOLSS_WRITEPRINTER: {
7688                         struct spoolss_WritePrinter *r = (struct spoolss_WritePrinter *)_r;
7689                         ZERO_STRUCT(r->out);
7690                         r->out.num_written = talloc_zero(mem_ctx, uint32_t);
7691                         if (r->out.num_written == NULL) {
7692                         return NT_STATUS_NO_MEMORY;
7693                         }
7694
7695                         r->out.result = _spoolss_WritePrinter(cli->pipes_struct, r);
7696                         return NT_STATUS_OK;
7697                 }
7698
7699                 case NDR_SPOOLSS_ENDPAGEPRINTER: {
7700                         struct spoolss_EndPagePrinter *r = (struct spoolss_EndPagePrinter *)_r;
7701                         r->out.result = _spoolss_EndPagePrinter(cli->pipes_struct, r);
7702                         return NT_STATUS_OK;
7703                 }
7704
7705                 case NDR_SPOOLSS_ABORTPRINTER: {
7706                         struct spoolss_AbortPrinter *r = (struct spoolss_AbortPrinter *)_r;
7707                         r->out.result = _spoolss_AbortPrinter(cli->pipes_struct, r);
7708                         return NT_STATUS_OK;
7709                 }
7710
7711                 case NDR_SPOOLSS_READPRINTER: {
7712                         struct spoolss_ReadPrinter *r = (struct spoolss_ReadPrinter *)_r;
7713                         ZERO_STRUCT(r->out);
7714                         r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.data_size);
7715                         if (r->out.data == NULL) {
7716                         return NT_STATUS_NO_MEMORY;
7717                         }
7718
7719                         r->out._data_size = talloc_zero(mem_ctx, uint32_t);
7720                         if (r->out._data_size == NULL) {
7721                         return NT_STATUS_NO_MEMORY;
7722                         }
7723
7724                         r->out.result = _spoolss_ReadPrinter(cli->pipes_struct, r);
7725                         return NT_STATUS_OK;
7726                 }
7727
7728                 case NDR_SPOOLSS_ENDDOCPRINTER: {
7729                         struct spoolss_EndDocPrinter *r = (struct spoolss_EndDocPrinter *)_r;
7730                         r->out.result = _spoolss_EndDocPrinter(cli->pipes_struct, r);
7731                         return NT_STATUS_OK;
7732                 }
7733
7734                 case NDR_SPOOLSS_ADDJOB: {
7735                         struct spoolss_AddJob *r = (struct spoolss_AddJob *)_r;
7736                         ZERO_STRUCT(r->out);
7737                         r->out.buffer = r->in.buffer;
7738                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7739                         if (r->out.needed == NULL) {
7740                         return NT_STATUS_NO_MEMORY;
7741                         }
7742
7743                         r->out.result = _spoolss_AddJob(cli->pipes_struct, r);
7744                         return NT_STATUS_OK;
7745                 }
7746
7747                 case NDR_SPOOLSS_SCHEDULEJOB: {
7748                         struct spoolss_ScheduleJob *r = (struct spoolss_ScheduleJob *)_r;
7749                         r->out.result = _spoolss_ScheduleJob(cli->pipes_struct, r);
7750                         return NT_STATUS_OK;
7751                 }
7752
7753                 case NDR_SPOOLSS_GETPRINTERDATA: {
7754                         struct spoolss_GetPrinterData *r = (struct spoolss_GetPrinterData *)_r;
7755                         ZERO_STRUCT(r->out);
7756                         r->out.type = talloc_zero(mem_ctx, enum spoolss_PrinterDataType);
7757                         if (r->out.type == NULL) {
7758                         return NT_STATUS_NO_MEMORY;
7759                         }
7760
7761                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7762                         if (r->out.needed == NULL) {
7763                         return NT_STATUS_NO_MEMORY;
7764                         }
7765
7766                         r->out.result = _spoolss_GetPrinterData(cli->pipes_struct, r);
7767                         return NT_STATUS_OK;
7768                 }
7769
7770                 case NDR_SPOOLSS_SETPRINTERDATA: {
7771                         struct spoolss_SetPrinterData *r = (struct spoolss_SetPrinterData *)_r;
7772                         r->out.result = _spoolss_SetPrinterData(cli->pipes_struct, r);
7773                         return NT_STATUS_OK;
7774                 }
7775
7776                 case NDR_SPOOLSS_WAITFORPRINTERCHANGE: {
7777                         struct spoolss_WaitForPrinterChange *r = (struct spoolss_WaitForPrinterChange *)_r;
7778                         r->out.result = _spoolss_WaitForPrinterChange(cli->pipes_struct, r);
7779                         return NT_STATUS_OK;
7780                 }
7781
7782                 case NDR_SPOOLSS_CLOSEPRINTER: {
7783                         struct spoolss_ClosePrinter *r = (struct spoolss_ClosePrinter *)_r;
7784                         ZERO_STRUCT(r->out);
7785                         r->out.handle = r->in.handle;
7786                         r->out.result = _spoolss_ClosePrinter(cli->pipes_struct, r);
7787                         return NT_STATUS_OK;
7788                 }
7789
7790                 case NDR_SPOOLSS_ADDFORM: {
7791                         struct spoolss_AddForm *r = (struct spoolss_AddForm *)_r;
7792                         r->out.result = _spoolss_AddForm(cli->pipes_struct, r);
7793                         return NT_STATUS_OK;
7794                 }
7795
7796                 case NDR_SPOOLSS_DELETEFORM: {
7797                         struct spoolss_DeleteForm *r = (struct spoolss_DeleteForm *)_r;
7798                         r->out.result = _spoolss_DeleteForm(cli->pipes_struct, r);
7799                         return NT_STATUS_OK;
7800                 }
7801
7802                 case NDR_SPOOLSS_GETFORM: {
7803                         struct spoolss_GetForm *r = (struct spoolss_GetForm *)_r;
7804                         ZERO_STRUCT(r->out);
7805                         r->out.info = talloc_zero(mem_ctx, union spoolss_FormInfo);
7806                         if (r->out.info == NULL) {
7807                         return NT_STATUS_NO_MEMORY;
7808                         }
7809
7810                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7811                         if (r->out.needed == NULL) {
7812                         return NT_STATUS_NO_MEMORY;
7813                         }
7814
7815                         r->out.result = _spoolss_GetForm(cli->pipes_struct, r);
7816                         return NT_STATUS_OK;
7817                 }
7818
7819                 case NDR_SPOOLSS_SETFORM: {
7820                         struct spoolss_SetForm *r = (struct spoolss_SetForm *)_r;
7821                         r->out.result = _spoolss_SetForm(cli->pipes_struct, r);
7822                         return NT_STATUS_OK;
7823                 }
7824
7825                 case NDR_SPOOLSS_ENUMFORMS: {
7826                         struct spoolss_EnumForms *r = (struct spoolss_EnumForms *)_r;
7827                         ZERO_STRUCT(r->out);
7828                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_FormInfo, r->out.count);
7829                         if (r->out.info == NULL) {
7830                         return NT_STATUS_NO_MEMORY;
7831                         }
7832
7833                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7834                         if (r->out.needed == NULL) {
7835                         return NT_STATUS_NO_MEMORY;
7836                         }
7837
7838                         r->out.result = _spoolss_EnumForms(cli->pipes_struct, r);
7839                         return NT_STATUS_OK;
7840                 }
7841
7842                 case NDR_SPOOLSS_ENUMPORTS: {
7843                         struct spoolss_EnumPorts *r = (struct spoolss_EnumPorts *)_r;
7844                         ZERO_STRUCT(r->out);
7845                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_PortInfo, r->out.count);
7846                         if (r->out.info == NULL) {
7847                         return NT_STATUS_NO_MEMORY;
7848                         }
7849
7850                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7851                         if (r->out.needed == NULL) {
7852                         return NT_STATUS_NO_MEMORY;
7853                         }
7854
7855                         r->out.result = _spoolss_EnumPorts(cli->pipes_struct, r);
7856                         return NT_STATUS_OK;
7857                 }
7858
7859                 case NDR_SPOOLSS_ENUMMONITORS: {
7860                         struct spoolss_EnumMonitors *r = (struct spoolss_EnumMonitors *)_r;
7861                         ZERO_STRUCT(r->out);
7862                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_MonitorInfo, r->out.count);
7863                         if (r->out.info == NULL) {
7864                         return NT_STATUS_NO_MEMORY;
7865                         }
7866
7867                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7868                         if (r->out.needed == NULL) {
7869                         return NT_STATUS_NO_MEMORY;
7870                         }
7871
7872                         r->out.result = _spoolss_EnumMonitors(cli->pipes_struct, r);
7873                         return NT_STATUS_OK;
7874                 }
7875
7876                 case NDR_SPOOLSS_ADDPORT: {
7877                         struct spoolss_AddPort *r = (struct spoolss_AddPort *)_r;
7878                         r->out.result = _spoolss_AddPort(cli->pipes_struct, r);
7879                         return NT_STATUS_OK;
7880                 }
7881
7882                 case NDR_SPOOLSS_CONFIGUREPORT: {
7883                         struct spoolss_ConfigurePort *r = (struct spoolss_ConfigurePort *)_r;
7884                         r->out.result = _spoolss_ConfigurePort(cli->pipes_struct, r);
7885                         return NT_STATUS_OK;
7886                 }
7887
7888                 case NDR_SPOOLSS_DELETEPORT: {
7889                         struct spoolss_DeletePort *r = (struct spoolss_DeletePort *)_r;
7890                         r->out.result = _spoolss_DeletePort(cli->pipes_struct, r);
7891                         return NT_STATUS_OK;
7892                 }
7893
7894                 case NDR_SPOOLSS_CREATEPRINTERIC: {
7895                         struct spoolss_CreatePrinterIC *r = (struct spoolss_CreatePrinterIC *)_r;
7896                         r->out.result = _spoolss_CreatePrinterIC(cli->pipes_struct, r);
7897                         return NT_STATUS_OK;
7898                 }
7899
7900                 case NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC: {
7901                         struct spoolss_PlayGDIScriptOnPrinterIC *r = (struct spoolss_PlayGDIScriptOnPrinterIC *)_r;
7902                         r->out.result = _spoolss_PlayGDIScriptOnPrinterIC(cli->pipes_struct, r);
7903                         return NT_STATUS_OK;
7904                 }
7905
7906                 case NDR_SPOOLSS_DELETEPRINTERIC: {
7907                         struct spoolss_DeletePrinterIC *r = (struct spoolss_DeletePrinterIC *)_r;
7908                         r->out.result = _spoolss_DeletePrinterIC(cli->pipes_struct, r);
7909                         return NT_STATUS_OK;
7910                 }
7911
7912                 case NDR_SPOOLSS_ADDPRINTERCONNECTION: {
7913                         struct spoolss_AddPrinterConnection *r = (struct spoolss_AddPrinterConnection *)_r;
7914                         r->out.result = _spoolss_AddPrinterConnection(cli->pipes_struct, r);
7915                         return NT_STATUS_OK;
7916                 }
7917
7918                 case NDR_SPOOLSS_DELETEPRINTERCONNECTION: {
7919                         struct spoolss_DeletePrinterConnection *r = (struct spoolss_DeletePrinterConnection *)_r;
7920                         r->out.result = _spoolss_DeletePrinterConnection(cli->pipes_struct, r);
7921                         return NT_STATUS_OK;
7922                 }
7923
7924                 case NDR_SPOOLSS_PRINTERMESSAGEBOX: {
7925                         struct spoolss_PrinterMessageBox *r = (struct spoolss_PrinterMessageBox *)_r;
7926                         r->out.result = _spoolss_PrinterMessageBox(cli->pipes_struct, r);
7927                         return NT_STATUS_OK;
7928                 }
7929
7930                 case NDR_SPOOLSS_ADDMONITOR: {
7931                         struct spoolss_AddMonitor *r = (struct spoolss_AddMonitor *)_r;
7932                         r->out.result = _spoolss_AddMonitor(cli->pipes_struct, r);
7933                         return NT_STATUS_OK;
7934                 }
7935
7936                 case NDR_SPOOLSS_DELETEMONITOR: {
7937                         struct spoolss_DeleteMonitor *r = (struct spoolss_DeleteMonitor *)_r;
7938                         r->out.result = _spoolss_DeleteMonitor(cli->pipes_struct, r);
7939                         return NT_STATUS_OK;
7940                 }
7941
7942                 case NDR_SPOOLSS_DELETEPRINTPROCESSOR: {
7943                         struct spoolss_DeletePrintProcessor *r = (struct spoolss_DeletePrintProcessor *)_r;
7944                         r->out.result = _spoolss_DeletePrintProcessor(cli->pipes_struct, r);
7945                         return NT_STATUS_OK;
7946                 }
7947
7948                 case NDR_SPOOLSS_ADDPRINTPROVIDOR: {
7949                         struct spoolss_AddPrintProvidor *r = (struct spoolss_AddPrintProvidor *)_r;
7950                         r->out.result = _spoolss_AddPrintProvidor(cli->pipes_struct, r);
7951                         return NT_STATUS_OK;
7952                 }
7953
7954                 case NDR_SPOOLSS_DELETEPRINTPROVIDOR: {
7955                         struct spoolss_DeletePrintProvidor *r = (struct spoolss_DeletePrintProvidor *)_r;
7956                         r->out.result = _spoolss_DeletePrintProvidor(cli->pipes_struct, r);
7957                         return NT_STATUS_OK;
7958                 }
7959
7960                 case NDR_SPOOLSS_ENUMPRINTPROCDATATYPES: {
7961                         struct spoolss_EnumPrintProcDataTypes *r = (struct spoolss_EnumPrintProcDataTypes *)_r;
7962                         r->out.result = _spoolss_EnumPrintProcDataTypes(cli->pipes_struct, r);
7963                         return NT_STATUS_OK;
7964                 }
7965
7966                 case NDR_SPOOLSS_RESETPRINTER: {
7967                         struct spoolss_ResetPrinter *r = (struct spoolss_ResetPrinter *)_r;
7968                         r->out.result = _spoolss_ResetPrinter(cli->pipes_struct, r);
7969                         return NT_STATUS_OK;
7970                 }
7971
7972                 case NDR_SPOOLSS_GETPRINTERDRIVER2: {
7973                         struct spoolss_GetPrinterDriver2 *r = (struct spoolss_GetPrinterDriver2 *)_r;
7974                         ZERO_STRUCT(r->out);
7975                         r->out.info = talloc_zero(mem_ctx, DATA_BLOB);
7976                         if (r->out.info == NULL) {
7977                         return NT_STATUS_NO_MEMORY;
7978                         }
7979
7980                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7981                         if (r->out.needed == NULL) {
7982                         return NT_STATUS_NO_MEMORY;
7983                         }
7984
7985                         r->out.server_major_version = talloc_zero(mem_ctx, uint32_t);
7986                         if (r->out.server_major_version == NULL) {
7987                         return NT_STATUS_NO_MEMORY;
7988                         }
7989
7990                         r->out.server_minor_version = talloc_zero(mem_ctx, uint32_t);
7991                         if (r->out.server_minor_version == NULL) {
7992                         return NT_STATUS_NO_MEMORY;
7993                         }
7994
7995                         r->out.result = _spoolss_GetPrinterDriver2(cli->pipes_struct, r);
7996                         return NT_STATUS_OK;
7997                 }
7998
7999                 case NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION: {
8000                         struct spoolss_FindFirstPrinterChangeNotification *r = (struct spoolss_FindFirstPrinterChangeNotification *)_r;
8001                         r->out.result = _spoolss_FindFirstPrinterChangeNotification(cli->pipes_struct, r);
8002                         return NT_STATUS_OK;
8003                 }
8004
8005                 case NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION: {
8006                         struct spoolss_FindNextPrinterChangeNotification *r = (struct spoolss_FindNextPrinterChangeNotification *)_r;
8007                         r->out.result = _spoolss_FindNextPrinterChangeNotification(cli->pipes_struct, r);
8008                         return NT_STATUS_OK;
8009                 }
8010
8011                 case NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY: {
8012                         struct spoolss_FindClosePrinterNotify *r = (struct spoolss_FindClosePrinterNotify *)_r;
8013                         r->out.result = _spoolss_FindClosePrinterNotify(cli->pipes_struct, r);
8014                         return NT_STATUS_OK;
8015                 }
8016
8017                 case NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD: {
8018                         struct spoolss_RouterFindFirstPrinterChangeNotificationOld *r = (struct spoolss_RouterFindFirstPrinterChangeNotificationOld *)_r;
8019                         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotificationOld(cli->pipes_struct, r);
8020                         return NT_STATUS_OK;
8021                 }
8022
8023                 case NDR_SPOOLSS_REPLYOPENPRINTER: {
8024                         struct spoolss_ReplyOpenPrinter *r = (struct spoolss_ReplyOpenPrinter *)_r;
8025                         ZERO_STRUCT(r->out);
8026                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
8027                         if (r->out.handle == NULL) {
8028                         return NT_STATUS_NO_MEMORY;
8029                         }
8030
8031                         r->out.result = _spoolss_ReplyOpenPrinter(cli->pipes_struct, r);
8032                         return NT_STATUS_OK;
8033                 }
8034
8035                 case NDR_SPOOLSS_ROUTERREPLYPRINTER: {
8036                         struct spoolss_RouterReplyPrinter *r = (struct spoolss_RouterReplyPrinter *)_r;
8037                         r->out.result = _spoolss_RouterReplyPrinter(cli->pipes_struct, r);
8038                         return NT_STATUS_OK;
8039                 }
8040
8041                 case NDR_SPOOLSS_REPLYCLOSEPRINTER: {
8042                         struct spoolss_ReplyClosePrinter *r = (struct spoolss_ReplyClosePrinter *)_r;
8043                         ZERO_STRUCT(r->out);
8044                         r->out.handle = r->in.handle;
8045                         r->out.result = _spoolss_ReplyClosePrinter(cli->pipes_struct, r);
8046                         return NT_STATUS_OK;
8047                 }
8048
8049                 case NDR_SPOOLSS_ADDPORTEX: {
8050                         struct spoolss_AddPortEx *r = (struct spoolss_AddPortEx *)_r;
8051                         r->out.result = _spoolss_AddPortEx(cli->pipes_struct, r);
8052                         return NT_STATUS_OK;
8053                 }
8054
8055                 case NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION: {
8056                         struct spoolss_RouterFindFirstPrinterChangeNotification *r = (struct spoolss_RouterFindFirstPrinterChangeNotification *)_r;
8057                         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotification(cli->pipes_struct, r);
8058                         return NT_STATUS_OK;
8059                 }
8060
8061                 case NDR_SPOOLSS_SPOOLERINIT: {
8062                         struct spoolss_SpoolerInit *r = (struct spoolss_SpoolerInit *)_r;
8063                         r->out.result = _spoolss_SpoolerInit(cli->pipes_struct, r);
8064                         return NT_STATUS_OK;
8065                 }
8066
8067                 case NDR_SPOOLSS_RESETPRINTEREX: {
8068                         struct spoolss_ResetPrinterEx *r = (struct spoolss_ResetPrinterEx *)_r;
8069                         r->out.result = _spoolss_ResetPrinterEx(cli->pipes_struct, r);
8070                         return NT_STATUS_OK;
8071                 }
8072
8073                 case NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX: {
8074                         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r = (struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *)_r;
8075                         r->out.result = _spoolss_RemoteFindFirstPrinterChangeNotifyEx(cli->pipes_struct, r);
8076                         return NT_STATUS_OK;
8077                 }
8078
8079                 case NDR_SPOOLSS_ROUTERREPLYPRINTEREX: {
8080                         struct spoolss_RouterReplyPrinterEx *r = (struct spoolss_RouterReplyPrinterEx *)_r;
8081                         ZERO_STRUCT(r->out);
8082                         r->out.reply_result = talloc_zero(mem_ctx, uint32_t);
8083                         if (r->out.reply_result == NULL) {
8084                         return NT_STATUS_NO_MEMORY;
8085                         }
8086
8087                         r->out.result = _spoolss_RouterReplyPrinterEx(cli->pipes_struct, r);
8088                         return NT_STATUS_OK;
8089                 }
8090
8091                 case NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY: {
8092                         struct spoolss_RouterRefreshPrinterChangeNotify *r = (struct spoolss_RouterRefreshPrinterChangeNotify *)_r;
8093                         ZERO_STRUCT(r->out);
8094                         r->out.info = talloc_zero(mem_ctx, struct spoolss_NotifyInfo *);
8095                         if (r->out.info == NULL) {
8096                         return NT_STATUS_NO_MEMORY;
8097                         }
8098
8099                         r->out.result = _spoolss_RouterRefreshPrinterChangeNotify(cli->pipes_struct, r);
8100                         return NT_STATUS_OK;
8101                 }
8102
8103                 case NDR_SPOOLSS_44: {
8104                         struct spoolss_44 *r = (struct spoolss_44 *)_r;
8105                         r->out.result = _spoolss_44(cli->pipes_struct, r);
8106                         return NT_STATUS_OK;
8107                 }
8108
8109                 case NDR_SPOOLSS_OPENPRINTEREX: {
8110                         struct spoolss_OpenPrinterEx *r = (struct spoolss_OpenPrinterEx *)_r;
8111                         ZERO_STRUCT(r->out);
8112                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
8113                         if (r->out.handle == NULL) {
8114                         return NT_STATUS_NO_MEMORY;
8115                         }
8116
8117                         r->out.result = _spoolss_OpenPrinterEx(cli->pipes_struct, r);
8118                         return NT_STATUS_OK;
8119                 }
8120
8121                 case NDR_SPOOLSS_ADDPRINTEREX: {
8122                         struct spoolss_AddPrinterEx *r = (struct spoolss_AddPrinterEx *)_r;
8123                         r->out.result = _spoolss_AddPrinterEx(cli->pipes_struct, r);
8124                         return NT_STATUS_OK;
8125                 }
8126
8127                 case NDR_SPOOLSS_47: {
8128                         struct spoolss_47 *r = (struct spoolss_47 *)_r;
8129                         r->out.result = _spoolss_47(cli->pipes_struct, r);
8130                         return NT_STATUS_OK;
8131                 }
8132
8133                 case NDR_SPOOLSS_ENUMPRINTERDATA: {
8134                         struct spoolss_EnumPrinterData *r = (struct spoolss_EnumPrinterData *)_r;
8135                         ZERO_STRUCT(r->out);
8136                         r->out.value_name = talloc_zero_array(mem_ctx, const char, r->in.value_offered / 2);
8137                         if (r->out.value_name == NULL) {
8138                         return NT_STATUS_NO_MEMORY;
8139                         }
8140
8141                         r->out.value_needed = talloc_zero(mem_ctx, uint32_t);
8142                         if (r->out.value_needed == NULL) {
8143                         return NT_STATUS_NO_MEMORY;
8144                         }
8145
8146                         r->out.printerdata_type = talloc_zero(mem_ctx, uint32_t);
8147                         if (r->out.printerdata_type == NULL) {
8148                         return NT_STATUS_NO_MEMORY;
8149                         }
8150
8151                         r->out.buffer = talloc_zero(mem_ctx, DATA_BLOB);
8152                         if (r->out.buffer == NULL) {
8153                         return NT_STATUS_NO_MEMORY;
8154                         }
8155
8156                         r->out.data_needed = talloc_zero(mem_ctx, uint32_t);
8157                         if (r->out.data_needed == NULL) {
8158                         return NT_STATUS_NO_MEMORY;
8159                         }
8160
8161                         r->out.result = _spoolss_EnumPrinterData(cli->pipes_struct, r);
8162                         return NT_STATUS_OK;
8163                 }
8164
8165                 case NDR_SPOOLSS_DELETEPRINTERDATA: {
8166                         struct spoolss_DeletePrinterData *r = (struct spoolss_DeletePrinterData *)_r;
8167                         r->out.result = _spoolss_DeletePrinterData(cli->pipes_struct, r);
8168                         return NT_STATUS_OK;
8169                 }
8170
8171                 case NDR_SPOOLSS_4A: {
8172                         struct spoolss_4a *r = (struct spoolss_4a *)_r;
8173                         r->out.result = _spoolss_4a(cli->pipes_struct, r);
8174                         return NT_STATUS_OK;
8175                 }
8176
8177                 case NDR_SPOOLSS_4B: {
8178                         struct spoolss_4b *r = (struct spoolss_4b *)_r;
8179                         r->out.result = _spoolss_4b(cli->pipes_struct, r);
8180                         return NT_STATUS_OK;
8181                 }
8182
8183                 case NDR_SPOOLSS_4C: {
8184                         struct spoolss_4c *r = (struct spoolss_4c *)_r;
8185                         r->out.result = _spoolss_4c(cli->pipes_struct, r);
8186                         return NT_STATUS_OK;
8187                 }
8188
8189                 case NDR_SPOOLSS_SETPRINTERDATAEX: {
8190                         struct spoolss_SetPrinterDataEx *r = (struct spoolss_SetPrinterDataEx *)_r;
8191                         r->out.result = _spoolss_SetPrinterDataEx(cli->pipes_struct, r);
8192                         return NT_STATUS_OK;
8193                 }
8194
8195                 case NDR_SPOOLSS_GETPRINTERDATAEX: {
8196                         struct spoolss_GetPrinterDataEx *r = (struct spoolss_GetPrinterDataEx *)_r;
8197                         ZERO_STRUCT(r->out);
8198                         r->out.type = talloc_zero(mem_ctx, uint32_t);
8199                         if (r->out.type == NULL) {
8200                         return NT_STATUS_NO_MEMORY;
8201                         }
8202
8203                         r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
8204                         if (r->out.buffer == NULL) {
8205                         return NT_STATUS_NO_MEMORY;
8206                         }
8207
8208                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8209                         if (r->out.needed == NULL) {
8210                         return NT_STATUS_NO_MEMORY;
8211                         }
8212
8213                         r->out.result = _spoolss_GetPrinterDataEx(cli->pipes_struct, r);
8214                         return NT_STATUS_OK;
8215                 }
8216
8217                 case NDR_SPOOLSS_ENUMPRINTERDATAEX: {
8218                         struct spoolss_EnumPrinterDataEx *r = (struct spoolss_EnumPrinterDataEx *)_r;
8219                         ZERO_STRUCT(r->out);
8220                         r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
8221                         if (r->out.buffer == NULL) {
8222                         return NT_STATUS_NO_MEMORY;
8223                         }
8224
8225                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8226                         if (r->out.needed == NULL) {
8227                         return NT_STATUS_NO_MEMORY;
8228                         }
8229
8230                         r->out.count = talloc_zero(mem_ctx, uint32_t);
8231                         if (r->out.count == NULL) {
8232                         return NT_STATUS_NO_MEMORY;
8233                         }
8234
8235                         r->out.result = _spoolss_EnumPrinterDataEx(cli->pipes_struct, r);
8236                         return NT_STATUS_OK;
8237                 }
8238
8239                 case NDR_SPOOLSS_ENUMPRINTERKEY: {
8240                         struct spoolss_EnumPrinterKey *r = (struct spoolss_EnumPrinterKey *)_r;
8241                         ZERO_STRUCT(r->out);
8242                         r->out.key_buffer = talloc_zero_array(mem_ctx, uint16_t, r->in.key_buffer_size / 2);
8243                         if (r->out.key_buffer == NULL) {
8244                         return NT_STATUS_NO_MEMORY;
8245                         }
8246
8247                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8248                         if (r->out.needed == NULL) {
8249                         return NT_STATUS_NO_MEMORY;
8250                         }
8251
8252                         r->out.result = _spoolss_EnumPrinterKey(cli->pipes_struct, r);
8253                         return NT_STATUS_OK;
8254                 }
8255
8256                 case NDR_SPOOLSS_DELETEPRINTERDATAEX: {
8257                         struct spoolss_DeletePrinterDataEx *r = (struct spoolss_DeletePrinterDataEx *)_r;
8258                         r->out.result = _spoolss_DeletePrinterDataEx(cli->pipes_struct, r);
8259                         return NT_STATUS_OK;
8260                 }
8261
8262                 case NDR_SPOOLSS_DELETEPRINTERKEY: {
8263                         struct spoolss_DeletePrinterKey *r = (struct spoolss_DeletePrinterKey *)_r;
8264                         r->out.result = _spoolss_DeletePrinterKey(cli->pipes_struct, r);
8265                         return NT_STATUS_OK;
8266                 }
8267
8268                 case NDR_SPOOLSS_53: {
8269                         struct spoolss_53 *r = (struct spoolss_53 *)_r;
8270                         r->out.result = _spoolss_53(cli->pipes_struct, r);
8271                         return NT_STATUS_OK;
8272                 }
8273
8274                 case NDR_SPOOLSS_DELETEPRINTERDRIVEREX: {
8275                         struct spoolss_DeletePrinterDriverEx *r = (struct spoolss_DeletePrinterDriverEx *)_r;
8276                         r->out.result = _spoolss_DeletePrinterDriverEx(cli->pipes_struct, r);
8277                         return NT_STATUS_OK;
8278                 }
8279
8280                 case NDR_SPOOLSS_55: {
8281                         struct spoolss_55 *r = (struct spoolss_55 *)_r;
8282                         r->out.result = _spoolss_55(cli->pipes_struct, r);
8283                         return NT_STATUS_OK;
8284                 }
8285
8286                 case NDR_SPOOLSS_56: {
8287                         struct spoolss_56 *r = (struct spoolss_56 *)_r;
8288                         r->out.result = _spoolss_56(cli->pipes_struct, r);
8289                         return NT_STATUS_OK;
8290                 }
8291
8292                 case NDR_SPOOLSS_57: {
8293                         struct spoolss_57 *r = (struct spoolss_57 *)_r;
8294                         r->out.result = _spoolss_57(cli->pipes_struct, r);
8295                         return NT_STATUS_OK;
8296                 }
8297
8298                 case NDR_SPOOLSS_XCVDATA: {
8299                         struct spoolss_XcvData *r = (struct spoolss_XcvData *)_r;
8300                         ZERO_STRUCT(r->out);
8301                         r->out.status_code = r->in.status_code;
8302                         r->out.out_data = talloc_zero_array(mem_ctx, uint8_t, r->in.out_data_size);
8303                         if (r->out.out_data == NULL) {
8304                         return NT_STATUS_NO_MEMORY;
8305                         }
8306
8307                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8308                         if (r->out.needed == NULL) {
8309                         return NT_STATUS_NO_MEMORY;
8310                         }
8311
8312                         r->out.result = _spoolss_XcvData(cli->pipes_struct, r);
8313                         return NT_STATUS_OK;
8314                 }
8315
8316                 case NDR_SPOOLSS_ADDPRINTERDRIVEREX: {
8317                         struct spoolss_AddPrinterDriverEx *r = (struct spoolss_AddPrinterDriverEx *)_r;
8318                         r->out.result = _spoolss_AddPrinterDriverEx(cli->pipes_struct, r);
8319                         return NT_STATUS_OK;
8320                 }
8321
8322                 case NDR_SPOOLSS_5A: {
8323                         struct spoolss_5a *r = (struct spoolss_5a *)_r;
8324                         r->out.result = _spoolss_5a(cli->pipes_struct, r);
8325                         return NT_STATUS_OK;
8326                 }
8327
8328                 case NDR_SPOOLSS_5B: {
8329                         struct spoolss_5b *r = (struct spoolss_5b *)_r;
8330                         r->out.result = _spoolss_5b(cli->pipes_struct, r);
8331                         return NT_STATUS_OK;
8332                 }
8333
8334                 case NDR_SPOOLSS_5C: {
8335                         struct spoolss_5c *r = (struct spoolss_5c *)_r;
8336                         r->out.result = _spoolss_5c(cli->pipes_struct, r);
8337                         return NT_STATUS_OK;
8338                 }
8339
8340                 case NDR_SPOOLSS_5D: {
8341                         struct spoolss_5d *r = (struct spoolss_5d *)_r;
8342                         r->out.result = _spoolss_5d(cli->pipes_struct, r);
8343                         return NT_STATUS_OK;
8344                 }
8345
8346                 case NDR_SPOOLSS_5E: {
8347                         struct spoolss_5e *r = (struct spoolss_5e *)_r;
8348                         r->out.result = _spoolss_5e(cli->pipes_struct, r);
8349                         return NT_STATUS_OK;
8350                 }
8351
8352                 case NDR_SPOOLSS_5F: {
8353                         struct spoolss_5f *r = (struct spoolss_5f *)_r;
8354                         r->out.result = _spoolss_5f(cli->pipes_struct, r);
8355                         return NT_STATUS_OK;
8356                 }
8357
8358                 default:
8359                         return NT_STATUS_NOT_IMPLEMENTED;
8360         }
8361 }
8362
8363 NTSTATUS rpc_spoolss_init(void)
8364 {
8365         return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "spoolss", "spoolss", &ndr_table_spoolss, api_spoolss_cmds, sizeof(api_spoolss_cmds) / sizeof(struct api_struct));
8366 }