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