Merge branch 'master' of ssh://git.samba.org/data/git/samba
[amitay/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         r->out.result = _spoolss_AddJob(p, r);
1925
1926         if (p->rng_fault_state) {
1927                 talloc_free(r);
1928                 /* Return true here, srv_pipe_hnd.c will take care */
1929                 return true;
1930         }
1931
1932         if (DEBUGLEVEL >= 10) {
1933                 NDR_PRINT_OUT_DEBUG(spoolss_AddJob, r);
1934         }
1935
1936         push = ndr_push_init_ctx(r, NULL);
1937         if (push == NULL) {
1938                 talloc_free(r);
1939                 return false;
1940         }
1941
1942         ndr_err = call->ndr_push(push, NDR_OUT, r);
1943         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1944                 talloc_free(r);
1945                 return false;
1946         }
1947
1948         blob = ndr_push_blob(push);
1949         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1950                 talloc_free(r);
1951                 return false;
1952         }
1953
1954         talloc_free(r);
1955
1956         return true;
1957 }
1958
1959 static bool api_spoolss_ScheduleJob(pipes_struct *p)
1960 {
1961         const struct ndr_interface_call *call;
1962         struct ndr_pull *pull;
1963         struct ndr_push *push;
1964         enum ndr_err_code ndr_err;
1965         DATA_BLOB blob;
1966         struct spoolss_ScheduleJob *r;
1967
1968         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SCHEDULEJOB];
1969
1970         r = talloc(talloc_tos(), struct spoolss_ScheduleJob);
1971         if (r == NULL) {
1972                 return false;
1973         }
1974
1975         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1976                 talloc_free(r);
1977                 return false;
1978         }
1979
1980         pull = ndr_pull_init_blob(&blob, r, NULL);
1981         if (pull == NULL) {
1982                 talloc_free(r);
1983                 return false;
1984         }
1985
1986         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1987         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1988         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1989                 talloc_free(r);
1990                 return false;
1991         }
1992
1993         if (DEBUGLEVEL >= 10) {
1994                 NDR_PRINT_IN_DEBUG(spoolss_ScheduleJob, r);
1995         }
1996
1997         r->out.result = _spoolss_ScheduleJob(p, r);
1998
1999         if (p->rng_fault_state) {
2000                 talloc_free(r);
2001                 /* Return true here, srv_pipe_hnd.c will take care */
2002                 return true;
2003         }
2004
2005         if (DEBUGLEVEL >= 10) {
2006                 NDR_PRINT_OUT_DEBUG(spoolss_ScheduleJob, r);
2007         }
2008
2009         push = ndr_push_init_ctx(r, NULL);
2010         if (push == NULL) {
2011                 talloc_free(r);
2012                 return false;
2013         }
2014
2015         ndr_err = call->ndr_push(push, NDR_OUT, r);
2016         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2017                 talloc_free(r);
2018                 return false;
2019         }
2020
2021         blob = ndr_push_blob(push);
2022         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2023                 talloc_free(r);
2024                 return false;
2025         }
2026
2027         talloc_free(r);
2028
2029         return true;
2030 }
2031
2032 static bool api_spoolss_GetPrinterData(pipes_struct *p)
2033 {
2034         const struct ndr_interface_call *call;
2035         struct ndr_pull *pull;
2036         struct ndr_push *push;
2037         enum ndr_err_code ndr_err;
2038         DATA_BLOB blob;
2039         struct spoolss_GetPrinterData *r;
2040
2041         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDATA];
2042
2043         r = talloc(talloc_tos(), struct spoolss_GetPrinterData);
2044         if (r == NULL) {
2045                 return false;
2046         }
2047
2048         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2049                 talloc_free(r);
2050                 return false;
2051         }
2052
2053         pull = ndr_pull_init_blob(&blob, r, NULL);
2054         if (pull == NULL) {
2055                 talloc_free(r);
2056                 return false;
2057         }
2058
2059         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2060         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2061         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2062                 talloc_free(r);
2063                 return false;
2064         }
2065
2066         if (DEBUGLEVEL >= 10) {
2067                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterData, r);
2068         }
2069
2070         ZERO_STRUCT(r->out);
2071         r->out.type = talloc_zero(r, enum spoolss_PrinterDataType);
2072         if (r->out.type == NULL) {
2073                 talloc_free(r);
2074                 return false;
2075         }
2076
2077         r->out.needed = talloc_zero(r, uint32_t);
2078         if (r->out.needed == NULL) {
2079                 talloc_free(r);
2080                 return false;
2081         }
2082
2083         r->out.result = _spoolss_GetPrinterData(p, r);
2084
2085         if (p->rng_fault_state) {
2086                 talloc_free(r);
2087                 /* Return true here, srv_pipe_hnd.c will take care */
2088                 return true;
2089         }
2090
2091         if (DEBUGLEVEL >= 10) {
2092                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterData, r);
2093         }
2094
2095         push = ndr_push_init_ctx(r, NULL);
2096         if (push == NULL) {
2097                 talloc_free(r);
2098                 return false;
2099         }
2100
2101         ndr_err = call->ndr_push(push, NDR_OUT, r);
2102         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2103                 talloc_free(r);
2104                 return false;
2105         }
2106
2107         blob = ndr_push_blob(push);
2108         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2109                 talloc_free(r);
2110                 return false;
2111         }
2112
2113         talloc_free(r);
2114
2115         return true;
2116 }
2117
2118 static bool api_spoolss_SetPrinterData(pipes_struct *p)
2119 {
2120         const struct ndr_interface_call *call;
2121         struct ndr_pull *pull;
2122         struct ndr_push *push;
2123         enum ndr_err_code ndr_err;
2124         DATA_BLOB blob;
2125         struct spoolss_SetPrinterData *r;
2126
2127         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETPRINTERDATA];
2128
2129         r = talloc(talloc_tos(), struct spoolss_SetPrinterData);
2130         if (r == NULL) {
2131                 return false;
2132         }
2133
2134         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2135                 talloc_free(r);
2136                 return false;
2137         }
2138
2139         pull = ndr_pull_init_blob(&blob, r, NULL);
2140         if (pull == NULL) {
2141                 talloc_free(r);
2142                 return false;
2143         }
2144
2145         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2146         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2147         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2148                 talloc_free(r);
2149                 return false;
2150         }
2151
2152         if (DEBUGLEVEL >= 10) {
2153                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinterData, r);
2154         }
2155
2156         r->out.result = _spoolss_SetPrinterData(p, r);
2157
2158         if (p->rng_fault_state) {
2159                 talloc_free(r);
2160                 /* Return true here, srv_pipe_hnd.c will take care */
2161                 return true;
2162         }
2163
2164         if (DEBUGLEVEL >= 10) {
2165                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinterData, r);
2166         }
2167
2168         push = ndr_push_init_ctx(r, NULL);
2169         if (push == NULL) {
2170                 talloc_free(r);
2171                 return false;
2172         }
2173
2174         ndr_err = call->ndr_push(push, NDR_OUT, r);
2175         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2176                 talloc_free(r);
2177                 return false;
2178         }
2179
2180         blob = ndr_push_blob(push);
2181         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2182                 talloc_free(r);
2183                 return false;
2184         }
2185
2186         talloc_free(r);
2187
2188         return true;
2189 }
2190
2191 static bool api_spoolss_WaitForPrinterChange(pipes_struct *p)
2192 {
2193         const struct ndr_interface_call *call;
2194         struct ndr_pull *pull;
2195         struct ndr_push *push;
2196         enum ndr_err_code ndr_err;
2197         DATA_BLOB blob;
2198         struct spoolss_WaitForPrinterChange *r;
2199
2200         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_WAITFORPRINTERCHANGE];
2201
2202         r = talloc(talloc_tos(), struct spoolss_WaitForPrinterChange);
2203         if (r == NULL) {
2204                 return false;
2205         }
2206
2207         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2208                 talloc_free(r);
2209                 return false;
2210         }
2211
2212         pull = ndr_pull_init_blob(&blob, r, NULL);
2213         if (pull == NULL) {
2214                 talloc_free(r);
2215                 return false;
2216         }
2217
2218         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2219         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2220         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2221                 talloc_free(r);
2222                 return false;
2223         }
2224
2225         if (DEBUGLEVEL >= 10) {
2226                 NDR_PRINT_IN_DEBUG(spoolss_WaitForPrinterChange, r);
2227         }
2228
2229         r->out.result = _spoolss_WaitForPrinterChange(p, r);
2230
2231         if (p->rng_fault_state) {
2232                 talloc_free(r);
2233                 /* Return true here, srv_pipe_hnd.c will take care */
2234                 return true;
2235         }
2236
2237         if (DEBUGLEVEL >= 10) {
2238                 NDR_PRINT_OUT_DEBUG(spoolss_WaitForPrinterChange, r);
2239         }
2240
2241         push = ndr_push_init_ctx(r, NULL);
2242         if (push == NULL) {
2243                 talloc_free(r);
2244                 return false;
2245         }
2246
2247         ndr_err = call->ndr_push(push, NDR_OUT, r);
2248         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2249                 talloc_free(r);
2250                 return false;
2251         }
2252
2253         blob = ndr_push_blob(push);
2254         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2255                 talloc_free(r);
2256                 return false;
2257         }
2258
2259         talloc_free(r);
2260
2261         return true;
2262 }
2263
2264 static bool api_spoolss_ClosePrinter(pipes_struct *p)
2265 {
2266         const struct ndr_interface_call *call;
2267         struct ndr_pull *pull;
2268         struct ndr_push *push;
2269         enum ndr_err_code ndr_err;
2270         DATA_BLOB blob;
2271         struct spoolss_ClosePrinter *r;
2272
2273         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_CLOSEPRINTER];
2274
2275         r = talloc(talloc_tos(), struct spoolss_ClosePrinter);
2276         if (r == NULL) {
2277                 return false;
2278         }
2279
2280         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2281                 talloc_free(r);
2282                 return false;
2283         }
2284
2285         pull = ndr_pull_init_blob(&blob, r, NULL);
2286         if (pull == NULL) {
2287                 talloc_free(r);
2288                 return false;
2289         }
2290
2291         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2292         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2293         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2294                 talloc_free(r);
2295                 return false;
2296         }
2297
2298         if (DEBUGLEVEL >= 10) {
2299                 NDR_PRINT_IN_DEBUG(spoolss_ClosePrinter, r);
2300         }
2301
2302         ZERO_STRUCT(r->out);
2303         r->out.handle = r->in.handle;
2304         r->out.result = _spoolss_ClosePrinter(p, r);
2305
2306         if (p->rng_fault_state) {
2307                 talloc_free(r);
2308                 /* Return true here, srv_pipe_hnd.c will take care */
2309                 return true;
2310         }
2311
2312         if (DEBUGLEVEL >= 10) {
2313                 NDR_PRINT_OUT_DEBUG(spoolss_ClosePrinter, r);
2314         }
2315
2316         push = ndr_push_init_ctx(r, NULL);
2317         if (push == NULL) {
2318                 talloc_free(r);
2319                 return false;
2320         }
2321
2322         ndr_err = call->ndr_push(push, NDR_OUT, r);
2323         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2324                 talloc_free(r);
2325                 return false;
2326         }
2327
2328         blob = ndr_push_blob(push);
2329         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2330                 talloc_free(r);
2331                 return false;
2332         }
2333
2334         talloc_free(r);
2335
2336         return true;
2337 }
2338
2339 static bool api_spoolss_AddForm(pipes_struct *p)
2340 {
2341         const struct ndr_interface_call *call;
2342         struct ndr_pull *pull;
2343         struct ndr_push *push;
2344         enum ndr_err_code ndr_err;
2345         DATA_BLOB blob;
2346         struct spoolss_AddForm *r;
2347
2348         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDFORM];
2349
2350         r = talloc(talloc_tos(), struct spoolss_AddForm);
2351         if (r == NULL) {
2352                 return false;
2353         }
2354
2355         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2356                 talloc_free(r);
2357                 return false;
2358         }
2359
2360         pull = ndr_pull_init_blob(&blob, r, NULL);
2361         if (pull == NULL) {
2362                 talloc_free(r);
2363                 return false;
2364         }
2365
2366         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2367         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2368         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2369                 talloc_free(r);
2370                 return false;
2371         }
2372
2373         if (DEBUGLEVEL >= 10) {
2374                 NDR_PRINT_IN_DEBUG(spoolss_AddForm, r);
2375         }
2376
2377         r->out.result = _spoolss_AddForm(p, r);
2378
2379         if (p->rng_fault_state) {
2380                 talloc_free(r);
2381                 /* Return true here, srv_pipe_hnd.c will take care */
2382                 return true;
2383         }
2384
2385         if (DEBUGLEVEL >= 10) {
2386                 NDR_PRINT_OUT_DEBUG(spoolss_AddForm, r);
2387         }
2388
2389         push = ndr_push_init_ctx(r, NULL);
2390         if (push == NULL) {
2391                 talloc_free(r);
2392                 return false;
2393         }
2394
2395         ndr_err = call->ndr_push(push, NDR_OUT, r);
2396         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2397                 talloc_free(r);
2398                 return false;
2399         }
2400
2401         blob = ndr_push_blob(push);
2402         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2403                 talloc_free(r);
2404                 return false;
2405         }
2406
2407         talloc_free(r);
2408
2409         return true;
2410 }
2411
2412 static bool api_spoolss_DeleteForm(pipes_struct *p)
2413 {
2414         const struct ndr_interface_call *call;
2415         struct ndr_pull *pull;
2416         struct ndr_push *push;
2417         enum ndr_err_code ndr_err;
2418         DATA_BLOB blob;
2419         struct spoolss_DeleteForm *r;
2420
2421         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEFORM];
2422
2423         r = talloc(talloc_tos(), struct spoolss_DeleteForm);
2424         if (r == NULL) {
2425                 return false;
2426         }
2427
2428         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2429                 talloc_free(r);
2430                 return false;
2431         }
2432
2433         pull = ndr_pull_init_blob(&blob, r, NULL);
2434         if (pull == NULL) {
2435                 talloc_free(r);
2436                 return false;
2437         }
2438
2439         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2440         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2441         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2442                 talloc_free(r);
2443                 return false;
2444         }
2445
2446         if (DEBUGLEVEL >= 10) {
2447                 NDR_PRINT_IN_DEBUG(spoolss_DeleteForm, r);
2448         }
2449
2450         r->out.result = _spoolss_DeleteForm(p, r);
2451
2452         if (p->rng_fault_state) {
2453                 talloc_free(r);
2454                 /* Return true here, srv_pipe_hnd.c will take care */
2455                 return true;
2456         }
2457
2458         if (DEBUGLEVEL >= 10) {
2459                 NDR_PRINT_OUT_DEBUG(spoolss_DeleteForm, r);
2460         }
2461
2462         push = ndr_push_init_ctx(r, NULL);
2463         if (push == NULL) {
2464                 talloc_free(r);
2465                 return false;
2466         }
2467
2468         ndr_err = call->ndr_push(push, NDR_OUT, r);
2469         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2470                 talloc_free(r);
2471                 return false;
2472         }
2473
2474         blob = ndr_push_blob(push);
2475         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2476                 talloc_free(r);
2477                 return false;
2478         }
2479
2480         talloc_free(r);
2481
2482         return true;
2483 }
2484
2485 static bool api_spoolss_GetForm(pipes_struct *p)
2486 {
2487         const struct ndr_interface_call *call;
2488         struct ndr_pull *pull;
2489         struct ndr_push *push;
2490         enum ndr_err_code ndr_err;
2491         DATA_BLOB blob;
2492         struct spoolss_GetForm *r;
2493
2494         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETFORM];
2495
2496         r = talloc(talloc_tos(), struct spoolss_GetForm);
2497         if (r == NULL) {
2498                 return false;
2499         }
2500
2501         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2502                 talloc_free(r);
2503                 return false;
2504         }
2505
2506         pull = ndr_pull_init_blob(&blob, r, NULL);
2507         if (pull == NULL) {
2508                 talloc_free(r);
2509                 return false;
2510         }
2511
2512         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2513         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2514         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2515                 talloc_free(r);
2516                 return false;
2517         }
2518
2519         if (DEBUGLEVEL >= 10) {
2520                 NDR_PRINT_IN_DEBUG(spoolss_GetForm, r);
2521         }
2522
2523         ZERO_STRUCT(r->out);
2524         r->out.info = talloc_zero(r, union spoolss_FormInfo);
2525         if (r->out.info == NULL) {
2526                 talloc_free(r);
2527                 return false;
2528         }
2529
2530         r->out.needed = talloc_zero(r, uint32_t);
2531         if (r->out.needed == NULL) {
2532                 talloc_free(r);
2533                 return false;
2534         }
2535
2536         r->out.result = _spoolss_GetForm(p, r);
2537
2538         if (p->rng_fault_state) {
2539                 talloc_free(r);
2540                 /* Return true here, srv_pipe_hnd.c will take care */
2541                 return true;
2542         }
2543
2544         if (DEBUGLEVEL >= 10) {
2545                 NDR_PRINT_OUT_DEBUG(spoolss_GetForm, r);
2546         }
2547
2548         push = ndr_push_init_ctx(r, NULL);
2549         if (push == NULL) {
2550                 talloc_free(r);
2551                 return false;
2552         }
2553
2554         ndr_err = call->ndr_push(push, NDR_OUT, r);
2555         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2556                 talloc_free(r);
2557                 return false;
2558         }
2559
2560         blob = ndr_push_blob(push);
2561         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2562                 talloc_free(r);
2563                 return false;
2564         }
2565
2566         talloc_free(r);
2567
2568         return true;
2569 }
2570
2571 static bool api_spoolss_SetForm(pipes_struct *p)
2572 {
2573         const struct ndr_interface_call *call;
2574         struct ndr_pull *pull;
2575         struct ndr_push *push;
2576         enum ndr_err_code ndr_err;
2577         DATA_BLOB blob;
2578         struct spoolss_SetForm *r;
2579
2580         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETFORM];
2581
2582         r = talloc(talloc_tos(), struct spoolss_SetForm);
2583         if (r == NULL) {
2584                 return false;
2585         }
2586
2587         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2588                 talloc_free(r);
2589                 return false;
2590         }
2591
2592         pull = ndr_pull_init_blob(&blob, r, NULL);
2593         if (pull == NULL) {
2594                 talloc_free(r);
2595                 return false;
2596         }
2597
2598         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2599         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2600         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2601                 talloc_free(r);
2602                 return false;
2603         }
2604
2605         if (DEBUGLEVEL >= 10) {
2606                 NDR_PRINT_IN_DEBUG(spoolss_SetForm, r);
2607         }
2608
2609         r->out.result = _spoolss_SetForm(p, r);
2610
2611         if (p->rng_fault_state) {
2612                 talloc_free(r);
2613                 /* Return true here, srv_pipe_hnd.c will take care */
2614                 return true;
2615         }
2616
2617         if (DEBUGLEVEL >= 10) {
2618                 NDR_PRINT_OUT_DEBUG(spoolss_SetForm, r);
2619         }
2620
2621         push = ndr_push_init_ctx(r, NULL);
2622         if (push == NULL) {
2623                 talloc_free(r);
2624                 return false;
2625         }
2626
2627         ndr_err = call->ndr_push(push, NDR_OUT, r);
2628         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2629                 talloc_free(r);
2630                 return false;
2631         }
2632
2633         blob = ndr_push_blob(push);
2634         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2635                 talloc_free(r);
2636                 return false;
2637         }
2638
2639         talloc_free(r);
2640
2641         return true;
2642 }
2643
2644 static bool api_spoolss_EnumForms(pipes_struct *p)
2645 {
2646         const struct ndr_interface_call *call;
2647         struct ndr_pull *pull;
2648         struct ndr_push *push;
2649         enum ndr_err_code ndr_err;
2650         DATA_BLOB blob;
2651         struct spoolss_EnumForms *r;
2652
2653         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMFORMS];
2654
2655         r = talloc(talloc_tos(), struct spoolss_EnumForms);
2656         if (r == NULL) {
2657                 return false;
2658         }
2659
2660         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2661                 talloc_free(r);
2662                 return false;
2663         }
2664
2665         pull = ndr_pull_init_blob(&blob, r, NULL);
2666         if (pull == NULL) {
2667                 talloc_free(r);
2668                 return false;
2669         }
2670
2671         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2672         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2673         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2674                 talloc_free(r);
2675                 return false;
2676         }
2677
2678         if (DEBUGLEVEL >= 10) {
2679                 NDR_PRINT_IN_DEBUG(spoolss_EnumForms, r);
2680         }
2681
2682         ZERO_STRUCT(r->out);
2683         r->out.info = talloc_zero_array(r, union spoolss_FormInfo, r->out.count);
2684         if (r->out.info == NULL) {
2685                 talloc_free(r);
2686                 return false;
2687         }
2688
2689         r->out.needed = talloc_zero(r, uint32_t);
2690         if (r->out.needed == NULL) {
2691                 talloc_free(r);
2692                 return false;
2693         }
2694
2695         r->out.result = _spoolss_EnumForms(p, r);
2696
2697         if (p->rng_fault_state) {
2698                 talloc_free(r);
2699                 /* Return true here, srv_pipe_hnd.c will take care */
2700                 return true;
2701         }
2702
2703         if (DEBUGLEVEL >= 10) {
2704                 NDR_PRINT_OUT_DEBUG(spoolss_EnumForms, r);
2705         }
2706
2707         push = ndr_push_init_ctx(r, NULL);
2708         if (push == NULL) {
2709                 talloc_free(r);
2710                 return false;
2711         }
2712
2713         ndr_err = call->ndr_push(push, NDR_OUT, r);
2714         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2715                 talloc_free(r);
2716                 return false;
2717         }
2718
2719         blob = ndr_push_blob(push);
2720         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2721                 talloc_free(r);
2722                 return false;
2723         }
2724
2725         talloc_free(r);
2726
2727         return true;
2728 }
2729
2730 static bool api_spoolss_EnumPorts(pipes_struct *p)
2731 {
2732         const struct ndr_interface_call *call;
2733         struct ndr_pull *pull;
2734         struct ndr_push *push;
2735         enum ndr_err_code ndr_err;
2736         DATA_BLOB blob;
2737         struct spoolss_EnumPorts *r;
2738
2739         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPORTS];
2740
2741         r = talloc(talloc_tos(), struct spoolss_EnumPorts);
2742         if (r == NULL) {
2743                 return false;
2744         }
2745
2746         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2747                 talloc_free(r);
2748                 return false;
2749         }
2750
2751         pull = ndr_pull_init_blob(&blob, r, NULL);
2752         if (pull == NULL) {
2753                 talloc_free(r);
2754                 return false;
2755         }
2756
2757         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2758         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2759         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2760                 talloc_free(r);
2761                 return false;
2762         }
2763
2764         if (DEBUGLEVEL >= 10) {
2765                 NDR_PRINT_IN_DEBUG(spoolss_EnumPorts, r);
2766         }
2767
2768         ZERO_STRUCT(r->out);
2769         r->out.info = talloc_zero_array(r, union spoolss_PortInfo, r->out.count);
2770         if (r->out.info == NULL) {
2771                 talloc_free(r);
2772                 return false;
2773         }
2774
2775         r->out.needed = talloc_zero(r, uint32_t);
2776         if (r->out.needed == NULL) {
2777                 talloc_free(r);
2778                 return false;
2779         }
2780
2781         r->out.result = _spoolss_EnumPorts(p, r);
2782
2783         if (p->rng_fault_state) {
2784                 talloc_free(r);
2785                 /* Return true here, srv_pipe_hnd.c will take care */
2786                 return true;
2787         }
2788
2789         if (DEBUGLEVEL >= 10) {
2790                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPorts, r);
2791         }
2792
2793         push = ndr_push_init_ctx(r, NULL);
2794         if (push == NULL) {
2795                 talloc_free(r);
2796                 return false;
2797         }
2798
2799         ndr_err = call->ndr_push(push, NDR_OUT, r);
2800         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2801                 talloc_free(r);
2802                 return false;
2803         }
2804
2805         blob = ndr_push_blob(push);
2806         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2807                 talloc_free(r);
2808                 return false;
2809         }
2810
2811         talloc_free(r);
2812
2813         return true;
2814 }
2815
2816 static bool api_spoolss_EnumMonitors(pipes_struct *p)
2817 {
2818         const struct ndr_interface_call *call;
2819         struct ndr_pull *pull;
2820         struct ndr_push *push;
2821         enum ndr_err_code ndr_err;
2822         DATA_BLOB blob;
2823         struct spoolss_EnumMonitors *r;
2824
2825         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMMONITORS];
2826
2827         r = talloc(talloc_tos(), struct spoolss_EnumMonitors);
2828         if (r == NULL) {
2829                 return false;
2830         }
2831
2832         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2833                 talloc_free(r);
2834                 return false;
2835         }
2836
2837         pull = ndr_pull_init_blob(&blob, r, NULL);
2838         if (pull == NULL) {
2839                 talloc_free(r);
2840                 return false;
2841         }
2842
2843         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2844         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2845         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2846                 talloc_free(r);
2847                 return false;
2848         }
2849
2850         if (DEBUGLEVEL >= 10) {
2851                 NDR_PRINT_IN_DEBUG(spoolss_EnumMonitors, r);
2852         }
2853
2854         ZERO_STRUCT(r->out);
2855         r->out.info = talloc_zero_array(r, union spoolss_MonitorInfo, r->out.count);
2856         if (r->out.info == NULL) {
2857                 talloc_free(r);
2858                 return false;
2859         }
2860
2861         r->out.needed = talloc_zero(r, uint32_t);
2862         if (r->out.needed == NULL) {
2863                 talloc_free(r);
2864                 return false;
2865         }
2866
2867         r->out.result = _spoolss_EnumMonitors(p, r);
2868
2869         if (p->rng_fault_state) {
2870                 talloc_free(r);
2871                 /* Return true here, srv_pipe_hnd.c will take care */
2872                 return true;
2873         }
2874
2875         if (DEBUGLEVEL >= 10) {
2876                 NDR_PRINT_OUT_DEBUG(spoolss_EnumMonitors, r);
2877         }
2878
2879         push = ndr_push_init_ctx(r, NULL);
2880         if (push == NULL) {
2881                 talloc_free(r);
2882                 return false;
2883         }
2884
2885         ndr_err = call->ndr_push(push, NDR_OUT, r);
2886         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2887                 talloc_free(r);
2888                 return false;
2889         }
2890
2891         blob = ndr_push_blob(push);
2892         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2893                 talloc_free(r);
2894                 return false;
2895         }
2896
2897         talloc_free(r);
2898
2899         return true;
2900 }
2901
2902 static bool api_spoolss_AddPort(pipes_struct *p)
2903 {
2904         const struct ndr_interface_call *call;
2905         struct ndr_pull *pull;
2906         struct ndr_push *push;
2907         enum ndr_err_code ndr_err;
2908         DATA_BLOB blob;
2909         struct spoolss_AddPort *r;
2910
2911         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPORT];
2912
2913         r = talloc(talloc_tos(), struct spoolss_AddPort);
2914         if (r == NULL) {
2915                 return false;
2916         }
2917
2918         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2919                 talloc_free(r);
2920                 return false;
2921         }
2922
2923         pull = ndr_pull_init_blob(&blob, r, NULL);
2924         if (pull == NULL) {
2925                 talloc_free(r);
2926                 return false;
2927         }
2928
2929         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2930         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2931         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2932                 talloc_free(r);
2933                 return false;
2934         }
2935
2936         if (DEBUGLEVEL >= 10) {
2937                 NDR_PRINT_IN_DEBUG(spoolss_AddPort, r);
2938         }
2939
2940         r->out.result = _spoolss_AddPort(p, r);
2941
2942         if (p->rng_fault_state) {
2943                 talloc_free(r);
2944                 /* Return true here, srv_pipe_hnd.c will take care */
2945                 return true;
2946         }
2947
2948         if (DEBUGLEVEL >= 10) {
2949                 NDR_PRINT_OUT_DEBUG(spoolss_AddPort, r);
2950         }
2951
2952         push = ndr_push_init_ctx(r, NULL);
2953         if (push == NULL) {
2954                 talloc_free(r);
2955                 return false;
2956         }
2957
2958         ndr_err = call->ndr_push(push, NDR_OUT, r);
2959         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2960                 talloc_free(r);
2961                 return false;
2962         }
2963
2964         blob = ndr_push_blob(push);
2965         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2966                 talloc_free(r);
2967                 return false;
2968         }
2969
2970         talloc_free(r);
2971
2972         return true;
2973 }
2974
2975 static bool api_spoolss_ConfigurePort(pipes_struct *p)
2976 {
2977         const struct ndr_interface_call *call;
2978         struct ndr_pull *pull;
2979         struct ndr_push *push;
2980         enum ndr_err_code ndr_err;
2981         DATA_BLOB blob;
2982         struct spoolss_ConfigurePort *r;
2983
2984         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_CONFIGUREPORT];
2985
2986         r = talloc(talloc_tos(), struct spoolss_ConfigurePort);
2987         if (r == NULL) {
2988                 return false;
2989         }
2990
2991         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2992                 talloc_free(r);
2993                 return false;
2994         }
2995
2996         pull = ndr_pull_init_blob(&blob, r, NULL);
2997         if (pull == NULL) {
2998                 talloc_free(r);
2999                 return false;
3000         }
3001
3002         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3003         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3004         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3005                 talloc_free(r);
3006                 return false;
3007         }
3008
3009         if (DEBUGLEVEL >= 10) {
3010                 NDR_PRINT_IN_DEBUG(spoolss_ConfigurePort, r);
3011         }
3012
3013         r->out.result = _spoolss_ConfigurePort(p, r);
3014
3015         if (p->rng_fault_state) {
3016                 talloc_free(r);
3017                 /* Return true here, srv_pipe_hnd.c will take care */
3018                 return true;
3019         }
3020
3021         if (DEBUGLEVEL >= 10) {
3022                 NDR_PRINT_OUT_DEBUG(spoolss_ConfigurePort, r);
3023         }
3024
3025         push = ndr_push_init_ctx(r, NULL);
3026         if (push == NULL) {
3027                 talloc_free(r);
3028                 return false;
3029         }
3030
3031         ndr_err = call->ndr_push(push, NDR_OUT, r);
3032         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3033                 talloc_free(r);
3034                 return false;
3035         }
3036
3037         blob = ndr_push_blob(push);
3038         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3039                 talloc_free(r);
3040                 return false;
3041         }
3042
3043         talloc_free(r);
3044
3045         return true;
3046 }
3047
3048 static bool api_spoolss_DeletePort(pipes_struct *p)
3049 {
3050         const struct ndr_interface_call *call;
3051         struct ndr_pull *pull;
3052         struct ndr_push *push;
3053         enum ndr_err_code ndr_err;
3054         DATA_BLOB blob;
3055         struct spoolss_DeletePort *r;
3056
3057         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPORT];
3058
3059         r = talloc(talloc_tos(), struct spoolss_DeletePort);
3060         if (r == NULL) {
3061                 return false;
3062         }
3063
3064         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3065                 talloc_free(r);
3066                 return false;
3067         }
3068
3069         pull = ndr_pull_init_blob(&blob, r, NULL);
3070         if (pull == NULL) {
3071                 talloc_free(r);
3072                 return false;
3073         }
3074
3075         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3076         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3077         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3078                 talloc_free(r);
3079                 return false;
3080         }
3081
3082         if (DEBUGLEVEL >= 10) {
3083                 NDR_PRINT_IN_DEBUG(spoolss_DeletePort, r);
3084         }
3085
3086         r->out.result = _spoolss_DeletePort(p, r);
3087
3088         if (p->rng_fault_state) {
3089                 talloc_free(r);
3090                 /* Return true here, srv_pipe_hnd.c will take care */
3091                 return true;
3092         }
3093
3094         if (DEBUGLEVEL >= 10) {
3095                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePort, r);
3096         }
3097
3098         push = ndr_push_init_ctx(r, NULL);
3099         if (push == NULL) {
3100                 talloc_free(r);
3101                 return false;
3102         }
3103
3104         ndr_err = call->ndr_push(push, NDR_OUT, r);
3105         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3106                 talloc_free(r);
3107                 return false;
3108         }
3109
3110         blob = ndr_push_blob(push);
3111         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3112                 talloc_free(r);
3113                 return false;
3114         }
3115
3116         talloc_free(r);
3117
3118         return true;
3119 }
3120
3121 static bool api_spoolss_CreatePrinterIC(pipes_struct *p)
3122 {
3123         const struct ndr_interface_call *call;
3124         struct ndr_pull *pull;
3125         struct ndr_push *push;
3126         enum ndr_err_code ndr_err;
3127         DATA_BLOB blob;
3128         struct spoolss_CreatePrinterIC *r;
3129
3130         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_CREATEPRINTERIC];
3131
3132         r = talloc(talloc_tos(), struct spoolss_CreatePrinterIC);
3133         if (r == NULL) {
3134                 return false;
3135         }
3136
3137         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3138                 talloc_free(r);
3139                 return false;
3140         }
3141
3142         pull = ndr_pull_init_blob(&blob, r, NULL);
3143         if (pull == NULL) {
3144                 talloc_free(r);
3145                 return false;
3146         }
3147
3148         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3149         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3150         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3151                 talloc_free(r);
3152                 return false;
3153         }
3154
3155         if (DEBUGLEVEL >= 10) {
3156                 NDR_PRINT_IN_DEBUG(spoolss_CreatePrinterIC, r);
3157         }
3158
3159         r->out.result = _spoolss_CreatePrinterIC(p, r);
3160
3161         if (p->rng_fault_state) {
3162                 talloc_free(r);
3163                 /* Return true here, srv_pipe_hnd.c will take care */
3164                 return true;
3165         }
3166
3167         if (DEBUGLEVEL >= 10) {
3168                 NDR_PRINT_OUT_DEBUG(spoolss_CreatePrinterIC, r);
3169         }
3170
3171         push = ndr_push_init_ctx(r, NULL);
3172         if (push == NULL) {
3173                 talloc_free(r);
3174                 return false;
3175         }
3176
3177         ndr_err = call->ndr_push(push, NDR_OUT, r);
3178         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3179                 talloc_free(r);
3180                 return false;
3181         }
3182
3183         blob = ndr_push_blob(push);
3184         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3185                 talloc_free(r);
3186                 return false;
3187         }
3188
3189         talloc_free(r);
3190
3191         return true;
3192 }
3193
3194 static bool api_spoolss_PlayGDIScriptOnPrinterIC(pipes_struct *p)
3195 {
3196         const struct ndr_interface_call *call;
3197         struct ndr_pull *pull;
3198         struct ndr_push *push;
3199         enum ndr_err_code ndr_err;
3200         DATA_BLOB blob;
3201         struct spoolss_PlayGDIScriptOnPrinterIC *r;
3202
3203         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC];
3204
3205         r = talloc(talloc_tos(), struct spoolss_PlayGDIScriptOnPrinterIC);
3206         if (r == NULL) {
3207                 return false;
3208         }
3209
3210         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3211                 talloc_free(r);
3212                 return false;
3213         }
3214
3215         pull = ndr_pull_init_blob(&blob, r, NULL);
3216         if (pull == NULL) {
3217                 talloc_free(r);
3218                 return false;
3219         }
3220
3221         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3222         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3223         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3224                 talloc_free(r);
3225                 return false;
3226         }
3227
3228         if (DEBUGLEVEL >= 10) {
3229                 NDR_PRINT_IN_DEBUG(spoolss_PlayGDIScriptOnPrinterIC, r);
3230         }
3231
3232         r->out.result = _spoolss_PlayGDIScriptOnPrinterIC(p, r);
3233
3234         if (p->rng_fault_state) {
3235                 talloc_free(r);
3236                 /* Return true here, srv_pipe_hnd.c will take care */
3237                 return true;
3238         }
3239
3240         if (DEBUGLEVEL >= 10) {
3241                 NDR_PRINT_OUT_DEBUG(spoolss_PlayGDIScriptOnPrinterIC, r);
3242         }
3243
3244         push = ndr_push_init_ctx(r, NULL);
3245         if (push == NULL) {
3246                 talloc_free(r);
3247                 return false;
3248         }
3249
3250         ndr_err = call->ndr_push(push, NDR_OUT, r);
3251         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3252                 talloc_free(r);
3253                 return false;
3254         }
3255
3256         blob = ndr_push_blob(push);
3257         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3258                 talloc_free(r);
3259                 return false;
3260         }
3261
3262         talloc_free(r);
3263
3264         return true;
3265 }
3266
3267 static bool api_spoolss_DeletePrinterIC(pipes_struct *p)
3268 {
3269         const struct ndr_interface_call *call;
3270         struct ndr_pull *pull;
3271         struct ndr_push *push;
3272         enum ndr_err_code ndr_err;
3273         DATA_BLOB blob;
3274         struct spoolss_DeletePrinterIC *r;
3275
3276         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERIC];
3277
3278         r = talloc(talloc_tos(), struct spoolss_DeletePrinterIC);
3279         if (r == NULL) {
3280                 return false;
3281         }
3282
3283         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3284                 talloc_free(r);
3285                 return false;
3286         }
3287
3288         pull = ndr_pull_init_blob(&blob, r, NULL);
3289         if (pull == NULL) {
3290                 talloc_free(r);
3291                 return false;
3292         }
3293
3294         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3295         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3296         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3297                 talloc_free(r);
3298                 return false;
3299         }
3300
3301         if (DEBUGLEVEL >= 10) {
3302                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterIC, r);
3303         }
3304
3305         r->out.result = _spoolss_DeletePrinterIC(p, r);
3306
3307         if (p->rng_fault_state) {
3308                 talloc_free(r);
3309                 /* Return true here, srv_pipe_hnd.c will take care */
3310                 return true;
3311         }
3312
3313         if (DEBUGLEVEL >= 10) {
3314                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterIC, r);
3315         }
3316
3317         push = ndr_push_init_ctx(r, NULL);
3318         if (push == NULL) {
3319                 talloc_free(r);
3320                 return false;
3321         }
3322
3323         ndr_err = call->ndr_push(push, NDR_OUT, r);
3324         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3325                 talloc_free(r);
3326                 return false;
3327         }
3328
3329         blob = ndr_push_blob(push);
3330         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3331                 talloc_free(r);
3332                 return false;
3333         }
3334
3335         talloc_free(r);
3336
3337         return true;
3338 }
3339
3340 static bool api_spoolss_AddPrinterConnection(pipes_struct *p)
3341 {
3342         const struct ndr_interface_call *call;
3343         struct ndr_pull *pull;
3344         struct ndr_push *push;
3345         enum ndr_err_code ndr_err;
3346         DATA_BLOB blob;
3347         struct spoolss_AddPrinterConnection *r;
3348
3349         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTERCONNECTION];
3350
3351         r = talloc(talloc_tos(), struct spoolss_AddPrinterConnection);
3352         if (r == NULL) {
3353                 return false;
3354         }
3355
3356         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3357                 talloc_free(r);
3358                 return false;
3359         }
3360
3361         pull = ndr_pull_init_blob(&blob, r, NULL);
3362         if (pull == NULL) {
3363                 talloc_free(r);
3364                 return false;
3365         }
3366
3367         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3368         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3369         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3370                 talloc_free(r);
3371                 return false;
3372         }
3373
3374         if (DEBUGLEVEL >= 10) {
3375                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterConnection, r);
3376         }
3377
3378         r->out.result = _spoolss_AddPrinterConnection(p, r);
3379
3380         if (p->rng_fault_state) {
3381                 talloc_free(r);
3382                 /* Return true here, srv_pipe_hnd.c will take care */
3383                 return true;
3384         }
3385
3386         if (DEBUGLEVEL >= 10) {
3387                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterConnection, r);
3388         }
3389
3390         push = ndr_push_init_ctx(r, NULL);
3391         if (push == NULL) {
3392                 talloc_free(r);
3393                 return false;
3394         }
3395
3396         ndr_err = call->ndr_push(push, NDR_OUT, r);
3397         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3398                 talloc_free(r);
3399                 return false;
3400         }
3401
3402         blob = ndr_push_blob(push);
3403         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3404                 talloc_free(r);
3405                 return false;
3406         }
3407
3408         talloc_free(r);
3409
3410         return true;
3411 }
3412
3413 static bool api_spoolss_DeletePrinterConnection(pipes_struct *p)
3414 {
3415         const struct ndr_interface_call *call;
3416         struct ndr_pull *pull;
3417         struct ndr_push *push;
3418         enum ndr_err_code ndr_err;
3419         DATA_BLOB blob;
3420         struct spoolss_DeletePrinterConnection *r;
3421
3422         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERCONNECTION];
3423
3424         r = talloc(talloc_tos(), struct spoolss_DeletePrinterConnection);
3425         if (r == NULL) {
3426                 return false;
3427         }
3428
3429         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3430                 talloc_free(r);
3431                 return false;
3432         }
3433
3434         pull = ndr_pull_init_blob(&blob, r, NULL);
3435         if (pull == NULL) {
3436                 talloc_free(r);
3437                 return false;
3438         }
3439
3440         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3441         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3442         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3443                 talloc_free(r);
3444                 return false;
3445         }
3446
3447         if (DEBUGLEVEL >= 10) {
3448                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterConnection, r);
3449         }
3450
3451         r->out.result = _spoolss_DeletePrinterConnection(p, r);
3452
3453         if (p->rng_fault_state) {
3454                 talloc_free(r);
3455                 /* Return true here, srv_pipe_hnd.c will take care */
3456                 return true;
3457         }
3458
3459         if (DEBUGLEVEL >= 10) {
3460                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterConnection, r);
3461         }
3462
3463         push = ndr_push_init_ctx(r, NULL);
3464         if (push == NULL) {
3465                 talloc_free(r);
3466                 return false;
3467         }
3468
3469         ndr_err = call->ndr_push(push, NDR_OUT, r);
3470         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3471                 talloc_free(r);
3472                 return false;
3473         }
3474
3475         blob = ndr_push_blob(push);
3476         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3477                 talloc_free(r);
3478                 return false;
3479         }
3480
3481         talloc_free(r);
3482
3483         return true;
3484 }
3485
3486 static bool api_spoolss_PrinterMessageBox(pipes_struct *p)
3487 {
3488         const struct ndr_interface_call *call;
3489         struct ndr_pull *pull;
3490         struct ndr_push *push;
3491         enum ndr_err_code ndr_err;
3492         DATA_BLOB blob;
3493         struct spoolss_PrinterMessageBox *r;
3494
3495         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_PRINTERMESSAGEBOX];
3496
3497         r = talloc(talloc_tos(), struct spoolss_PrinterMessageBox);
3498         if (r == NULL) {
3499                 return false;
3500         }
3501
3502         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3503                 talloc_free(r);
3504                 return false;
3505         }
3506
3507         pull = ndr_pull_init_blob(&blob, r, NULL);
3508         if (pull == NULL) {
3509                 talloc_free(r);
3510                 return false;
3511         }
3512
3513         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3514         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3515         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3516                 talloc_free(r);
3517                 return false;
3518         }
3519
3520         if (DEBUGLEVEL >= 10) {
3521                 NDR_PRINT_IN_DEBUG(spoolss_PrinterMessageBox, r);
3522         }
3523
3524         r->out.result = _spoolss_PrinterMessageBox(p, r);
3525
3526         if (p->rng_fault_state) {
3527                 talloc_free(r);
3528                 /* Return true here, srv_pipe_hnd.c will take care */
3529                 return true;
3530         }
3531
3532         if (DEBUGLEVEL >= 10) {
3533                 NDR_PRINT_OUT_DEBUG(spoolss_PrinterMessageBox, r);
3534         }
3535
3536         push = ndr_push_init_ctx(r, NULL);
3537         if (push == NULL) {
3538                 talloc_free(r);
3539                 return false;
3540         }
3541
3542         ndr_err = call->ndr_push(push, NDR_OUT, r);
3543         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3544                 talloc_free(r);
3545                 return false;
3546         }
3547
3548         blob = ndr_push_blob(push);
3549         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3550                 talloc_free(r);
3551                 return false;
3552         }
3553
3554         talloc_free(r);
3555
3556         return true;
3557 }
3558
3559 static bool api_spoolss_AddMonitor(pipes_struct *p)
3560 {
3561         const struct ndr_interface_call *call;
3562         struct ndr_pull *pull;
3563         struct ndr_push *push;
3564         enum ndr_err_code ndr_err;
3565         DATA_BLOB blob;
3566         struct spoolss_AddMonitor *r;
3567
3568         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDMONITOR];
3569
3570         r = talloc(talloc_tos(), struct spoolss_AddMonitor);
3571         if (r == NULL) {
3572                 return false;
3573         }
3574
3575         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3576                 talloc_free(r);
3577                 return false;
3578         }
3579
3580         pull = ndr_pull_init_blob(&blob, r, NULL);
3581         if (pull == NULL) {
3582                 talloc_free(r);
3583                 return false;
3584         }
3585
3586         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3587         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3588         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3589                 talloc_free(r);
3590                 return false;
3591         }
3592
3593         if (DEBUGLEVEL >= 10) {
3594                 NDR_PRINT_IN_DEBUG(spoolss_AddMonitor, r);
3595         }
3596
3597         r->out.result = _spoolss_AddMonitor(p, r);
3598
3599         if (p->rng_fault_state) {
3600                 talloc_free(r);
3601                 /* Return true here, srv_pipe_hnd.c will take care */
3602                 return true;
3603         }
3604
3605         if (DEBUGLEVEL >= 10) {
3606                 NDR_PRINT_OUT_DEBUG(spoolss_AddMonitor, r);
3607         }
3608
3609         push = ndr_push_init_ctx(r, NULL);
3610         if (push == NULL) {
3611                 talloc_free(r);
3612                 return false;
3613         }
3614
3615         ndr_err = call->ndr_push(push, NDR_OUT, r);
3616         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3617                 talloc_free(r);
3618                 return false;
3619         }
3620
3621         blob = ndr_push_blob(push);
3622         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3623                 talloc_free(r);
3624                 return false;
3625         }
3626
3627         talloc_free(r);
3628
3629         return true;
3630 }
3631
3632 static bool api_spoolss_DeleteMonitor(pipes_struct *p)
3633 {
3634         const struct ndr_interface_call *call;
3635         struct ndr_pull *pull;
3636         struct ndr_push *push;
3637         enum ndr_err_code ndr_err;
3638         DATA_BLOB blob;
3639         struct spoolss_DeleteMonitor *r;
3640
3641         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEMONITOR];
3642
3643         r = talloc(talloc_tos(), struct spoolss_DeleteMonitor);
3644         if (r == NULL) {
3645                 return false;
3646         }
3647
3648         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3649                 talloc_free(r);
3650                 return false;
3651         }
3652
3653         pull = ndr_pull_init_blob(&blob, r, NULL);
3654         if (pull == NULL) {
3655                 talloc_free(r);
3656                 return false;
3657         }
3658
3659         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3660         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3661         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3662                 talloc_free(r);
3663                 return false;
3664         }
3665
3666         if (DEBUGLEVEL >= 10) {
3667                 NDR_PRINT_IN_DEBUG(spoolss_DeleteMonitor, r);
3668         }
3669
3670         r->out.result = _spoolss_DeleteMonitor(p, r);
3671
3672         if (p->rng_fault_state) {
3673                 talloc_free(r);
3674                 /* Return true here, srv_pipe_hnd.c will take care */
3675                 return true;
3676         }
3677
3678         if (DEBUGLEVEL >= 10) {
3679                 NDR_PRINT_OUT_DEBUG(spoolss_DeleteMonitor, r);
3680         }
3681
3682         push = ndr_push_init_ctx(r, NULL);
3683         if (push == NULL) {
3684                 talloc_free(r);
3685                 return false;
3686         }
3687
3688         ndr_err = call->ndr_push(push, NDR_OUT, r);
3689         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3690                 talloc_free(r);
3691                 return false;
3692         }
3693
3694         blob = ndr_push_blob(push);
3695         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3696                 talloc_free(r);
3697                 return false;
3698         }
3699
3700         talloc_free(r);
3701
3702         return true;
3703 }
3704
3705 static bool api_spoolss_DeletePrintProcessor(pipes_struct *p)
3706 {
3707         const struct ndr_interface_call *call;
3708         struct ndr_pull *pull;
3709         struct ndr_push *push;
3710         enum ndr_err_code ndr_err;
3711         DATA_BLOB blob;
3712         struct spoolss_DeletePrintProcessor *r;
3713
3714         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTPROCESSOR];
3715
3716         r = talloc(talloc_tos(), struct spoolss_DeletePrintProcessor);
3717         if (r == NULL) {
3718                 return false;
3719         }
3720
3721         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3722                 talloc_free(r);
3723                 return false;
3724         }
3725
3726         pull = ndr_pull_init_blob(&blob, r, NULL);
3727         if (pull == NULL) {
3728                 talloc_free(r);
3729                 return false;
3730         }
3731
3732         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3733         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3734         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3735                 talloc_free(r);
3736                 return false;
3737         }
3738
3739         if (DEBUGLEVEL >= 10) {
3740                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrintProcessor, r);
3741         }
3742
3743         r->out.result = _spoolss_DeletePrintProcessor(p, r);
3744
3745         if (p->rng_fault_state) {
3746                 talloc_free(r);
3747                 /* Return true here, srv_pipe_hnd.c will take care */
3748                 return true;
3749         }
3750
3751         if (DEBUGLEVEL >= 10) {
3752                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrintProcessor, r);
3753         }
3754
3755         push = ndr_push_init_ctx(r, NULL);
3756         if (push == NULL) {
3757                 talloc_free(r);
3758                 return false;
3759         }
3760
3761         ndr_err = call->ndr_push(push, NDR_OUT, r);
3762         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3763                 talloc_free(r);
3764                 return false;
3765         }
3766
3767         blob = ndr_push_blob(push);
3768         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3769                 talloc_free(r);
3770                 return false;
3771         }
3772
3773         talloc_free(r);
3774
3775         return true;
3776 }
3777
3778 static bool api_spoolss_AddPrintProvidor(pipes_struct *p)
3779 {
3780         const struct ndr_interface_call *call;
3781         struct ndr_pull *pull;
3782         struct ndr_push *push;
3783         enum ndr_err_code ndr_err;
3784         DATA_BLOB blob;
3785         struct spoolss_AddPrintProvidor *r;
3786
3787         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTPROVIDOR];
3788
3789         r = talloc(talloc_tos(), struct spoolss_AddPrintProvidor);
3790         if (r == NULL) {
3791                 return false;
3792         }
3793
3794         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3795                 talloc_free(r);
3796                 return false;
3797         }
3798
3799         pull = ndr_pull_init_blob(&blob, r, NULL);
3800         if (pull == NULL) {
3801                 talloc_free(r);
3802                 return false;
3803         }
3804
3805         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3806         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3807         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3808                 talloc_free(r);
3809                 return false;
3810         }
3811
3812         if (DEBUGLEVEL >= 10) {
3813                 NDR_PRINT_IN_DEBUG(spoolss_AddPrintProvidor, r);
3814         }
3815
3816         r->out.result = _spoolss_AddPrintProvidor(p, r);
3817
3818         if (p->rng_fault_state) {
3819                 talloc_free(r);
3820                 /* Return true here, srv_pipe_hnd.c will take care */
3821                 return true;
3822         }
3823
3824         if (DEBUGLEVEL >= 10) {
3825                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrintProvidor, r);
3826         }
3827
3828         push = ndr_push_init_ctx(r, NULL);
3829         if (push == NULL) {
3830                 talloc_free(r);
3831                 return false;
3832         }
3833
3834         ndr_err = call->ndr_push(push, NDR_OUT, r);
3835         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3836                 talloc_free(r);
3837                 return false;
3838         }
3839
3840         blob = ndr_push_blob(push);
3841         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3842                 talloc_free(r);
3843                 return false;
3844         }
3845
3846         talloc_free(r);
3847
3848         return true;
3849 }
3850
3851 static bool api_spoolss_DeletePrintProvidor(pipes_struct *p)
3852 {
3853         const struct ndr_interface_call *call;
3854         struct ndr_pull *pull;
3855         struct ndr_push *push;
3856         enum ndr_err_code ndr_err;
3857         DATA_BLOB blob;
3858         struct spoolss_DeletePrintProvidor *r;
3859
3860         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTPROVIDOR];
3861
3862         r = talloc(talloc_tos(), struct spoolss_DeletePrintProvidor);
3863         if (r == NULL) {
3864                 return false;
3865         }
3866
3867         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3868                 talloc_free(r);
3869                 return false;
3870         }
3871
3872         pull = ndr_pull_init_blob(&blob, r, NULL);
3873         if (pull == NULL) {
3874                 talloc_free(r);
3875                 return false;
3876         }
3877
3878         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3879         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3880         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3881                 talloc_free(r);
3882                 return false;
3883         }
3884
3885         if (DEBUGLEVEL >= 10) {
3886                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrintProvidor, r);
3887         }
3888
3889         r->out.result = _spoolss_DeletePrintProvidor(p, r);
3890
3891         if (p->rng_fault_state) {
3892                 talloc_free(r);
3893                 /* Return true here, srv_pipe_hnd.c will take care */
3894                 return true;
3895         }
3896
3897         if (DEBUGLEVEL >= 10) {
3898                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrintProvidor, r);
3899         }
3900
3901         push = ndr_push_init_ctx(r, NULL);
3902         if (push == NULL) {
3903                 talloc_free(r);
3904                 return false;
3905         }
3906
3907         ndr_err = call->ndr_push(push, NDR_OUT, r);
3908         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3909                 talloc_free(r);
3910                 return false;
3911         }
3912
3913         blob = ndr_push_blob(push);
3914         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3915                 talloc_free(r);
3916                 return false;
3917         }
3918
3919         talloc_free(r);
3920
3921         return true;
3922 }
3923
3924 static bool api_spoolss_EnumPrintProcDataTypes(pipes_struct *p)
3925 {
3926         const struct ndr_interface_call *call;
3927         struct ndr_pull *pull;
3928         struct ndr_push *push;
3929         enum ndr_err_code ndr_err;
3930         DATA_BLOB blob;
3931         struct spoolss_EnumPrintProcDataTypes *r;
3932
3933         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTPROCDATATYPES];
3934
3935         r = talloc(talloc_tos(), struct spoolss_EnumPrintProcDataTypes);
3936         if (r == NULL) {
3937                 return false;
3938         }
3939
3940         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3941                 talloc_free(r);
3942                 return false;
3943         }
3944
3945         pull = ndr_pull_init_blob(&blob, r, NULL);
3946         if (pull == NULL) {
3947                 talloc_free(r);
3948                 return false;
3949         }
3950
3951         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3952         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3953         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3954                 talloc_free(r);
3955                 return false;
3956         }
3957
3958         if (DEBUGLEVEL >= 10) {
3959                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrintProcDataTypes, r);
3960         }
3961
3962         r->out.result = _spoolss_EnumPrintProcDataTypes(p, r);
3963
3964         if (p->rng_fault_state) {
3965                 talloc_free(r);
3966                 /* Return true here, srv_pipe_hnd.c will take care */
3967                 return true;
3968         }
3969
3970         if (DEBUGLEVEL >= 10) {
3971                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrintProcDataTypes, r);
3972         }
3973
3974         push = ndr_push_init_ctx(r, NULL);
3975         if (push == NULL) {
3976                 talloc_free(r);
3977                 return false;
3978         }
3979
3980         ndr_err = call->ndr_push(push, NDR_OUT, r);
3981         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3982                 talloc_free(r);
3983                 return false;
3984         }
3985
3986         blob = ndr_push_blob(push);
3987         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3988                 talloc_free(r);
3989                 return false;
3990         }
3991
3992         talloc_free(r);
3993
3994         return true;
3995 }
3996
3997 static bool api_spoolss_ResetPrinter(pipes_struct *p)
3998 {
3999         const struct ndr_interface_call *call;
4000         struct ndr_pull *pull;
4001         struct ndr_push *push;
4002         enum ndr_err_code ndr_err;
4003         DATA_BLOB blob;
4004         struct spoolss_ResetPrinter *r;
4005
4006         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_RESETPRINTER];
4007
4008         r = talloc(talloc_tos(), struct spoolss_ResetPrinter);
4009         if (r == NULL) {
4010                 return false;
4011         }
4012
4013         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4014                 talloc_free(r);
4015                 return false;
4016         }
4017
4018         pull = ndr_pull_init_blob(&blob, r, NULL);
4019         if (pull == NULL) {
4020                 talloc_free(r);
4021                 return false;
4022         }
4023
4024         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4025         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4026         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4027                 talloc_free(r);
4028                 return false;
4029         }
4030
4031         if (DEBUGLEVEL >= 10) {
4032                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinter, r);
4033         }
4034
4035         r->out.result = _spoolss_ResetPrinter(p, r);
4036
4037         if (p->rng_fault_state) {
4038                 talloc_free(r);
4039                 /* Return true here, srv_pipe_hnd.c will take care */
4040                 return true;
4041         }
4042
4043         if (DEBUGLEVEL >= 10) {
4044                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinter, r);
4045         }
4046
4047         push = ndr_push_init_ctx(r, NULL);
4048         if (push == NULL) {
4049                 talloc_free(r);
4050                 return false;
4051         }
4052
4053         ndr_err = call->ndr_push(push, NDR_OUT, r);
4054         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4055                 talloc_free(r);
4056                 return false;
4057         }
4058
4059         blob = ndr_push_blob(push);
4060         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4061                 talloc_free(r);
4062                 return false;
4063         }
4064
4065         talloc_free(r);
4066
4067         return true;
4068 }
4069
4070 static bool api_spoolss_GetPrinterDriver2(pipes_struct *p)
4071 {
4072         const struct ndr_interface_call *call;
4073         struct ndr_pull *pull;
4074         struct ndr_push *push;
4075         enum ndr_err_code ndr_err;
4076         DATA_BLOB blob;
4077         struct spoolss_GetPrinterDriver2 *r;
4078
4079         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDRIVER2];
4080
4081         r = talloc(talloc_tos(), struct spoolss_GetPrinterDriver2);
4082         if (r == NULL) {
4083                 return false;
4084         }
4085
4086         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4087                 talloc_free(r);
4088                 return false;
4089         }
4090
4091         pull = ndr_pull_init_blob(&blob, r, NULL);
4092         if (pull == NULL) {
4093                 talloc_free(r);
4094                 return false;
4095         }
4096
4097         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4098         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4099         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4100                 talloc_free(r);
4101                 return false;
4102         }
4103
4104         if (DEBUGLEVEL >= 10) {
4105                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriver2, r);
4106         }
4107
4108         ZERO_STRUCT(r->out);
4109         r->out.info = talloc_zero(r, DATA_BLOB);
4110         if (r->out.info == NULL) {
4111                 talloc_free(r);
4112                 return false;
4113         }
4114
4115         r->out.needed = talloc_zero(r, uint32_t);
4116         if (r->out.needed == NULL) {
4117                 talloc_free(r);
4118                 return false;
4119         }
4120
4121         r->out.server_major_version = talloc_zero(r, uint32_t);
4122         if (r->out.server_major_version == NULL) {
4123                 talloc_free(r);
4124                 return false;
4125         }
4126
4127         r->out.server_minor_version = talloc_zero(r, uint32_t);
4128         if (r->out.server_minor_version == NULL) {
4129                 talloc_free(r);
4130                 return false;
4131         }
4132
4133         r->out.result = _spoolss_GetPrinterDriver2(p, r);
4134
4135         if (p->rng_fault_state) {
4136                 talloc_free(r);
4137                 /* Return true here, srv_pipe_hnd.c will take care */
4138                 return true;
4139         }
4140
4141         if (DEBUGLEVEL >= 10) {
4142                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriver2, r);
4143         }
4144
4145         push = ndr_push_init_ctx(r, NULL);
4146         if (push == NULL) {
4147                 talloc_free(r);
4148                 return false;
4149         }
4150
4151         ndr_err = call->ndr_push(push, NDR_OUT, r);
4152         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4153                 talloc_free(r);
4154                 return false;
4155         }
4156
4157         blob = ndr_push_blob(push);
4158         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4159                 talloc_free(r);
4160                 return false;
4161         }
4162
4163         talloc_free(r);
4164
4165         return true;
4166 }
4167
4168 static bool api_spoolss_FindFirstPrinterChangeNotification(pipes_struct *p)
4169 {
4170         const struct ndr_interface_call *call;
4171         struct ndr_pull *pull;
4172         struct ndr_push *push;
4173         enum ndr_err_code ndr_err;
4174         DATA_BLOB blob;
4175         struct spoolss_FindFirstPrinterChangeNotification *r;
4176
4177         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION];
4178
4179         r = talloc(talloc_tos(), struct spoolss_FindFirstPrinterChangeNotification);
4180         if (r == NULL) {
4181                 return false;
4182         }
4183
4184         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4185                 talloc_free(r);
4186                 return false;
4187         }
4188
4189         pull = ndr_pull_init_blob(&blob, r, NULL);
4190         if (pull == NULL) {
4191                 talloc_free(r);
4192                 return false;
4193         }
4194
4195         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4196         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4197         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4198                 talloc_free(r);
4199                 return false;
4200         }
4201
4202         if (DEBUGLEVEL >= 10) {
4203                 NDR_PRINT_IN_DEBUG(spoolss_FindFirstPrinterChangeNotification, r);
4204         }
4205
4206         r->out.result = _spoolss_FindFirstPrinterChangeNotification(p, r);
4207
4208         if (p->rng_fault_state) {
4209                 talloc_free(r);
4210                 /* Return true here, srv_pipe_hnd.c will take care */
4211                 return true;
4212         }
4213
4214         if (DEBUGLEVEL >= 10) {
4215                 NDR_PRINT_OUT_DEBUG(spoolss_FindFirstPrinterChangeNotification, r);
4216         }
4217
4218         push = ndr_push_init_ctx(r, NULL);
4219         if (push == NULL) {
4220                 talloc_free(r);
4221                 return false;
4222         }
4223
4224         ndr_err = call->ndr_push(push, NDR_OUT, r);
4225         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4226                 talloc_free(r);
4227                 return false;
4228         }
4229
4230         blob = ndr_push_blob(push);
4231         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4232                 talloc_free(r);
4233                 return false;
4234         }
4235
4236         talloc_free(r);
4237
4238         return true;
4239 }
4240
4241 static bool api_spoolss_FindNextPrinterChangeNotification(pipes_struct *p)
4242 {
4243         const struct ndr_interface_call *call;
4244         struct ndr_pull *pull;
4245         struct ndr_push *push;
4246         enum ndr_err_code ndr_err;
4247         DATA_BLOB blob;
4248         struct spoolss_FindNextPrinterChangeNotification *r;
4249
4250         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION];
4251
4252         r = talloc(talloc_tos(), struct spoolss_FindNextPrinterChangeNotification);
4253         if (r == NULL) {
4254                 return false;
4255         }
4256
4257         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4258                 talloc_free(r);
4259                 return false;
4260         }
4261
4262         pull = ndr_pull_init_blob(&blob, r, NULL);
4263         if (pull == NULL) {
4264                 talloc_free(r);
4265                 return false;
4266         }
4267
4268         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4269         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4270         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4271                 talloc_free(r);
4272                 return false;
4273         }
4274
4275         if (DEBUGLEVEL >= 10) {
4276                 NDR_PRINT_IN_DEBUG(spoolss_FindNextPrinterChangeNotification, r);
4277         }
4278
4279         r->out.result = _spoolss_FindNextPrinterChangeNotification(p, r);
4280
4281         if (p->rng_fault_state) {
4282                 talloc_free(r);
4283                 /* Return true here, srv_pipe_hnd.c will take care */
4284                 return true;
4285         }
4286
4287         if (DEBUGLEVEL >= 10) {
4288                 NDR_PRINT_OUT_DEBUG(spoolss_FindNextPrinterChangeNotification, r);
4289         }
4290
4291         push = ndr_push_init_ctx(r, NULL);
4292         if (push == NULL) {
4293                 talloc_free(r);
4294                 return false;
4295         }
4296
4297         ndr_err = call->ndr_push(push, NDR_OUT, r);
4298         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4299                 talloc_free(r);
4300                 return false;
4301         }
4302
4303         blob = ndr_push_blob(push);
4304         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4305                 talloc_free(r);
4306                 return false;
4307         }
4308
4309         talloc_free(r);
4310
4311         return true;
4312 }
4313
4314 static bool api_spoolss_FindClosePrinterNotify(pipes_struct *p)
4315 {
4316         const struct ndr_interface_call *call;
4317         struct ndr_pull *pull;
4318         struct ndr_push *push;
4319         enum ndr_err_code ndr_err;
4320         DATA_BLOB blob;
4321         struct spoolss_FindClosePrinterNotify *r;
4322
4323         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY];
4324
4325         r = talloc(talloc_tos(), struct spoolss_FindClosePrinterNotify);
4326         if (r == NULL) {
4327                 return false;
4328         }
4329
4330         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4331                 talloc_free(r);
4332                 return false;
4333         }
4334
4335         pull = ndr_pull_init_blob(&blob, r, NULL);
4336         if (pull == NULL) {
4337                 talloc_free(r);
4338                 return false;
4339         }
4340
4341         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4342         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4343         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4344                 talloc_free(r);
4345                 return false;
4346         }
4347
4348         if (DEBUGLEVEL >= 10) {
4349                 NDR_PRINT_IN_DEBUG(spoolss_FindClosePrinterNotify, r);
4350         }
4351
4352         r->out.result = _spoolss_FindClosePrinterNotify(p, r);
4353
4354         if (p->rng_fault_state) {
4355                 talloc_free(r);
4356                 /* Return true here, srv_pipe_hnd.c will take care */
4357                 return true;
4358         }
4359
4360         if (DEBUGLEVEL >= 10) {
4361                 NDR_PRINT_OUT_DEBUG(spoolss_FindClosePrinterNotify, r);
4362         }
4363
4364         push = ndr_push_init_ctx(r, NULL);
4365         if (push == NULL) {
4366                 talloc_free(r);
4367                 return false;
4368         }
4369
4370         ndr_err = call->ndr_push(push, NDR_OUT, r);
4371         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4372                 talloc_free(r);
4373                 return false;
4374         }
4375
4376         blob = ndr_push_blob(push);
4377         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4378                 talloc_free(r);
4379                 return false;
4380         }
4381
4382         talloc_free(r);
4383
4384         return true;
4385 }
4386
4387 static bool api_spoolss_RouterFindFirstPrinterChangeNotificationOld(pipes_struct *p)
4388 {
4389         const struct ndr_interface_call *call;
4390         struct ndr_pull *pull;
4391         struct ndr_push *push;
4392         enum ndr_err_code ndr_err;
4393         DATA_BLOB blob;
4394         struct spoolss_RouterFindFirstPrinterChangeNotificationOld *r;
4395
4396         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD];
4397
4398         r = talloc(talloc_tos(), struct spoolss_RouterFindFirstPrinterChangeNotificationOld);
4399         if (r == NULL) {
4400                 return false;
4401         }
4402
4403         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4404                 talloc_free(r);
4405                 return false;
4406         }
4407
4408         pull = ndr_pull_init_blob(&blob, r, NULL);
4409         if (pull == NULL) {
4410                 talloc_free(r);
4411                 return false;
4412         }
4413
4414         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4415         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4416         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4417                 talloc_free(r);
4418                 return false;
4419         }
4420
4421         if (DEBUGLEVEL >= 10) {
4422                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, r);
4423         }
4424
4425         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotificationOld(p, r);
4426
4427         if (p->rng_fault_state) {
4428                 talloc_free(r);
4429                 /* Return true here, srv_pipe_hnd.c will take care */
4430                 return true;
4431         }
4432
4433         if (DEBUGLEVEL >= 10) {
4434                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, r);
4435         }
4436
4437         push = ndr_push_init_ctx(r, NULL);
4438         if (push == NULL) {
4439                 talloc_free(r);
4440                 return false;
4441         }
4442
4443         ndr_err = call->ndr_push(push, NDR_OUT, r);
4444         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4445                 talloc_free(r);
4446                 return false;
4447         }
4448
4449         blob = ndr_push_blob(push);
4450         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4451                 talloc_free(r);
4452                 return false;
4453         }
4454
4455         talloc_free(r);
4456
4457         return true;
4458 }
4459
4460 static bool api_spoolss_ReplyOpenPrinter(pipes_struct *p)
4461 {
4462         const struct ndr_interface_call *call;
4463         struct ndr_pull *pull;
4464         struct ndr_push *push;
4465         enum ndr_err_code ndr_err;
4466         DATA_BLOB blob;
4467         struct spoolss_ReplyOpenPrinter *r;
4468
4469         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REPLYOPENPRINTER];
4470
4471         r = talloc(talloc_tos(), struct spoolss_ReplyOpenPrinter);
4472         if (r == NULL) {
4473                 return false;
4474         }
4475
4476         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4477                 talloc_free(r);
4478                 return false;
4479         }
4480
4481         pull = ndr_pull_init_blob(&blob, r, NULL);
4482         if (pull == NULL) {
4483                 talloc_free(r);
4484                 return false;
4485         }
4486
4487         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4488         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4489         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4490                 talloc_free(r);
4491                 return false;
4492         }
4493
4494         if (DEBUGLEVEL >= 10) {
4495                 NDR_PRINT_IN_DEBUG(spoolss_ReplyOpenPrinter, r);
4496         }
4497
4498         ZERO_STRUCT(r->out);
4499         r->out.handle = talloc_zero(r, struct policy_handle);
4500         if (r->out.handle == NULL) {
4501                 talloc_free(r);
4502                 return false;
4503         }
4504
4505         r->out.result = _spoolss_ReplyOpenPrinter(p, r);
4506
4507         if (p->rng_fault_state) {
4508                 talloc_free(r);
4509                 /* Return true here, srv_pipe_hnd.c will take care */
4510                 return true;
4511         }
4512
4513         if (DEBUGLEVEL >= 10) {
4514                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyOpenPrinter, r);
4515         }
4516
4517         push = ndr_push_init_ctx(r, NULL);
4518         if (push == NULL) {
4519                 talloc_free(r);
4520                 return false;
4521         }
4522
4523         ndr_err = call->ndr_push(push, NDR_OUT, r);
4524         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4525                 talloc_free(r);
4526                 return false;
4527         }
4528
4529         blob = ndr_push_blob(push);
4530         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4531                 talloc_free(r);
4532                 return false;
4533         }
4534
4535         talloc_free(r);
4536
4537         return true;
4538 }
4539
4540 static bool api_spoolss_RouterReplyPrinter(pipes_struct *p)
4541 {
4542         const struct ndr_interface_call *call;
4543         struct ndr_pull *pull;
4544         struct ndr_push *push;
4545         enum ndr_err_code ndr_err;
4546         DATA_BLOB blob;
4547         struct spoolss_RouterReplyPrinter *r;
4548
4549         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREPLYPRINTER];
4550
4551         r = talloc(talloc_tos(), struct spoolss_RouterReplyPrinter);
4552         if (r == NULL) {
4553                 return false;
4554         }
4555
4556         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4557                 talloc_free(r);
4558                 return false;
4559         }
4560
4561         pull = ndr_pull_init_blob(&blob, r, NULL);
4562         if (pull == NULL) {
4563                 talloc_free(r);
4564                 return false;
4565         }
4566
4567         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4568         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4569         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4570                 talloc_free(r);
4571                 return false;
4572         }
4573
4574         if (DEBUGLEVEL >= 10) {
4575                 NDR_PRINT_IN_DEBUG(spoolss_RouterReplyPrinter, r);
4576         }
4577
4578         r->out.result = _spoolss_RouterReplyPrinter(p, r);
4579
4580         if (p->rng_fault_state) {
4581                 talloc_free(r);
4582                 /* Return true here, srv_pipe_hnd.c will take care */
4583                 return true;
4584         }
4585
4586         if (DEBUGLEVEL >= 10) {
4587                 NDR_PRINT_OUT_DEBUG(spoolss_RouterReplyPrinter, r);
4588         }
4589
4590         push = ndr_push_init_ctx(r, NULL);
4591         if (push == NULL) {
4592                 talloc_free(r);
4593                 return false;
4594         }
4595
4596         ndr_err = call->ndr_push(push, NDR_OUT, r);
4597         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4598                 talloc_free(r);
4599                 return false;
4600         }
4601
4602         blob = ndr_push_blob(push);
4603         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4604                 talloc_free(r);
4605                 return false;
4606         }
4607
4608         talloc_free(r);
4609
4610         return true;
4611 }
4612
4613 static bool api_spoolss_ReplyClosePrinter(pipes_struct *p)
4614 {
4615         const struct ndr_interface_call *call;
4616         struct ndr_pull *pull;
4617         struct ndr_push *push;
4618         enum ndr_err_code ndr_err;
4619         DATA_BLOB blob;
4620         struct spoolss_ReplyClosePrinter *r;
4621
4622         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REPLYCLOSEPRINTER];
4623
4624         r = talloc(talloc_tos(), struct spoolss_ReplyClosePrinter);
4625         if (r == NULL) {
4626                 return false;
4627         }
4628
4629         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4630                 talloc_free(r);
4631                 return false;
4632         }
4633
4634         pull = ndr_pull_init_blob(&blob, r, NULL);
4635         if (pull == NULL) {
4636                 talloc_free(r);
4637                 return false;
4638         }
4639
4640         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4641         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4642         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4643                 talloc_free(r);
4644                 return false;
4645         }
4646
4647         if (DEBUGLEVEL >= 10) {
4648                 NDR_PRINT_IN_DEBUG(spoolss_ReplyClosePrinter, r);
4649         }
4650
4651         ZERO_STRUCT(r->out);
4652         r->out.handle = r->in.handle;
4653         r->out.result = _spoolss_ReplyClosePrinter(p, r);
4654
4655         if (p->rng_fault_state) {
4656                 talloc_free(r);
4657                 /* Return true here, srv_pipe_hnd.c will take care */
4658                 return true;
4659         }
4660
4661         if (DEBUGLEVEL >= 10) {
4662                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyClosePrinter, r);
4663         }
4664
4665         push = ndr_push_init_ctx(r, NULL);
4666         if (push == NULL) {
4667                 talloc_free(r);
4668                 return false;
4669         }
4670
4671         ndr_err = call->ndr_push(push, NDR_OUT, r);
4672         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4673                 talloc_free(r);
4674                 return false;
4675         }
4676
4677         blob = ndr_push_blob(push);
4678         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4679                 talloc_free(r);
4680                 return false;
4681         }
4682
4683         talloc_free(r);
4684
4685         return true;
4686 }
4687
4688 static bool api_spoolss_AddPortEx(pipes_struct *p)
4689 {
4690         const struct ndr_interface_call *call;
4691         struct ndr_pull *pull;
4692         struct ndr_push *push;
4693         enum ndr_err_code ndr_err;
4694         DATA_BLOB blob;
4695         struct spoolss_AddPortEx *r;
4696
4697         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPORTEX];
4698
4699         r = talloc(talloc_tos(), struct spoolss_AddPortEx);
4700         if (r == NULL) {
4701                 return false;
4702         }
4703
4704         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4705                 talloc_free(r);
4706                 return false;
4707         }
4708
4709         pull = ndr_pull_init_blob(&blob, r, NULL);
4710         if (pull == NULL) {
4711                 talloc_free(r);
4712                 return false;
4713         }
4714
4715         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4716         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4717         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4718                 talloc_free(r);
4719                 return false;
4720         }
4721
4722         if (DEBUGLEVEL >= 10) {
4723                 NDR_PRINT_IN_DEBUG(spoolss_AddPortEx, r);
4724         }
4725
4726         r->out.result = _spoolss_AddPortEx(p, r);
4727
4728         if (p->rng_fault_state) {
4729                 talloc_free(r);
4730                 /* Return true here, srv_pipe_hnd.c will take care */
4731                 return true;
4732         }
4733
4734         if (DEBUGLEVEL >= 10) {
4735                 NDR_PRINT_OUT_DEBUG(spoolss_AddPortEx, r);
4736         }
4737
4738         push = ndr_push_init_ctx(r, NULL);
4739         if (push == NULL) {
4740                 talloc_free(r);
4741                 return false;
4742         }
4743
4744         ndr_err = call->ndr_push(push, NDR_OUT, r);
4745         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4746                 talloc_free(r);
4747                 return false;
4748         }
4749
4750         blob = ndr_push_blob(push);
4751         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4752                 talloc_free(r);
4753                 return false;
4754         }
4755
4756         talloc_free(r);
4757
4758         return true;
4759 }
4760
4761 static bool api_spoolss_RouterFindFirstPrinterChangeNotification(pipes_struct *p)
4762 {
4763         const struct ndr_interface_call *call;
4764         struct ndr_pull *pull;
4765         struct ndr_push *push;
4766         enum ndr_err_code ndr_err;
4767         DATA_BLOB blob;
4768         struct spoolss_RouterFindFirstPrinterChangeNotification *r;
4769
4770         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION];
4771
4772         r = talloc(talloc_tos(), struct spoolss_RouterFindFirstPrinterChangeNotification);
4773         if (r == NULL) {
4774                 return false;
4775         }
4776
4777         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4778                 talloc_free(r);
4779                 return false;
4780         }
4781
4782         pull = ndr_pull_init_blob(&blob, r, NULL);
4783         if (pull == NULL) {
4784                 talloc_free(r);
4785                 return false;
4786         }
4787
4788         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4789         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4790         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4791                 talloc_free(r);
4792                 return false;
4793         }
4794
4795         if (DEBUGLEVEL >= 10) {
4796                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, r);
4797         }
4798
4799         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotification(p, r);
4800
4801         if (p->rng_fault_state) {
4802                 talloc_free(r);
4803                 /* Return true here, srv_pipe_hnd.c will take care */
4804                 return true;
4805         }
4806
4807         if (DEBUGLEVEL >= 10) {
4808                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, r);
4809         }
4810
4811         push = ndr_push_init_ctx(r, NULL);
4812         if (push == NULL) {
4813                 talloc_free(r);
4814                 return false;
4815         }
4816
4817         ndr_err = call->ndr_push(push, NDR_OUT, r);
4818         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4819                 talloc_free(r);
4820                 return false;
4821         }
4822
4823         blob = ndr_push_blob(push);
4824         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4825                 talloc_free(r);
4826                 return false;
4827         }
4828
4829         talloc_free(r);
4830
4831         return true;
4832 }
4833
4834 static bool api_spoolss_SpoolerInit(pipes_struct *p)
4835 {
4836         const struct ndr_interface_call *call;
4837         struct ndr_pull *pull;
4838         struct ndr_push *push;
4839         enum ndr_err_code ndr_err;
4840         DATA_BLOB blob;
4841         struct spoolss_SpoolerInit *r;
4842
4843         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SPOOLERINIT];
4844
4845         r = talloc(talloc_tos(), struct spoolss_SpoolerInit);
4846         if (r == NULL) {
4847                 return false;
4848         }
4849
4850         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4851                 talloc_free(r);
4852                 return false;
4853         }
4854
4855         pull = ndr_pull_init_blob(&blob, r, NULL);
4856         if (pull == NULL) {
4857                 talloc_free(r);
4858                 return false;
4859         }
4860
4861         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4862         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4863         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4864                 talloc_free(r);
4865                 return false;
4866         }
4867
4868         if (DEBUGLEVEL >= 10) {
4869                 NDR_PRINT_IN_DEBUG(spoolss_SpoolerInit, r);
4870         }
4871
4872         r->out.result = _spoolss_SpoolerInit(p, r);
4873
4874         if (p->rng_fault_state) {
4875                 talloc_free(r);
4876                 /* Return true here, srv_pipe_hnd.c will take care */
4877                 return true;
4878         }
4879
4880         if (DEBUGLEVEL >= 10) {
4881                 NDR_PRINT_OUT_DEBUG(spoolss_SpoolerInit, r);
4882         }
4883
4884         push = ndr_push_init_ctx(r, NULL);
4885         if (push == NULL) {
4886                 talloc_free(r);
4887                 return false;
4888         }
4889
4890         ndr_err = call->ndr_push(push, NDR_OUT, r);
4891         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4892                 talloc_free(r);
4893                 return false;
4894         }
4895
4896         blob = ndr_push_blob(push);
4897         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4898                 talloc_free(r);
4899                 return false;
4900         }
4901
4902         talloc_free(r);
4903
4904         return true;
4905 }
4906
4907 static bool api_spoolss_ResetPrinterEx(pipes_struct *p)
4908 {
4909         const struct ndr_interface_call *call;
4910         struct ndr_pull *pull;
4911         struct ndr_push *push;
4912         enum ndr_err_code ndr_err;
4913         DATA_BLOB blob;
4914         struct spoolss_ResetPrinterEx *r;
4915
4916         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_RESETPRINTEREX];
4917
4918         r = talloc(talloc_tos(), struct spoolss_ResetPrinterEx);
4919         if (r == NULL) {
4920                 return false;
4921         }
4922
4923         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4924                 talloc_free(r);
4925                 return false;
4926         }
4927
4928         pull = ndr_pull_init_blob(&blob, r, NULL);
4929         if (pull == NULL) {
4930                 talloc_free(r);
4931                 return false;
4932         }
4933
4934         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4935         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4936         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4937                 talloc_free(r);
4938                 return false;
4939         }
4940
4941         if (DEBUGLEVEL >= 10) {
4942                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinterEx, r);
4943         }
4944
4945         r->out.result = _spoolss_ResetPrinterEx(p, r);
4946
4947         if (p->rng_fault_state) {
4948                 talloc_free(r);
4949                 /* Return true here, srv_pipe_hnd.c will take care */
4950                 return true;
4951         }
4952
4953         if (DEBUGLEVEL >= 10) {
4954                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinterEx, r);
4955         }
4956
4957         push = ndr_push_init_ctx(r, NULL);
4958         if (push == NULL) {
4959                 talloc_free(r);
4960                 return false;
4961         }
4962
4963         ndr_err = call->ndr_push(push, NDR_OUT, r);
4964         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4965                 talloc_free(r);
4966                 return false;
4967         }
4968
4969         blob = ndr_push_blob(push);
4970         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4971                 talloc_free(r);
4972                 return false;
4973         }
4974
4975         talloc_free(r);
4976
4977         return true;
4978 }
4979
4980 static bool api_spoolss_RemoteFindFirstPrinterChangeNotifyEx(pipes_struct *p)
4981 {
4982         const struct ndr_interface_call *call;
4983         struct ndr_pull *pull;
4984         struct ndr_push *push;
4985         enum ndr_err_code ndr_err;
4986         DATA_BLOB blob;
4987         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r;
4988
4989         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX];
4990
4991         r = talloc(talloc_tos(), struct spoolss_RemoteFindFirstPrinterChangeNotifyEx);
4992         if (r == NULL) {
4993                 return false;
4994         }
4995
4996         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4997                 talloc_free(r);
4998                 return false;
4999         }
5000
5001         pull = ndr_pull_init_blob(&blob, r, NULL);
5002         if (pull == NULL) {
5003                 talloc_free(r);
5004                 return false;
5005         }
5006
5007         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5008         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5009         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5010                 talloc_free(r);
5011                 return false;
5012         }
5013
5014         if (DEBUGLEVEL >= 10) {
5015                 NDR_PRINT_IN_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, r);
5016         }
5017
5018         r->out.result = _spoolss_RemoteFindFirstPrinterChangeNotifyEx(p, r);
5019
5020         if (p->rng_fault_state) {
5021                 talloc_free(r);
5022                 /* Return true here, srv_pipe_hnd.c will take care */
5023                 return true;
5024         }
5025
5026         if (DEBUGLEVEL >= 10) {
5027                 NDR_PRINT_OUT_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, r);
5028         }
5029
5030         push = ndr_push_init_ctx(r, NULL);
5031         if (push == NULL) {
5032                 talloc_free(r);
5033                 return false;
5034         }
5035
5036         ndr_err = call->ndr_push(push, NDR_OUT, r);
5037         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5038                 talloc_free(r);
5039                 return false;
5040         }
5041
5042         blob = ndr_push_blob(push);
5043         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5044                 talloc_free(r);
5045                 return false;
5046         }
5047
5048         talloc_free(r);
5049
5050         return true;
5051 }
5052
5053 static bool api_spoolss_RouterRefreshPrinterChangeNotification(pipes_struct *p)
5054 {
5055         const struct ndr_interface_call *call;
5056         struct ndr_pull *pull;
5057         struct ndr_push *push;
5058         enum ndr_err_code ndr_err;
5059         DATA_BLOB blob;
5060         struct spoolss_RouterRefreshPrinterChangeNotification *r;
5061
5062         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFICATION];
5063
5064         r = talloc(talloc_tos(), struct spoolss_RouterRefreshPrinterChangeNotification);
5065         if (r == NULL) {
5066                 return false;
5067         }
5068
5069         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5070                 talloc_free(r);
5071                 return false;
5072         }
5073
5074         pull = ndr_pull_init_blob(&blob, r, NULL);
5075         if (pull == NULL) {
5076                 talloc_free(r);
5077                 return false;
5078         }
5079
5080         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5081         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5082         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5083                 talloc_free(r);
5084                 return false;
5085         }
5086
5087         if (DEBUGLEVEL >= 10) {
5088                 NDR_PRINT_IN_DEBUG(spoolss_RouterRefreshPrinterChangeNotification, r);
5089         }
5090
5091         r->out.result = _spoolss_RouterRefreshPrinterChangeNotification(p, r);
5092
5093         if (p->rng_fault_state) {
5094                 talloc_free(r);
5095                 /* Return true here, srv_pipe_hnd.c will take care */
5096                 return true;
5097         }
5098
5099         if (DEBUGLEVEL >= 10) {
5100                 NDR_PRINT_OUT_DEBUG(spoolss_RouterRefreshPrinterChangeNotification, r);
5101         }
5102
5103         push = ndr_push_init_ctx(r, NULL);
5104         if (push == NULL) {
5105                 talloc_free(r);
5106                 return false;
5107         }
5108
5109         ndr_err = call->ndr_push(push, NDR_OUT, r);
5110         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5111                 talloc_free(r);
5112                 return false;
5113         }
5114
5115         blob = ndr_push_blob(push);
5116         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5117                 talloc_free(r);
5118                 return false;
5119         }
5120
5121         talloc_free(r);
5122
5123         return true;
5124 }
5125
5126 static bool api_spoolss_RemoteFindNextPrinterChangeNotifyEx(pipes_struct *p)
5127 {
5128         const struct ndr_interface_call *call;
5129         struct ndr_pull *pull;
5130         struct ndr_push *push;
5131         enum ndr_err_code ndr_err;
5132         DATA_BLOB blob;
5133         struct spoolss_RemoteFindNextPrinterChangeNotifyEx *r;
5134
5135         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REMOTEFINDNEXTPRINTERCHANGENOTIFYEX];
5136
5137         r = talloc(talloc_tos(), struct spoolss_RemoteFindNextPrinterChangeNotifyEx);
5138         if (r == NULL) {
5139                 return false;
5140         }
5141
5142         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5143                 talloc_free(r);
5144                 return false;
5145         }
5146
5147         pull = ndr_pull_init_blob(&blob, r, NULL);
5148         if (pull == NULL) {
5149                 talloc_free(r);
5150                 return false;
5151         }
5152
5153         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5154         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5155         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5156                 talloc_free(r);
5157                 return false;
5158         }
5159
5160         if (DEBUGLEVEL >= 10) {
5161                 NDR_PRINT_IN_DEBUG(spoolss_RemoteFindNextPrinterChangeNotifyEx, r);
5162         }
5163
5164         ZERO_STRUCT(r->out);
5165         r->out.info = talloc_zero(r, struct spoolss_NotifyInfo *);
5166         if (r->out.info == NULL) {
5167                 talloc_free(r);
5168                 return false;
5169         }
5170
5171         r->out.result = _spoolss_RemoteFindNextPrinterChangeNotifyEx(p, r);
5172
5173         if (p->rng_fault_state) {
5174                 talloc_free(r);
5175                 /* Return true here, srv_pipe_hnd.c will take care */
5176                 return true;
5177         }
5178
5179         if (DEBUGLEVEL >= 10) {
5180                 NDR_PRINT_OUT_DEBUG(spoolss_RemoteFindNextPrinterChangeNotifyEx, r);
5181         }
5182
5183         push = ndr_push_init_ctx(r, NULL);
5184         if (push == NULL) {
5185                 talloc_free(r);
5186                 return false;
5187         }
5188
5189         ndr_err = call->ndr_push(push, NDR_OUT, r);
5190         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5191                 talloc_free(r);
5192                 return false;
5193         }
5194
5195         blob = ndr_push_blob(push);
5196         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5197                 talloc_free(r);
5198                 return false;
5199         }
5200
5201         talloc_free(r);
5202
5203         return true;
5204 }
5205
5206 static bool api_spoolss_44(pipes_struct *p)
5207 {
5208         const struct ndr_interface_call *call;
5209         struct ndr_pull *pull;
5210         struct ndr_push *push;
5211         enum ndr_err_code ndr_err;
5212         DATA_BLOB blob;
5213         struct spoolss_44 *r;
5214
5215         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_44];
5216
5217         r = talloc(talloc_tos(), struct spoolss_44);
5218         if (r == NULL) {
5219                 return false;
5220         }
5221
5222         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5223                 talloc_free(r);
5224                 return false;
5225         }
5226
5227         pull = ndr_pull_init_blob(&blob, r, NULL);
5228         if (pull == NULL) {
5229                 talloc_free(r);
5230                 return false;
5231         }
5232
5233         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5234         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5235         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5236                 talloc_free(r);
5237                 return false;
5238         }
5239
5240         if (DEBUGLEVEL >= 10) {
5241                 NDR_PRINT_IN_DEBUG(spoolss_44, r);
5242         }
5243
5244         r->out.result = _spoolss_44(p, r);
5245
5246         if (p->rng_fault_state) {
5247                 talloc_free(r);
5248                 /* Return true here, srv_pipe_hnd.c will take care */
5249                 return true;
5250         }
5251
5252         if (DEBUGLEVEL >= 10) {
5253                 NDR_PRINT_OUT_DEBUG(spoolss_44, r);
5254         }
5255
5256         push = ndr_push_init_ctx(r, NULL);
5257         if (push == NULL) {
5258                 talloc_free(r);
5259                 return false;
5260         }
5261
5262         ndr_err = call->ndr_push(push, NDR_OUT, r);
5263         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5264                 talloc_free(r);
5265                 return false;
5266         }
5267
5268         blob = ndr_push_blob(push);
5269         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5270                 talloc_free(r);
5271                 return false;
5272         }
5273
5274         talloc_free(r);
5275
5276         return true;
5277 }
5278
5279 static bool api_spoolss_OpenPrinterEx(pipes_struct *p)
5280 {
5281         const struct ndr_interface_call *call;
5282         struct ndr_pull *pull;
5283         struct ndr_push *push;
5284         enum ndr_err_code ndr_err;
5285         DATA_BLOB blob;
5286         struct spoolss_OpenPrinterEx *r;
5287
5288         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_OPENPRINTEREX];
5289
5290         r = talloc(talloc_tos(), struct spoolss_OpenPrinterEx);
5291         if (r == NULL) {
5292                 return false;
5293         }
5294
5295         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5296                 talloc_free(r);
5297                 return false;
5298         }
5299
5300         pull = ndr_pull_init_blob(&blob, r, NULL);
5301         if (pull == NULL) {
5302                 talloc_free(r);
5303                 return false;
5304         }
5305
5306         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5307         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5308         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5309                 talloc_free(r);
5310                 return false;
5311         }
5312
5313         if (DEBUGLEVEL >= 10) {
5314                 NDR_PRINT_IN_DEBUG(spoolss_OpenPrinterEx, r);
5315         }
5316
5317         ZERO_STRUCT(r->out);
5318         r->out.handle = talloc_zero(r, struct policy_handle);
5319         if (r->out.handle == NULL) {
5320                 talloc_free(r);
5321                 return false;
5322         }
5323
5324         r->out.result = _spoolss_OpenPrinterEx(p, r);
5325
5326         if (p->rng_fault_state) {
5327                 talloc_free(r);
5328                 /* Return true here, srv_pipe_hnd.c will take care */
5329                 return true;
5330         }
5331
5332         if (DEBUGLEVEL >= 10) {
5333                 NDR_PRINT_OUT_DEBUG(spoolss_OpenPrinterEx, r);
5334         }
5335
5336         push = ndr_push_init_ctx(r, NULL);
5337         if (push == NULL) {
5338                 talloc_free(r);
5339                 return false;
5340         }
5341
5342         ndr_err = call->ndr_push(push, NDR_OUT, r);
5343         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5344                 talloc_free(r);
5345                 return false;
5346         }
5347
5348         blob = ndr_push_blob(push);
5349         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5350                 talloc_free(r);
5351                 return false;
5352         }
5353
5354         talloc_free(r);
5355
5356         return true;
5357 }
5358
5359 static bool api_spoolss_AddPrinterEx(pipes_struct *p)
5360 {
5361         const struct ndr_interface_call *call;
5362         struct ndr_pull *pull;
5363         struct ndr_push *push;
5364         enum ndr_err_code ndr_err;
5365         DATA_BLOB blob;
5366         struct spoolss_AddPrinterEx *r;
5367
5368         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTEREX];
5369
5370         r = talloc(talloc_tos(), struct spoolss_AddPrinterEx);
5371         if (r == NULL) {
5372                 return false;
5373         }
5374
5375         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5376                 talloc_free(r);
5377                 return false;
5378         }
5379
5380         pull = ndr_pull_init_blob(&blob, r, NULL);
5381         if (pull == NULL) {
5382                 talloc_free(r);
5383                 return false;
5384         }
5385
5386         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5387         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5388         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5389                 talloc_free(r);
5390                 return false;
5391         }
5392
5393         if (DEBUGLEVEL >= 10) {
5394                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterEx, r);
5395         }
5396
5397         r->out.result = _spoolss_AddPrinterEx(p, r);
5398
5399         if (p->rng_fault_state) {
5400                 talloc_free(r);
5401                 /* Return true here, srv_pipe_hnd.c will take care */
5402                 return true;
5403         }
5404
5405         if (DEBUGLEVEL >= 10) {
5406                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterEx, r);
5407         }
5408
5409         push = ndr_push_init_ctx(r, NULL);
5410         if (push == NULL) {
5411                 talloc_free(r);
5412                 return false;
5413         }
5414
5415         ndr_err = call->ndr_push(push, NDR_OUT, r);
5416         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5417                 talloc_free(r);
5418                 return false;
5419         }
5420
5421         blob = ndr_push_blob(push);
5422         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5423                 talloc_free(r);
5424                 return false;
5425         }
5426
5427         talloc_free(r);
5428
5429         return true;
5430 }
5431
5432 static bool api_spoolss_47(pipes_struct *p)
5433 {
5434         const struct ndr_interface_call *call;
5435         struct ndr_pull *pull;
5436         struct ndr_push *push;
5437         enum ndr_err_code ndr_err;
5438         DATA_BLOB blob;
5439         struct spoolss_47 *r;
5440
5441         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_47];
5442
5443         r = talloc(talloc_tos(), struct spoolss_47);
5444         if (r == NULL) {
5445                 return false;
5446         }
5447
5448         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5449                 talloc_free(r);
5450                 return false;
5451         }
5452
5453         pull = ndr_pull_init_blob(&blob, r, NULL);
5454         if (pull == NULL) {
5455                 talloc_free(r);
5456                 return false;
5457         }
5458
5459         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5460         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5461         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5462                 talloc_free(r);
5463                 return false;
5464         }
5465
5466         if (DEBUGLEVEL >= 10) {
5467                 NDR_PRINT_IN_DEBUG(spoolss_47, r);
5468         }
5469
5470         r->out.result = _spoolss_47(p, r);
5471
5472         if (p->rng_fault_state) {
5473                 talloc_free(r);
5474                 /* Return true here, srv_pipe_hnd.c will take care */
5475                 return true;
5476         }
5477
5478         if (DEBUGLEVEL >= 10) {
5479                 NDR_PRINT_OUT_DEBUG(spoolss_47, r);
5480         }
5481
5482         push = ndr_push_init_ctx(r, NULL);
5483         if (push == NULL) {
5484                 talloc_free(r);
5485                 return false;
5486         }
5487
5488         ndr_err = call->ndr_push(push, NDR_OUT, r);
5489         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5490                 talloc_free(r);
5491                 return false;
5492         }
5493
5494         blob = ndr_push_blob(push);
5495         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5496                 talloc_free(r);
5497                 return false;
5498         }
5499
5500         talloc_free(r);
5501
5502         return true;
5503 }
5504
5505 static bool api_spoolss_EnumPrinterData(pipes_struct *p)
5506 {
5507         const struct ndr_interface_call *call;
5508         struct ndr_pull *pull;
5509         struct ndr_push *push;
5510         enum ndr_err_code ndr_err;
5511         DATA_BLOB blob;
5512         struct spoolss_EnumPrinterData *r;
5513
5514         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERDATA];
5515
5516         r = talloc(talloc_tos(), struct spoolss_EnumPrinterData);
5517         if (r == NULL) {
5518                 return false;
5519         }
5520
5521         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5522                 talloc_free(r);
5523                 return false;
5524         }
5525
5526         pull = ndr_pull_init_blob(&blob, r, NULL);
5527         if (pull == NULL) {
5528                 talloc_free(r);
5529                 return false;
5530         }
5531
5532         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5533         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5534         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5535                 talloc_free(r);
5536                 return false;
5537         }
5538
5539         if (DEBUGLEVEL >= 10) {
5540                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterData, r);
5541         }
5542
5543         ZERO_STRUCT(r->out);
5544         r->out.value_name = talloc_zero_array(r, const char, r->in.value_offered / 2);
5545         if (r->out.value_name == NULL) {
5546                 talloc_free(r);
5547                 return false;
5548         }
5549
5550         r->out.value_needed = talloc_zero(r, uint32_t);
5551         if (r->out.value_needed == NULL) {
5552                 talloc_free(r);
5553                 return false;
5554         }
5555
5556         r->out.printerdata_type = talloc_zero(r, uint32_t);
5557         if (r->out.printerdata_type == NULL) {
5558                 talloc_free(r);
5559                 return false;
5560         }
5561
5562         r->out.buffer = talloc_zero(r, DATA_BLOB);
5563         if (r->out.buffer == NULL) {
5564                 talloc_free(r);
5565                 return false;
5566         }
5567
5568         r->out.data_needed = talloc_zero(r, uint32_t);
5569         if (r->out.data_needed == NULL) {
5570                 talloc_free(r);
5571                 return false;
5572         }
5573
5574         r->out.result = _spoolss_EnumPrinterData(p, r);
5575
5576         if (p->rng_fault_state) {
5577                 talloc_free(r);
5578                 /* Return true here, srv_pipe_hnd.c will take care */
5579                 return true;
5580         }
5581
5582         if (DEBUGLEVEL >= 10) {
5583                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterData, r);
5584         }
5585
5586         push = ndr_push_init_ctx(r, NULL);
5587         if (push == NULL) {
5588                 talloc_free(r);
5589                 return false;
5590         }
5591
5592         ndr_err = call->ndr_push(push, NDR_OUT, r);
5593         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5594                 talloc_free(r);
5595                 return false;
5596         }
5597
5598         blob = ndr_push_blob(push);
5599         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5600                 talloc_free(r);
5601                 return false;
5602         }
5603
5604         talloc_free(r);
5605
5606         return true;
5607 }
5608
5609 static bool api_spoolss_DeletePrinterData(pipes_struct *p)
5610 {
5611         const struct ndr_interface_call *call;
5612         struct ndr_pull *pull;
5613         struct ndr_push *push;
5614         enum ndr_err_code ndr_err;
5615         DATA_BLOB blob;
5616         struct spoolss_DeletePrinterData *r;
5617
5618         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDATA];
5619
5620         r = talloc(talloc_tos(), struct spoolss_DeletePrinterData);
5621         if (r == NULL) {
5622                 return false;
5623         }
5624
5625         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5626                 talloc_free(r);
5627                 return false;
5628         }
5629
5630         pull = ndr_pull_init_blob(&blob, r, NULL);
5631         if (pull == NULL) {
5632                 talloc_free(r);
5633                 return false;
5634         }
5635
5636         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5637         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5638         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5639                 talloc_free(r);
5640                 return false;
5641         }
5642
5643         if (DEBUGLEVEL >= 10) {
5644                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterData, r);
5645         }
5646
5647         r->out.result = _spoolss_DeletePrinterData(p, r);
5648
5649         if (p->rng_fault_state) {
5650                 talloc_free(r);
5651                 /* Return true here, srv_pipe_hnd.c will take care */
5652                 return true;
5653         }
5654
5655         if (DEBUGLEVEL >= 10) {
5656                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterData, r);
5657         }
5658
5659         push = ndr_push_init_ctx(r, NULL);
5660         if (push == NULL) {
5661                 talloc_free(r);
5662                 return false;
5663         }
5664
5665         ndr_err = call->ndr_push(push, NDR_OUT, r);
5666         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5667                 talloc_free(r);
5668                 return false;
5669         }
5670
5671         blob = ndr_push_blob(push);
5672         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5673                 talloc_free(r);
5674                 return false;
5675         }
5676
5677         talloc_free(r);
5678
5679         return true;
5680 }
5681
5682 static bool api_spoolss_4a(pipes_struct *p)
5683 {
5684         const struct ndr_interface_call *call;
5685         struct ndr_pull *pull;
5686         struct ndr_push *push;
5687         enum ndr_err_code ndr_err;
5688         DATA_BLOB blob;
5689         struct spoolss_4a *r;
5690
5691         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4A];
5692
5693         r = talloc(talloc_tos(), struct spoolss_4a);
5694         if (r == NULL) {
5695                 return false;
5696         }
5697
5698         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5699                 talloc_free(r);
5700                 return false;
5701         }
5702
5703         pull = ndr_pull_init_blob(&blob, r, NULL);
5704         if (pull == NULL) {
5705                 talloc_free(r);
5706                 return false;
5707         }
5708
5709         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5710         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5711         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5712                 talloc_free(r);
5713                 return false;
5714         }
5715
5716         if (DEBUGLEVEL >= 10) {
5717                 NDR_PRINT_IN_DEBUG(spoolss_4a, r);
5718         }
5719
5720         r->out.result = _spoolss_4a(p, r);
5721
5722         if (p->rng_fault_state) {
5723                 talloc_free(r);
5724                 /* Return true here, srv_pipe_hnd.c will take care */
5725                 return true;
5726         }
5727
5728         if (DEBUGLEVEL >= 10) {
5729                 NDR_PRINT_OUT_DEBUG(spoolss_4a, r);
5730         }
5731
5732         push = ndr_push_init_ctx(r, NULL);
5733         if (push == NULL) {
5734                 talloc_free(r);
5735                 return false;
5736         }
5737
5738         ndr_err = call->ndr_push(push, NDR_OUT, r);
5739         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5740                 talloc_free(r);
5741                 return false;
5742         }
5743
5744         blob = ndr_push_blob(push);
5745         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5746                 talloc_free(r);
5747                 return false;
5748         }
5749
5750         talloc_free(r);
5751
5752         return true;
5753 }
5754
5755 static bool api_spoolss_4b(pipes_struct *p)
5756 {
5757         const struct ndr_interface_call *call;
5758         struct ndr_pull *pull;
5759         struct ndr_push *push;
5760         enum ndr_err_code ndr_err;
5761         DATA_BLOB blob;
5762         struct spoolss_4b *r;
5763
5764         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4B];
5765
5766         r = talloc(talloc_tos(), struct spoolss_4b);
5767         if (r == NULL) {
5768                 return false;
5769         }
5770
5771         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5772                 talloc_free(r);
5773                 return false;
5774         }
5775
5776         pull = ndr_pull_init_blob(&blob, r, NULL);
5777         if (pull == NULL) {
5778                 talloc_free(r);
5779                 return false;
5780         }
5781
5782         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5783         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5784         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5785                 talloc_free(r);
5786                 return false;
5787         }
5788
5789         if (DEBUGLEVEL >= 10) {
5790                 NDR_PRINT_IN_DEBUG(spoolss_4b, r);
5791         }
5792
5793         r->out.result = _spoolss_4b(p, r);
5794
5795         if (p->rng_fault_state) {
5796                 talloc_free(r);
5797                 /* Return true here, srv_pipe_hnd.c will take care */
5798                 return true;
5799         }
5800
5801         if (DEBUGLEVEL >= 10) {
5802                 NDR_PRINT_OUT_DEBUG(spoolss_4b, r);
5803         }
5804
5805         push = ndr_push_init_ctx(r, NULL);
5806         if (push == NULL) {
5807                 talloc_free(r);
5808                 return false;
5809         }
5810
5811         ndr_err = call->ndr_push(push, NDR_OUT, r);
5812         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5813                 talloc_free(r);
5814                 return false;
5815         }
5816
5817         blob = ndr_push_blob(push);
5818         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5819                 talloc_free(r);
5820                 return false;
5821         }
5822
5823         talloc_free(r);
5824
5825         return true;
5826 }
5827
5828 static bool api_spoolss_4c(pipes_struct *p)
5829 {
5830         const struct ndr_interface_call *call;
5831         struct ndr_pull *pull;
5832         struct ndr_push *push;
5833         enum ndr_err_code ndr_err;
5834         DATA_BLOB blob;
5835         struct spoolss_4c *r;
5836
5837         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4C];
5838
5839         r = talloc(talloc_tos(), struct spoolss_4c);
5840         if (r == NULL) {
5841                 return false;
5842         }
5843
5844         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5845                 talloc_free(r);
5846                 return false;
5847         }
5848
5849         pull = ndr_pull_init_blob(&blob, r, NULL);
5850         if (pull == NULL) {
5851                 talloc_free(r);
5852                 return false;
5853         }
5854
5855         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5856         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5857         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5858                 talloc_free(r);
5859                 return false;
5860         }
5861
5862         if (DEBUGLEVEL >= 10) {
5863                 NDR_PRINT_IN_DEBUG(spoolss_4c, r);
5864         }
5865
5866         r->out.result = _spoolss_4c(p, r);
5867
5868         if (p->rng_fault_state) {
5869                 talloc_free(r);
5870                 /* Return true here, srv_pipe_hnd.c will take care */
5871                 return true;
5872         }
5873
5874         if (DEBUGLEVEL >= 10) {
5875                 NDR_PRINT_OUT_DEBUG(spoolss_4c, r);
5876         }
5877
5878         push = ndr_push_init_ctx(r, NULL);
5879         if (push == NULL) {
5880                 talloc_free(r);
5881                 return false;
5882         }
5883
5884         ndr_err = call->ndr_push(push, NDR_OUT, r);
5885         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5886                 talloc_free(r);
5887                 return false;
5888         }
5889
5890         blob = ndr_push_blob(push);
5891         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5892                 talloc_free(r);
5893                 return false;
5894         }
5895
5896         talloc_free(r);
5897
5898         return true;
5899 }
5900
5901 static bool api_spoolss_SetPrinterDataEx(pipes_struct *p)
5902 {
5903         const struct ndr_interface_call *call;
5904         struct ndr_pull *pull;
5905         struct ndr_push *push;
5906         enum ndr_err_code ndr_err;
5907         DATA_BLOB blob;
5908         struct spoolss_SetPrinterDataEx *r;
5909
5910         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETPRINTERDATAEX];
5911
5912         r = talloc(talloc_tos(), struct spoolss_SetPrinterDataEx);
5913         if (r == NULL) {
5914                 return false;
5915         }
5916
5917         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5918                 talloc_free(r);
5919                 return false;
5920         }
5921
5922         pull = ndr_pull_init_blob(&blob, r, NULL);
5923         if (pull == NULL) {
5924                 talloc_free(r);
5925                 return false;
5926         }
5927
5928         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5929         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5930         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5931                 talloc_free(r);
5932                 return false;
5933         }
5934
5935         if (DEBUGLEVEL >= 10) {
5936                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinterDataEx, r);
5937         }
5938
5939         r->out.result = _spoolss_SetPrinterDataEx(p, r);
5940
5941         if (p->rng_fault_state) {
5942                 talloc_free(r);
5943                 /* Return true here, srv_pipe_hnd.c will take care */
5944                 return true;
5945         }
5946
5947         if (DEBUGLEVEL >= 10) {
5948                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinterDataEx, r);
5949         }
5950
5951         push = ndr_push_init_ctx(r, NULL);
5952         if (push == NULL) {
5953                 talloc_free(r);
5954                 return false;
5955         }
5956
5957         ndr_err = call->ndr_push(push, NDR_OUT, r);
5958         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5959                 talloc_free(r);
5960                 return false;
5961         }
5962
5963         blob = ndr_push_blob(push);
5964         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5965                 talloc_free(r);
5966                 return false;
5967         }
5968
5969         talloc_free(r);
5970
5971         return true;
5972 }
5973
5974 static bool api_spoolss_GetPrinterDataEx(pipes_struct *p)
5975 {
5976         const struct ndr_interface_call *call;
5977         struct ndr_pull *pull;
5978         struct ndr_push *push;
5979         enum ndr_err_code ndr_err;
5980         DATA_BLOB blob;
5981         struct spoolss_GetPrinterDataEx *r;
5982
5983         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDATAEX];
5984
5985         r = talloc(talloc_tos(), struct spoolss_GetPrinterDataEx);
5986         if (r == NULL) {
5987                 return false;
5988         }
5989
5990         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5991                 talloc_free(r);
5992                 return false;
5993         }
5994
5995         pull = ndr_pull_init_blob(&blob, r, NULL);
5996         if (pull == NULL) {
5997                 talloc_free(r);
5998                 return false;
5999         }
6000
6001         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6002         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6003         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6004                 talloc_free(r);
6005                 return false;
6006         }
6007
6008         if (DEBUGLEVEL >= 10) {
6009                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDataEx, r);
6010         }
6011
6012         ZERO_STRUCT(r->out);
6013         r->out.type = talloc_zero(r, uint32_t);
6014         if (r->out.type == NULL) {
6015                 talloc_free(r);
6016                 return false;
6017         }
6018
6019         r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
6020         if (r->out.buffer == NULL) {
6021                 talloc_free(r);
6022                 return false;
6023         }
6024
6025         r->out.needed = talloc_zero(r, uint32_t);
6026         if (r->out.needed == NULL) {
6027                 talloc_free(r);
6028                 return false;
6029         }
6030
6031         r->out.result = _spoolss_GetPrinterDataEx(p, r);
6032
6033         if (p->rng_fault_state) {
6034                 talloc_free(r);
6035                 /* Return true here, srv_pipe_hnd.c will take care */
6036                 return true;
6037         }
6038
6039         if (DEBUGLEVEL >= 10) {
6040                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDataEx, r);
6041         }
6042
6043         push = ndr_push_init_ctx(r, NULL);
6044         if (push == NULL) {
6045                 talloc_free(r);
6046                 return false;
6047         }
6048
6049         ndr_err = call->ndr_push(push, NDR_OUT, r);
6050         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6051                 talloc_free(r);
6052                 return false;
6053         }
6054
6055         blob = ndr_push_blob(push);
6056         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6057                 talloc_free(r);
6058                 return false;
6059         }
6060
6061         talloc_free(r);
6062
6063         return true;
6064 }
6065
6066 static bool api_spoolss_EnumPrinterDataEx(pipes_struct *p)
6067 {
6068         const struct ndr_interface_call *call;
6069         struct ndr_pull *pull;
6070         struct ndr_push *push;
6071         enum ndr_err_code ndr_err;
6072         DATA_BLOB blob;
6073         struct spoolss_EnumPrinterDataEx *r;
6074
6075         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERDATAEX];
6076
6077         r = talloc(talloc_tos(), struct spoolss_EnumPrinterDataEx);
6078         if (r == NULL) {
6079                 return false;
6080         }
6081
6082         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6083                 talloc_free(r);
6084                 return false;
6085         }
6086
6087         pull = ndr_pull_init_blob(&blob, r, NULL);
6088         if (pull == NULL) {
6089                 talloc_free(r);
6090                 return false;
6091         }
6092
6093         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6094         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6095         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6096                 talloc_free(r);
6097                 return false;
6098         }
6099
6100         if (DEBUGLEVEL >= 10) {
6101                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterDataEx, r);
6102         }
6103
6104         ZERO_STRUCT(r->out);
6105         r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
6106         if (r->out.buffer == NULL) {
6107                 talloc_free(r);
6108                 return false;
6109         }
6110
6111         r->out.needed = talloc_zero(r, uint32_t);
6112         if (r->out.needed == NULL) {
6113                 talloc_free(r);
6114                 return false;
6115         }
6116
6117         r->out.count = talloc_zero(r, uint32_t);
6118         if (r->out.count == NULL) {
6119                 talloc_free(r);
6120                 return false;
6121         }
6122
6123         r->out.result = _spoolss_EnumPrinterDataEx(p, r);
6124
6125         if (p->rng_fault_state) {
6126                 talloc_free(r);
6127                 /* Return true here, srv_pipe_hnd.c will take care */
6128                 return true;
6129         }
6130
6131         if (DEBUGLEVEL >= 10) {
6132                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterDataEx, r);
6133         }
6134
6135         push = ndr_push_init_ctx(r, NULL);
6136         if (push == NULL) {
6137                 talloc_free(r);
6138                 return false;
6139         }
6140
6141         ndr_err = call->ndr_push(push, NDR_OUT, r);
6142         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6143                 talloc_free(r);
6144                 return false;
6145         }
6146
6147         blob = ndr_push_blob(push);
6148         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6149                 talloc_free(r);
6150                 return false;
6151         }
6152
6153         talloc_free(r);
6154
6155         return true;
6156 }
6157
6158 static bool api_spoolss_EnumPrinterKey(pipes_struct *p)
6159 {
6160         const struct ndr_interface_call *call;
6161         struct ndr_pull *pull;
6162         struct ndr_push *push;
6163         enum ndr_err_code ndr_err;
6164         DATA_BLOB blob;
6165         struct spoolss_EnumPrinterKey *r;
6166
6167         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERKEY];
6168
6169         r = talloc(talloc_tos(), struct spoolss_EnumPrinterKey);
6170         if (r == NULL) {
6171                 return false;
6172         }
6173
6174         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6175                 talloc_free(r);
6176                 return false;
6177         }
6178
6179         pull = ndr_pull_init_blob(&blob, r, NULL);
6180         if (pull == NULL) {
6181                 talloc_free(r);
6182                 return false;
6183         }
6184
6185         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6186         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6187         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6188                 talloc_free(r);
6189                 return false;
6190         }
6191
6192         if (DEBUGLEVEL >= 10) {
6193                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterKey, r);
6194         }
6195
6196         ZERO_STRUCT(r->out);
6197         r->out.key_buffer = talloc_zero_array(r, uint16_t, r->in.key_buffer_size / 2);
6198         if (r->out.key_buffer == NULL) {
6199                 talloc_free(r);
6200                 return false;
6201         }
6202
6203         r->out.needed = talloc_zero(r, uint32_t);
6204         if (r->out.needed == NULL) {
6205                 talloc_free(r);
6206                 return false;
6207         }
6208
6209         r->out.result = _spoolss_EnumPrinterKey(p, r);
6210
6211         if (p->rng_fault_state) {
6212                 talloc_free(r);
6213                 /* Return true here, srv_pipe_hnd.c will take care */
6214                 return true;
6215         }
6216
6217         if (DEBUGLEVEL >= 10) {
6218                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterKey, r);
6219         }
6220
6221         push = ndr_push_init_ctx(r, NULL);
6222         if (push == NULL) {
6223                 talloc_free(r);
6224                 return false;
6225         }
6226
6227         ndr_err = call->ndr_push(push, NDR_OUT, r);
6228         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6229                 talloc_free(r);
6230                 return false;
6231         }
6232
6233         blob = ndr_push_blob(push);
6234         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6235                 talloc_free(r);
6236                 return false;
6237         }
6238
6239         talloc_free(r);
6240
6241         return true;
6242 }
6243
6244 static bool api_spoolss_DeletePrinterDataEx(pipes_struct *p)
6245 {
6246         const struct ndr_interface_call *call;
6247         struct ndr_pull *pull;
6248         struct ndr_push *push;
6249         enum ndr_err_code ndr_err;
6250         DATA_BLOB blob;
6251         struct spoolss_DeletePrinterDataEx *r;
6252
6253         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDATAEX];
6254
6255         r = talloc(talloc_tos(), struct spoolss_DeletePrinterDataEx);
6256         if (r == NULL) {
6257                 return false;
6258         }
6259
6260         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6261                 talloc_free(r);
6262                 return false;
6263         }
6264
6265         pull = ndr_pull_init_blob(&blob, r, NULL);
6266         if (pull == NULL) {
6267                 talloc_free(r);
6268                 return false;
6269         }
6270
6271         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6272         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6273         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6274                 talloc_free(r);
6275                 return false;
6276         }
6277
6278         if (DEBUGLEVEL >= 10) {
6279                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDataEx, r);
6280         }
6281
6282         r->out.result = _spoolss_DeletePrinterDataEx(p, r);
6283
6284         if (p->rng_fault_state) {
6285                 talloc_free(r);
6286                 /* Return true here, srv_pipe_hnd.c will take care */
6287                 return true;
6288         }
6289
6290         if (DEBUGLEVEL >= 10) {
6291                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDataEx, r);
6292         }
6293
6294         push = ndr_push_init_ctx(r, NULL);
6295         if (push == NULL) {
6296                 talloc_free(r);
6297                 return false;
6298         }
6299
6300         ndr_err = call->ndr_push(push, NDR_OUT, r);
6301         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6302                 talloc_free(r);
6303                 return false;
6304         }
6305
6306         blob = ndr_push_blob(push);
6307         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6308                 talloc_free(r);
6309                 return false;
6310         }
6311
6312         talloc_free(r);
6313
6314         return true;
6315 }
6316
6317 static bool api_spoolss_DeletePrinterKey(pipes_struct *p)
6318 {
6319         const struct ndr_interface_call *call;
6320         struct ndr_pull *pull;
6321         struct ndr_push *push;
6322         enum ndr_err_code ndr_err;
6323         DATA_BLOB blob;
6324         struct spoolss_DeletePrinterKey *r;
6325
6326         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERKEY];
6327
6328         r = talloc(talloc_tos(), struct spoolss_DeletePrinterKey);
6329         if (r == NULL) {
6330                 return false;
6331         }
6332
6333         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6334                 talloc_free(r);
6335                 return false;
6336         }
6337
6338         pull = ndr_pull_init_blob(&blob, r, NULL);
6339         if (pull == NULL) {
6340                 talloc_free(r);
6341                 return false;
6342         }
6343
6344         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6345         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6346         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6347                 talloc_free(r);
6348                 return false;
6349         }
6350
6351         if (DEBUGLEVEL >= 10) {
6352                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterKey, r);
6353         }
6354
6355         r->out.result = _spoolss_DeletePrinterKey(p, r);
6356
6357         if (p->rng_fault_state) {
6358                 talloc_free(r);
6359                 /* Return true here, srv_pipe_hnd.c will take care */
6360                 return true;
6361         }
6362
6363         if (DEBUGLEVEL >= 10) {
6364                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterKey, r);
6365         }
6366
6367         push = ndr_push_init_ctx(r, NULL);
6368         if (push == NULL) {
6369                 talloc_free(r);
6370                 return false;
6371         }
6372
6373         ndr_err = call->ndr_push(push, NDR_OUT, r);
6374         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6375                 talloc_free(r);
6376                 return false;
6377         }
6378
6379         blob = ndr_push_blob(push);
6380         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6381                 talloc_free(r);
6382                 return false;
6383         }
6384
6385         talloc_free(r);
6386
6387         return true;
6388 }
6389
6390 static bool api_spoolss_53(pipes_struct *p)
6391 {
6392         const struct ndr_interface_call *call;
6393         struct ndr_pull *pull;
6394         struct ndr_push *push;
6395         enum ndr_err_code ndr_err;
6396         DATA_BLOB blob;
6397         struct spoolss_53 *r;
6398
6399         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_53];
6400
6401         r = talloc(talloc_tos(), struct spoolss_53);
6402         if (r == NULL) {
6403                 return false;
6404         }
6405
6406         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6407                 talloc_free(r);
6408                 return false;
6409         }
6410
6411         pull = ndr_pull_init_blob(&blob, r, NULL);
6412         if (pull == NULL) {
6413                 talloc_free(r);
6414                 return false;
6415         }
6416
6417         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6418         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6419         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6420                 talloc_free(r);
6421                 return false;
6422         }
6423
6424         if (DEBUGLEVEL >= 10) {
6425                 NDR_PRINT_IN_DEBUG(spoolss_53, r);
6426         }
6427
6428         r->out.result = _spoolss_53(p, r);
6429
6430         if (p->rng_fault_state) {
6431                 talloc_free(r);
6432                 /* Return true here, srv_pipe_hnd.c will take care */
6433                 return true;
6434         }
6435
6436         if (DEBUGLEVEL >= 10) {
6437                 NDR_PRINT_OUT_DEBUG(spoolss_53, r);
6438         }
6439
6440         push = ndr_push_init_ctx(r, NULL);
6441         if (push == NULL) {
6442                 talloc_free(r);
6443                 return false;
6444         }
6445
6446         ndr_err = call->ndr_push(push, NDR_OUT, r);
6447         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6448                 talloc_free(r);
6449                 return false;
6450         }
6451
6452         blob = ndr_push_blob(push);
6453         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6454                 talloc_free(r);
6455                 return false;
6456         }
6457
6458         talloc_free(r);
6459
6460         return true;
6461 }
6462
6463 static bool api_spoolss_DeletePrinterDriverEx(pipes_struct *p)
6464 {
6465         const struct ndr_interface_call *call;
6466         struct ndr_pull *pull;
6467         struct ndr_push *push;
6468         enum ndr_err_code ndr_err;
6469         DATA_BLOB blob;
6470         struct spoolss_DeletePrinterDriverEx *r;
6471
6472         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDRIVEREX];
6473
6474         r = talloc(talloc_tos(), struct spoolss_DeletePrinterDriverEx);
6475         if (r == NULL) {
6476                 return false;
6477         }
6478
6479         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6480                 talloc_free(r);
6481                 return false;
6482         }
6483
6484         pull = ndr_pull_init_blob(&blob, r, NULL);
6485         if (pull == NULL) {
6486                 talloc_free(r);
6487                 return false;
6488         }
6489
6490         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6491         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6492         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6493                 talloc_free(r);
6494                 return false;
6495         }
6496
6497         if (DEBUGLEVEL >= 10) {
6498                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDriverEx, r);
6499         }
6500
6501         r->out.result = _spoolss_DeletePrinterDriverEx(p, r);
6502
6503         if (p->rng_fault_state) {
6504                 talloc_free(r);
6505                 /* Return true here, srv_pipe_hnd.c will take care */
6506                 return true;
6507         }
6508
6509         if (DEBUGLEVEL >= 10) {
6510                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDriverEx, r);
6511         }
6512
6513         push = ndr_push_init_ctx(r, NULL);
6514         if (push == NULL) {
6515                 talloc_free(r);
6516                 return false;
6517         }
6518
6519         ndr_err = call->ndr_push(push, NDR_OUT, r);
6520         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6521                 talloc_free(r);
6522                 return false;
6523         }
6524
6525         blob = ndr_push_blob(push);
6526         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6527                 talloc_free(r);
6528                 return false;
6529         }
6530
6531         talloc_free(r);
6532
6533         return true;
6534 }
6535
6536 static bool api_spoolss_55(pipes_struct *p)
6537 {
6538         const struct ndr_interface_call *call;
6539         struct ndr_pull *pull;
6540         struct ndr_push *push;
6541         enum ndr_err_code ndr_err;
6542         DATA_BLOB blob;
6543         struct spoolss_55 *r;
6544
6545         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_55];
6546
6547         r = talloc(talloc_tos(), struct spoolss_55);
6548         if (r == NULL) {
6549                 return false;
6550         }
6551
6552         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6553                 talloc_free(r);
6554                 return false;
6555         }
6556
6557         pull = ndr_pull_init_blob(&blob, r, NULL);
6558         if (pull == NULL) {
6559                 talloc_free(r);
6560                 return false;
6561         }
6562
6563         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6564         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6565         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6566                 talloc_free(r);
6567                 return false;
6568         }
6569
6570         if (DEBUGLEVEL >= 10) {
6571                 NDR_PRINT_IN_DEBUG(spoolss_55, r);
6572         }
6573
6574         r->out.result = _spoolss_55(p, r);
6575
6576         if (p->rng_fault_state) {
6577                 talloc_free(r);
6578                 /* Return true here, srv_pipe_hnd.c will take care */
6579                 return true;
6580         }
6581
6582         if (DEBUGLEVEL >= 10) {
6583                 NDR_PRINT_OUT_DEBUG(spoolss_55, r);
6584         }
6585
6586         push = ndr_push_init_ctx(r, NULL);
6587         if (push == NULL) {
6588                 talloc_free(r);
6589                 return false;
6590         }
6591
6592         ndr_err = call->ndr_push(push, NDR_OUT, r);
6593         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6594                 talloc_free(r);
6595                 return false;
6596         }
6597
6598         blob = ndr_push_blob(push);
6599         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6600                 talloc_free(r);
6601                 return false;
6602         }
6603
6604         talloc_free(r);
6605
6606         return true;
6607 }
6608
6609 static bool api_spoolss_56(pipes_struct *p)
6610 {
6611         const struct ndr_interface_call *call;
6612         struct ndr_pull *pull;
6613         struct ndr_push *push;
6614         enum ndr_err_code ndr_err;
6615         DATA_BLOB blob;
6616         struct spoolss_56 *r;
6617
6618         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_56];
6619
6620         r = talloc(talloc_tos(), struct spoolss_56);
6621         if (r == NULL) {
6622                 return false;
6623         }
6624
6625         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6626                 talloc_free(r);
6627                 return false;
6628         }
6629
6630         pull = ndr_pull_init_blob(&blob, r, NULL);
6631         if (pull == NULL) {
6632                 talloc_free(r);
6633                 return false;
6634         }
6635
6636         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6637         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6638         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6639                 talloc_free(r);
6640                 return false;
6641         }
6642
6643         if (DEBUGLEVEL >= 10) {
6644                 NDR_PRINT_IN_DEBUG(spoolss_56, r);
6645         }
6646
6647         r->out.result = _spoolss_56(p, r);
6648
6649         if (p->rng_fault_state) {
6650                 talloc_free(r);
6651                 /* Return true here, srv_pipe_hnd.c will take care */
6652                 return true;
6653         }
6654
6655         if (DEBUGLEVEL >= 10) {
6656                 NDR_PRINT_OUT_DEBUG(spoolss_56, r);
6657         }
6658
6659         push = ndr_push_init_ctx(r, NULL);
6660         if (push == NULL) {
6661                 talloc_free(r);
6662                 return false;
6663         }
6664
6665         ndr_err = call->ndr_push(push, NDR_OUT, r);
6666         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6667                 talloc_free(r);
6668                 return false;
6669         }
6670
6671         blob = ndr_push_blob(push);
6672         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6673                 talloc_free(r);
6674                 return false;
6675         }
6676
6677         talloc_free(r);
6678
6679         return true;
6680 }
6681
6682 static bool api_spoolss_57(pipes_struct *p)
6683 {
6684         const struct ndr_interface_call *call;
6685         struct ndr_pull *pull;
6686         struct ndr_push *push;
6687         enum ndr_err_code ndr_err;
6688         DATA_BLOB blob;
6689         struct spoolss_57 *r;
6690
6691         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_57];
6692
6693         r = talloc(talloc_tos(), struct spoolss_57);
6694         if (r == NULL) {
6695                 return false;
6696         }
6697
6698         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6699                 talloc_free(r);
6700                 return false;
6701         }
6702
6703         pull = ndr_pull_init_blob(&blob, r, NULL);
6704         if (pull == NULL) {
6705                 talloc_free(r);
6706                 return false;
6707         }
6708
6709         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6710         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6711         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6712                 talloc_free(r);
6713                 return false;
6714         }
6715
6716         if (DEBUGLEVEL >= 10) {
6717                 NDR_PRINT_IN_DEBUG(spoolss_57, r);
6718         }
6719
6720         r->out.result = _spoolss_57(p, r);
6721
6722         if (p->rng_fault_state) {
6723                 talloc_free(r);
6724                 /* Return true here, srv_pipe_hnd.c will take care */
6725                 return true;
6726         }
6727
6728         if (DEBUGLEVEL >= 10) {
6729                 NDR_PRINT_OUT_DEBUG(spoolss_57, r);
6730         }
6731
6732         push = ndr_push_init_ctx(r, NULL);
6733         if (push == NULL) {
6734                 talloc_free(r);
6735                 return false;
6736         }
6737
6738         ndr_err = call->ndr_push(push, NDR_OUT, r);
6739         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6740                 talloc_free(r);
6741                 return false;
6742         }
6743
6744         blob = ndr_push_blob(push);
6745         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6746                 talloc_free(r);
6747                 return false;
6748         }
6749
6750         talloc_free(r);
6751
6752         return true;
6753 }
6754
6755 static bool api_spoolss_XcvData(pipes_struct *p)
6756 {
6757         const struct ndr_interface_call *call;
6758         struct ndr_pull *pull;
6759         struct ndr_push *push;
6760         enum ndr_err_code ndr_err;
6761         DATA_BLOB blob;
6762         struct spoolss_XcvData *r;
6763
6764         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_XCVDATA];
6765
6766         r = talloc(talloc_tos(), struct spoolss_XcvData);
6767         if (r == NULL) {
6768                 return false;
6769         }
6770
6771         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6772                 talloc_free(r);
6773                 return false;
6774         }
6775
6776         pull = ndr_pull_init_blob(&blob, r, NULL);
6777         if (pull == NULL) {
6778                 talloc_free(r);
6779                 return false;
6780         }
6781
6782         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6783         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6784         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6785                 talloc_free(r);
6786                 return false;
6787         }
6788
6789         if (DEBUGLEVEL >= 10) {
6790                 NDR_PRINT_IN_DEBUG(spoolss_XcvData, r);
6791         }
6792
6793         ZERO_STRUCT(r->out);
6794         r->out.status_code = r->in.status_code;
6795         r->out.out_data = talloc_zero_array(r, uint8_t, r->in.out_data_size);
6796         if (r->out.out_data == NULL) {
6797                 talloc_free(r);
6798                 return false;
6799         }
6800
6801         r->out.needed = talloc_zero(r, uint32_t);
6802         if (r->out.needed == NULL) {
6803                 talloc_free(r);
6804                 return false;
6805         }
6806
6807         r->out.result = _spoolss_XcvData(p, r);
6808
6809         if (p->rng_fault_state) {
6810                 talloc_free(r);
6811                 /* Return true here, srv_pipe_hnd.c will take care */
6812                 return true;
6813         }
6814
6815         if (DEBUGLEVEL >= 10) {
6816                 NDR_PRINT_OUT_DEBUG(spoolss_XcvData, r);
6817         }
6818
6819         push = ndr_push_init_ctx(r, NULL);
6820         if (push == NULL) {
6821                 talloc_free(r);
6822                 return false;
6823         }
6824
6825         ndr_err = call->ndr_push(push, NDR_OUT, r);
6826         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6827                 talloc_free(r);
6828                 return false;
6829         }
6830
6831         blob = ndr_push_blob(push);
6832         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6833                 talloc_free(r);
6834                 return false;
6835         }
6836
6837         talloc_free(r);
6838
6839         return true;
6840 }
6841
6842 static bool api_spoolss_AddPrinterDriverEx(pipes_struct *p)
6843 {
6844         const struct ndr_interface_call *call;
6845         struct ndr_pull *pull;
6846         struct ndr_push *push;
6847         enum ndr_err_code ndr_err;
6848         DATA_BLOB blob;
6849         struct spoolss_AddPrinterDriverEx *r;
6850
6851         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTERDRIVEREX];
6852
6853         r = talloc(talloc_tos(), struct spoolss_AddPrinterDriverEx);
6854         if (r == NULL) {
6855                 return false;
6856         }
6857
6858         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6859                 talloc_free(r);
6860                 return false;
6861         }
6862
6863         pull = ndr_pull_init_blob(&blob, r, NULL);
6864         if (pull == NULL) {
6865                 talloc_free(r);
6866                 return false;
6867         }
6868
6869         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6870         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6871         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6872                 talloc_free(r);
6873                 return false;
6874         }
6875
6876         if (DEBUGLEVEL >= 10) {
6877                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterDriverEx, r);
6878         }
6879
6880         r->out.result = _spoolss_AddPrinterDriverEx(p, r);
6881
6882         if (p->rng_fault_state) {
6883                 talloc_free(r);
6884                 /* Return true here, srv_pipe_hnd.c will take care */
6885                 return true;
6886         }
6887
6888         if (DEBUGLEVEL >= 10) {
6889                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterDriverEx, r);
6890         }
6891
6892         push = ndr_push_init_ctx(r, NULL);
6893         if (push == NULL) {
6894                 talloc_free(r);
6895                 return false;
6896         }
6897
6898         ndr_err = call->ndr_push(push, NDR_OUT, r);
6899         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6900                 talloc_free(r);
6901                 return false;
6902         }
6903
6904         blob = ndr_push_blob(push);
6905         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6906                 talloc_free(r);
6907                 return false;
6908         }
6909
6910         talloc_free(r);
6911
6912         return true;
6913 }
6914
6915 static bool api_spoolss_5a(pipes_struct *p)
6916 {
6917         const struct ndr_interface_call *call;
6918         struct ndr_pull *pull;
6919         struct ndr_push *push;
6920         enum ndr_err_code ndr_err;
6921         DATA_BLOB blob;
6922         struct spoolss_5a *r;
6923
6924         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5A];
6925
6926         r = talloc(talloc_tos(), struct spoolss_5a);
6927         if (r == NULL) {
6928                 return false;
6929         }
6930
6931         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6932                 talloc_free(r);
6933                 return false;
6934         }
6935
6936         pull = ndr_pull_init_blob(&blob, r, NULL);
6937         if (pull == NULL) {
6938                 talloc_free(r);
6939                 return false;
6940         }
6941
6942         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6943         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6944         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6945                 talloc_free(r);
6946                 return false;
6947         }
6948
6949         if (DEBUGLEVEL >= 10) {
6950                 NDR_PRINT_IN_DEBUG(spoolss_5a, r);
6951         }
6952
6953         r->out.result = _spoolss_5a(p, r);
6954
6955         if (p->rng_fault_state) {
6956                 talloc_free(r);
6957                 /* Return true here, srv_pipe_hnd.c will take care */
6958                 return true;
6959         }
6960
6961         if (DEBUGLEVEL >= 10) {
6962                 NDR_PRINT_OUT_DEBUG(spoolss_5a, r);
6963         }
6964
6965         push = ndr_push_init_ctx(r, NULL);
6966         if (push == NULL) {
6967                 talloc_free(r);
6968                 return false;
6969         }
6970
6971         ndr_err = call->ndr_push(push, NDR_OUT, r);
6972         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6973                 talloc_free(r);
6974                 return false;
6975         }
6976
6977         blob = ndr_push_blob(push);
6978         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6979                 talloc_free(r);
6980                 return false;
6981         }
6982
6983         talloc_free(r);
6984
6985         return true;
6986 }
6987
6988 static bool api_spoolss_5b(pipes_struct *p)
6989 {
6990         const struct ndr_interface_call *call;
6991         struct ndr_pull *pull;
6992         struct ndr_push *push;
6993         enum ndr_err_code ndr_err;
6994         DATA_BLOB blob;
6995         struct spoolss_5b *r;
6996
6997         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5B];
6998
6999         r = talloc(talloc_tos(), struct spoolss_5b);
7000         if (r == NULL) {
7001                 return false;
7002         }
7003
7004         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7005                 talloc_free(r);
7006                 return false;
7007         }
7008
7009         pull = ndr_pull_init_blob(&blob, r, NULL);
7010         if (pull == NULL) {
7011                 talloc_free(r);
7012                 return false;
7013         }
7014
7015         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7016         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7017         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7018                 talloc_free(r);
7019                 return false;
7020         }
7021
7022         if (DEBUGLEVEL >= 10) {
7023                 NDR_PRINT_IN_DEBUG(spoolss_5b, r);
7024         }
7025
7026         r->out.result = _spoolss_5b(p, r);
7027
7028         if (p->rng_fault_state) {
7029                 talloc_free(r);
7030                 /* Return true here, srv_pipe_hnd.c will take care */
7031                 return true;
7032         }
7033
7034         if (DEBUGLEVEL >= 10) {
7035                 NDR_PRINT_OUT_DEBUG(spoolss_5b, r);
7036         }
7037
7038         push = ndr_push_init_ctx(r, NULL);
7039         if (push == NULL) {
7040                 talloc_free(r);
7041                 return false;
7042         }
7043
7044         ndr_err = call->ndr_push(push, NDR_OUT, r);
7045         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7046                 talloc_free(r);
7047                 return false;
7048         }
7049
7050         blob = ndr_push_blob(push);
7051         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7052                 talloc_free(r);
7053                 return false;
7054         }
7055
7056         talloc_free(r);
7057
7058         return true;
7059 }
7060
7061 static bool api_spoolss_5c(pipes_struct *p)
7062 {
7063         const struct ndr_interface_call *call;
7064         struct ndr_pull *pull;
7065         struct ndr_push *push;
7066         enum ndr_err_code ndr_err;
7067         DATA_BLOB blob;
7068         struct spoolss_5c *r;
7069
7070         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5C];
7071
7072         r = talloc(talloc_tos(), struct spoolss_5c);
7073         if (r == NULL) {
7074                 return false;
7075         }
7076
7077         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7078                 talloc_free(r);
7079                 return false;
7080         }
7081
7082         pull = ndr_pull_init_blob(&blob, r, NULL);
7083         if (pull == NULL) {
7084                 talloc_free(r);
7085                 return false;
7086         }
7087
7088         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7089         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7090         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7091                 talloc_free(r);
7092                 return false;
7093         }
7094
7095         if (DEBUGLEVEL >= 10) {
7096                 NDR_PRINT_IN_DEBUG(spoolss_5c, r);
7097         }
7098
7099         r->out.result = _spoolss_5c(p, r);
7100
7101         if (p->rng_fault_state) {
7102                 talloc_free(r);
7103                 /* Return true here, srv_pipe_hnd.c will take care */
7104                 return true;
7105         }
7106
7107         if (DEBUGLEVEL >= 10) {
7108                 NDR_PRINT_OUT_DEBUG(spoolss_5c, r);
7109         }
7110
7111         push = ndr_push_init_ctx(r, NULL);
7112         if (push == NULL) {
7113                 talloc_free(r);
7114                 return false;
7115         }
7116
7117         ndr_err = call->ndr_push(push, NDR_OUT, r);
7118         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7119                 talloc_free(r);
7120                 return false;
7121         }
7122
7123         blob = ndr_push_blob(push);
7124         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7125                 talloc_free(r);
7126                 return false;
7127         }
7128
7129         talloc_free(r);
7130
7131         return true;
7132 }
7133
7134 static bool api_spoolss_5d(pipes_struct *p)
7135 {
7136         const struct ndr_interface_call *call;
7137         struct ndr_pull *pull;
7138         struct ndr_push *push;
7139         enum ndr_err_code ndr_err;
7140         DATA_BLOB blob;
7141         struct spoolss_5d *r;
7142
7143         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5D];
7144
7145         r = talloc(talloc_tos(), struct spoolss_5d);
7146         if (r == NULL) {
7147                 return false;
7148         }
7149
7150         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7151                 talloc_free(r);
7152                 return false;
7153         }
7154
7155         pull = ndr_pull_init_blob(&blob, r, NULL);
7156         if (pull == NULL) {
7157                 talloc_free(r);
7158                 return false;
7159         }
7160
7161         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7162         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7163         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7164                 talloc_free(r);
7165                 return false;
7166         }
7167
7168         if (DEBUGLEVEL >= 10) {
7169                 NDR_PRINT_IN_DEBUG(spoolss_5d, r);
7170         }
7171
7172         r->out.result = _spoolss_5d(p, r);
7173
7174         if (p->rng_fault_state) {
7175                 talloc_free(r);
7176                 /* Return true here, srv_pipe_hnd.c will take care */
7177                 return true;
7178         }
7179
7180         if (DEBUGLEVEL >= 10) {
7181                 NDR_PRINT_OUT_DEBUG(spoolss_5d, r);
7182         }
7183
7184         push = ndr_push_init_ctx(r, NULL);
7185         if (push == NULL) {
7186                 talloc_free(r);
7187                 return false;
7188         }
7189
7190         ndr_err = call->ndr_push(push, NDR_OUT, r);
7191         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7192                 talloc_free(r);
7193                 return false;
7194         }
7195
7196         blob = ndr_push_blob(push);
7197         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7198                 talloc_free(r);
7199                 return false;
7200         }
7201
7202         talloc_free(r);
7203
7204         return true;
7205 }
7206
7207 static bool api_spoolss_5e(pipes_struct *p)
7208 {
7209         const struct ndr_interface_call *call;
7210         struct ndr_pull *pull;
7211         struct ndr_push *push;
7212         enum ndr_err_code ndr_err;
7213         DATA_BLOB blob;
7214         struct spoolss_5e *r;
7215
7216         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5E];
7217
7218         r = talloc(talloc_tos(), struct spoolss_5e);
7219         if (r == NULL) {
7220                 return false;
7221         }
7222
7223         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7224                 talloc_free(r);
7225                 return false;
7226         }
7227
7228         pull = ndr_pull_init_blob(&blob, r, NULL);
7229         if (pull == NULL) {
7230                 talloc_free(r);
7231                 return false;
7232         }
7233
7234         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7235         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7236         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7237                 talloc_free(r);
7238                 return false;
7239         }
7240
7241         if (DEBUGLEVEL >= 10) {
7242                 NDR_PRINT_IN_DEBUG(spoolss_5e, r);
7243         }
7244
7245         r->out.result = _spoolss_5e(p, r);
7246
7247         if (p->rng_fault_state) {
7248                 talloc_free(r);
7249                 /* Return true here, srv_pipe_hnd.c will take care */
7250                 return true;
7251         }
7252
7253         if (DEBUGLEVEL >= 10) {
7254                 NDR_PRINT_OUT_DEBUG(spoolss_5e, r);
7255         }
7256
7257         push = ndr_push_init_ctx(r, NULL);
7258         if (push == NULL) {
7259                 talloc_free(r);
7260                 return false;
7261         }
7262
7263         ndr_err = call->ndr_push(push, NDR_OUT, r);
7264         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7265                 talloc_free(r);
7266                 return false;
7267         }
7268
7269         blob = ndr_push_blob(push);
7270         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7271                 talloc_free(r);
7272                 return false;
7273         }
7274
7275         talloc_free(r);
7276
7277         return true;
7278 }
7279
7280 static bool api_spoolss_5f(pipes_struct *p)
7281 {
7282         const struct ndr_interface_call *call;
7283         struct ndr_pull *pull;
7284         struct ndr_push *push;
7285         enum ndr_err_code ndr_err;
7286         DATA_BLOB blob;
7287         struct spoolss_5f *r;
7288
7289         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5F];
7290
7291         r = talloc(talloc_tos(), struct spoolss_5f);
7292         if (r == NULL) {
7293                 return false;
7294         }
7295
7296         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7297                 talloc_free(r);
7298                 return false;
7299         }
7300
7301         pull = ndr_pull_init_blob(&blob, r, NULL);
7302         if (pull == NULL) {
7303                 talloc_free(r);
7304                 return false;
7305         }
7306
7307         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7308         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7309         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7310                 talloc_free(r);
7311                 return false;
7312         }
7313
7314         if (DEBUGLEVEL >= 10) {
7315                 NDR_PRINT_IN_DEBUG(spoolss_5f, r);
7316         }
7317
7318         r->out.result = _spoolss_5f(p, r);
7319
7320         if (p->rng_fault_state) {
7321                 talloc_free(r);
7322                 /* Return true here, srv_pipe_hnd.c will take care */
7323                 return true;
7324         }
7325
7326         if (DEBUGLEVEL >= 10) {
7327                 NDR_PRINT_OUT_DEBUG(spoolss_5f, r);
7328         }
7329
7330         push = ndr_push_init_ctx(r, NULL);
7331         if (push == NULL) {
7332                 talloc_free(r);
7333                 return false;
7334         }
7335
7336         ndr_err = call->ndr_push(push, NDR_OUT, r);
7337         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7338                 talloc_free(r);
7339                 return false;
7340         }
7341
7342         blob = ndr_push_blob(push);
7343         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7344                 talloc_free(r);
7345                 return false;
7346         }
7347
7348         talloc_free(r);
7349
7350         return true;
7351 }
7352
7353
7354 /* Tables */
7355 static struct api_struct api_spoolss_cmds[] = 
7356 {
7357         {"SPOOLSS_ENUMPRINTERS", NDR_SPOOLSS_ENUMPRINTERS, api_spoolss_EnumPrinters},
7358         {"SPOOLSS_OPENPRINTER", NDR_SPOOLSS_OPENPRINTER, api_spoolss_OpenPrinter},
7359         {"SPOOLSS_SETJOB", NDR_SPOOLSS_SETJOB, api_spoolss_SetJob},
7360         {"SPOOLSS_GETJOB", NDR_SPOOLSS_GETJOB, api_spoolss_GetJob},
7361         {"SPOOLSS_ENUMJOBS", NDR_SPOOLSS_ENUMJOBS, api_spoolss_EnumJobs},
7362         {"SPOOLSS_ADDPRINTER", NDR_SPOOLSS_ADDPRINTER, api_spoolss_AddPrinter},
7363         {"SPOOLSS_DELETEPRINTER", NDR_SPOOLSS_DELETEPRINTER, api_spoolss_DeletePrinter},
7364         {"SPOOLSS_SETPRINTER", NDR_SPOOLSS_SETPRINTER, api_spoolss_SetPrinter},
7365         {"SPOOLSS_GETPRINTER", NDR_SPOOLSS_GETPRINTER, api_spoolss_GetPrinter},
7366         {"SPOOLSS_ADDPRINTERDRIVER", NDR_SPOOLSS_ADDPRINTERDRIVER, api_spoolss_AddPrinterDriver},
7367         {"SPOOLSS_ENUMPRINTERDRIVERS", NDR_SPOOLSS_ENUMPRINTERDRIVERS, api_spoolss_EnumPrinterDrivers},
7368         {"SPOOLSS_GETPRINTERDRIVER", NDR_SPOOLSS_GETPRINTERDRIVER, api_spoolss_GetPrinterDriver},
7369         {"SPOOLSS_GETPRINTERDRIVERDIRECTORY", NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY, api_spoolss_GetPrinterDriverDirectory},
7370         {"SPOOLSS_DELETEPRINTERDRIVER", NDR_SPOOLSS_DELETEPRINTERDRIVER, api_spoolss_DeletePrinterDriver},
7371         {"SPOOLSS_ADDPRINTPROCESSOR", NDR_SPOOLSS_ADDPRINTPROCESSOR, api_spoolss_AddPrintProcessor},
7372         {"SPOOLSS_ENUMPRINTPROCESSORS", NDR_SPOOLSS_ENUMPRINTPROCESSORS, api_spoolss_EnumPrintProcessors},
7373         {"SPOOLSS_GETPRINTPROCESSORDIRECTORY", NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY, api_spoolss_GetPrintProcessorDirectory},
7374         {"SPOOLSS_STARTDOCPRINTER", NDR_SPOOLSS_STARTDOCPRINTER, api_spoolss_StartDocPrinter},
7375         {"SPOOLSS_STARTPAGEPRINTER", NDR_SPOOLSS_STARTPAGEPRINTER, api_spoolss_StartPagePrinter},
7376         {"SPOOLSS_WRITEPRINTER", NDR_SPOOLSS_WRITEPRINTER, api_spoolss_WritePrinter},
7377         {"SPOOLSS_ENDPAGEPRINTER", NDR_SPOOLSS_ENDPAGEPRINTER, api_spoolss_EndPagePrinter},
7378         {"SPOOLSS_ABORTPRINTER", NDR_SPOOLSS_ABORTPRINTER, api_spoolss_AbortPrinter},
7379         {"SPOOLSS_READPRINTER", NDR_SPOOLSS_READPRINTER, api_spoolss_ReadPrinter},
7380         {"SPOOLSS_ENDDOCPRINTER", NDR_SPOOLSS_ENDDOCPRINTER, api_spoolss_EndDocPrinter},
7381         {"SPOOLSS_ADDJOB", NDR_SPOOLSS_ADDJOB, api_spoolss_AddJob},
7382         {"SPOOLSS_SCHEDULEJOB", NDR_SPOOLSS_SCHEDULEJOB, api_spoolss_ScheduleJob},
7383         {"SPOOLSS_GETPRINTERDATA", NDR_SPOOLSS_GETPRINTERDATA, api_spoolss_GetPrinterData},
7384         {"SPOOLSS_SETPRINTERDATA", NDR_SPOOLSS_SETPRINTERDATA, api_spoolss_SetPrinterData},
7385         {"SPOOLSS_WAITFORPRINTERCHANGE", NDR_SPOOLSS_WAITFORPRINTERCHANGE, api_spoolss_WaitForPrinterChange},
7386         {"SPOOLSS_CLOSEPRINTER", NDR_SPOOLSS_CLOSEPRINTER, api_spoolss_ClosePrinter},
7387         {"SPOOLSS_ADDFORM", NDR_SPOOLSS_ADDFORM, api_spoolss_AddForm},
7388         {"SPOOLSS_DELETEFORM", NDR_SPOOLSS_DELETEFORM, api_spoolss_DeleteForm},
7389         {"SPOOLSS_GETFORM", NDR_SPOOLSS_GETFORM, api_spoolss_GetForm},
7390         {"SPOOLSS_SETFORM", NDR_SPOOLSS_SETFORM, api_spoolss_SetForm},
7391         {"SPOOLSS_ENUMFORMS", NDR_SPOOLSS_ENUMFORMS, api_spoolss_EnumForms},
7392         {"SPOOLSS_ENUMPORTS", NDR_SPOOLSS_ENUMPORTS, api_spoolss_EnumPorts},
7393         {"SPOOLSS_ENUMMONITORS", NDR_SPOOLSS_ENUMMONITORS, api_spoolss_EnumMonitors},
7394         {"SPOOLSS_ADDPORT", NDR_SPOOLSS_ADDPORT, api_spoolss_AddPort},
7395         {"SPOOLSS_CONFIGUREPORT", NDR_SPOOLSS_CONFIGUREPORT, api_spoolss_ConfigurePort},
7396         {"SPOOLSS_DELETEPORT", NDR_SPOOLSS_DELETEPORT, api_spoolss_DeletePort},
7397         {"SPOOLSS_CREATEPRINTERIC", NDR_SPOOLSS_CREATEPRINTERIC, api_spoolss_CreatePrinterIC},
7398         {"SPOOLSS_PLAYGDISCRIPTONPRINTERIC", NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC, api_spoolss_PlayGDIScriptOnPrinterIC},
7399         {"SPOOLSS_DELETEPRINTERIC", NDR_SPOOLSS_DELETEPRINTERIC, api_spoolss_DeletePrinterIC},
7400         {"SPOOLSS_ADDPRINTERCONNECTION", NDR_SPOOLSS_ADDPRINTERCONNECTION, api_spoolss_AddPrinterConnection},
7401         {"SPOOLSS_DELETEPRINTERCONNECTION", NDR_SPOOLSS_DELETEPRINTERCONNECTION, api_spoolss_DeletePrinterConnection},
7402         {"SPOOLSS_PRINTERMESSAGEBOX", NDR_SPOOLSS_PRINTERMESSAGEBOX, api_spoolss_PrinterMessageBox},
7403         {"SPOOLSS_ADDMONITOR", NDR_SPOOLSS_ADDMONITOR, api_spoolss_AddMonitor},
7404         {"SPOOLSS_DELETEMONITOR", NDR_SPOOLSS_DELETEMONITOR, api_spoolss_DeleteMonitor},
7405         {"SPOOLSS_DELETEPRINTPROCESSOR", NDR_SPOOLSS_DELETEPRINTPROCESSOR, api_spoolss_DeletePrintProcessor},
7406         {"SPOOLSS_ADDPRINTPROVIDOR", NDR_SPOOLSS_ADDPRINTPROVIDOR, api_spoolss_AddPrintProvidor},
7407         {"SPOOLSS_DELETEPRINTPROVIDOR", NDR_SPOOLSS_DELETEPRINTPROVIDOR, api_spoolss_DeletePrintProvidor},
7408         {"SPOOLSS_ENUMPRINTPROCDATATYPES", NDR_SPOOLSS_ENUMPRINTPROCDATATYPES, api_spoolss_EnumPrintProcDataTypes},
7409         {"SPOOLSS_RESETPRINTER", NDR_SPOOLSS_RESETPRINTER, api_spoolss_ResetPrinter},
7410         {"SPOOLSS_GETPRINTERDRIVER2", NDR_SPOOLSS_GETPRINTERDRIVER2, api_spoolss_GetPrinterDriver2},
7411         {"SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION, api_spoolss_FindFirstPrinterChangeNotification},
7412         {"SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION, api_spoolss_FindNextPrinterChangeNotification},
7413         {"SPOOLSS_FINDCLOSEPRINTERNOTIFY", NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY, api_spoolss_FindClosePrinterNotify},
7414         {"SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD", NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD, api_spoolss_RouterFindFirstPrinterChangeNotificationOld},
7415         {"SPOOLSS_REPLYOPENPRINTER", NDR_SPOOLSS_REPLYOPENPRINTER, api_spoolss_ReplyOpenPrinter},
7416         {"SPOOLSS_ROUTERREPLYPRINTER", NDR_SPOOLSS_ROUTERREPLYPRINTER, api_spoolss_RouterReplyPrinter},
7417         {"SPOOLSS_REPLYCLOSEPRINTER", NDR_SPOOLSS_REPLYCLOSEPRINTER, api_spoolss_ReplyClosePrinter},
7418         {"SPOOLSS_ADDPORTEX", NDR_SPOOLSS_ADDPORTEX, api_spoolss_AddPortEx},
7419         {"SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION, api_spoolss_RouterFindFirstPrinterChangeNotification},
7420         {"SPOOLSS_SPOOLERINIT", NDR_SPOOLSS_SPOOLERINIT, api_spoolss_SpoolerInit},
7421         {"SPOOLSS_RESETPRINTEREX", NDR_SPOOLSS_RESETPRINTEREX, api_spoolss_ResetPrinterEx},
7422         {"SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX", NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX, api_spoolss_RemoteFindFirstPrinterChangeNotifyEx},
7423         {"SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFICATION, api_spoolss_RouterRefreshPrinterChangeNotification},
7424         {"SPOOLSS_REMOTEFINDNEXTPRINTERCHANGENOTIFYEX", NDR_SPOOLSS_REMOTEFINDNEXTPRINTERCHANGENOTIFYEX, api_spoolss_RemoteFindNextPrinterChangeNotifyEx},
7425         {"SPOOLSS_44", NDR_SPOOLSS_44, api_spoolss_44},
7426         {"SPOOLSS_OPENPRINTEREX", NDR_SPOOLSS_OPENPRINTEREX, api_spoolss_OpenPrinterEx},
7427         {"SPOOLSS_ADDPRINTEREX", NDR_SPOOLSS_ADDPRINTEREX, api_spoolss_AddPrinterEx},
7428         {"SPOOLSS_47", NDR_SPOOLSS_47, api_spoolss_47},
7429         {"SPOOLSS_ENUMPRINTERDATA", NDR_SPOOLSS_ENUMPRINTERDATA, api_spoolss_EnumPrinterData},
7430         {"SPOOLSS_DELETEPRINTERDATA", NDR_SPOOLSS_DELETEPRINTERDATA, api_spoolss_DeletePrinterData},
7431         {"SPOOLSS_4A", NDR_SPOOLSS_4A, api_spoolss_4a},
7432         {"SPOOLSS_4B", NDR_SPOOLSS_4B, api_spoolss_4b},
7433         {"SPOOLSS_4C", NDR_SPOOLSS_4C, api_spoolss_4c},
7434         {"SPOOLSS_SETPRINTERDATAEX", NDR_SPOOLSS_SETPRINTERDATAEX, api_spoolss_SetPrinterDataEx},
7435         {"SPOOLSS_GETPRINTERDATAEX", NDR_SPOOLSS_GETPRINTERDATAEX, api_spoolss_GetPrinterDataEx},
7436         {"SPOOLSS_ENUMPRINTERDATAEX", NDR_SPOOLSS_ENUMPRINTERDATAEX, api_spoolss_EnumPrinterDataEx},
7437         {"SPOOLSS_ENUMPRINTERKEY", NDR_SPOOLSS_ENUMPRINTERKEY, api_spoolss_EnumPrinterKey},
7438         {"SPOOLSS_DELETEPRINTERDATAEX", NDR_SPOOLSS_DELETEPRINTERDATAEX, api_spoolss_DeletePrinterDataEx},
7439         {"SPOOLSS_DELETEPRINTERKEY", NDR_SPOOLSS_DELETEPRINTERKEY, api_spoolss_DeletePrinterKey},
7440         {"SPOOLSS_53", NDR_SPOOLSS_53, api_spoolss_53},
7441         {"SPOOLSS_DELETEPRINTERDRIVEREX", NDR_SPOOLSS_DELETEPRINTERDRIVEREX, api_spoolss_DeletePrinterDriverEx},
7442         {"SPOOLSS_55", NDR_SPOOLSS_55, api_spoolss_55},
7443         {"SPOOLSS_56", NDR_SPOOLSS_56, api_spoolss_56},
7444         {"SPOOLSS_57", NDR_SPOOLSS_57, api_spoolss_57},
7445         {"SPOOLSS_XCVDATA", NDR_SPOOLSS_XCVDATA, api_spoolss_XcvData},
7446         {"SPOOLSS_ADDPRINTERDRIVEREX", NDR_SPOOLSS_ADDPRINTERDRIVEREX, api_spoolss_AddPrinterDriverEx},
7447         {"SPOOLSS_5A", NDR_SPOOLSS_5A, api_spoolss_5a},
7448         {"SPOOLSS_5B", NDR_SPOOLSS_5B, api_spoolss_5b},
7449         {"SPOOLSS_5C", NDR_SPOOLSS_5C, api_spoolss_5c},
7450         {"SPOOLSS_5D", NDR_SPOOLSS_5D, api_spoolss_5d},
7451         {"SPOOLSS_5E", NDR_SPOOLSS_5E, api_spoolss_5e},
7452         {"SPOOLSS_5F", NDR_SPOOLSS_5F, api_spoolss_5f},
7453 };
7454
7455 void spoolss_get_pipe_fns(struct api_struct **fns, int *n_fns)
7456 {
7457         *fns = api_spoolss_cmds;
7458         *n_fns = sizeof(api_spoolss_cmds) / sizeof(struct api_struct);
7459 }
7460
7461 NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
7462 {
7463         if (cli->pipes_struct == NULL) {
7464                 return NT_STATUS_INVALID_PARAMETER;
7465         }
7466
7467         switch (opnum)
7468         {
7469                 case NDR_SPOOLSS_ENUMPRINTERS: {
7470                         struct spoolss_EnumPrinters *r = (struct spoolss_EnumPrinters *)_r;
7471                         ZERO_STRUCT(r->out);
7472                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_PrinterInfo, r->out.count);
7473                         if (r->out.info == NULL) {
7474                         return NT_STATUS_NO_MEMORY;
7475                         }
7476
7477                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7478                         if (r->out.needed == NULL) {
7479                         return NT_STATUS_NO_MEMORY;
7480                         }
7481
7482                         r->out.result = _spoolss_EnumPrinters(cli->pipes_struct, r);
7483                         return NT_STATUS_OK;
7484                 }
7485
7486                 case NDR_SPOOLSS_OPENPRINTER: {
7487                         struct spoolss_OpenPrinter *r = (struct spoolss_OpenPrinter *)_r;
7488                         ZERO_STRUCT(r->out);
7489                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
7490                         if (r->out.handle == NULL) {
7491                         return NT_STATUS_NO_MEMORY;
7492                         }
7493
7494                         r->out.result = _spoolss_OpenPrinter(cli->pipes_struct, r);
7495                         return NT_STATUS_OK;
7496                 }
7497
7498                 case NDR_SPOOLSS_SETJOB: {
7499                         struct spoolss_SetJob *r = (struct spoolss_SetJob *)_r;
7500                         r->out.result = _spoolss_SetJob(cli->pipes_struct, r);
7501                         return NT_STATUS_OK;
7502                 }
7503
7504                 case NDR_SPOOLSS_GETJOB: {
7505                         struct spoolss_GetJob *r = (struct spoolss_GetJob *)_r;
7506                         ZERO_STRUCT(r->out);
7507                         r->out.info = talloc_zero(mem_ctx, union spoolss_JobInfo);
7508                         if (r->out.info == NULL) {
7509                         return NT_STATUS_NO_MEMORY;
7510                         }
7511
7512                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7513                         if (r->out.needed == NULL) {
7514                         return NT_STATUS_NO_MEMORY;
7515                         }
7516
7517                         r->out.result = _spoolss_GetJob(cli->pipes_struct, r);
7518                         return NT_STATUS_OK;
7519                 }
7520
7521                 case NDR_SPOOLSS_ENUMJOBS: {
7522                         struct spoolss_EnumJobs *r = (struct spoolss_EnumJobs *)_r;
7523                         ZERO_STRUCT(r->out);
7524                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_JobInfo, r->out.count);
7525                         if (r->out.info == NULL) {
7526                         return NT_STATUS_NO_MEMORY;
7527                         }
7528
7529                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7530                         if (r->out.needed == NULL) {
7531                         return NT_STATUS_NO_MEMORY;
7532                         }
7533
7534                         r->out.result = _spoolss_EnumJobs(cli->pipes_struct, r);
7535                         return NT_STATUS_OK;
7536                 }
7537
7538                 case NDR_SPOOLSS_ADDPRINTER: {
7539                         struct spoolss_AddPrinter *r = (struct spoolss_AddPrinter *)_r;
7540                         r->out.result = _spoolss_AddPrinter(cli->pipes_struct, r);
7541                         return NT_STATUS_OK;
7542                 }
7543
7544                 case NDR_SPOOLSS_DELETEPRINTER: {
7545                         struct spoolss_DeletePrinter *r = (struct spoolss_DeletePrinter *)_r;
7546                         r->out.result = _spoolss_DeletePrinter(cli->pipes_struct, r);
7547                         return NT_STATUS_OK;
7548                 }
7549
7550                 case NDR_SPOOLSS_SETPRINTER: {
7551                         struct spoolss_SetPrinter *r = (struct spoolss_SetPrinter *)_r;
7552                         r->out.result = _spoolss_SetPrinter(cli->pipes_struct, r);
7553                         return NT_STATUS_OK;
7554                 }
7555
7556                 case NDR_SPOOLSS_GETPRINTER: {
7557                         struct spoolss_GetPrinter *r = (struct spoolss_GetPrinter *)_r;
7558                         ZERO_STRUCT(r->out);
7559                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrinterInfo);
7560                         if (r->out.info == NULL) {
7561                         return NT_STATUS_NO_MEMORY;
7562                         }
7563
7564                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7565                         if (r->out.needed == NULL) {
7566                         return NT_STATUS_NO_MEMORY;
7567                         }
7568
7569                         r->out.result = _spoolss_GetPrinter(cli->pipes_struct, r);
7570                         return NT_STATUS_OK;
7571                 }
7572
7573                 case NDR_SPOOLSS_ADDPRINTERDRIVER: {
7574                         struct spoolss_AddPrinterDriver *r = (struct spoolss_AddPrinterDriver *)_r;
7575                         r->out.result = _spoolss_AddPrinterDriver(cli->pipes_struct, r);
7576                         return NT_STATUS_OK;
7577                 }
7578
7579                 case NDR_SPOOLSS_ENUMPRINTERDRIVERS: {
7580                         struct spoolss_EnumPrinterDrivers *r = (struct spoolss_EnumPrinterDrivers *)_r;
7581                         ZERO_STRUCT(r->out);
7582                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_DriverInfo, r->out.count);
7583                         if (r->out.info == NULL) {
7584                         return NT_STATUS_NO_MEMORY;
7585                         }
7586
7587                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7588                         if (r->out.needed == NULL) {
7589                         return NT_STATUS_NO_MEMORY;
7590                         }
7591
7592                         r->out.result = _spoolss_EnumPrinterDrivers(cli->pipes_struct, r);
7593                         return NT_STATUS_OK;
7594                 }
7595
7596                 case NDR_SPOOLSS_GETPRINTERDRIVER: {
7597                         struct spoolss_GetPrinterDriver *r = (struct spoolss_GetPrinterDriver *)_r;
7598                         r->out.result = _spoolss_GetPrinterDriver(cli->pipes_struct, r);
7599                         return NT_STATUS_OK;
7600                 }
7601
7602                 case NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY: {
7603                         struct spoolss_GetPrinterDriverDirectory *r = (struct spoolss_GetPrinterDriverDirectory *)_r;
7604                         ZERO_STRUCT(r->out);
7605                         r->out.info = talloc_zero(mem_ctx, union spoolss_DriverDirectoryInfo);
7606                         if (r->out.info == NULL) {
7607                         return NT_STATUS_NO_MEMORY;
7608                         }
7609
7610                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7611                         if (r->out.needed == NULL) {
7612                         return NT_STATUS_NO_MEMORY;
7613                         }
7614
7615                         r->out.result = _spoolss_GetPrinterDriverDirectory(cli->pipes_struct, r);
7616                         return NT_STATUS_OK;
7617                 }
7618
7619                 case NDR_SPOOLSS_DELETEPRINTERDRIVER: {
7620                         struct spoolss_DeletePrinterDriver *r = (struct spoolss_DeletePrinterDriver *)_r;
7621                         r->out.result = _spoolss_DeletePrinterDriver(cli->pipes_struct, r);
7622                         return NT_STATUS_OK;
7623                 }
7624
7625                 case NDR_SPOOLSS_ADDPRINTPROCESSOR: {
7626                         struct spoolss_AddPrintProcessor *r = (struct spoolss_AddPrintProcessor *)_r;
7627                         r->out.result = _spoolss_AddPrintProcessor(cli->pipes_struct, r);
7628                         return NT_STATUS_OK;
7629                 }
7630
7631                 case NDR_SPOOLSS_ENUMPRINTPROCESSORS: {
7632                         struct spoolss_EnumPrintProcessors *r = (struct spoolss_EnumPrintProcessors *)_r;
7633                         ZERO_STRUCT(r->out);
7634                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_PrintProcessorInfo, r->out.count);
7635                         if (r->out.info == NULL) {
7636                         return NT_STATUS_NO_MEMORY;
7637                         }
7638
7639                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7640                         if (r->out.needed == NULL) {
7641                         return NT_STATUS_NO_MEMORY;
7642                         }
7643
7644                         r->out.result = _spoolss_EnumPrintProcessors(cli->pipes_struct, r);
7645                         return NT_STATUS_OK;
7646                 }
7647
7648                 case NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY: {
7649                         struct spoolss_GetPrintProcessorDirectory *r = (struct spoolss_GetPrintProcessorDirectory *)_r;
7650                         r->out.result = _spoolss_GetPrintProcessorDirectory(cli->pipes_struct, r);
7651                         return NT_STATUS_OK;
7652                 }
7653
7654                 case NDR_SPOOLSS_STARTDOCPRINTER: {
7655                         struct spoolss_StartDocPrinter *r = (struct spoolss_StartDocPrinter *)_r;
7656                         ZERO_STRUCT(r->out);
7657                         r->out.job_id = talloc_zero(mem_ctx, uint32_t);
7658                         if (r->out.job_id == NULL) {
7659                         return NT_STATUS_NO_MEMORY;
7660                         }
7661
7662                         r->out.result = _spoolss_StartDocPrinter(cli->pipes_struct, r);
7663                         return NT_STATUS_OK;
7664                 }
7665
7666                 case NDR_SPOOLSS_STARTPAGEPRINTER: {
7667                         struct spoolss_StartPagePrinter *r = (struct spoolss_StartPagePrinter *)_r;
7668                         r->out.result = _spoolss_StartPagePrinter(cli->pipes_struct, r);
7669                         return NT_STATUS_OK;
7670                 }
7671
7672                 case NDR_SPOOLSS_WRITEPRINTER: {
7673                         struct spoolss_WritePrinter *r = (struct spoolss_WritePrinter *)_r;
7674                         ZERO_STRUCT(r->out);
7675                         r->out.num_written = talloc_zero(mem_ctx, uint32_t);
7676                         if (r->out.num_written == NULL) {
7677                         return NT_STATUS_NO_MEMORY;
7678                         }
7679
7680                         r->out.result = _spoolss_WritePrinter(cli->pipes_struct, r);
7681                         return NT_STATUS_OK;
7682                 }
7683
7684                 case NDR_SPOOLSS_ENDPAGEPRINTER: {
7685                         struct spoolss_EndPagePrinter *r = (struct spoolss_EndPagePrinter *)_r;
7686                         r->out.result = _spoolss_EndPagePrinter(cli->pipes_struct, r);
7687                         return NT_STATUS_OK;
7688                 }
7689
7690                 case NDR_SPOOLSS_ABORTPRINTER: {
7691                         struct spoolss_AbortPrinter *r = (struct spoolss_AbortPrinter *)_r;
7692                         r->out.result = _spoolss_AbortPrinter(cli->pipes_struct, r);
7693                         return NT_STATUS_OK;
7694                 }
7695
7696                 case NDR_SPOOLSS_READPRINTER: {
7697                         struct spoolss_ReadPrinter *r = (struct spoolss_ReadPrinter *)_r;
7698                         ZERO_STRUCT(r->out);
7699                         r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.data_size);
7700                         if (r->out.data == NULL) {
7701                         return NT_STATUS_NO_MEMORY;
7702                         }
7703
7704                         r->out._data_size = talloc_zero(mem_ctx, uint32_t);
7705                         if (r->out._data_size == NULL) {
7706                         return NT_STATUS_NO_MEMORY;
7707                         }
7708
7709                         r->out.result = _spoolss_ReadPrinter(cli->pipes_struct, r);
7710                         return NT_STATUS_OK;
7711                 }
7712
7713                 case NDR_SPOOLSS_ENDDOCPRINTER: {
7714                         struct spoolss_EndDocPrinter *r = (struct spoolss_EndDocPrinter *)_r;
7715                         r->out.result = _spoolss_EndDocPrinter(cli->pipes_struct, r);
7716                         return NT_STATUS_OK;
7717                 }
7718
7719                 case NDR_SPOOLSS_ADDJOB: {
7720                         struct spoolss_AddJob *r = (struct spoolss_AddJob *)_r;
7721                         r->out.result = _spoolss_AddJob(cli->pipes_struct, r);
7722                         return NT_STATUS_OK;
7723                 }
7724
7725                 case NDR_SPOOLSS_SCHEDULEJOB: {
7726                         struct spoolss_ScheduleJob *r = (struct spoolss_ScheduleJob *)_r;
7727                         r->out.result = _spoolss_ScheduleJob(cli->pipes_struct, r);
7728                         return NT_STATUS_OK;
7729                 }
7730
7731                 case NDR_SPOOLSS_GETPRINTERDATA: {
7732                         struct spoolss_GetPrinterData *r = (struct spoolss_GetPrinterData *)_r;
7733                         ZERO_STRUCT(r->out);
7734                         r->out.type = talloc_zero(mem_ctx, enum spoolss_PrinterDataType);
7735                         if (r->out.type == NULL) {
7736                         return NT_STATUS_NO_MEMORY;
7737                         }
7738
7739                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7740                         if (r->out.needed == NULL) {
7741                         return NT_STATUS_NO_MEMORY;
7742                         }
7743
7744                         r->out.result = _spoolss_GetPrinterData(cli->pipes_struct, r);
7745                         return NT_STATUS_OK;
7746                 }
7747
7748                 case NDR_SPOOLSS_SETPRINTERDATA: {
7749                         struct spoolss_SetPrinterData *r = (struct spoolss_SetPrinterData *)_r;
7750                         r->out.result = _spoolss_SetPrinterData(cli->pipes_struct, r);
7751                         return NT_STATUS_OK;
7752                 }
7753
7754                 case NDR_SPOOLSS_WAITFORPRINTERCHANGE: {
7755                         struct spoolss_WaitForPrinterChange *r = (struct spoolss_WaitForPrinterChange *)_r;
7756                         r->out.result = _spoolss_WaitForPrinterChange(cli->pipes_struct, r);
7757                         return NT_STATUS_OK;
7758                 }
7759
7760                 case NDR_SPOOLSS_CLOSEPRINTER: {
7761                         struct spoolss_ClosePrinter *r = (struct spoolss_ClosePrinter *)_r;
7762                         ZERO_STRUCT(r->out);
7763                         r->out.handle = r->in.handle;
7764                         r->out.result = _spoolss_ClosePrinter(cli->pipes_struct, r);
7765                         return NT_STATUS_OK;
7766                 }
7767
7768                 case NDR_SPOOLSS_ADDFORM: {
7769                         struct spoolss_AddForm *r = (struct spoolss_AddForm *)_r;
7770                         r->out.result = _spoolss_AddForm(cli->pipes_struct, r);
7771                         return NT_STATUS_OK;
7772                 }
7773
7774                 case NDR_SPOOLSS_DELETEFORM: {
7775                         struct spoolss_DeleteForm *r = (struct spoolss_DeleteForm *)_r;
7776                         r->out.result = _spoolss_DeleteForm(cli->pipes_struct, r);
7777                         return NT_STATUS_OK;
7778                 }
7779
7780                 case NDR_SPOOLSS_GETFORM: {
7781                         struct spoolss_GetForm *r = (struct spoolss_GetForm *)_r;
7782                         ZERO_STRUCT(r->out);
7783                         r->out.info = talloc_zero(mem_ctx, union spoolss_FormInfo);
7784                         if (r->out.info == NULL) {
7785                         return NT_STATUS_NO_MEMORY;
7786                         }
7787
7788                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7789                         if (r->out.needed == NULL) {
7790                         return NT_STATUS_NO_MEMORY;
7791                         }
7792
7793                         r->out.result = _spoolss_GetForm(cli->pipes_struct, r);
7794                         return NT_STATUS_OK;
7795                 }
7796
7797                 case NDR_SPOOLSS_SETFORM: {
7798                         struct spoolss_SetForm *r = (struct spoolss_SetForm *)_r;
7799                         r->out.result = _spoolss_SetForm(cli->pipes_struct, r);
7800                         return NT_STATUS_OK;
7801                 }
7802
7803                 case NDR_SPOOLSS_ENUMFORMS: {
7804                         struct spoolss_EnumForms *r = (struct spoolss_EnumForms *)_r;
7805                         ZERO_STRUCT(r->out);
7806                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_FormInfo, r->out.count);
7807                         if (r->out.info == NULL) {
7808                         return NT_STATUS_NO_MEMORY;
7809                         }
7810
7811                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7812                         if (r->out.needed == NULL) {
7813                         return NT_STATUS_NO_MEMORY;
7814                         }
7815
7816                         r->out.result = _spoolss_EnumForms(cli->pipes_struct, r);
7817                         return NT_STATUS_OK;
7818                 }
7819
7820                 case NDR_SPOOLSS_ENUMPORTS: {
7821                         struct spoolss_EnumPorts *r = (struct spoolss_EnumPorts *)_r;
7822                         ZERO_STRUCT(r->out);
7823                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_PortInfo, r->out.count);
7824                         if (r->out.info == NULL) {
7825                         return NT_STATUS_NO_MEMORY;
7826                         }
7827
7828                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7829                         if (r->out.needed == NULL) {
7830                         return NT_STATUS_NO_MEMORY;
7831                         }
7832
7833                         r->out.result = _spoolss_EnumPorts(cli->pipes_struct, r);
7834                         return NT_STATUS_OK;
7835                 }
7836
7837                 case NDR_SPOOLSS_ENUMMONITORS: {
7838                         struct spoolss_EnumMonitors *r = (struct spoolss_EnumMonitors *)_r;
7839                         ZERO_STRUCT(r->out);
7840                         r->out.info = talloc_zero_array(mem_ctx, union spoolss_MonitorInfo, r->out.count);
7841                         if (r->out.info == NULL) {
7842                         return NT_STATUS_NO_MEMORY;
7843                         }
7844
7845                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7846                         if (r->out.needed == NULL) {
7847                         return NT_STATUS_NO_MEMORY;
7848                         }
7849
7850                         r->out.result = _spoolss_EnumMonitors(cli->pipes_struct, r);
7851                         return NT_STATUS_OK;
7852                 }
7853
7854                 case NDR_SPOOLSS_ADDPORT: {
7855                         struct spoolss_AddPort *r = (struct spoolss_AddPort *)_r;
7856                         r->out.result = _spoolss_AddPort(cli->pipes_struct, r);
7857                         return NT_STATUS_OK;
7858                 }
7859
7860                 case NDR_SPOOLSS_CONFIGUREPORT: {
7861                         struct spoolss_ConfigurePort *r = (struct spoolss_ConfigurePort *)_r;
7862                         r->out.result = _spoolss_ConfigurePort(cli->pipes_struct, r);
7863                         return NT_STATUS_OK;
7864                 }
7865
7866                 case NDR_SPOOLSS_DELETEPORT: {
7867                         struct spoolss_DeletePort *r = (struct spoolss_DeletePort *)_r;
7868                         r->out.result = _spoolss_DeletePort(cli->pipes_struct, r);
7869                         return NT_STATUS_OK;
7870                 }
7871
7872                 case NDR_SPOOLSS_CREATEPRINTERIC: {
7873                         struct spoolss_CreatePrinterIC *r = (struct spoolss_CreatePrinterIC *)_r;
7874                         r->out.result = _spoolss_CreatePrinterIC(cli->pipes_struct, r);
7875                         return NT_STATUS_OK;
7876                 }
7877
7878                 case NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC: {
7879                         struct spoolss_PlayGDIScriptOnPrinterIC *r = (struct spoolss_PlayGDIScriptOnPrinterIC *)_r;
7880                         r->out.result = _spoolss_PlayGDIScriptOnPrinterIC(cli->pipes_struct, r);
7881                         return NT_STATUS_OK;
7882                 }
7883
7884                 case NDR_SPOOLSS_DELETEPRINTERIC: {
7885                         struct spoolss_DeletePrinterIC *r = (struct spoolss_DeletePrinterIC *)_r;
7886                         r->out.result = _spoolss_DeletePrinterIC(cli->pipes_struct, r);
7887                         return NT_STATUS_OK;
7888                 }
7889
7890                 case NDR_SPOOLSS_ADDPRINTERCONNECTION: {
7891                         struct spoolss_AddPrinterConnection *r = (struct spoolss_AddPrinterConnection *)_r;
7892                         r->out.result = _spoolss_AddPrinterConnection(cli->pipes_struct, r);
7893                         return NT_STATUS_OK;
7894                 }
7895
7896                 case NDR_SPOOLSS_DELETEPRINTERCONNECTION: {
7897                         struct spoolss_DeletePrinterConnection *r = (struct spoolss_DeletePrinterConnection *)_r;
7898                         r->out.result = _spoolss_DeletePrinterConnection(cli->pipes_struct, r);
7899                         return NT_STATUS_OK;
7900                 }
7901
7902                 case NDR_SPOOLSS_PRINTERMESSAGEBOX: {
7903                         struct spoolss_PrinterMessageBox *r = (struct spoolss_PrinterMessageBox *)_r;
7904                         r->out.result = _spoolss_PrinterMessageBox(cli->pipes_struct, r);
7905                         return NT_STATUS_OK;
7906                 }
7907
7908                 case NDR_SPOOLSS_ADDMONITOR: {
7909                         struct spoolss_AddMonitor *r = (struct spoolss_AddMonitor *)_r;
7910                         r->out.result = _spoolss_AddMonitor(cli->pipes_struct, r);
7911                         return NT_STATUS_OK;
7912                 }
7913
7914                 case NDR_SPOOLSS_DELETEMONITOR: {
7915                         struct spoolss_DeleteMonitor *r = (struct spoolss_DeleteMonitor *)_r;
7916                         r->out.result = _spoolss_DeleteMonitor(cli->pipes_struct, r);
7917                         return NT_STATUS_OK;
7918                 }
7919
7920                 case NDR_SPOOLSS_DELETEPRINTPROCESSOR: {
7921                         struct spoolss_DeletePrintProcessor *r = (struct spoolss_DeletePrintProcessor *)_r;
7922                         r->out.result = _spoolss_DeletePrintProcessor(cli->pipes_struct, r);
7923                         return NT_STATUS_OK;
7924                 }
7925
7926                 case NDR_SPOOLSS_ADDPRINTPROVIDOR: {
7927                         struct spoolss_AddPrintProvidor *r = (struct spoolss_AddPrintProvidor *)_r;
7928                         r->out.result = _spoolss_AddPrintProvidor(cli->pipes_struct, r);
7929                         return NT_STATUS_OK;
7930                 }
7931
7932                 case NDR_SPOOLSS_DELETEPRINTPROVIDOR: {
7933                         struct spoolss_DeletePrintProvidor *r = (struct spoolss_DeletePrintProvidor *)_r;
7934                         r->out.result = _spoolss_DeletePrintProvidor(cli->pipes_struct, r);
7935                         return NT_STATUS_OK;
7936                 }
7937
7938                 case NDR_SPOOLSS_ENUMPRINTPROCDATATYPES: {
7939                         struct spoolss_EnumPrintProcDataTypes *r = (struct spoolss_EnumPrintProcDataTypes *)_r;
7940                         r->out.result = _spoolss_EnumPrintProcDataTypes(cli->pipes_struct, r);
7941                         return NT_STATUS_OK;
7942                 }
7943
7944                 case NDR_SPOOLSS_RESETPRINTER: {
7945                         struct spoolss_ResetPrinter *r = (struct spoolss_ResetPrinter *)_r;
7946                         r->out.result = _spoolss_ResetPrinter(cli->pipes_struct, r);
7947                         return NT_STATUS_OK;
7948                 }
7949
7950                 case NDR_SPOOLSS_GETPRINTERDRIVER2: {
7951                         struct spoolss_GetPrinterDriver2 *r = (struct spoolss_GetPrinterDriver2 *)_r;
7952                         ZERO_STRUCT(r->out);
7953                         r->out.info = talloc_zero(mem_ctx, DATA_BLOB);
7954                         if (r->out.info == NULL) {
7955                         return NT_STATUS_NO_MEMORY;
7956                         }
7957
7958                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7959                         if (r->out.needed == NULL) {
7960                         return NT_STATUS_NO_MEMORY;
7961                         }
7962
7963                         r->out.server_major_version = talloc_zero(mem_ctx, uint32_t);
7964                         if (r->out.server_major_version == NULL) {
7965                         return NT_STATUS_NO_MEMORY;
7966                         }
7967
7968                         r->out.server_minor_version = talloc_zero(mem_ctx, uint32_t);
7969                         if (r->out.server_minor_version == NULL) {
7970                         return NT_STATUS_NO_MEMORY;
7971                         }
7972
7973                         r->out.result = _spoolss_GetPrinterDriver2(cli->pipes_struct, r);
7974                         return NT_STATUS_OK;
7975                 }
7976
7977                 case NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION: {
7978                         struct spoolss_FindFirstPrinterChangeNotification *r = (struct spoolss_FindFirstPrinterChangeNotification *)_r;
7979                         r->out.result = _spoolss_FindFirstPrinterChangeNotification(cli->pipes_struct, r);
7980                         return NT_STATUS_OK;
7981                 }
7982
7983                 case NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION: {
7984                         struct spoolss_FindNextPrinterChangeNotification *r = (struct spoolss_FindNextPrinterChangeNotification *)_r;
7985                         r->out.result = _spoolss_FindNextPrinterChangeNotification(cli->pipes_struct, r);
7986                         return NT_STATUS_OK;
7987                 }
7988
7989                 case NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY: {
7990                         struct spoolss_FindClosePrinterNotify *r = (struct spoolss_FindClosePrinterNotify *)_r;
7991                         r->out.result = _spoolss_FindClosePrinterNotify(cli->pipes_struct, r);
7992                         return NT_STATUS_OK;
7993                 }
7994
7995                 case NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD: {
7996                         struct spoolss_RouterFindFirstPrinterChangeNotificationOld *r = (struct spoolss_RouterFindFirstPrinterChangeNotificationOld *)_r;
7997                         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotificationOld(cli->pipes_struct, r);
7998                         return NT_STATUS_OK;
7999                 }
8000
8001                 case NDR_SPOOLSS_REPLYOPENPRINTER: {
8002                         struct spoolss_ReplyOpenPrinter *r = (struct spoolss_ReplyOpenPrinter *)_r;
8003                         ZERO_STRUCT(r->out);
8004                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
8005                         if (r->out.handle == NULL) {
8006                         return NT_STATUS_NO_MEMORY;
8007                         }
8008
8009                         r->out.result = _spoolss_ReplyOpenPrinter(cli->pipes_struct, r);
8010                         return NT_STATUS_OK;
8011                 }
8012
8013                 case NDR_SPOOLSS_ROUTERREPLYPRINTER: {
8014                         struct spoolss_RouterReplyPrinter *r = (struct spoolss_RouterReplyPrinter *)_r;
8015                         r->out.result = _spoolss_RouterReplyPrinter(cli->pipes_struct, r);
8016                         return NT_STATUS_OK;
8017                 }
8018
8019                 case NDR_SPOOLSS_REPLYCLOSEPRINTER: {
8020                         struct spoolss_ReplyClosePrinter *r = (struct spoolss_ReplyClosePrinter *)_r;
8021                         ZERO_STRUCT(r->out);
8022                         r->out.handle = r->in.handle;
8023                         r->out.result = _spoolss_ReplyClosePrinter(cli->pipes_struct, r);
8024                         return NT_STATUS_OK;
8025                 }
8026
8027                 case NDR_SPOOLSS_ADDPORTEX: {
8028                         struct spoolss_AddPortEx *r = (struct spoolss_AddPortEx *)_r;
8029                         r->out.result = _spoolss_AddPortEx(cli->pipes_struct, r);
8030                         return NT_STATUS_OK;
8031                 }
8032
8033                 case NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION: {
8034                         struct spoolss_RouterFindFirstPrinterChangeNotification *r = (struct spoolss_RouterFindFirstPrinterChangeNotification *)_r;
8035                         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotification(cli->pipes_struct, r);
8036                         return NT_STATUS_OK;
8037                 }
8038
8039                 case NDR_SPOOLSS_SPOOLERINIT: {
8040                         struct spoolss_SpoolerInit *r = (struct spoolss_SpoolerInit *)_r;
8041                         r->out.result = _spoolss_SpoolerInit(cli->pipes_struct, r);
8042                         return NT_STATUS_OK;
8043                 }
8044
8045                 case NDR_SPOOLSS_RESETPRINTEREX: {
8046                         struct spoolss_ResetPrinterEx *r = (struct spoolss_ResetPrinterEx *)_r;
8047                         r->out.result = _spoolss_ResetPrinterEx(cli->pipes_struct, r);
8048                         return NT_STATUS_OK;
8049                 }
8050
8051                 case NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX: {
8052                         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r = (struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *)_r;
8053                         r->out.result = _spoolss_RemoteFindFirstPrinterChangeNotifyEx(cli->pipes_struct, r);
8054                         return NT_STATUS_OK;
8055                 }
8056
8057                 case NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFICATION: {
8058                         struct spoolss_RouterRefreshPrinterChangeNotification *r = (struct spoolss_RouterRefreshPrinterChangeNotification *)_r;
8059                         r->out.result = _spoolss_RouterRefreshPrinterChangeNotification(cli->pipes_struct, r);
8060                         return NT_STATUS_OK;
8061                 }
8062
8063                 case NDR_SPOOLSS_REMOTEFINDNEXTPRINTERCHANGENOTIFYEX: {
8064                         struct spoolss_RemoteFindNextPrinterChangeNotifyEx *r = (struct spoolss_RemoteFindNextPrinterChangeNotifyEx *)_r;
8065                         ZERO_STRUCT(r->out);
8066                         r->out.info = talloc_zero(mem_ctx, struct spoolss_NotifyInfo *);
8067                         if (r->out.info == NULL) {
8068                         return NT_STATUS_NO_MEMORY;
8069                         }
8070
8071                         r->out.result = _spoolss_RemoteFindNextPrinterChangeNotifyEx(cli->pipes_struct, r);
8072                         return NT_STATUS_OK;
8073                 }
8074
8075                 case NDR_SPOOLSS_44: {
8076                         struct spoolss_44 *r = (struct spoolss_44 *)_r;
8077                         r->out.result = _spoolss_44(cli->pipes_struct, r);
8078                         return NT_STATUS_OK;
8079                 }
8080
8081                 case NDR_SPOOLSS_OPENPRINTEREX: {
8082                         struct spoolss_OpenPrinterEx *r = (struct spoolss_OpenPrinterEx *)_r;
8083                         ZERO_STRUCT(r->out);
8084                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
8085                         if (r->out.handle == NULL) {
8086                         return NT_STATUS_NO_MEMORY;
8087                         }
8088
8089                         r->out.result = _spoolss_OpenPrinterEx(cli->pipes_struct, r);
8090                         return NT_STATUS_OK;
8091                 }
8092
8093                 case NDR_SPOOLSS_ADDPRINTEREX: {
8094                         struct spoolss_AddPrinterEx *r = (struct spoolss_AddPrinterEx *)_r;
8095                         r->out.result = _spoolss_AddPrinterEx(cli->pipes_struct, r);
8096                         return NT_STATUS_OK;
8097                 }
8098
8099                 case NDR_SPOOLSS_47: {
8100                         struct spoolss_47 *r = (struct spoolss_47 *)_r;
8101                         r->out.result = _spoolss_47(cli->pipes_struct, r);
8102                         return NT_STATUS_OK;
8103                 }
8104
8105                 case NDR_SPOOLSS_ENUMPRINTERDATA: {
8106                         struct spoolss_EnumPrinterData *r = (struct spoolss_EnumPrinterData *)_r;
8107                         ZERO_STRUCT(r->out);
8108                         r->out.value_name = talloc_zero_array(mem_ctx, const char, r->in.value_offered / 2);
8109                         if (r->out.value_name == NULL) {
8110                         return NT_STATUS_NO_MEMORY;
8111                         }
8112
8113                         r->out.value_needed = talloc_zero(mem_ctx, uint32_t);
8114                         if (r->out.value_needed == NULL) {
8115                         return NT_STATUS_NO_MEMORY;
8116                         }
8117
8118                         r->out.printerdata_type = talloc_zero(mem_ctx, uint32_t);
8119                         if (r->out.printerdata_type == NULL) {
8120                         return NT_STATUS_NO_MEMORY;
8121                         }
8122
8123                         r->out.buffer = talloc_zero(mem_ctx, DATA_BLOB);
8124                         if (r->out.buffer == NULL) {
8125                         return NT_STATUS_NO_MEMORY;
8126                         }
8127
8128                         r->out.data_needed = talloc_zero(mem_ctx, uint32_t);
8129                         if (r->out.data_needed == NULL) {
8130                         return NT_STATUS_NO_MEMORY;
8131                         }
8132
8133                         r->out.result = _spoolss_EnumPrinterData(cli->pipes_struct, r);
8134                         return NT_STATUS_OK;
8135                 }
8136
8137                 case NDR_SPOOLSS_DELETEPRINTERDATA: {
8138                         struct spoolss_DeletePrinterData *r = (struct spoolss_DeletePrinterData *)_r;
8139                         r->out.result = _spoolss_DeletePrinterData(cli->pipes_struct, r);
8140                         return NT_STATUS_OK;
8141                 }
8142
8143                 case NDR_SPOOLSS_4A: {
8144                         struct spoolss_4a *r = (struct spoolss_4a *)_r;
8145                         r->out.result = _spoolss_4a(cli->pipes_struct, r);
8146                         return NT_STATUS_OK;
8147                 }
8148
8149                 case NDR_SPOOLSS_4B: {
8150                         struct spoolss_4b *r = (struct spoolss_4b *)_r;
8151                         r->out.result = _spoolss_4b(cli->pipes_struct, r);
8152                         return NT_STATUS_OK;
8153                 }
8154
8155                 case NDR_SPOOLSS_4C: {
8156                         struct spoolss_4c *r = (struct spoolss_4c *)_r;
8157                         r->out.result = _spoolss_4c(cli->pipes_struct, r);
8158                         return NT_STATUS_OK;
8159                 }
8160
8161                 case NDR_SPOOLSS_SETPRINTERDATAEX: {
8162                         struct spoolss_SetPrinterDataEx *r = (struct spoolss_SetPrinterDataEx *)_r;
8163                         r->out.result = _spoolss_SetPrinterDataEx(cli->pipes_struct, r);
8164                         return NT_STATUS_OK;
8165                 }
8166
8167                 case NDR_SPOOLSS_GETPRINTERDATAEX: {
8168                         struct spoolss_GetPrinterDataEx *r = (struct spoolss_GetPrinterDataEx *)_r;
8169                         ZERO_STRUCT(r->out);
8170                         r->out.type = talloc_zero(mem_ctx, uint32_t);
8171                         if (r->out.type == NULL) {
8172                         return NT_STATUS_NO_MEMORY;
8173                         }
8174
8175                         r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
8176                         if (r->out.buffer == NULL) {
8177                         return NT_STATUS_NO_MEMORY;
8178                         }
8179
8180                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8181                         if (r->out.needed == NULL) {
8182                         return NT_STATUS_NO_MEMORY;
8183                         }
8184
8185                         r->out.result = _spoolss_GetPrinterDataEx(cli->pipes_struct, r);
8186                         return NT_STATUS_OK;
8187                 }
8188
8189                 case NDR_SPOOLSS_ENUMPRINTERDATAEX: {
8190                         struct spoolss_EnumPrinterDataEx *r = (struct spoolss_EnumPrinterDataEx *)_r;
8191                         ZERO_STRUCT(r->out);
8192                         r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
8193                         if (r->out.buffer == NULL) {
8194                         return NT_STATUS_NO_MEMORY;
8195                         }
8196
8197                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8198                         if (r->out.needed == NULL) {
8199                         return NT_STATUS_NO_MEMORY;
8200                         }
8201
8202                         r->out.count = talloc_zero(mem_ctx, uint32_t);
8203                         if (r->out.count == NULL) {
8204                         return NT_STATUS_NO_MEMORY;
8205                         }
8206
8207                         r->out.result = _spoolss_EnumPrinterDataEx(cli->pipes_struct, r);
8208                         return NT_STATUS_OK;
8209                 }
8210
8211                 case NDR_SPOOLSS_ENUMPRINTERKEY: {
8212                         struct spoolss_EnumPrinterKey *r = (struct spoolss_EnumPrinterKey *)_r;
8213                         ZERO_STRUCT(r->out);
8214                         r->out.key_buffer = talloc_zero_array(mem_ctx, uint16_t, r->in.key_buffer_size / 2);
8215                         if (r->out.key_buffer == NULL) {
8216                         return NT_STATUS_NO_MEMORY;
8217                         }
8218
8219                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8220                         if (r->out.needed == NULL) {
8221                         return NT_STATUS_NO_MEMORY;
8222                         }
8223
8224                         r->out.result = _spoolss_EnumPrinterKey(cli->pipes_struct, r);
8225                         return NT_STATUS_OK;
8226                 }
8227
8228                 case NDR_SPOOLSS_DELETEPRINTERDATAEX: {
8229                         struct spoolss_DeletePrinterDataEx *r = (struct spoolss_DeletePrinterDataEx *)_r;
8230                         r->out.result = _spoolss_DeletePrinterDataEx(cli->pipes_struct, r);
8231                         return NT_STATUS_OK;
8232                 }
8233
8234                 case NDR_SPOOLSS_DELETEPRINTERKEY: {
8235                         struct spoolss_DeletePrinterKey *r = (struct spoolss_DeletePrinterKey *)_r;
8236                         r->out.result = _spoolss_DeletePrinterKey(cli->pipes_struct, r);
8237                         return NT_STATUS_OK;
8238                 }
8239
8240                 case NDR_SPOOLSS_53: {
8241                         struct spoolss_53 *r = (struct spoolss_53 *)_r;
8242                         r->out.result = _spoolss_53(cli->pipes_struct, r);
8243                         return NT_STATUS_OK;
8244                 }
8245
8246                 case NDR_SPOOLSS_DELETEPRINTERDRIVEREX: {
8247                         struct spoolss_DeletePrinterDriverEx *r = (struct spoolss_DeletePrinterDriverEx *)_r;
8248                         r->out.result = _spoolss_DeletePrinterDriverEx(cli->pipes_struct, r);
8249                         return NT_STATUS_OK;
8250                 }
8251
8252                 case NDR_SPOOLSS_55: {
8253                         struct spoolss_55 *r = (struct spoolss_55 *)_r;
8254                         r->out.result = _spoolss_55(cli->pipes_struct, r);
8255                         return NT_STATUS_OK;
8256                 }
8257
8258                 case NDR_SPOOLSS_56: {
8259                         struct spoolss_56 *r = (struct spoolss_56 *)_r;
8260                         r->out.result = _spoolss_56(cli->pipes_struct, r);
8261                         return NT_STATUS_OK;
8262                 }
8263
8264                 case NDR_SPOOLSS_57: {
8265                         struct spoolss_57 *r = (struct spoolss_57 *)_r;
8266                         r->out.result = _spoolss_57(cli->pipes_struct, r);
8267                         return NT_STATUS_OK;
8268                 }
8269
8270                 case NDR_SPOOLSS_XCVDATA: {
8271                         struct spoolss_XcvData *r = (struct spoolss_XcvData *)_r;
8272                         ZERO_STRUCT(r->out);
8273                         r->out.status_code = r->in.status_code;
8274                         r->out.out_data = talloc_zero_array(mem_ctx, uint8_t, r->in.out_data_size);
8275                         if (r->out.out_data == NULL) {
8276                         return NT_STATUS_NO_MEMORY;
8277                         }
8278
8279                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8280                         if (r->out.needed == NULL) {
8281                         return NT_STATUS_NO_MEMORY;
8282                         }
8283
8284                         r->out.result = _spoolss_XcvData(cli->pipes_struct, r);
8285                         return NT_STATUS_OK;
8286                 }
8287
8288                 case NDR_SPOOLSS_ADDPRINTERDRIVEREX: {
8289                         struct spoolss_AddPrinterDriverEx *r = (struct spoolss_AddPrinterDriverEx *)_r;
8290                         r->out.result = _spoolss_AddPrinterDriverEx(cli->pipes_struct, r);
8291                         return NT_STATUS_OK;
8292                 }
8293
8294                 case NDR_SPOOLSS_5A: {
8295                         struct spoolss_5a *r = (struct spoolss_5a *)_r;
8296                         r->out.result = _spoolss_5a(cli->pipes_struct, r);
8297                         return NT_STATUS_OK;
8298                 }
8299
8300                 case NDR_SPOOLSS_5B: {
8301                         struct spoolss_5b *r = (struct spoolss_5b *)_r;
8302                         r->out.result = _spoolss_5b(cli->pipes_struct, r);
8303                         return NT_STATUS_OK;
8304                 }
8305
8306                 case NDR_SPOOLSS_5C: {
8307                         struct spoolss_5c *r = (struct spoolss_5c *)_r;
8308                         r->out.result = _spoolss_5c(cli->pipes_struct, r);
8309                         return NT_STATUS_OK;
8310                 }
8311
8312                 case NDR_SPOOLSS_5D: {
8313                         struct spoolss_5d *r = (struct spoolss_5d *)_r;
8314                         r->out.result = _spoolss_5d(cli->pipes_struct, r);
8315                         return NT_STATUS_OK;
8316                 }
8317
8318                 case NDR_SPOOLSS_5E: {
8319                         struct spoolss_5e *r = (struct spoolss_5e *)_r;
8320                         r->out.result = _spoolss_5e(cli->pipes_struct, r);
8321                         return NT_STATUS_OK;
8322                 }
8323
8324                 case NDR_SPOOLSS_5F: {
8325                         struct spoolss_5f *r = (struct spoolss_5f *)_r;
8326                         r->out.result = _spoolss_5f(cli->pipes_struct, r);
8327                         return NT_STATUS_OK;
8328                 }
8329
8330                 default:
8331                         return NT_STATUS_NOT_IMPLEMENTED;
8332         }
8333 }
8334
8335 NTSTATUS rpc_spoolss_init(void)
8336 {
8337         return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "spoolss", "spoolss", &ndr_table_spoolss, api_spoolss_cmds, sizeof(api_spoolss_cmds) / sizeof(struct api_struct));
8338 }