Merge branch 'master' of ssh://git.samba.org/data/git/samba into wspp-schema
[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(r, union spoolss_PrinterInfo *);
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(r, union spoolss_JobInfo *);
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(r, union spoolss_DriverInfo *);
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(r, union spoolss_PrintProcessorInfo *);
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(r, union spoolss_FormInfo *);
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(r, union spoolss_PortInfo *);
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(r, union spoolss_MonitorInfo *);
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         ZERO_STRUCT(r->out);
4026         r->out.count = talloc_zero(r, uint32_t);
4027         if (r->out.count == NULL) {
4028                 talloc_free(r);
4029                 return false;
4030         }
4031
4032         r->out.info = talloc_zero(r, union spoolss_PrintProcDataTypesInfo *);
4033         if (r->out.info == NULL) {
4034                 talloc_free(r);
4035                 return false;
4036         }
4037
4038         r->out.needed = talloc_zero(r, uint32_t);
4039         if (r->out.needed == NULL) {
4040                 talloc_free(r);
4041                 return false;
4042         }
4043
4044         r->out.result = _spoolss_EnumPrintProcDataTypes(p, r);
4045
4046         if (p->rng_fault_state) {
4047                 talloc_free(r);
4048                 /* Return true here, srv_pipe_hnd.c will take care */
4049                 return true;
4050         }
4051
4052         if (DEBUGLEVEL >= 10) {
4053                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrintProcDataTypes, r);
4054         }
4055
4056         push = ndr_push_init_ctx(r, NULL);
4057         if (push == NULL) {
4058                 talloc_free(r);
4059                 return false;
4060         }
4061
4062         ndr_err = call->ndr_push(push, NDR_OUT, r);
4063         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4064                 talloc_free(r);
4065                 return false;
4066         }
4067
4068         blob = ndr_push_blob(push);
4069         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4070                 talloc_free(r);
4071                 return false;
4072         }
4073
4074         talloc_free(r);
4075
4076         return true;
4077 }
4078
4079 static bool api_spoolss_ResetPrinter(pipes_struct *p)
4080 {
4081         const struct ndr_interface_call *call;
4082         struct ndr_pull *pull;
4083         struct ndr_push *push;
4084         enum ndr_err_code ndr_err;
4085         DATA_BLOB blob;
4086         struct spoolss_ResetPrinter *r;
4087
4088         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_RESETPRINTER];
4089
4090         r = talloc(talloc_tos(), struct spoolss_ResetPrinter);
4091         if (r == NULL) {
4092                 return false;
4093         }
4094
4095         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4096                 talloc_free(r);
4097                 return false;
4098         }
4099
4100         pull = ndr_pull_init_blob(&blob, r, NULL);
4101         if (pull == NULL) {
4102                 talloc_free(r);
4103                 return false;
4104         }
4105
4106         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4107         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4108         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4109                 talloc_free(r);
4110                 return false;
4111         }
4112
4113         if (DEBUGLEVEL >= 10) {
4114                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinter, r);
4115         }
4116
4117         r->out.result = _spoolss_ResetPrinter(p, r);
4118
4119         if (p->rng_fault_state) {
4120                 talloc_free(r);
4121                 /* Return true here, srv_pipe_hnd.c will take care */
4122                 return true;
4123         }
4124
4125         if (DEBUGLEVEL >= 10) {
4126                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinter, r);
4127         }
4128
4129         push = ndr_push_init_ctx(r, NULL);
4130         if (push == NULL) {
4131                 talloc_free(r);
4132                 return false;
4133         }
4134
4135         ndr_err = call->ndr_push(push, NDR_OUT, r);
4136         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4137                 talloc_free(r);
4138                 return false;
4139         }
4140
4141         blob = ndr_push_blob(push);
4142         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4143                 talloc_free(r);
4144                 return false;
4145         }
4146
4147         talloc_free(r);
4148
4149         return true;
4150 }
4151
4152 static bool api_spoolss_GetPrinterDriver2(pipes_struct *p)
4153 {
4154         const struct ndr_interface_call *call;
4155         struct ndr_pull *pull;
4156         struct ndr_push *push;
4157         enum ndr_err_code ndr_err;
4158         DATA_BLOB blob;
4159         struct spoolss_GetPrinterDriver2 *r;
4160
4161         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDRIVER2];
4162
4163         r = talloc(talloc_tos(), struct spoolss_GetPrinterDriver2);
4164         if (r == NULL) {
4165                 return false;
4166         }
4167
4168         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4169                 talloc_free(r);
4170                 return false;
4171         }
4172
4173         pull = ndr_pull_init_blob(&blob, r, NULL);
4174         if (pull == NULL) {
4175                 talloc_free(r);
4176                 return false;
4177         }
4178
4179         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4180         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4181         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4182                 talloc_free(r);
4183                 return false;
4184         }
4185
4186         if (DEBUGLEVEL >= 10) {
4187                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriver2, r);
4188         }
4189
4190         ZERO_STRUCT(r->out);
4191         r->out.info = talloc_zero(r, union spoolss_DriverInfo);
4192         if (r->out.info == NULL) {
4193                 talloc_free(r);
4194                 return false;
4195         }
4196
4197         r->out.needed = talloc_zero(r, uint32_t);
4198         if (r->out.needed == NULL) {
4199                 talloc_free(r);
4200                 return false;
4201         }
4202
4203         r->out.server_major_version = talloc_zero(r, uint32_t);
4204         if (r->out.server_major_version == NULL) {
4205                 talloc_free(r);
4206                 return false;
4207         }
4208
4209         r->out.server_minor_version = talloc_zero(r, uint32_t);
4210         if (r->out.server_minor_version == NULL) {
4211                 talloc_free(r);
4212                 return false;
4213         }
4214
4215         r->out.result = _spoolss_GetPrinterDriver2(p, r);
4216
4217         if (p->rng_fault_state) {
4218                 talloc_free(r);
4219                 /* Return true here, srv_pipe_hnd.c will take care */
4220                 return true;
4221         }
4222
4223         if (DEBUGLEVEL >= 10) {
4224                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriver2, r);
4225         }
4226
4227         push = ndr_push_init_ctx(r, NULL);
4228         if (push == NULL) {
4229                 talloc_free(r);
4230                 return false;
4231         }
4232
4233         ndr_err = call->ndr_push(push, NDR_OUT, r);
4234         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4235                 talloc_free(r);
4236                 return false;
4237         }
4238
4239         blob = ndr_push_blob(push);
4240         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4241                 talloc_free(r);
4242                 return false;
4243         }
4244
4245         talloc_free(r);
4246
4247         return true;
4248 }
4249
4250 static bool api_spoolss_FindFirstPrinterChangeNotification(pipes_struct *p)
4251 {
4252         const struct ndr_interface_call *call;
4253         struct ndr_pull *pull;
4254         struct ndr_push *push;
4255         enum ndr_err_code ndr_err;
4256         DATA_BLOB blob;
4257         struct spoolss_FindFirstPrinterChangeNotification *r;
4258
4259         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION];
4260
4261         r = talloc(talloc_tos(), struct spoolss_FindFirstPrinterChangeNotification);
4262         if (r == NULL) {
4263                 return false;
4264         }
4265
4266         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4267                 talloc_free(r);
4268                 return false;
4269         }
4270
4271         pull = ndr_pull_init_blob(&blob, r, NULL);
4272         if (pull == NULL) {
4273                 talloc_free(r);
4274                 return false;
4275         }
4276
4277         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4278         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4279         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4280                 talloc_free(r);
4281                 return false;
4282         }
4283
4284         if (DEBUGLEVEL >= 10) {
4285                 NDR_PRINT_IN_DEBUG(spoolss_FindFirstPrinterChangeNotification, r);
4286         }
4287
4288         r->out.result = _spoolss_FindFirstPrinterChangeNotification(p, r);
4289
4290         if (p->rng_fault_state) {
4291                 talloc_free(r);
4292                 /* Return true here, srv_pipe_hnd.c will take care */
4293                 return true;
4294         }
4295
4296         if (DEBUGLEVEL >= 10) {
4297                 NDR_PRINT_OUT_DEBUG(spoolss_FindFirstPrinterChangeNotification, r);
4298         }
4299
4300         push = ndr_push_init_ctx(r, NULL);
4301         if (push == NULL) {
4302                 talloc_free(r);
4303                 return false;
4304         }
4305
4306         ndr_err = call->ndr_push(push, NDR_OUT, r);
4307         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4308                 talloc_free(r);
4309                 return false;
4310         }
4311
4312         blob = ndr_push_blob(push);
4313         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4314                 talloc_free(r);
4315                 return false;
4316         }
4317
4318         talloc_free(r);
4319
4320         return true;
4321 }
4322
4323 static bool api_spoolss_FindNextPrinterChangeNotification(pipes_struct *p)
4324 {
4325         const struct ndr_interface_call *call;
4326         struct ndr_pull *pull;
4327         struct ndr_push *push;
4328         enum ndr_err_code ndr_err;
4329         DATA_BLOB blob;
4330         struct spoolss_FindNextPrinterChangeNotification *r;
4331
4332         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION];
4333
4334         r = talloc(talloc_tos(), struct spoolss_FindNextPrinterChangeNotification);
4335         if (r == NULL) {
4336                 return false;
4337         }
4338
4339         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4340                 talloc_free(r);
4341                 return false;
4342         }
4343
4344         pull = ndr_pull_init_blob(&blob, r, NULL);
4345         if (pull == NULL) {
4346                 talloc_free(r);
4347                 return false;
4348         }
4349
4350         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4351         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4352         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4353                 talloc_free(r);
4354                 return false;
4355         }
4356
4357         if (DEBUGLEVEL >= 10) {
4358                 NDR_PRINT_IN_DEBUG(spoolss_FindNextPrinterChangeNotification, r);
4359         }
4360
4361         r->out.result = _spoolss_FindNextPrinterChangeNotification(p, r);
4362
4363         if (p->rng_fault_state) {
4364                 talloc_free(r);
4365                 /* Return true here, srv_pipe_hnd.c will take care */
4366                 return true;
4367         }
4368
4369         if (DEBUGLEVEL >= 10) {
4370                 NDR_PRINT_OUT_DEBUG(spoolss_FindNextPrinterChangeNotification, r);
4371         }
4372
4373         push = ndr_push_init_ctx(r, NULL);
4374         if (push == NULL) {
4375                 talloc_free(r);
4376                 return false;
4377         }
4378
4379         ndr_err = call->ndr_push(push, NDR_OUT, r);
4380         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4381                 talloc_free(r);
4382                 return false;
4383         }
4384
4385         blob = ndr_push_blob(push);
4386         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4387                 talloc_free(r);
4388                 return false;
4389         }
4390
4391         talloc_free(r);
4392
4393         return true;
4394 }
4395
4396 static bool api_spoolss_FindClosePrinterNotify(pipes_struct *p)
4397 {
4398         const struct ndr_interface_call *call;
4399         struct ndr_pull *pull;
4400         struct ndr_push *push;
4401         enum ndr_err_code ndr_err;
4402         DATA_BLOB blob;
4403         struct spoolss_FindClosePrinterNotify *r;
4404
4405         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY];
4406
4407         r = talloc(talloc_tos(), struct spoolss_FindClosePrinterNotify);
4408         if (r == NULL) {
4409                 return false;
4410         }
4411
4412         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4413                 talloc_free(r);
4414                 return false;
4415         }
4416
4417         pull = ndr_pull_init_blob(&blob, r, NULL);
4418         if (pull == NULL) {
4419                 talloc_free(r);
4420                 return false;
4421         }
4422
4423         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4424         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4425         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4426                 talloc_free(r);
4427                 return false;
4428         }
4429
4430         if (DEBUGLEVEL >= 10) {
4431                 NDR_PRINT_IN_DEBUG(spoolss_FindClosePrinterNotify, r);
4432         }
4433
4434         r->out.result = _spoolss_FindClosePrinterNotify(p, r);
4435
4436         if (p->rng_fault_state) {
4437                 talloc_free(r);
4438                 /* Return true here, srv_pipe_hnd.c will take care */
4439                 return true;
4440         }
4441
4442         if (DEBUGLEVEL >= 10) {
4443                 NDR_PRINT_OUT_DEBUG(spoolss_FindClosePrinterNotify, r);
4444         }
4445
4446         push = ndr_push_init_ctx(r, NULL);
4447         if (push == NULL) {
4448                 talloc_free(r);
4449                 return false;
4450         }
4451
4452         ndr_err = call->ndr_push(push, NDR_OUT, r);
4453         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4454                 talloc_free(r);
4455                 return false;
4456         }
4457
4458         blob = ndr_push_blob(push);
4459         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4460                 talloc_free(r);
4461                 return false;
4462         }
4463
4464         talloc_free(r);
4465
4466         return true;
4467 }
4468
4469 static bool api_spoolss_RouterFindFirstPrinterChangeNotificationOld(pipes_struct *p)
4470 {
4471         const struct ndr_interface_call *call;
4472         struct ndr_pull *pull;
4473         struct ndr_push *push;
4474         enum ndr_err_code ndr_err;
4475         DATA_BLOB blob;
4476         struct spoolss_RouterFindFirstPrinterChangeNotificationOld *r;
4477
4478         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD];
4479
4480         r = talloc(talloc_tos(), struct spoolss_RouterFindFirstPrinterChangeNotificationOld);
4481         if (r == NULL) {
4482                 return false;
4483         }
4484
4485         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4486                 talloc_free(r);
4487                 return false;
4488         }
4489
4490         pull = ndr_pull_init_blob(&blob, r, NULL);
4491         if (pull == NULL) {
4492                 talloc_free(r);
4493                 return false;
4494         }
4495
4496         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4497         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4498         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4499                 talloc_free(r);
4500                 return false;
4501         }
4502
4503         if (DEBUGLEVEL >= 10) {
4504                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, r);
4505         }
4506
4507         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotificationOld(p, r);
4508
4509         if (p->rng_fault_state) {
4510                 talloc_free(r);
4511                 /* Return true here, srv_pipe_hnd.c will take care */
4512                 return true;
4513         }
4514
4515         if (DEBUGLEVEL >= 10) {
4516                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, r);
4517         }
4518
4519         push = ndr_push_init_ctx(r, NULL);
4520         if (push == NULL) {
4521                 talloc_free(r);
4522                 return false;
4523         }
4524
4525         ndr_err = call->ndr_push(push, NDR_OUT, r);
4526         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4527                 talloc_free(r);
4528                 return false;
4529         }
4530
4531         blob = ndr_push_blob(push);
4532         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4533                 talloc_free(r);
4534                 return false;
4535         }
4536
4537         talloc_free(r);
4538
4539         return true;
4540 }
4541
4542 static bool api_spoolss_ReplyOpenPrinter(pipes_struct *p)
4543 {
4544         const struct ndr_interface_call *call;
4545         struct ndr_pull *pull;
4546         struct ndr_push *push;
4547         enum ndr_err_code ndr_err;
4548         DATA_BLOB blob;
4549         struct spoolss_ReplyOpenPrinter *r;
4550
4551         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REPLYOPENPRINTER];
4552
4553         r = talloc(talloc_tos(), struct spoolss_ReplyOpenPrinter);
4554         if (r == NULL) {
4555                 return false;
4556         }
4557
4558         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4559                 talloc_free(r);
4560                 return false;
4561         }
4562
4563         pull = ndr_pull_init_blob(&blob, r, NULL);
4564         if (pull == NULL) {
4565                 talloc_free(r);
4566                 return false;
4567         }
4568
4569         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4570         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4571         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4572                 talloc_free(r);
4573                 return false;
4574         }
4575
4576         if (DEBUGLEVEL >= 10) {
4577                 NDR_PRINT_IN_DEBUG(spoolss_ReplyOpenPrinter, r);
4578         }
4579
4580         ZERO_STRUCT(r->out);
4581         r->out.handle = talloc_zero(r, struct policy_handle);
4582         if (r->out.handle == NULL) {
4583                 talloc_free(r);
4584                 return false;
4585         }
4586
4587         r->out.result = _spoolss_ReplyOpenPrinter(p, r);
4588
4589         if (p->rng_fault_state) {
4590                 talloc_free(r);
4591                 /* Return true here, srv_pipe_hnd.c will take care */
4592                 return true;
4593         }
4594
4595         if (DEBUGLEVEL >= 10) {
4596                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyOpenPrinter, r);
4597         }
4598
4599         push = ndr_push_init_ctx(r, NULL);
4600         if (push == NULL) {
4601                 talloc_free(r);
4602                 return false;
4603         }
4604
4605         ndr_err = call->ndr_push(push, NDR_OUT, r);
4606         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4607                 talloc_free(r);
4608                 return false;
4609         }
4610
4611         blob = ndr_push_blob(push);
4612         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4613                 talloc_free(r);
4614                 return false;
4615         }
4616
4617         talloc_free(r);
4618
4619         return true;
4620 }
4621
4622 static bool api_spoolss_RouterReplyPrinter(pipes_struct *p)
4623 {
4624         const struct ndr_interface_call *call;
4625         struct ndr_pull *pull;
4626         struct ndr_push *push;
4627         enum ndr_err_code ndr_err;
4628         DATA_BLOB blob;
4629         struct spoolss_RouterReplyPrinter *r;
4630
4631         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREPLYPRINTER];
4632
4633         r = talloc(talloc_tos(), struct spoolss_RouterReplyPrinter);
4634         if (r == NULL) {
4635                 return false;
4636         }
4637
4638         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4639                 talloc_free(r);
4640                 return false;
4641         }
4642
4643         pull = ndr_pull_init_blob(&blob, r, NULL);
4644         if (pull == NULL) {
4645                 talloc_free(r);
4646                 return false;
4647         }
4648
4649         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4650         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4651         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4652                 talloc_free(r);
4653                 return false;
4654         }
4655
4656         if (DEBUGLEVEL >= 10) {
4657                 NDR_PRINT_IN_DEBUG(spoolss_RouterReplyPrinter, r);
4658         }
4659
4660         r->out.result = _spoolss_RouterReplyPrinter(p, r);
4661
4662         if (p->rng_fault_state) {
4663                 talloc_free(r);
4664                 /* Return true here, srv_pipe_hnd.c will take care */
4665                 return true;
4666         }
4667
4668         if (DEBUGLEVEL >= 10) {
4669                 NDR_PRINT_OUT_DEBUG(spoolss_RouterReplyPrinter, r);
4670         }
4671
4672         push = ndr_push_init_ctx(r, NULL);
4673         if (push == NULL) {
4674                 talloc_free(r);
4675                 return false;
4676         }
4677
4678         ndr_err = call->ndr_push(push, NDR_OUT, r);
4679         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4680                 talloc_free(r);
4681                 return false;
4682         }
4683
4684         blob = ndr_push_blob(push);
4685         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4686                 talloc_free(r);
4687                 return false;
4688         }
4689
4690         talloc_free(r);
4691
4692         return true;
4693 }
4694
4695 static bool api_spoolss_ReplyClosePrinter(pipes_struct *p)
4696 {
4697         const struct ndr_interface_call *call;
4698         struct ndr_pull *pull;
4699         struct ndr_push *push;
4700         enum ndr_err_code ndr_err;
4701         DATA_BLOB blob;
4702         struct spoolss_ReplyClosePrinter *r;
4703
4704         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REPLYCLOSEPRINTER];
4705
4706         r = talloc(talloc_tos(), struct spoolss_ReplyClosePrinter);
4707         if (r == NULL) {
4708                 return false;
4709         }
4710
4711         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4712                 talloc_free(r);
4713                 return false;
4714         }
4715
4716         pull = ndr_pull_init_blob(&blob, r, NULL);
4717         if (pull == NULL) {
4718                 talloc_free(r);
4719                 return false;
4720         }
4721
4722         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4723         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4724         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4725                 talloc_free(r);
4726                 return false;
4727         }
4728
4729         if (DEBUGLEVEL >= 10) {
4730                 NDR_PRINT_IN_DEBUG(spoolss_ReplyClosePrinter, r);
4731         }
4732
4733         ZERO_STRUCT(r->out);
4734         r->out.handle = r->in.handle;
4735         r->out.result = _spoolss_ReplyClosePrinter(p, r);
4736
4737         if (p->rng_fault_state) {
4738                 talloc_free(r);
4739                 /* Return true here, srv_pipe_hnd.c will take care */
4740                 return true;
4741         }
4742
4743         if (DEBUGLEVEL >= 10) {
4744                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyClosePrinter, r);
4745         }
4746
4747         push = ndr_push_init_ctx(r, NULL);
4748         if (push == NULL) {
4749                 talloc_free(r);
4750                 return false;
4751         }
4752
4753         ndr_err = call->ndr_push(push, NDR_OUT, r);
4754         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4755                 talloc_free(r);
4756                 return false;
4757         }
4758
4759         blob = ndr_push_blob(push);
4760         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4761                 talloc_free(r);
4762                 return false;
4763         }
4764
4765         talloc_free(r);
4766
4767         return true;
4768 }
4769
4770 static bool api_spoolss_AddPortEx(pipes_struct *p)
4771 {
4772         const struct ndr_interface_call *call;
4773         struct ndr_pull *pull;
4774         struct ndr_push *push;
4775         enum ndr_err_code ndr_err;
4776         DATA_BLOB blob;
4777         struct spoolss_AddPortEx *r;
4778
4779         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPORTEX];
4780
4781         r = talloc(talloc_tos(), struct spoolss_AddPortEx);
4782         if (r == NULL) {
4783                 return false;
4784         }
4785
4786         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4787                 talloc_free(r);
4788                 return false;
4789         }
4790
4791         pull = ndr_pull_init_blob(&blob, r, NULL);
4792         if (pull == NULL) {
4793                 talloc_free(r);
4794                 return false;
4795         }
4796
4797         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4798         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4799         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4800                 talloc_free(r);
4801                 return false;
4802         }
4803
4804         if (DEBUGLEVEL >= 10) {
4805                 NDR_PRINT_IN_DEBUG(spoolss_AddPortEx, r);
4806         }
4807
4808         r->out.result = _spoolss_AddPortEx(p, r);
4809
4810         if (p->rng_fault_state) {
4811                 talloc_free(r);
4812                 /* Return true here, srv_pipe_hnd.c will take care */
4813                 return true;
4814         }
4815
4816         if (DEBUGLEVEL >= 10) {
4817                 NDR_PRINT_OUT_DEBUG(spoolss_AddPortEx, r);
4818         }
4819
4820         push = ndr_push_init_ctx(r, NULL);
4821         if (push == NULL) {
4822                 talloc_free(r);
4823                 return false;
4824         }
4825
4826         ndr_err = call->ndr_push(push, NDR_OUT, r);
4827         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4828                 talloc_free(r);
4829                 return false;
4830         }
4831
4832         blob = ndr_push_blob(push);
4833         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4834                 talloc_free(r);
4835                 return false;
4836         }
4837
4838         talloc_free(r);
4839
4840         return true;
4841 }
4842
4843 static bool api_spoolss_RouterFindFirstPrinterChangeNotification(pipes_struct *p)
4844 {
4845         const struct ndr_interface_call *call;
4846         struct ndr_pull *pull;
4847         struct ndr_push *push;
4848         enum ndr_err_code ndr_err;
4849         DATA_BLOB blob;
4850         struct spoolss_RouterFindFirstPrinterChangeNotification *r;
4851
4852         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION];
4853
4854         r = talloc(talloc_tos(), struct spoolss_RouterFindFirstPrinterChangeNotification);
4855         if (r == NULL) {
4856                 return false;
4857         }
4858
4859         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4860                 talloc_free(r);
4861                 return false;
4862         }
4863
4864         pull = ndr_pull_init_blob(&blob, r, NULL);
4865         if (pull == NULL) {
4866                 talloc_free(r);
4867                 return false;
4868         }
4869
4870         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4871         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4872         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4873                 talloc_free(r);
4874                 return false;
4875         }
4876
4877         if (DEBUGLEVEL >= 10) {
4878                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, r);
4879         }
4880
4881         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotification(p, r);
4882
4883         if (p->rng_fault_state) {
4884                 talloc_free(r);
4885                 /* Return true here, srv_pipe_hnd.c will take care */
4886                 return true;
4887         }
4888
4889         if (DEBUGLEVEL >= 10) {
4890                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, r);
4891         }
4892
4893         push = ndr_push_init_ctx(r, NULL);
4894         if (push == NULL) {
4895                 talloc_free(r);
4896                 return false;
4897         }
4898
4899         ndr_err = call->ndr_push(push, NDR_OUT, r);
4900         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4901                 talloc_free(r);
4902                 return false;
4903         }
4904
4905         blob = ndr_push_blob(push);
4906         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4907                 talloc_free(r);
4908                 return false;
4909         }
4910
4911         talloc_free(r);
4912
4913         return true;
4914 }
4915
4916 static bool api_spoolss_SpoolerInit(pipes_struct *p)
4917 {
4918         const struct ndr_interface_call *call;
4919         struct ndr_pull *pull;
4920         struct ndr_push *push;
4921         enum ndr_err_code ndr_err;
4922         DATA_BLOB blob;
4923         struct spoolss_SpoolerInit *r;
4924
4925         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SPOOLERINIT];
4926
4927         r = talloc(talloc_tos(), struct spoolss_SpoolerInit);
4928         if (r == NULL) {
4929                 return false;
4930         }
4931
4932         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4933                 talloc_free(r);
4934                 return false;
4935         }
4936
4937         pull = ndr_pull_init_blob(&blob, r, NULL);
4938         if (pull == NULL) {
4939                 talloc_free(r);
4940                 return false;
4941         }
4942
4943         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4944         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4945         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4946                 talloc_free(r);
4947                 return false;
4948         }
4949
4950         if (DEBUGLEVEL >= 10) {
4951                 NDR_PRINT_IN_DEBUG(spoolss_SpoolerInit, r);
4952         }
4953
4954         r->out.result = _spoolss_SpoolerInit(p, r);
4955
4956         if (p->rng_fault_state) {
4957                 talloc_free(r);
4958                 /* Return true here, srv_pipe_hnd.c will take care */
4959                 return true;
4960         }
4961
4962         if (DEBUGLEVEL >= 10) {
4963                 NDR_PRINT_OUT_DEBUG(spoolss_SpoolerInit, r);
4964         }
4965
4966         push = ndr_push_init_ctx(r, NULL);
4967         if (push == NULL) {
4968                 talloc_free(r);
4969                 return false;
4970         }
4971
4972         ndr_err = call->ndr_push(push, NDR_OUT, r);
4973         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4974                 talloc_free(r);
4975                 return false;
4976         }
4977
4978         blob = ndr_push_blob(push);
4979         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4980                 talloc_free(r);
4981                 return false;
4982         }
4983
4984         talloc_free(r);
4985
4986         return true;
4987 }
4988
4989 static bool api_spoolss_ResetPrinterEx(pipes_struct *p)
4990 {
4991         const struct ndr_interface_call *call;
4992         struct ndr_pull *pull;
4993         struct ndr_push *push;
4994         enum ndr_err_code ndr_err;
4995         DATA_BLOB blob;
4996         struct spoolss_ResetPrinterEx *r;
4997
4998         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_RESETPRINTEREX];
4999
5000         r = talloc(talloc_tos(), struct spoolss_ResetPrinterEx);
5001         if (r == NULL) {
5002                 return false;
5003         }
5004
5005         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5006                 talloc_free(r);
5007                 return false;
5008         }
5009
5010         pull = ndr_pull_init_blob(&blob, r, NULL);
5011         if (pull == NULL) {
5012                 talloc_free(r);
5013                 return false;
5014         }
5015
5016         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5017         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5018         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5019                 talloc_free(r);
5020                 return false;
5021         }
5022
5023         if (DEBUGLEVEL >= 10) {
5024                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinterEx, r);
5025         }
5026
5027         r->out.result = _spoolss_ResetPrinterEx(p, r);
5028
5029         if (p->rng_fault_state) {
5030                 talloc_free(r);
5031                 /* Return true here, srv_pipe_hnd.c will take care */
5032                 return true;
5033         }
5034
5035         if (DEBUGLEVEL >= 10) {
5036                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinterEx, r);
5037         }
5038
5039         push = ndr_push_init_ctx(r, NULL);
5040         if (push == NULL) {
5041                 talloc_free(r);
5042                 return false;
5043         }
5044
5045         ndr_err = call->ndr_push(push, NDR_OUT, r);
5046         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5047                 talloc_free(r);
5048                 return false;
5049         }
5050
5051         blob = ndr_push_blob(push);
5052         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5053                 talloc_free(r);
5054                 return false;
5055         }
5056
5057         talloc_free(r);
5058
5059         return true;
5060 }
5061
5062 static bool api_spoolss_RemoteFindFirstPrinterChangeNotifyEx(pipes_struct *p)
5063 {
5064         const struct ndr_interface_call *call;
5065         struct ndr_pull *pull;
5066         struct ndr_push *push;
5067         enum ndr_err_code ndr_err;
5068         DATA_BLOB blob;
5069         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r;
5070
5071         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX];
5072
5073         r = talloc(talloc_tos(), struct spoolss_RemoteFindFirstPrinterChangeNotifyEx);
5074         if (r == NULL) {
5075                 return false;
5076         }
5077
5078         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5079                 talloc_free(r);
5080                 return false;
5081         }
5082
5083         pull = ndr_pull_init_blob(&blob, r, NULL);
5084         if (pull == NULL) {
5085                 talloc_free(r);
5086                 return false;
5087         }
5088
5089         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5090         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5091         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5092                 talloc_free(r);
5093                 return false;
5094         }
5095
5096         if (DEBUGLEVEL >= 10) {
5097                 NDR_PRINT_IN_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, r);
5098         }
5099
5100         r->out.result = _spoolss_RemoteFindFirstPrinterChangeNotifyEx(p, r);
5101
5102         if (p->rng_fault_state) {
5103                 talloc_free(r);
5104                 /* Return true here, srv_pipe_hnd.c will take care */
5105                 return true;
5106         }
5107
5108         if (DEBUGLEVEL >= 10) {
5109                 NDR_PRINT_OUT_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, r);
5110         }
5111
5112         push = ndr_push_init_ctx(r, NULL);
5113         if (push == NULL) {
5114                 talloc_free(r);
5115                 return false;
5116         }
5117
5118         ndr_err = call->ndr_push(push, NDR_OUT, r);
5119         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5120                 talloc_free(r);
5121                 return false;
5122         }
5123
5124         blob = ndr_push_blob(push);
5125         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5126                 talloc_free(r);
5127                 return false;
5128         }
5129
5130         talloc_free(r);
5131
5132         return true;
5133 }
5134
5135 static bool api_spoolss_RouterReplyPrinterEx(pipes_struct *p)
5136 {
5137         const struct ndr_interface_call *call;
5138         struct ndr_pull *pull;
5139         struct ndr_push *push;
5140         enum ndr_err_code ndr_err;
5141         DATA_BLOB blob;
5142         struct spoolss_RouterReplyPrinterEx *r;
5143
5144         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREPLYPRINTEREX];
5145
5146         r = talloc(talloc_tos(), struct spoolss_RouterReplyPrinterEx);
5147         if (r == NULL) {
5148                 return false;
5149         }
5150
5151         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5152                 talloc_free(r);
5153                 return false;
5154         }
5155
5156         pull = ndr_pull_init_blob(&blob, r, NULL);
5157         if (pull == NULL) {
5158                 talloc_free(r);
5159                 return false;
5160         }
5161
5162         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5163         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5164         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5165                 talloc_free(r);
5166                 return false;
5167         }
5168
5169         if (DEBUGLEVEL >= 10) {
5170                 NDR_PRINT_IN_DEBUG(spoolss_RouterReplyPrinterEx, r);
5171         }
5172
5173         ZERO_STRUCT(r->out);
5174         r->out.reply_result = talloc_zero(r, uint32_t);
5175         if (r->out.reply_result == NULL) {
5176                 talloc_free(r);
5177                 return false;
5178         }
5179
5180         r->out.result = _spoolss_RouterReplyPrinterEx(p, r);
5181
5182         if (p->rng_fault_state) {
5183                 talloc_free(r);
5184                 /* Return true here, srv_pipe_hnd.c will take care */
5185                 return true;
5186         }
5187
5188         if (DEBUGLEVEL >= 10) {
5189                 NDR_PRINT_OUT_DEBUG(spoolss_RouterReplyPrinterEx, r);
5190         }
5191
5192         push = ndr_push_init_ctx(r, NULL);
5193         if (push == NULL) {
5194                 talloc_free(r);
5195                 return false;
5196         }
5197
5198         ndr_err = call->ndr_push(push, NDR_OUT, r);
5199         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5200                 talloc_free(r);
5201                 return false;
5202         }
5203
5204         blob = ndr_push_blob(push);
5205         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5206                 talloc_free(r);
5207                 return false;
5208         }
5209
5210         talloc_free(r);
5211
5212         return true;
5213 }
5214
5215 static bool api_spoolss_RouterRefreshPrinterChangeNotify(pipes_struct *p)
5216 {
5217         const struct ndr_interface_call *call;
5218         struct ndr_pull *pull;
5219         struct ndr_push *push;
5220         enum ndr_err_code ndr_err;
5221         DATA_BLOB blob;
5222         struct spoolss_RouterRefreshPrinterChangeNotify *r;
5223
5224         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY];
5225
5226         r = talloc(talloc_tos(), struct spoolss_RouterRefreshPrinterChangeNotify);
5227         if (r == NULL) {
5228                 return false;
5229         }
5230
5231         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5232                 talloc_free(r);
5233                 return false;
5234         }
5235
5236         pull = ndr_pull_init_blob(&blob, r, NULL);
5237         if (pull == NULL) {
5238                 talloc_free(r);
5239                 return false;
5240         }
5241
5242         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5243         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5244         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5245                 talloc_free(r);
5246                 return false;
5247         }
5248
5249         if (DEBUGLEVEL >= 10) {
5250                 NDR_PRINT_IN_DEBUG(spoolss_RouterRefreshPrinterChangeNotify, r);
5251         }
5252
5253         ZERO_STRUCT(r->out);
5254         r->out.info = talloc_zero(r, struct spoolss_NotifyInfo *);
5255         if (r->out.info == NULL) {
5256                 talloc_free(r);
5257                 return false;
5258         }
5259
5260         r->out.result = _spoolss_RouterRefreshPrinterChangeNotify(p, r);
5261
5262         if (p->rng_fault_state) {
5263                 talloc_free(r);
5264                 /* Return true here, srv_pipe_hnd.c will take care */
5265                 return true;
5266         }
5267
5268         if (DEBUGLEVEL >= 10) {
5269                 NDR_PRINT_OUT_DEBUG(spoolss_RouterRefreshPrinterChangeNotify, r);
5270         }
5271
5272         push = ndr_push_init_ctx(r, NULL);
5273         if (push == NULL) {
5274                 talloc_free(r);
5275                 return false;
5276         }
5277
5278         ndr_err = call->ndr_push(push, NDR_OUT, r);
5279         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5280                 talloc_free(r);
5281                 return false;
5282         }
5283
5284         blob = ndr_push_blob(push);
5285         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5286                 talloc_free(r);
5287                 return false;
5288         }
5289
5290         talloc_free(r);
5291
5292         return true;
5293 }
5294
5295 static bool api_spoolss_44(pipes_struct *p)
5296 {
5297         const struct ndr_interface_call *call;
5298         struct ndr_pull *pull;
5299         struct ndr_push *push;
5300         enum ndr_err_code ndr_err;
5301         DATA_BLOB blob;
5302         struct spoolss_44 *r;
5303
5304         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_44];
5305
5306         r = talloc(talloc_tos(), struct spoolss_44);
5307         if (r == NULL) {
5308                 return false;
5309         }
5310
5311         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5312                 talloc_free(r);
5313                 return false;
5314         }
5315
5316         pull = ndr_pull_init_blob(&blob, r, NULL);
5317         if (pull == NULL) {
5318                 talloc_free(r);
5319                 return false;
5320         }
5321
5322         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5323         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5324         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5325                 talloc_free(r);
5326                 return false;
5327         }
5328
5329         if (DEBUGLEVEL >= 10) {
5330                 NDR_PRINT_IN_DEBUG(spoolss_44, r);
5331         }
5332
5333         r->out.result = _spoolss_44(p, r);
5334
5335         if (p->rng_fault_state) {
5336                 talloc_free(r);
5337                 /* Return true here, srv_pipe_hnd.c will take care */
5338                 return true;
5339         }
5340
5341         if (DEBUGLEVEL >= 10) {
5342                 NDR_PRINT_OUT_DEBUG(spoolss_44, r);
5343         }
5344
5345         push = ndr_push_init_ctx(r, NULL);
5346         if (push == NULL) {
5347                 talloc_free(r);
5348                 return false;
5349         }
5350
5351         ndr_err = call->ndr_push(push, NDR_OUT, r);
5352         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5353                 talloc_free(r);
5354                 return false;
5355         }
5356
5357         blob = ndr_push_blob(push);
5358         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5359                 talloc_free(r);
5360                 return false;
5361         }
5362
5363         talloc_free(r);
5364
5365         return true;
5366 }
5367
5368 static bool api_spoolss_OpenPrinterEx(pipes_struct *p)
5369 {
5370         const struct ndr_interface_call *call;
5371         struct ndr_pull *pull;
5372         struct ndr_push *push;
5373         enum ndr_err_code ndr_err;
5374         DATA_BLOB blob;
5375         struct spoolss_OpenPrinterEx *r;
5376
5377         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_OPENPRINTEREX];
5378
5379         r = talloc(talloc_tos(), struct spoolss_OpenPrinterEx);
5380         if (r == NULL) {
5381                 return false;
5382         }
5383
5384         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5385                 talloc_free(r);
5386                 return false;
5387         }
5388
5389         pull = ndr_pull_init_blob(&blob, r, NULL);
5390         if (pull == NULL) {
5391                 talloc_free(r);
5392                 return false;
5393         }
5394
5395         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5396         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5397         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5398                 talloc_free(r);
5399                 return false;
5400         }
5401
5402         if (DEBUGLEVEL >= 10) {
5403                 NDR_PRINT_IN_DEBUG(spoolss_OpenPrinterEx, r);
5404         }
5405
5406         ZERO_STRUCT(r->out);
5407         r->out.handle = talloc_zero(r, struct policy_handle);
5408         if (r->out.handle == NULL) {
5409                 talloc_free(r);
5410                 return false;
5411         }
5412
5413         r->out.result = _spoolss_OpenPrinterEx(p, r);
5414
5415         if (p->rng_fault_state) {
5416                 talloc_free(r);
5417                 /* Return true here, srv_pipe_hnd.c will take care */
5418                 return true;
5419         }
5420
5421         if (DEBUGLEVEL >= 10) {
5422                 NDR_PRINT_OUT_DEBUG(spoolss_OpenPrinterEx, r);
5423         }
5424
5425         push = ndr_push_init_ctx(r, NULL);
5426         if (push == NULL) {
5427                 talloc_free(r);
5428                 return false;
5429         }
5430
5431         ndr_err = call->ndr_push(push, NDR_OUT, r);
5432         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5433                 talloc_free(r);
5434                 return false;
5435         }
5436
5437         blob = ndr_push_blob(push);
5438         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5439                 talloc_free(r);
5440                 return false;
5441         }
5442
5443         talloc_free(r);
5444
5445         return true;
5446 }
5447
5448 static bool api_spoolss_AddPrinterEx(pipes_struct *p)
5449 {
5450         const struct ndr_interface_call *call;
5451         struct ndr_pull *pull;
5452         struct ndr_push *push;
5453         enum ndr_err_code ndr_err;
5454         DATA_BLOB blob;
5455         struct spoolss_AddPrinterEx *r;
5456
5457         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTEREX];
5458
5459         r = talloc(talloc_tos(), struct spoolss_AddPrinterEx);
5460         if (r == NULL) {
5461                 return false;
5462         }
5463
5464         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5465                 talloc_free(r);
5466                 return false;
5467         }
5468
5469         pull = ndr_pull_init_blob(&blob, r, NULL);
5470         if (pull == NULL) {
5471                 talloc_free(r);
5472                 return false;
5473         }
5474
5475         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5476         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5477         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5478                 talloc_free(r);
5479                 return false;
5480         }
5481
5482         if (DEBUGLEVEL >= 10) {
5483                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterEx, r);
5484         }
5485
5486         ZERO_STRUCT(r->out);
5487         r->out.handle = talloc_zero(r, struct policy_handle);
5488         if (r->out.handle == NULL) {
5489                 talloc_free(r);
5490                 return false;
5491         }
5492
5493         r->out.result = _spoolss_AddPrinterEx(p, r);
5494
5495         if (p->rng_fault_state) {
5496                 talloc_free(r);
5497                 /* Return true here, srv_pipe_hnd.c will take care */
5498                 return true;
5499         }
5500
5501         if (DEBUGLEVEL >= 10) {
5502                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterEx, r);
5503         }
5504
5505         push = ndr_push_init_ctx(r, NULL);
5506         if (push == NULL) {
5507                 talloc_free(r);
5508                 return false;
5509         }
5510
5511         ndr_err = call->ndr_push(push, NDR_OUT, r);
5512         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5513                 talloc_free(r);
5514                 return false;
5515         }
5516
5517         blob = ndr_push_blob(push);
5518         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5519                 talloc_free(r);
5520                 return false;
5521         }
5522
5523         talloc_free(r);
5524
5525         return true;
5526 }
5527
5528 static bool api_spoolss_47(pipes_struct *p)
5529 {
5530         const struct ndr_interface_call *call;
5531         struct ndr_pull *pull;
5532         struct ndr_push *push;
5533         enum ndr_err_code ndr_err;
5534         DATA_BLOB blob;
5535         struct spoolss_47 *r;
5536
5537         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_47];
5538
5539         r = talloc(talloc_tos(), struct spoolss_47);
5540         if (r == NULL) {
5541                 return false;
5542         }
5543
5544         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5545                 talloc_free(r);
5546                 return false;
5547         }
5548
5549         pull = ndr_pull_init_blob(&blob, r, NULL);
5550         if (pull == NULL) {
5551                 talloc_free(r);
5552                 return false;
5553         }
5554
5555         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5556         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5557         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5558                 talloc_free(r);
5559                 return false;
5560         }
5561
5562         if (DEBUGLEVEL >= 10) {
5563                 NDR_PRINT_IN_DEBUG(spoolss_47, r);
5564         }
5565
5566         r->out.result = _spoolss_47(p, r);
5567
5568         if (p->rng_fault_state) {
5569                 talloc_free(r);
5570                 /* Return true here, srv_pipe_hnd.c will take care */
5571                 return true;
5572         }
5573
5574         if (DEBUGLEVEL >= 10) {
5575                 NDR_PRINT_OUT_DEBUG(spoolss_47, r);
5576         }
5577
5578         push = ndr_push_init_ctx(r, NULL);
5579         if (push == NULL) {
5580                 talloc_free(r);
5581                 return false;
5582         }
5583
5584         ndr_err = call->ndr_push(push, NDR_OUT, r);
5585         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5586                 talloc_free(r);
5587                 return false;
5588         }
5589
5590         blob = ndr_push_blob(push);
5591         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5592                 talloc_free(r);
5593                 return false;
5594         }
5595
5596         talloc_free(r);
5597
5598         return true;
5599 }
5600
5601 static bool api_spoolss_EnumPrinterData(pipes_struct *p)
5602 {
5603         const struct ndr_interface_call *call;
5604         struct ndr_pull *pull;
5605         struct ndr_push *push;
5606         enum ndr_err_code ndr_err;
5607         DATA_BLOB blob;
5608         struct spoolss_EnumPrinterData *r;
5609
5610         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERDATA];
5611
5612         r = talloc(talloc_tos(), struct spoolss_EnumPrinterData);
5613         if (r == NULL) {
5614                 return false;
5615         }
5616
5617         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5618                 talloc_free(r);
5619                 return false;
5620         }
5621
5622         pull = ndr_pull_init_blob(&blob, r, NULL);
5623         if (pull == NULL) {
5624                 talloc_free(r);
5625                 return false;
5626         }
5627
5628         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5629         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5630         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5631                 talloc_free(r);
5632                 return false;
5633         }
5634
5635         if (DEBUGLEVEL >= 10) {
5636                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterData, r);
5637         }
5638
5639         ZERO_STRUCT(r->out);
5640         r->out.value_name = talloc_zero_array(r, const char, r->in.value_offered / 2);
5641         if (r->out.value_name == NULL) {
5642                 talloc_free(r);
5643                 return false;
5644         }
5645
5646         r->out.value_needed = talloc_zero(r, uint32_t);
5647         if (r->out.value_needed == NULL) {
5648                 talloc_free(r);
5649                 return false;
5650         }
5651
5652         r->out.printerdata_type = talloc_zero(r, uint32_t);
5653         if (r->out.printerdata_type == NULL) {
5654                 talloc_free(r);
5655                 return false;
5656         }
5657
5658         r->out.buffer = talloc_zero(r, DATA_BLOB);
5659         if (r->out.buffer == NULL) {
5660                 talloc_free(r);
5661                 return false;
5662         }
5663
5664         r->out.data_needed = talloc_zero(r, uint32_t);
5665         if (r->out.data_needed == NULL) {
5666                 talloc_free(r);
5667                 return false;
5668         }
5669
5670         r->out.result = _spoolss_EnumPrinterData(p, r);
5671
5672         if (p->rng_fault_state) {
5673                 talloc_free(r);
5674                 /* Return true here, srv_pipe_hnd.c will take care */
5675                 return true;
5676         }
5677
5678         if (DEBUGLEVEL >= 10) {
5679                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterData, r);
5680         }
5681
5682         push = ndr_push_init_ctx(r, NULL);
5683         if (push == NULL) {
5684                 talloc_free(r);
5685                 return false;
5686         }
5687
5688         ndr_err = call->ndr_push(push, NDR_OUT, r);
5689         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5690                 talloc_free(r);
5691                 return false;
5692         }
5693
5694         blob = ndr_push_blob(push);
5695         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5696                 talloc_free(r);
5697                 return false;
5698         }
5699
5700         talloc_free(r);
5701
5702         return true;
5703 }
5704
5705 static bool api_spoolss_DeletePrinterData(pipes_struct *p)
5706 {
5707         const struct ndr_interface_call *call;
5708         struct ndr_pull *pull;
5709         struct ndr_push *push;
5710         enum ndr_err_code ndr_err;
5711         DATA_BLOB blob;
5712         struct spoolss_DeletePrinterData *r;
5713
5714         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDATA];
5715
5716         r = talloc(talloc_tos(), struct spoolss_DeletePrinterData);
5717         if (r == NULL) {
5718                 return false;
5719         }
5720
5721         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5722                 talloc_free(r);
5723                 return false;
5724         }
5725
5726         pull = ndr_pull_init_blob(&blob, r, NULL);
5727         if (pull == NULL) {
5728                 talloc_free(r);
5729                 return false;
5730         }
5731
5732         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5733         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5734         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5735                 talloc_free(r);
5736                 return false;
5737         }
5738
5739         if (DEBUGLEVEL >= 10) {
5740                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterData, r);
5741         }
5742
5743         r->out.result = _spoolss_DeletePrinterData(p, r);
5744
5745         if (p->rng_fault_state) {
5746                 talloc_free(r);
5747                 /* Return true here, srv_pipe_hnd.c will take care */
5748                 return true;
5749         }
5750
5751         if (DEBUGLEVEL >= 10) {
5752                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterData, r);
5753         }
5754
5755         push = ndr_push_init_ctx(r, NULL);
5756         if (push == NULL) {
5757                 talloc_free(r);
5758                 return false;
5759         }
5760
5761         ndr_err = call->ndr_push(push, NDR_OUT, r);
5762         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5763                 talloc_free(r);
5764                 return false;
5765         }
5766
5767         blob = ndr_push_blob(push);
5768         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5769                 talloc_free(r);
5770                 return false;
5771         }
5772
5773         talloc_free(r);
5774
5775         return true;
5776 }
5777
5778 static bool api_spoolss_4a(pipes_struct *p)
5779 {
5780         const struct ndr_interface_call *call;
5781         struct ndr_pull *pull;
5782         struct ndr_push *push;
5783         enum ndr_err_code ndr_err;
5784         DATA_BLOB blob;
5785         struct spoolss_4a *r;
5786
5787         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4A];
5788
5789         r = talloc(talloc_tos(), struct spoolss_4a);
5790         if (r == NULL) {
5791                 return false;
5792         }
5793
5794         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5795                 talloc_free(r);
5796                 return false;
5797         }
5798
5799         pull = ndr_pull_init_blob(&blob, r, NULL);
5800         if (pull == NULL) {
5801                 talloc_free(r);
5802                 return false;
5803         }
5804
5805         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5806         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5807         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5808                 talloc_free(r);
5809                 return false;
5810         }
5811
5812         if (DEBUGLEVEL >= 10) {
5813                 NDR_PRINT_IN_DEBUG(spoolss_4a, r);
5814         }
5815
5816         r->out.result = _spoolss_4a(p, r);
5817
5818         if (p->rng_fault_state) {
5819                 talloc_free(r);
5820                 /* Return true here, srv_pipe_hnd.c will take care */
5821                 return true;
5822         }
5823
5824         if (DEBUGLEVEL >= 10) {
5825                 NDR_PRINT_OUT_DEBUG(spoolss_4a, r);
5826         }
5827
5828         push = ndr_push_init_ctx(r, NULL);
5829         if (push == NULL) {
5830                 talloc_free(r);
5831                 return false;
5832         }
5833
5834         ndr_err = call->ndr_push(push, NDR_OUT, r);
5835         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5836                 talloc_free(r);
5837                 return false;
5838         }
5839
5840         blob = ndr_push_blob(push);
5841         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5842                 talloc_free(r);
5843                 return false;
5844         }
5845
5846         talloc_free(r);
5847
5848         return true;
5849 }
5850
5851 static bool api_spoolss_4b(pipes_struct *p)
5852 {
5853         const struct ndr_interface_call *call;
5854         struct ndr_pull *pull;
5855         struct ndr_push *push;
5856         enum ndr_err_code ndr_err;
5857         DATA_BLOB blob;
5858         struct spoolss_4b *r;
5859
5860         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4B];
5861
5862         r = talloc(talloc_tos(), struct spoolss_4b);
5863         if (r == NULL) {
5864                 return false;
5865         }
5866
5867         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5868                 talloc_free(r);
5869                 return false;
5870         }
5871
5872         pull = ndr_pull_init_blob(&blob, r, NULL);
5873         if (pull == NULL) {
5874                 talloc_free(r);
5875                 return false;
5876         }
5877
5878         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5879         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5880         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5881                 talloc_free(r);
5882                 return false;
5883         }
5884
5885         if (DEBUGLEVEL >= 10) {
5886                 NDR_PRINT_IN_DEBUG(spoolss_4b, r);
5887         }
5888
5889         r->out.result = _spoolss_4b(p, r);
5890
5891         if (p->rng_fault_state) {
5892                 talloc_free(r);
5893                 /* Return true here, srv_pipe_hnd.c will take care */
5894                 return true;
5895         }
5896
5897         if (DEBUGLEVEL >= 10) {
5898                 NDR_PRINT_OUT_DEBUG(spoolss_4b, r);
5899         }
5900
5901         push = ndr_push_init_ctx(r, NULL);
5902         if (push == NULL) {
5903                 talloc_free(r);
5904                 return false;
5905         }
5906
5907         ndr_err = call->ndr_push(push, NDR_OUT, r);
5908         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5909                 talloc_free(r);
5910                 return false;
5911         }
5912
5913         blob = ndr_push_blob(push);
5914         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5915                 talloc_free(r);
5916                 return false;
5917         }
5918
5919         talloc_free(r);
5920
5921         return true;
5922 }
5923
5924 static bool api_spoolss_4c(pipes_struct *p)
5925 {
5926         const struct ndr_interface_call *call;
5927         struct ndr_pull *pull;
5928         struct ndr_push *push;
5929         enum ndr_err_code ndr_err;
5930         DATA_BLOB blob;
5931         struct spoolss_4c *r;
5932
5933         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4C];
5934
5935         r = talloc(talloc_tos(), struct spoolss_4c);
5936         if (r == NULL) {
5937                 return false;
5938         }
5939
5940         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5941                 talloc_free(r);
5942                 return false;
5943         }
5944
5945         pull = ndr_pull_init_blob(&blob, r, NULL);
5946         if (pull == NULL) {
5947                 talloc_free(r);
5948                 return false;
5949         }
5950
5951         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5952         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5953         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5954                 talloc_free(r);
5955                 return false;
5956         }
5957
5958         if (DEBUGLEVEL >= 10) {
5959                 NDR_PRINT_IN_DEBUG(spoolss_4c, r);
5960         }
5961
5962         r->out.result = _spoolss_4c(p, r);
5963
5964         if (p->rng_fault_state) {
5965                 talloc_free(r);
5966                 /* Return true here, srv_pipe_hnd.c will take care */
5967                 return true;
5968         }
5969
5970         if (DEBUGLEVEL >= 10) {
5971                 NDR_PRINT_OUT_DEBUG(spoolss_4c, r);
5972         }
5973
5974         push = ndr_push_init_ctx(r, NULL);
5975         if (push == NULL) {
5976                 talloc_free(r);
5977                 return false;
5978         }
5979
5980         ndr_err = call->ndr_push(push, NDR_OUT, r);
5981         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5982                 talloc_free(r);
5983                 return false;
5984         }
5985
5986         blob = ndr_push_blob(push);
5987         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5988                 talloc_free(r);
5989                 return false;
5990         }
5991
5992         talloc_free(r);
5993
5994         return true;
5995 }
5996
5997 static bool api_spoolss_SetPrinterDataEx(pipes_struct *p)
5998 {
5999         const struct ndr_interface_call *call;
6000         struct ndr_pull *pull;
6001         struct ndr_push *push;
6002         enum ndr_err_code ndr_err;
6003         DATA_BLOB blob;
6004         struct spoolss_SetPrinterDataEx *r;
6005
6006         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETPRINTERDATAEX];
6007
6008         r = talloc(talloc_tos(), struct spoolss_SetPrinterDataEx);
6009         if (r == NULL) {
6010                 return false;
6011         }
6012
6013         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6014                 talloc_free(r);
6015                 return false;
6016         }
6017
6018         pull = ndr_pull_init_blob(&blob, r, NULL);
6019         if (pull == NULL) {
6020                 talloc_free(r);
6021                 return false;
6022         }
6023
6024         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6025         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6026         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6027                 talloc_free(r);
6028                 return false;
6029         }
6030
6031         if (DEBUGLEVEL >= 10) {
6032                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinterDataEx, r);
6033         }
6034
6035         r->out.result = _spoolss_SetPrinterDataEx(p, r);
6036
6037         if (p->rng_fault_state) {
6038                 talloc_free(r);
6039                 /* Return true here, srv_pipe_hnd.c will take care */
6040                 return true;
6041         }
6042
6043         if (DEBUGLEVEL >= 10) {
6044                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinterDataEx, r);
6045         }
6046
6047         push = ndr_push_init_ctx(r, NULL);
6048         if (push == NULL) {
6049                 talloc_free(r);
6050                 return false;
6051         }
6052
6053         ndr_err = call->ndr_push(push, NDR_OUT, r);
6054         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6055                 talloc_free(r);
6056                 return false;
6057         }
6058
6059         blob = ndr_push_blob(push);
6060         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6061                 talloc_free(r);
6062                 return false;
6063         }
6064
6065         talloc_free(r);
6066
6067         return true;
6068 }
6069
6070 static bool api_spoolss_GetPrinterDataEx(pipes_struct *p)
6071 {
6072         const struct ndr_interface_call *call;
6073         struct ndr_pull *pull;
6074         struct ndr_push *push;
6075         enum ndr_err_code ndr_err;
6076         DATA_BLOB blob;
6077         struct spoolss_GetPrinterDataEx *r;
6078
6079         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDATAEX];
6080
6081         r = talloc(talloc_tos(), struct spoolss_GetPrinterDataEx);
6082         if (r == NULL) {
6083                 return false;
6084         }
6085
6086         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6087                 talloc_free(r);
6088                 return false;
6089         }
6090
6091         pull = ndr_pull_init_blob(&blob, r, NULL);
6092         if (pull == NULL) {
6093                 talloc_free(r);
6094                 return false;
6095         }
6096
6097         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6098         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6099         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6100                 talloc_free(r);
6101                 return false;
6102         }
6103
6104         if (DEBUGLEVEL >= 10) {
6105                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDataEx, r);
6106         }
6107
6108         ZERO_STRUCT(r->out);
6109         r->out.type = talloc_zero(r, uint32_t);
6110         if (r->out.type == NULL) {
6111                 talloc_free(r);
6112                 return false;
6113         }
6114
6115         r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
6116         if (r->out.buffer == NULL) {
6117                 talloc_free(r);
6118                 return false;
6119         }
6120
6121         r->out.needed = talloc_zero(r, uint32_t);
6122         if (r->out.needed == NULL) {
6123                 talloc_free(r);
6124                 return false;
6125         }
6126
6127         r->out.result = _spoolss_GetPrinterDataEx(p, r);
6128
6129         if (p->rng_fault_state) {
6130                 talloc_free(r);
6131                 /* Return true here, srv_pipe_hnd.c will take care */
6132                 return true;
6133         }
6134
6135         if (DEBUGLEVEL >= 10) {
6136                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDataEx, r);
6137         }
6138
6139         push = ndr_push_init_ctx(r, NULL);
6140         if (push == NULL) {
6141                 talloc_free(r);
6142                 return false;
6143         }
6144
6145         ndr_err = call->ndr_push(push, NDR_OUT, r);
6146         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6147                 talloc_free(r);
6148                 return false;
6149         }
6150
6151         blob = ndr_push_blob(push);
6152         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6153                 talloc_free(r);
6154                 return false;
6155         }
6156
6157         talloc_free(r);
6158
6159         return true;
6160 }
6161
6162 static bool api_spoolss_EnumPrinterDataEx(pipes_struct *p)
6163 {
6164         const struct ndr_interface_call *call;
6165         struct ndr_pull *pull;
6166         struct ndr_push *push;
6167         enum ndr_err_code ndr_err;
6168         DATA_BLOB blob;
6169         struct spoolss_EnumPrinterDataEx *r;
6170
6171         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERDATAEX];
6172
6173         r = talloc(talloc_tos(), struct spoolss_EnumPrinterDataEx);
6174         if (r == NULL) {
6175                 return false;
6176         }
6177
6178         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6179                 talloc_free(r);
6180                 return false;
6181         }
6182
6183         pull = ndr_pull_init_blob(&blob, r, NULL);
6184         if (pull == NULL) {
6185                 talloc_free(r);
6186                 return false;
6187         }
6188
6189         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6190         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6191         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6192                 talloc_free(r);
6193                 return false;
6194         }
6195
6196         if (DEBUGLEVEL >= 10) {
6197                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterDataEx, r);
6198         }
6199
6200         ZERO_STRUCT(r->out);
6201         r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
6202         if (r->out.buffer == NULL) {
6203                 talloc_free(r);
6204                 return false;
6205         }
6206
6207         r->out.needed = talloc_zero(r, uint32_t);
6208         if (r->out.needed == NULL) {
6209                 talloc_free(r);
6210                 return false;
6211         }
6212
6213         r->out.count = talloc_zero(r, uint32_t);
6214         if (r->out.count == NULL) {
6215                 talloc_free(r);
6216                 return false;
6217         }
6218
6219         r->out.result = _spoolss_EnumPrinterDataEx(p, r);
6220
6221         if (p->rng_fault_state) {
6222                 talloc_free(r);
6223                 /* Return true here, srv_pipe_hnd.c will take care */
6224                 return true;
6225         }
6226
6227         if (DEBUGLEVEL >= 10) {
6228                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterDataEx, r);
6229         }
6230
6231         push = ndr_push_init_ctx(r, NULL);
6232         if (push == NULL) {
6233                 talloc_free(r);
6234                 return false;
6235         }
6236
6237         ndr_err = call->ndr_push(push, NDR_OUT, r);
6238         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6239                 talloc_free(r);
6240                 return false;
6241         }
6242
6243         blob = ndr_push_blob(push);
6244         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6245                 talloc_free(r);
6246                 return false;
6247         }
6248
6249         talloc_free(r);
6250
6251         return true;
6252 }
6253
6254 static bool api_spoolss_EnumPrinterKey(pipes_struct *p)
6255 {
6256         const struct ndr_interface_call *call;
6257         struct ndr_pull *pull;
6258         struct ndr_push *push;
6259         enum ndr_err_code ndr_err;
6260         DATA_BLOB blob;
6261         struct spoolss_EnumPrinterKey *r;
6262
6263         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERKEY];
6264
6265         r = talloc(talloc_tos(), struct spoolss_EnumPrinterKey);
6266         if (r == NULL) {
6267                 return false;
6268         }
6269
6270         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6271                 talloc_free(r);
6272                 return false;
6273         }
6274
6275         pull = ndr_pull_init_blob(&blob, r, NULL);
6276         if (pull == NULL) {
6277                 talloc_free(r);
6278                 return false;
6279         }
6280
6281         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6282         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6283         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6284                 talloc_free(r);
6285                 return false;
6286         }
6287
6288         if (DEBUGLEVEL >= 10) {
6289                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterKey, r);
6290         }
6291
6292         ZERO_STRUCT(r->out);
6293         r->out.key_buffer = talloc_zero_array(r, uint16_t, r->in.key_buffer_size / 2);
6294         if (r->out.key_buffer == NULL) {
6295                 talloc_free(r);
6296                 return false;
6297         }
6298
6299         r->out.needed = talloc_zero(r, uint32_t);
6300         if (r->out.needed == NULL) {
6301                 talloc_free(r);
6302                 return false;
6303         }
6304
6305         r->out.result = _spoolss_EnumPrinterKey(p, r);
6306
6307         if (p->rng_fault_state) {
6308                 talloc_free(r);
6309                 /* Return true here, srv_pipe_hnd.c will take care */
6310                 return true;
6311         }
6312
6313         if (DEBUGLEVEL >= 10) {
6314                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterKey, r);
6315         }
6316
6317         push = ndr_push_init_ctx(r, NULL);
6318         if (push == NULL) {
6319                 talloc_free(r);
6320                 return false;
6321         }
6322
6323         ndr_err = call->ndr_push(push, NDR_OUT, r);
6324         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6325                 talloc_free(r);
6326                 return false;
6327         }
6328
6329         blob = ndr_push_blob(push);
6330         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6331                 talloc_free(r);
6332                 return false;
6333         }
6334
6335         talloc_free(r);
6336
6337         return true;
6338 }
6339
6340 static bool api_spoolss_DeletePrinterDataEx(pipes_struct *p)
6341 {
6342         const struct ndr_interface_call *call;
6343         struct ndr_pull *pull;
6344         struct ndr_push *push;
6345         enum ndr_err_code ndr_err;
6346         DATA_BLOB blob;
6347         struct spoolss_DeletePrinterDataEx *r;
6348
6349         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDATAEX];
6350
6351         r = talloc(talloc_tos(), struct spoolss_DeletePrinterDataEx);
6352         if (r == NULL) {
6353                 return false;
6354         }
6355
6356         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6357                 talloc_free(r);
6358                 return false;
6359         }
6360
6361         pull = ndr_pull_init_blob(&blob, r, NULL);
6362         if (pull == NULL) {
6363                 talloc_free(r);
6364                 return false;
6365         }
6366
6367         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6368         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6369         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6370                 talloc_free(r);
6371                 return false;
6372         }
6373
6374         if (DEBUGLEVEL >= 10) {
6375                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDataEx, r);
6376         }
6377
6378         r->out.result = _spoolss_DeletePrinterDataEx(p, r);
6379
6380         if (p->rng_fault_state) {
6381                 talloc_free(r);
6382                 /* Return true here, srv_pipe_hnd.c will take care */
6383                 return true;
6384         }
6385
6386         if (DEBUGLEVEL >= 10) {
6387                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDataEx, r);
6388         }
6389
6390         push = ndr_push_init_ctx(r, NULL);
6391         if (push == NULL) {
6392                 talloc_free(r);
6393                 return false;
6394         }
6395
6396         ndr_err = call->ndr_push(push, NDR_OUT, r);
6397         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6398                 talloc_free(r);
6399                 return false;
6400         }
6401
6402         blob = ndr_push_blob(push);
6403         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6404                 talloc_free(r);
6405                 return false;
6406         }
6407
6408         talloc_free(r);
6409
6410         return true;
6411 }
6412
6413 static bool api_spoolss_DeletePrinterKey(pipes_struct *p)
6414 {
6415         const struct ndr_interface_call *call;
6416         struct ndr_pull *pull;
6417         struct ndr_push *push;
6418         enum ndr_err_code ndr_err;
6419         DATA_BLOB blob;
6420         struct spoolss_DeletePrinterKey *r;
6421
6422         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERKEY];
6423
6424         r = talloc(talloc_tos(), struct spoolss_DeletePrinterKey);
6425         if (r == NULL) {
6426                 return false;
6427         }
6428
6429         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6430                 talloc_free(r);
6431                 return false;
6432         }
6433
6434         pull = ndr_pull_init_blob(&blob, r, NULL);
6435         if (pull == NULL) {
6436                 talloc_free(r);
6437                 return false;
6438         }
6439
6440         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6441         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6442         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6443                 talloc_free(r);
6444                 return false;
6445         }
6446
6447         if (DEBUGLEVEL >= 10) {
6448                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterKey, r);
6449         }
6450
6451         r->out.result = _spoolss_DeletePrinterKey(p, r);
6452
6453         if (p->rng_fault_state) {
6454                 talloc_free(r);
6455                 /* Return true here, srv_pipe_hnd.c will take care */
6456                 return true;
6457         }
6458
6459         if (DEBUGLEVEL >= 10) {
6460                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterKey, r);
6461         }
6462
6463         push = ndr_push_init_ctx(r, NULL);
6464         if (push == NULL) {
6465                 talloc_free(r);
6466                 return false;
6467         }
6468
6469         ndr_err = call->ndr_push(push, NDR_OUT, r);
6470         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6471                 talloc_free(r);
6472                 return false;
6473         }
6474
6475         blob = ndr_push_blob(push);
6476         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6477                 talloc_free(r);
6478                 return false;
6479         }
6480
6481         talloc_free(r);
6482
6483         return true;
6484 }
6485
6486 static bool api_spoolss_53(pipes_struct *p)
6487 {
6488         const struct ndr_interface_call *call;
6489         struct ndr_pull *pull;
6490         struct ndr_push *push;
6491         enum ndr_err_code ndr_err;
6492         DATA_BLOB blob;
6493         struct spoolss_53 *r;
6494
6495         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_53];
6496
6497         r = talloc(talloc_tos(), struct spoolss_53);
6498         if (r == NULL) {
6499                 return false;
6500         }
6501
6502         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6503                 talloc_free(r);
6504                 return false;
6505         }
6506
6507         pull = ndr_pull_init_blob(&blob, r, NULL);
6508         if (pull == NULL) {
6509                 talloc_free(r);
6510                 return false;
6511         }
6512
6513         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6514         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6515         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6516                 talloc_free(r);
6517                 return false;
6518         }
6519
6520         if (DEBUGLEVEL >= 10) {
6521                 NDR_PRINT_IN_DEBUG(spoolss_53, r);
6522         }
6523
6524         r->out.result = _spoolss_53(p, r);
6525
6526         if (p->rng_fault_state) {
6527                 talloc_free(r);
6528                 /* Return true here, srv_pipe_hnd.c will take care */
6529                 return true;
6530         }
6531
6532         if (DEBUGLEVEL >= 10) {
6533                 NDR_PRINT_OUT_DEBUG(spoolss_53, r);
6534         }
6535
6536         push = ndr_push_init_ctx(r, NULL);
6537         if (push == NULL) {
6538                 talloc_free(r);
6539                 return false;
6540         }
6541
6542         ndr_err = call->ndr_push(push, NDR_OUT, r);
6543         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6544                 talloc_free(r);
6545                 return false;
6546         }
6547
6548         blob = ndr_push_blob(push);
6549         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6550                 talloc_free(r);
6551                 return false;
6552         }
6553
6554         talloc_free(r);
6555
6556         return true;
6557 }
6558
6559 static bool api_spoolss_DeletePrinterDriverEx(pipes_struct *p)
6560 {
6561         const struct ndr_interface_call *call;
6562         struct ndr_pull *pull;
6563         struct ndr_push *push;
6564         enum ndr_err_code ndr_err;
6565         DATA_BLOB blob;
6566         struct spoolss_DeletePrinterDriverEx *r;
6567
6568         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDRIVEREX];
6569
6570         r = talloc(talloc_tos(), struct spoolss_DeletePrinterDriverEx);
6571         if (r == NULL) {
6572                 return false;
6573         }
6574
6575         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6576                 talloc_free(r);
6577                 return false;
6578         }
6579
6580         pull = ndr_pull_init_blob(&blob, r, NULL);
6581         if (pull == NULL) {
6582                 talloc_free(r);
6583                 return false;
6584         }
6585
6586         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6587         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6588         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6589                 talloc_free(r);
6590                 return false;
6591         }
6592
6593         if (DEBUGLEVEL >= 10) {
6594                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDriverEx, r);
6595         }
6596
6597         r->out.result = _spoolss_DeletePrinterDriverEx(p, r);
6598
6599         if (p->rng_fault_state) {
6600                 talloc_free(r);
6601                 /* Return true here, srv_pipe_hnd.c will take care */
6602                 return true;
6603         }
6604
6605         if (DEBUGLEVEL >= 10) {
6606                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDriverEx, r);
6607         }
6608
6609         push = ndr_push_init_ctx(r, NULL);
6610         if (push == NULL) {
6611                 talloc_free(r);
6612                 return false;
6613         }
6614
6615         ndr_err = call->ndr_push(push, NDR_OUT, r);
6616         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6617                 talloc_free(r);
6618                 return false;
6619         }
6620
6621         blob = ndr_push_blob(push);
6622         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6623                 talloc_free(r);
6624                 return false;
6625         }
6626
6627         talloc_free(r);
6628
6629         return true;
6630 }
6631
6632 static bool api_spoolss_55(pipes_struct *p)
6633 {
6634         const struct ndr_interface_call *call;
6635         struct ndr_pull *pull;
6636         struct ndr_push *push;
6637         enum ndr_err_code ndr_err;
6638         DATA_BLOB blob;
6639         struct spoolss_55 *r;
6640
6641         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_55];
6642
6643         r = talloc(talloc_tos(), struct spoolss_55);
6644         if (r == NULL) {
6645                 return false;
6646         }
6647
6648         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6649                 talloc_free(r);
6650                 return false;
6651         }
6652
6653         pull = ndr_pull_init_blob(&blob, r, NULL);
6654         if (pull == NULL) {
6655                 talloc_free(r);
6656                 return false;
6657         }
6658
6659         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6660         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6661         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6662                 talloc_free(r);
6663                 return false;
6664         }
6665
6666         if (DEBUGLEVEL >= 10) {
6667                 NDR_PRINT_IN_DEBUG(spoolss_55, r);
6668         }
6669
6670         r->out.result = _spoolss_55(p, r);
6671
6672         if (p->rng_fault_state) {
6673                 talloc_free(r);
6674                 /* Return true here, srv_pipe_hnd.c will take care */
6675                 return true;
6676         }
6677
6678         if (DEBUGLEVEL >= 10) {
6679                 NDR_PRINT_OUT_DEBUG(spoolss_55, r);
6680         }
6681
6682         push = ndr_push_init_ctx(r, NULL);
6683         if (push == NULL) {
6684                 talloc_free(r);
6685                 return false;
6686         }
6687
6688         ndr_err = call->ndr_push(push, NDR_OUT, r);
6689         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6690                 talloc_free(r);
6691                 return false;
6692         }
6693
6694         blob = ndr_push_blob(push);
6695         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6696                 talloc_free(r);
6697                 return false;
6698         }
6699
6700         talloc_free(r);
6701
6702         return true;
6703 }
6704
6705 static bool api_spoolss_56(pipes_struct *p)
6706 {
6707         const struct ndr_interface_call *call;
6708         struct ndr_pull *pull;
6709         struct ndr_push *push;
6710         enum ndr_err_code ndr_err;
6711         DATA_BLOB blob;
6712         struct spoolss_56 *r;
6713
6714         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_56];
6715
6716         r = talloc(talloc_tos(), struct spoolss_56);
6717         if (r == NULL) {
6718                 return false;
6719         }
6720
6721         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6722                 talloc_free(r);
6723                 return false;
6724         }
6725
6726         pull = ndr_pull_init_blob(&blob, r, NULL);
6727         if (pull == NULL) {
6728                 talloc_free(r);
6729                 return false;
6730         }
6731
6732         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6733         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6734         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6735                 talloc_free(r);
6736                 return false;
6737         }
6738
6739         if (DEBUGLEVEL >= 10) {
6740                 NDR_PRINT_IN_DEBUG(spoolss_56, r);
6741         }
6742
6743         r->out.result = _spoolss_56(p, r);
6744
6745         if (p->rng_fault_state) {
6746                 talloc_free(r);
6747                 /* Return true here, srv_pipe_hnd.c will take care */
6748                 return true;
6749         }
6750
6751         if (DEBUGLEVEL >= 10) {
6752                 NDR_PRINT_OUT_DEBUG(spoolss_56, r);
6753         }
6754
6755         push = ndr_push_init_ctx(r, NULL);
6756         if (push == NULL) {
6757                 talloc_free(r);
6758                 return false;
6759         }
6760
6761         ndr_err = call->ndr_push(push, NDR_OUT, r);
6762         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6763                 talloc_free(r);
6764                 return false;
6765         }
6766
6767         blob = ndr_push_blob(push);
6768         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6769                 talloc_free(r);
6770                 return false;
6771         }
6772
6773         talloc_free(r);
6774
6775         return true;
6776 }
6777
6778 static bool api_spoolss_57(pipes_struct *p)
6779 {
6780         const struct ndr_interface_call *call;
6781         struct ndr_pull *pull;
6782         struct ndr_push *push;
6783         enum ndr_err_code ndr_err;
6784         DATA_BLOB blob;
6785         struct spoolss_57 *r;
6786
6787         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_57];
6788
6789         r = talloc(talloc_tos(), struct spoolss_57);
6790         if (r == NULL) {
6791                 return false;
6792         }
6793
6794         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6795                 talloc_free(r);
6796                 return false;
6797         }
6798
6799         pull = ndr_pull_init_blob(&blob, r, NULL);
6800         if (pull == NULL) {
6801                 talloc_free(r);
6802                 return false;
6803         }
6804
6805         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6806         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6807         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6808                 talloc_free(r);
6809                 return false;
6810         }
6811
6812         if (DEBUGLEVEL >= 10) {
6813                 NDR_PRINT_IN_DEBUG(spoolss_57, r);
6814         }
6815
6816         r->out.result = _spoolss_57(p, r);
6817
6818         if (p->rng_fault_state) {
6819                 talloc_free(r);
6820                 /* Return true here, srv_pipe_hnd.c will take care */
6821                 return true;
6822         }
6823
6824         if (DEBUGLEVEL >= 10) {
6825                 NDR_PRINT_OUT_DEBUG(spoolss_57, r);
6826         }
6827
6828         push = ndr_push_init_ctx(r, NULL);
6829         if (push == NULL) {
6830                 talloc_free(r);
6831                 return false;
6832         }
6833
6834         ndr_err = call->ndr_push(push, NDR_OUT, r);
6835         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6836                 talloc_free(r);
6837                 return false;
6838         }
6839
6840         blob = ndr_push_blob(push);
6841         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6842                 talloc_free(r);
6843                 return false;
6844         }
6845
6846         talloc_free(r);
6847
6848         return true;
6849 }
6850
6851 static bool api_spoolss_XcvData(pipes_struct *p)
6852 {
6853         const struct ndr_interface_call *call;
6854         struct ndr_pull *pull;
6855         struct ndr_push *push;
6856         enum ndr_err_code ndr_err;
6857         DATA_BLOB blob;
6858         struct spoolss_XcvData *r;
6859
6860         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_XCVDATA];
6861
6862         r = talloc(talloc_tos(), struct spoolss_XcvData);
6863         if (r == NULL) {
6864                 return false;
6865         }
6866
6867         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6868                 talloc_free(r);
6869                 return false;
6870         }
6871
6872         pull = ndr_pull_init_blob(&blob, r, NULL);
6873         if (pull == NULL) {
6874                 talloc_free(r);
6875                 return false;
6876         }
6877
6878         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6879         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6880         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6881                 talloc_free(r);
6882                 return false;
6883         }
6884
6885         if (DEBUGLEVEL >= 10) {
6886                 NDR_PRINT_IN_DEBUG(spoolss_XcvData, r);
6887         }
6888
6889         ZERO_STRUCT(r->out);
6890         r->out.status_code = r->in.status_code;
6891         r->out.out_data = talloc_zero_array(r, uint8_t, r->in.out_data_size);
6892         if (r->out.out_data == NULL) {
6893                 talloc_free(r);
6894                 return false;
6895         }
6896
6897         r->out.needed = talloc_zero(r, uint32_t);
6898         if (r->out.needed == NULL) {
6899                 talloc_free(r);
6900                 return false;
6901         }
6902
6903         r->out.result = _spoolss_XcvData(p, r);
6904
6905         if (p->rng_fault_state) {
6906                 talloc_free(r);
6907                 /* Return true here, srv_pipe_hnd.c will take care */
6908                 return true;
6909         }
6910
6911         if (DEBUGLEVEL >= 10) {
6912                 NDR_PRINT_OUT_DEBUG(spoolss_XcvData, r);
6913         }
6914
6915         push = ndr_push_init_ctx(r, NULL);
6916         if (push == NULL) {
6917                 talloc_free(r);
6918                 return false;
6919         }
6920
6921         ndr_err = call->ndr_push(push, NDR_OUT, r);
6922         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6923                 talloc_free(r);
6924                 return false;
6925         }
6926
6927         blob = ndr_push_blob(push);
6928         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6929                 talloc_free(r);
6930                 return false;
6931         }
6932
6933         talloc_free(r);
6934
6935         return true;
6936 }
6937
6938 static bool api_spoolss_AddPrinterDriverEx(pipes_struct *p)
6939 {
6940         const struct ndr_interface_call *call;
6941         struct ndr_pull *pull;
6942         struct ndr_push *push;
6943         enum ndr_err_code ndr_err;
6944         DATA_BLOB blob;
6945         struct spoolss_AddPrinterDriverEx *r;
6946
6947         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTERDRIVEREX];
6948
6949         r = talloc(talloc_tos(), struct spoolss_AddPrinterDriverEx);
6950         if (r == NULL) {
6951                 return false;
6952         }
6953
6954         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6955                 talloc_free(r);
6956                 return false;
6957         }
6958
6959         pull = ndr_pull_init_blob(&blob, r, NULL);
6960         if (pull == NULL) {
6961                 talloc_free(r);
6962                 return false;
6963         }
6964
6965         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6966         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6967         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6968                 talloc_free(r);
6969                 return false;
6970         }
6971
6972         if (DEBUGLEVEL >= 10) {
6973                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterDriverEx, r);
6974         }
6975
6976         r->out.result = _spoolss_AddPrinterDriverEx(p, r);
6977
6978         if (p->rng_fault_state) {
6979                 talloc_free(r);
6980                 /* Return true here, srv_pipe_hnd.c will take care */
6981                 return true;
6982         }
6983
6984         if (DEBUGLEVEL >= 10) {
6985                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterDriverEx, r);
6986         }
6987
6988         push = ndr_push_init_ctx(r, NULL);
6989         if (push == NULL) {
6990                 talloc_free(r);
6991                 return false;
6992         }
6993
6994         ndr_err = call->ndr_push(push, NDR_OUT, r);
6995         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6996                 talloc_free(r);
6997                 return false;
6998         }
6999
7000         blob = ndr_push_blob(push);
7001         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7002                 talloc_free(r);
7003                 return false;
7004         }
7005
7006         talloc_free(r);
7007
7008         return true;
7009 }
7010
7011 static bool api_spoolss_5a(pipes_struct *p)
7012 {
7013         const struct ndr_interface_call *call;
7014         struct ndr_pull *pull;
7015         struct ndr_push *push;
7016         enum ndr_err_code ndr_err;
7017         DATA_BLOB blob;
7018         struct spoolss_5a *r;
7019
7020         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5A];
7021
7022         r = talloc(talloc_tos(), struct spoolss_5a);
7023         if (r == NULL) {
7024                 return false;
7025         }
7026
7027         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7028                 talloc_free(r);
7029                 return false;
7030         }
7031
7032         pull = ndr_pull_init_blob(&blob, r, NULL);
7033         if (pull == NULL) {
7034                 talloc_free(r);
7035                 return false;
7036         }
7037
7038         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7039         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7040         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7041                 talloc_free(r);
7042                 return false;
7043         }
7044
7045         if (DEBUGLEVEL >= 10) {
7046                 NDR_PRINT_IN_DEBUG(spoolss_5a, r);
7047         }
7048
7049         r->out.result = _spoolss_5a(p, r);
7050
7051         if (p->rng_fault_state) {
7052                 talloc_free(r);
7053                 /* Return true here, srv_pipe_hnd.c will take care */
7054                 return true;
7055         }
7056
7057         if (DEBUGLEVEL >= 10) {
7058                 NDR_PRINT_OUT_DEBUG(spoolss_5a, r);
7059         }
7060
7061         push = ndr_push_init_ctx(r, NULL);
7062         if (push == NULL) {
7063                 talloc_free(r);
7064                 return false;
7065         }
7066
7067         ndr_err = call->ndr_push(push, NDR_OUT, r);
7068         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7069                 talloc_free(r);
7070                 return false;
7071         }
7072
7073         blob = ndr_push_blob(push);
7074         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7075                 talloc_free(r);
7076                 return false;
7077         }
7078
7079         talloc_free(r);
7080
7081         return true;
7082 }
7083
7084 static bool api_spoolss_5b(pipes_struct *p)
7085 {
7086         const struct ndr_interface_call *call;
7087         struct ndr_pull *pull;
7088         struct ndr_push *push;
7089         enum ndr_err_code ndr_err;
7090         DATA_BLOB blob;
7091         struct spoolss_5b *r;
7092
7093         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5B];
7094
7095         r = talloc(talloc_tos(), struct spoolss_5b);
7096         if (r == NULL) {
7097                 return false;
7098         }
7099
7100         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7101                 talloc_free(r);
7102                 return false;
7103         }
7104
7105         pull = ndr_pull_init_blob(&blob, r, NULL);
7106         if (pull == NULL) {
7107                 talloc_free(r);
7108                 return false;
7109         }
7110
7111         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7112         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7113         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7114                 talloc_free(r);
7115                 return false;
7116         }
7117
7118         if (DEBUGLEVEL >= 10) {
7119                 NDR_PRINT_IN_DEBUG(spoolss_5b, r);
7120         }
7121
7122         r->out.result = _spoolss_5b(p, r);
7123
7124         if (p->rng_fault_state) {
7125                 talloc_free(r);
7126                 /* Return true here, srv_pipe_hnd.c will take care */
7127                 return true;
7128         }
7129
7130         if (DEBUGLEVEL >= 10) {
7131                 NDR_PRINT_OUT_DEBUG(spoolss_5b, r);
7132         }
7133
7134         push = ndr_push_init_ctx(r, NULL);
7135         if (push == NULL) {
7136                 talloc_free(r);
7137                 return false;
7138         }
7139
7140         ndr_err = call->ndr_push(push, NDR_OUT, r);
7141         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7142                 talloc_free(r);
7143                 return false;
7144         }
7145
7146         blob = ndr_push_blob(push);
7147         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7148                 talloc_free(r);
7149                 return false;
7150         }
7151
7152         talloc_free(r);
7153
7154         return true;
7155 }
7156
7157 static bool api_spoolss_5c(pipes_struct *p)
7158 {
7159         const struct ndr_interface_call *call;
7160         struct ndr_pull *pull;
7161         struct ndr_push *push;
7162         enum ndr_err_code ndr_err;
7163         DATA_BLOB blob;
7164         struct spoolss_5c *r;
7165
7166         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5C];
7167
7168         r = talloc(talloc_tos(), struct spoolss_5c);
7169         if (r == NULL) {
7170                 return false;
7171         }
7172
7173         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7174                 talloc_free(r);
7175                 return false;
7176         }
7177
7178         pull = ndr_pull_init_blob(&blob, r, NULL);
7179         if (pull == NULL) {
7180                 talloc_free(r);
7181                 return false;
7182         }
7183
7184         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7185         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7186         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7187                 talloc_free(r);
7188                 return false;
7189         }
7190
7191         if (DEBUGLEVEL >= 10) {
7192                 NDR_PRINT_IN_DEBUG(spoolss_5c, r);
7193         }
7194
7195         r->out.result = _spoolss_5c(p, r);
7196
7197         if (p->rng_fault_state) {
7198                 talloc_free(r);
7199                 /* Return true here, srv_pipe_hnd.c will take care */
7200                 return true;
7201         }
7202
7203         if (DEBUGLEVEL >= 10) {
7204                 NDR_PRINT_OUT_DEBUG(spoolss_5c, r);
7205         }
7206
7207         push = ndr_push_init_ctx(r, NULL);
7208         if (push == NULL) {
7209                 talloc_free(r);
7210                 return false;
7211         }
7212
7213         ndr_err = call->ndr_push(push, NDR_OUT, r);
7214         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7215                 talloc_free(r);
7216                 return false;
7217         }
7218
7219         blob = ndr_push_blob(push);
7220         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7221                 talloc_free(r);
7222                 return false;
7223         }
7224
7225         talloc_free(r);
7226
7227         return true;
7228 }
7229
7230 static bool api_spoolss_5d(pipes_struct *p)
7231 {
7232         const struct ndr_interface_call *call;
7233         struct ndr_pull *pull;
7234         struct ndr_push *push;
7235         enum ndr_err_code ndr_err;
7236         DATA_BLOB blob;
7237         struct spoolss_5d *r;
7238
7239         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5D];
7240
7241         r = talloc(talloc_tos(), struct spoolss_5d);
7242         if (r == NULL) {
7243                 return false;
7244         }
7245
7246         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7247                 talloc_free(r);
7248                 return false;
7249         }
7250
7251         pull = ndr_pull_init_blob(&blob, r, NULL);
7252         if (pull == NULL) {
7253                 talloc_free(r);
7254                 return false;
7255         }
7256
7257         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7258         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7259         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7260                 talloc_free(r);
7261                 return false;
7262         }
7263
7264         if (DEBUGLEVEL >= 10) {
7265                 NDR_PRINT_IN_DEBUG(spoolss_5d, r);
7266         }
7267
7268         r->out.result = _spoolss_5d(p, r);
7269
7270         if (p->rng_fault_state) {
7271                 talloc_free(r);
7272                 /* Return true here, srv_pipe_hnd.c will take care */
7273                 return true;
7274         }
7275
7276         if (DEBUGLEVEL >= 10) {
7277                 NDR_PRINT_OUT_DEBUG(spoolss_5d, r);
7278         }
7279
7280         push = ndr_push_init_ctx(r, NULL);
7281         if (push == NULL) {
7282                 talloc_free(r);
7283                 return false;
7284         }
7285
7286         ndr_err = call->ndr_push(push, NDR_OUT, r);
7287         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7288                 talloc_free(r);
7289                 return false;
7290         }
7291
7292         blob = ndr_push_blob(push);
7293         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7294                 talloc_free(r);
7295                 return false;
7296         }
7297
7298         talloc_free(r);
7299
7300         return true;
7301 }
7302
7303 static bool api_spoolss_5e(pipes_struct *p)
7304 {
7305         const struct ndr_interface_call *call;
7306         struct ndr_pull *pull;
7307         struct ndr_push *push;
7308         enum ndr_err_code ndr_err;
7309         DATA_BLOB blob;
7310         struct spoolss_5e *r;
7311
7312         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5E];
7313
7314         r = talloc(talloc_tos(), struct spoolss_5e);
7315         if (r == NULL) {
7316                 return false;
7317         }
7318
7319         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7320                 talloc_free(r);
7321                 return false;
7322         }
7323
7324         pull = ndr_pull_init_blob(&blob, r, NULL);
7325         if (pull == NULL) {
7326                 talloc_free(r);
7327                 return false;
7328         }
7329
7330         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7331         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7332         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7333                 talloc_free(r);
7334                 return false;
7335         }
7336
7337         if (DEBUGLEVEL >= 10) {
7338                 NDR_PRINT_IN_DEBUG(spoolss_5e, r);
7339         }
7340
7341         r->out.result = _spoolss_5e(p, r);
7342
7343         if (p->rng_fault_state) {
7344                 talloc_free(r);
7345                 /* Return true here, srv_pipe_hnd.c will take care */
7346                 return true;
7347         }
7348
7349         if (DEBUGLEVEL >= 10) {
7350                 NDR_PRINT_OUT_DEBUG(spoolss_5e, r);
7351         }
7352
7353         push = ndr_push_init_ctx(r, NULL);
7354         if (push == NULL) {
7355                 talloc_free(r);
7356                 return false;
7357         }
7358
7359         ndr_err = call->ndr_push(push, NDR_OUT, r);
7360         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7361                 talloc_free(r);
7362                 return false;
7363         }
7364
7365         blob = ndr_push_blob(push);
7366         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7367                 talloc_free(r);
7368                 return false;
7369         }
7370
7371         talloc_free(r);
7372
7373         return true;
7374 }
7375
7376 static bool api_spoolss_5f(pipes_struct *p)
7377 {
7378         const struct ndr_interface_call *call;
7379         struct ndr_pull *pull;
7380         struct ndr_push *push;
7381         enum ndr_err_code ndr_err;
7382         DATA_BLOB blob;
7383         struct spoolss_5f *r;
7384
7385         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5F];
7386
7387         r = talloc(talloc_tos(), struct spoolss_5f);
7388         if (r == NULL) {
7389                 return false;
7390         }
7391
7392         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7393                 talloc_free(r);
7394                 return false;
7395         }
7396
7397         pull = ndr_pull_init_blob(&blob, r, NULL);
7398         if (pull == NULL) {
7399                 talloc_free(r);
7400                 return false;
7401         }
7402
7403         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7404         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7405         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7406                 talloc_free(r);
7407                 return false;
7408         }
7409
7410         if (DEBUGLEVEL >= 10) {
7411                 NDR_PRINT_IN_DEBUG(spoolss_5f, r);
7412         }
7413
7414         r->out.result = _spoolss_5f(p, r);
7415
7416         if (p->rng_fault_state) {
7417                 talloc_free(r);
7418                 /* Return true here, srv_pipe_hnd.c will take care */
7419                 return true;
7420         }
7421
7422         if (DEBUGLEVEL >= 10) {
7423                 NDR_PRINT_OUT_DEBUG(spoolss_5f, r);
7424         }
7425
7426         push = ndr_push_init_ctx(r, NULL);
7427         if (push == NULL) {
7428                 talloc_free(r);
7429                 return false;
7430         }
7431
7432         ndr_err = call->ndr_push(push, NDR_OUT, r);
7433         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7434                 talloc_free(r);
7435                 return false;
7436         }
7437
7438         blob = ndr_push_blob(push);
7439         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7440                 talloc_free(r);
7441                 return false;
7442         }
7443
7444         talloc_free(r);
7445
7446         return true;
7447 }
7448
7449
7450 /* Tables */
7451 static struct api_struct api_spoolss_cmds[] = 
7452 {
7453         {"SPOOLSS_ENUMPRINTERS", NDR_SPOOLSS_ENUMPRINTERS, api_spoolss_EnumPrinters},
7454         {"SPOOLSS_OPENPRINTER", NDR_SPOOLSS_OPENPRINTER, api_spoolss_OpenPrinter},
7455         {"SPOOLSS_SETJOB", NDR_SPOOLSS_SETJOB, api_spoolss_SetJob},
7456         {"SPOOLSS_GETJOB", NDR_SPOOLSS_GETJOB, api_spoolss_GetJob},
7457         {"SPOOLSS_ENUMJOBS", NDR_SPOOLSS_ENUMJOBS, api_spoolss_EnumJobs},
7458         {"SPOOLSS_ADDPRINTER", NDR_SPOOLSS_ADDPRINTER, api_spoolss_AddPrinter},
7459         {"SPOOLSS_DELETEPRINTER", NDR_SPOOLSS_DELETEPRINTER, api_spoolss_DeletePrinter},
7460         {"SPOOLSS_SETPRINTER", NDR_SPOOLSS_SETPRINTER, api_spoolss_SetPrinter},
7461         {"SPOOLSS_GETPRINTER", NDR_SPOOLSS_GETPRINTER, api_spoolss_GetPrinter},
7462         {"SPOOLSS_ADDPRINTERDRIVER", NDR_SPOOLSS_ADDPRINTERDRIVER, api_spoolss_AddPrinterDriver},
7463         {"SPOOLSS_ENUMPRINTERDRIVERS", NDR_SPOOLSS_ENUMPRINTERDRIVERS, api_spoolss_EnumPrinterDrivers},
7464         {"SPOOLSS_GETPRINTERDRIVER", NDR_SPOOLSS_GETPRINTERDRIVER, api_spoolss_GetPrinterDriver},
7465         {"SPOOLSS_GETPRINTERDRIVERDIRECTORY", NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY, api_spoolss_GetPrinterDriverDirectory},
7466         {"SPOOLSS_DELETEPRINTERDRIVER", NDR_SPOOLSS_DELETEPRINTERDRIVER, api_spoolss_DeletePrinterDriver},
7467         {"SPOOLSS_ADDPRINTPROCESSOR", NDR_SPOOLSS_ADDPRINTPROCESSOR, api_spoolss_AddPrintProcessor},
7468         {"SPOOLSS_ENUMPRINTPROCESSORS", NDR_SPOOLSS_ENUMPRINTPROCESSORS, api_spoolss_EnumPrintProcessors},
7469         {"SPOOLSS_GETPRINTPROCESSORDIRECTORY", NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY, api_spoolss_GetPrintProcessorDirectory},
7470         {"SPOOLSS_STARTDOCPRINTER", NDR_SPOOLSS_STARTDOCPRINTER, api_spoolss_StartDocPrinter},
7471         {"SPOOLSS_STARTPAGEPRINTER", NDR_SPOOLSS_STARTPAGEPRINTER, api_spoolss_StartPagePrinter},
7472         {"SPOOLSS_WRITEPRINTER", NDR_SPOOLSS_WRITEPRINTER, api_spoolss_WritePrinter},
7473         {"SPOOLSS_ENDPAGEPRINTER", NDR_SPOOLSS_ENDPAGEPRINTER, api_spoolss_EndPagePrinter},
7474         {"SPOOLSS_ABORTPRINTER", NDR_SPOOLSS_ABORTPRINTER, api_spoolss_AbortPrinter},
7475         {"SPOOLSS_READPRINTER", NDR_SPOOLSS_READPRINTER, api_spoolss_ReadPrinter},
7476         {"SPOOLSS_ENDDOCPRINTER", NDR_SPOOLSS_ENDDOCPRINTER, api_spoolss_EndDocPrinter},
7477         {"SPOOLSS_ADDJOB", NDR_SPOOLSS_ADDJOB, api_spoolss_AddJob},
7478         {"SPOOLSS_SCHEDULEJOB", NDR_SPOOLSS_SCHEDULEJOB, api_spoolss_ScheduleJob},
7479         {"SPOOLSS_GETPRINTERDATA", NDR_SPOOLSS_GETPRINTERDATA, api_spoolss_GetPrinterData},
7480         {"SPOOLSS_SETPRINTERDATA", NDR_SPOOLSS_SETPRINTERDATA, api_spoolss_SetPrinterData},
7481         {"SPOOLSS_WAITFORPRINTERCHANGE", NDR_SPOOLSS_WAITFORPRINTERCHANGE, api_spoolss_WaitForPrinterChange},
7482         {"SPOOLSS_CLOSEPRINTER", NDR_SPOOLSS_CLOSEPRINTER, api_spoolss_ClosePrinter},
7483         {"SPOOLSS_ADDFORM", NDR_SPOOLSS_ADDFORM, api_spoolss_AddForm},
7484         {"SPOOLSS_DELETEFORM", NDR_SPOOLSS_DELETEFORM, api_spoolss_DeleteForm},
7485         {"SPOOLSS_GETFORM", NDR_SPOOLSS_GETFORM, api_spoolss_GetForm},
7486         {"SPOOLSS_SETFORM", NDR_SPOOLSS_SETFORM, api_spoolss_SetForm},
7487         {"SPOOLSS_ENUMFORMS", NDR_SPOOLSS_ENUMFORMS, api_spoolss_EnumForms},
7488         {"SPOOLSS_ENUMPORTS", NDR_SPOOLSS_ENUMPORTS, api_spoolss_EnumPorts},
7489         {"SPOOLSS_ENUMMONITORS", NDR_SPOOLSS_ENUMMONITORS, api_spoolss_EnumMonitors},
7490         {"SPOOLSS_ADDPORT", NDR_SPOOLSS_ADDPORT, api_spoolss_AddPort},
7491         {"SPOOLSS_CONFIGUREPORT", NDR_SPOOLSS_CONFIGUREPORT, api_spoolss_ConfigurePort},
7492         {"SPOOLSS_DELETEPORT", NDR_SPOOLSS_DELETEPORT, api_spoolss_DeletePort},
7493         {"SPOOLSS_CREATEPRINTERIC", NDR_SPOOLSS_CREATEPRINTERIC, api_spoolss_CreatePrinterIC},
7494         {"SPOOLSS_PLAYGDISCRIPTONPRINTERIC", NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC, api_spoolss_PlayGDIScriptOnPrinterIC},
7495         {"SPOOLSS_DELETEPRINTERIC", NDR_SPOOLSS_DELETEPRINTERIC, api_spoolss_DeletePrinterIC},
7496         {"SPOOLSS_ADDPRINTERCONNECTION", NDR_SPOOLSS_ADDPRINTERCONNECTION, api_spoolss_AddPrinterConnection},
7497         {"SPOOLSS_DELETEPRINTERCONNECTION", NDR_SPOOLSS_DELETEPRINTERCONNECTION, api_spoolss_DeletePrinterConnection},
7498         {"SPOOLSS_PRINTERMESSAGEBOX", NDR_SPOOLSS_PRINTERMESSAGEBOX, api_spoolss_PrinterMessageBox},
7499         {"SPOOLSS_ADDMONITOR", NDR_SPOOLSS_ADDMONITOR, api_spoolss_AddMonitor},
7500         {"SPOOLSS_DELETEMONITOR", NDR_SPOOLSS_DELETEMONITOR, api_spoolss_DeleteMonitor},
7501         {"SPOOLSS_DELETEPRINTPROCESSOR", NDR_SPOOLSS_DELETEPRINTPROCESSOR, api_spoolss_DeletePrintProcessor},
7502         {"SPOOLSS_ADDPRINTPROVIDOR", NDR_SPOOLSS_ADDPRINTPROVIDOR, api_spoolss_AddPrintProvidor},
7503         {"SPOOLSS_DELETEPRINTPROVIDOR", NDR_SPOOLSS_DELETEPRINTPROVIDOR, api_spoolss_DeletePrintProvidor},
7504         {"SPOOLSS_ENUMPRINTPROCDATATYPES", NDR_SPOOLSS_ENUMPRINTPROCDATATYPES, api_spoolss_EnumPrintProcDataTypes},
7505         {"SPOOLSS_RESETPRINTER", NDR_SPOOLSS_RESETPRINTER, api_spoolss_ResetPrinter},
7506         {"SPOOLSS_GETPRINTERDRIVER2", NDR_SPOOLSS_GETPRINTERDRIVER2, api_spoolss_GetPrinterDriver2},
7507         {"SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION, api_spoolss_FindFirstPrinterChangeNotification},
7508         {"SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION, api_spoolss_FindNextPrinterChangeNotification},
7509         {"SPOOLSS_FINDCLOSEPRINTERNOTIFY", NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY, api_spoolss_FindClosePrinterNotify},
7510         {"SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD", NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD, api_spoolss_RouterFindFirstPrinterChangeNotificationOld},
7511         {"SPOOLSS_REPLYOPENPRINTER", NDR_SPOOLSS_REPLYOPENPRINTER, api_spoolss_ReplyOpenPrinter},
7512         {"SPOOLSS_ROUTERREPLYPRINTER", NDR_SPOOLSS_ROUTERREPLYPRINTER, api_spoolss_RouterReplyPrinter},
7513         {"SPOOLSS_REPLYCLOSEPRINTER", NDR_SPOOLSS_REPLYCLOSEPRINTER, api_spoolss_ReplyClosePrinter},
7514         {"SPOOLSS_ADDPORTEX", NDR_SPOOLSS_ADDPORTEX, api_spoolss_AddPortEx},
7515         {"SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION, api_spoolss_RouterFindFirstPrinterChangeNotification},
7516         {"SPOOLSS_SPOOLERINIT", NDR_SPOOLSS_SPOOLERINIT, api_spoolss_SpoolerInit},
7517         {"SPOOLSS_RESETPRINTEREX", NDR_SPOOLSS_RESETPRINTEREX, api_spoolss_ResetPrinterEx},
7518         {"SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX", NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX, api_spoolss_RemoteFindFirstPrinterChangeNotifyEx},
7519         {"SPOOLSS_ROUTERREPLYPRINTEREX", NDR_SPOOLSS_ROUTERREPLYPRINTEREX, api_spoolss_RouterReplyPrinterEx},
7520         {"SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY", NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY, api_spoolss_RouterRefreshPrinterChangeNotify},
7521         {"SPOOLSS_44", NDR_SPOOLSS_44, api_spoolss_44},
7522         {"SPOOLSS_OPENPRINTEREX", NDR_SPOOLSS_OPENPRINTEREX, api_spoolss_OpenPrinterEx},
7523         {"SPOOLSS_ADDPRINTEREX", NDR_SPOOLSS_ADDPRINTEREX, api_spoolss_AddPrinterEx},
7524         {"SPOOLSS_47", NDR_SPOOLSS_47, api_spoolss_47},
7525         {"SPOOLSS_ENUMPRINTERDATA", NDR_SPOOLSS_ENUMPRINTERDATA, api_spoolss_EnumPrinterData},
7526         {"SPOOLSS_DELETEPRINTERDATA", NDR_SPOOLSS_DELETEPRINTERDATA, api_spoolss_DeletePrinterData},
7527         {"SPOOLSS_4A", NDR_SPOOLSS_4A, api_spoolss_4a},
7528         {"SPOOLSS_4B", NDR_SPOOLSS_4B, api_spoolss_4b},
7529         {"SPOOLSS_4C", NDR_SPOOLSS_4C, api_spoolss_4c},
7530         {"SPOOLSS_SETPRINTERDATAEX", NDR_SPOOLSS_SETPRINTERDATAEX, api_spoolss_SetPrinterDataEx},
7531         {"SPOOLSS_GETPRINTERDATAEX", NDR_SPOOLSS_GETPRINTERDATAEX, api_spoolss_GetPrinterDataEx},
7532         {"SPOOLSS_ENUMPRINTERDATAEX", NDR_SPOOLSS_ENUMPRINTERDATAEX, api_spoolss_EnumPrinterDataEx},
7533         {"SPOOLSS_ENUMPRINTERKEY", NDR_SPOOLSS_ENUMPRINTERKEY, api_spoolss_EnumPrinterKey},
7534         {"SPOOLSS_DELETEPRINTERDATAEX", NDR_SPOOLSS_DELETEPRINTERDATAEX, api_spoolss_DeletePrinterDataEx},
7535         {"SPOOLSS_DELETEPRINTERKEY", NDR_SPOOLSS_DELETEPRINTERKEY, api_spoolss_DeletePrinterKey},
7536         {"SPOOLSS_53", NDR_SPOOLSS_53, api_spoolss_53},
7537         {"SPOOLSS_DELETEPRINTERDRIVEREX", NDR_SPOOLSS_DELETEPRINTERDRIVEREX, api_spoolss_DeletePrinterDriverEx},
7538         {"SPOOLSS_55", NDR_SPOOLSS_55, api_spoolss_55},
7539         {"SPOOLSS_56", NDR_SPOOLSS_56, api_spoolss_56},
7540         {"SPOOLSS_57", NDR_SPOOLSS_57, api_spoolss_57},
7541         {"SPOOLSS_XCVDATA", NDR_SPOOLSS_XCVDATA, api_spoolss_XcvData},
7542         {"SPOOLSS_ADDPRINTERDRIVEREX", NDR_SPOOLSS_ADDPRINTERDRIVEREX, api_spoolss_AddPrinterDriverEx},
7543         {"SPOOLSS_5A", NDR_SPOOLSS_5A, api_spoolss_5a},
7544         {"SPOOLSS_5B", NDR_SPOOLSS_5B, api_spoolss_5b},
7545         {"SPOOLSS_5C", NDR_SPOOLSS_5C, api_spoolss_5c},
7546         {"SPOOLSS_5D", NDR_SPOOLSS_5D, api_spoolss_5d},
7547         {"SPOOLSS_5E", NDR_SPOOLSS_5E, api_spoolss_5e},
7548         {"SPOOLSS_5F", NDR_SPOOLSS_5F, api_spoolss_5f},
7549 };
7550
7551 void spoolss_get_pipe_fns(struct api_struct **fns, int *n_fns)
7552 {
7553         *fns = api_spoolss_cmds;
7554         *n_fns = sizeof(api_spoolss_cmds) / sizeof(struct api_struct);
7555 }
7556
7557 NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
7558 {
7559         if (cli->pipes_struct == NULL) {
7560                 return NT_STATUS_INVALID_PARAMETER;
7561         }
7562
7563         switch (opnum)
7564         {
7565                 case NDR_SPOOLSS_ENUMPRINTERS: {
7566                         struct spoolss_EnumPrinters *r = (struct spoolss_EnumPrinters *)_r;
7567                         ZERO_STRUCT(r->out);
7568                         r->out.count = talloc_zero(mem_ctx, uint32_t);
7569                         if (r->out.count == NULL) {
7570                         return NT_STATUS_NO_MEMORY;
7571                         }
7572
7573                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrinterInfo *);
7574                         if (r->out.info == NULL) {
7575                         return NT_STATUS_NO_MEMORY;
7576                         }
7577
7578                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7579                         if (r->out.needed == NULL) {
7580                         return NT_STATUS_NO_MEMORY;
7581                         }
7582
7583                         r->out.result = _spoolss_EnumPrinters(cli->pipes_struct, r);
7584                         return NT_STATUS_OK;
7585                 }
7586
7587                 case NDR_SPOOLSS_OPENPRINTER: {
7588                         struct spoolss_OpenPrinter *r = (struct spoolss_OpenPrinter *)_r;
7589                         ZERO_STRUCT(r->out);
7590                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
7591                         if (r->out.handle == NULL) {
7592                         return NT_STATUS_NO_MEMORY;
7593                         }
7594
7595                         r->out.result = _spoolss_OpenPrinter(cli->pipes_struct, r);
7596                         return NT_STATUS_OK;
7597                 }
7598
7599                 case NDR_SPOOLSS_SETJOB: {
7600                         struct spoolss_SetJob *r = (struct spoolss_SetJob *)_r;
7601                         r->out.result = _spoolss_SetJob(cli->pipes_struct, r);
7602                         return NT_STATUS_OK;
7603                 }
7604
7605                 case NDR_SPOOLSS_GETJOB: {
7606                         struct spoolss_GetJob *r = (struct spoolss_GetJob *)_r;
7607                         ZERO_STRUCT(r->out);
7608                         r->out.info = talloc_zero(mem_ctx, union spoolss_JobInfo);
7609                         if (r->out.info == NULL) {
7610                         return NT_STATUS_NO_MEMORY;
7611                         }
7612
7613                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7614                         if (r->out.needed == NULL) {
7615                         return NT_STATUS_NO_MEMORY;
7616                         }
7617
7618                         r->out.result = _spoolss_GetJob(cli->pipes_struct, r);
7619                         return NT_STATUS_OK;
7620                 }
7621
7622                 case NDR_SPOOLSS_ENUMJOBS: {
7623                         struct spoolss_EnumJobs *r = (struct spoolss_EnumJobs *)_r;
7624                         ZERO_STRUCT(r->out);
7625                         r->out.count = talloc_zero(mem_ctx, uint32_t);
7626                         if (r->out.count == NULL) {
7627                         return NT_STATUS_NO_MEMORY;
7628                         }
7629
7630                         r->out.info = talloc_zero(mem_ctx, union spoolss_JobInfo *);
7631                         if (r->out.info == NULL) {
7632                         return NT_STATUS_NO_MEMORY;
7633                         }
7634
7635                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7636                         if (r->out.needed == NULL) {
7637                         return NT_STATUS_NO_MEMORY;
7638                         }
7639
7640                         r->out.result = _spoolss_EnumJobs(cli->pipes_struct, r);
7641                         return NT_STATUS_OK;
7642                 }
7643
7644                 case NDR_SPOOLSS_ADDPRINTER: {
7645                         struct spoolss_AddPrinter *r = (struct spoolss_AddPrinter *)_r;
7646                         r->out.result = _spoolss_AddPrinter(cli->pipes_struct, r);
7647                         return NT_STATUS_OK;
7648                 }
7649
7650                 case NDR_SPOOLSS_DELETEPRINTER: {
7651                         struct spoolss_DeletePrinter *r = (struct spoolss_DeletePrinter *)_r;
7652                         r->out.result = _spoolss_DeletePrinter(cli->pipes_struct, r);
7653                         return NT_STATUS_OK;
7654                 }
7655
7656                 case NDR_SPOOLSS_SETPRINTER: {
7657                         struct spoolss_SetPrinter *r = (struct spoolss_SetPrinter *)_r;
7658                         r->out.result = _spoolss_SetPrinter(cli->pipes_struct, r);
7659                         return NT_STATUS_OK;
7660                 }
7661
7662                 case NDR_SPOOLSS_GETPRINTER: {
7663                         struct spoolss_GetPrinter *r = (struct spoolss_GetPrinter *)_r;
7664                         ZERO_STRUCT(r->out);
7665                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrinterInfo);
7666                         if (r->out.info == NULL) {
7667                         return NT_STATUS_NO_MEMORY;
7668                         }
7669
7670                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7671                         if (r->out.needed == NULL) {
7672                         return NT_STATUS_NO_MEMORY;
7673                         }
7674
7675                         r->out.result = _spoolss_GetPrinter(cli->pipes_struct, r);
7676                         return NT_STATUS_OK;
7677                 }
7678
7679                 case NDR_SPOOLSS_ADDPRINTERDRIVER: {
7680                         struct spoolss_AddPrinterDriver *r = (struct spoolss_AddPrinterDriver *)_r;
7681                         r->out.result = _spoolss_AddPrinterDriver(cli->pipes_struct, r);
7682                         return NT_STATUS_OK;
7683                 }
7684
7685                 case NDR_SPOOLSS_ENUMPRINTERDRIVERS: {
7686                         struct spoolss_EnumPrinterDrivers *r = (struct spoolss_EnumPrinterDrivers *)_r;
7687                         ZERO_STRUCT(r->out);
7688                         r->out.count = talloc_zero(mem_ctx, uint32_t);
7689                         if (r->out.count == NULL) {
7690                         return NT_STATUS_NO_MEMORY;
7691                         }
7692
7693                         r->out.info = talloc_zero(mem_ctx, union spoolss_DriverInfo *);
7694                         if (r->out.info == NULL) {
7695                         return NT_STATUS_NO_MEMORY;
7696                         }
7697
7698                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7699                         if (r->out.needed == NULL) {
7700                         return NT_STATUS_NO_MEMORY;
7701                         }
7702
7703                         r->out.result = _spoolss_EnumPrinterDrivers(cli->pipes_struct, r);
7704                         return NT_STATUS_OK;
7705                 }
7706
7707                 case NDR_SPOOLSS_GETPRINTERDRIVER: {
7708                         struct spoolss_GetPrinterDriver *r = (struct spoolss_GetPrinterDriver *)_r;
7709                         r->out.result = _spoolss_GetPrinterDriver(cli->pipes_struct, r);
7710                         return NT_STATUS_OK;
7711                 }
7712
7713                 case NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY: {
7714                         struct spoolss_GetPrinterDriverDirectory *r = (struct spoolss_GetPrinterDriverDirectory *)_r;
7715                         ZERO_STRUCT(r->out);
7716                         r->out.info = talloc_zero(mem_ctx, union spoolss_DriverDirectoryInfo);
7717                         if (r->out.info == NULL) {
7718                         return NT_STATUS_NO_MEMORY;
7719                         }
7720
7721                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7722                         if (r->out.needed == NULL) {
7723                         return NT_STATUS_NO_MEMORY;
7724                         }
7725
7726                         r->out.result = _spoolss_GetPrinterDriverDirectory(cli->pipes_struct, r);
7727                         return NT_STATUS_OK;
7728                 }
7729
7730                 case NDR_SPOOLSS_DELETEPRINTERDRIVER: {
7731                         struct spoolss_DeletePrinterDriver *r = (struct spoolss_DeletePrinterDriver *)_r;
7732                         r->out.result = _spoolss_DeletePrinterDriver(cli->pipes_struct, r);
7733                         return NT_STATUS_OK;
7734                 }
7735
7736                 case NDR_SPOOLSS_ADDPRINTPROCESSOR: {
7737                         struct spoolss_AddPrintProcessor *r = (struct spoolss_AddPrintProcessor *)_r;
7738                         r->out.result = _spoolss_AddPrintProcessor(cli->pipes_struct, r);
7739                         return NT_STATUS_OK;
7740                 }
7741
7742                 case NDR_SPOOLSS_ENUMPRINTPROCESSORS: {
7743                         struct spoolss_EnumPrintProcessors *r = (struct spoolss_EnumPrintProcessors *)_r;
7744                         ZERO_STRUCT(r->out);
7745                         r->out.count = talloc_zero(mem_ctx, uint32_t);
7746                         if (r->out.count == NULL) {
7747                         return NT_STATUS_NO_MEMORY;
7748                         }
7749
7750                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrintProcessorInfo *);
7751                         if (r->out.info == NULL) {
7752                         return NT_STATUS_NO_MEMORY;
7753                         }
7754
7755                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7756                         if (r->out.needed == NULL) {
7757                         return NT_STATUS_NO_MEMORY;
7758                         }
7759
7760                         r->out.result = _spoolss_EnumPrintProcessors(cli->pipes_struct, r);
7761                         return NT_STATUS_OK;
7762                 }
7763
7764                 case NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY: {
7765                         struct spoolss_GetPrintProcessorDirectory *r = (struct spoolss_GetPrintProcessorDirectory *)_r;
7766                         ZERO_STRUCT(r->out);
7767                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrintProcessorDirectoryInfo);
7768                         if (r->out.info == NULL) {
7769                         return NT_STATUS_NO_MEMORY;
7770                         }
7771
7772                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7773                         if (r->out.needed == NULL) {
7774                         return NT_STATUS_NO_MEMORY;
7775                         }
7776
7777                         r->out.result = _spoolss_GetPrintProcessorDirectory(cli->pipes_struct, r);
7778                         return NT_STATUS_OK;
7779                 }
7780
7781                 case NDR_SPOOLSS_STARTDOCPRINTER: {
7782                         struct spoolss_StartDocPrinter *r = (struct spoolss_StartDocPrinter *)_r;
7783                         ZERO_STRUCT(r->out);
7784                         r->out.job_id = talloc_zero(mem_ctx, uint32_t);
7785                         if (r->out.job_id == NULL) {
7786                         return NT_STATUS_NO_MEMORY;
7787                         }
7788
7789                         r->out.result = _spoolss_StartDocPrinter(cli->pipes_struct, r);
7790                         return NT_STATUS_OK;
7791                 }
7792
7793                 case NDR_SPOOLSS_STARTPAGEPRINTER: {
7794                         struct spoolss_StartPagePrinter *r = (struct spoolss_StartPagePrinter *)_r;
7795                         r->out.result = _spoolss_StartPagePrinter(cli->pipes_struct, r);
7796                         return NT_STATUS_OK;
7797                 }
7798
7799                 case NDR_SPOOLSS_WRITEPRINTER: {
7800                         struct spoolss_WritePrinter *r = (struct spoolss_WritePrinter *)_r;
7801                         ZERO_STRUCT(r->out);
7802                         r->out.num_written = talloc_zero(mem_ctx, uint32_t);
7803                         if (r->out.num_written == NULL) {
7804                         return NT_STATUS_NO_MEMORY;
7805                         }
7806
7807                         r->out.result = _spoolss_WritePrinter(cli->pipes_struct, r);
7808                         return NT_STATUS_OK;
7809                 }
7810
7811                 case NDR_SPOOLSS_ENDPAGEPRINTER: {
7812                         struct spoolss_EndPagePrinter *r = (struct spoolss_EndPagePrinter *)_r;
7813                         r->out.result = _spoolss_EndPagePrinter(cli->pipes_struct, r);
7814                         return NT_STATUS_OK;
7815                 }
7816
7817                 case NDR_SPOOLSS_ABORTPRINTER: {
7818                         struct spoolss_AbortPrinter *r = (struct spoolss_AbortPrinter *)_r;
7819                         r->out.result = _spoolss_AbortPrinter(cli->pipes_struct, r);
7820                         return NT_STATUS_OK;
7821                 }
7822
7823                 case NDR_SPOOLSS_READPRINTER: {
7824                         struct spoolss_ReadPrinter *r = (struct spoolss_ReadPrinter *)_r;
7825                         ZERO_STRUCT(r->out);
7826                         r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.data_size);
7827                         if (r->out.data == NULL) {
7828                         return NT_STATUS_NO_MEMORY;
7829                         }
7830
7831                         r->out._data_size = talloc_zero(mem_ctx, uint32_t);
7832                         if (r->out._data_size == NULL) {
7833                         return NT_STATUS_NO_MEMORY;
7834                         }
7835
7836                         r->out.result = _spoolss_ReadPrinter(cli->pipes_struct, r);
7837                         return NT_STATUS_OK;
7838                 }
7839
7840                 case NDR_SPOOLSS_ENDDOCPRINTER: {
7841                         struct spoolss_EndDocPrinter *r = (struct spoolss_EndDocPrinter *)_r;
7842                         r->out.result = _spoolss_EndDocPrinter(cli->pipes_struct, r);
7843                         return NT_STATUS_OK;
7844                 }
7845
7846                 case NDR_SPOOLSS_ADDJOB: {
7847                         struct spoolss_AddJob *r = (struct spoolss_AddJob *)_r;
7848                         ZERO_STRUCT(r->out);
7849                         r->out.buffer = r->in.buffer;
7850                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7851                         if (r->out.needed == NULL) {
7852                         return NT_STATUS_NO_MEMORY;
7853                         }
7854
7855                         r->out.result = _spoolss_AddJob(cli->pipes_struct, r);
7856                         return NT_STATUS_OK;
7857                 }
7858
7859                 case NDR_SPOOLSS_SCHEDULEJOB: {
7860                         struct spoolss_ScheduleJob *r = (struct spoolss_ScheduleJob *)_r;
7861                         r->out.result = _spoolss_ScheduleJob(cli->pipes_struct, r);
7862                         return NT_STATUS_OK;
7863                 }
7864
7865                 case NDR_SPOOLSS_GETPRINTERDATA: {
7866                         struct spoolss_GetPrinterData *r = (struct spoolss_GetPrinterData *)_r;
7867                         ZERO_STRUCT(r->out);
7868                         r->out.type = talloc_zero(mem_ctx, enum spoolss_PrinterDataType);
7869                         if (r->out.type == NULL) {
7870                         return NT_STATUS_NO_MEMORY;
7871                         }
7872
7873                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7874                         if (r->out.needed == NULL) {
7875                         return NT_STATUS_NO_MEMORY;
7876                         }
7877
7878                         r->out.result = _spoolss_GetPrinterData(cli->pipes_struct, r);
7879                         return NT_STATUS_OK;
7880                 }
7881
7882                 case NDR_SPOOLSS_SETPRINTERDATA: {
7883                         struct spoolss_SetPrinterData *r = (struct spoolss_SetPrinterData *)_r;
7884                         r->out.result = _spoolss_SetPrinterData(cli->pipes_struct, r);
7885                         return NT_STATUS_OK;
7886                 }
7887
7888                 case NDR_SPOOLSS_WAITFORPRINTERCHANGE: {
7889                         struct spoolss_WaitForPrinterChange *r = (struct spoolss_WaitForPrinterChange *)_r;
7890                         r->out.result = _spoolss_WaitForPrinterChange(cli->pipes_struct, r);
7891                         return NT_STATUS_OK;
7892                 }
7893
7894                 case NDR_SPOOLSS_CLOSEPRINTER: {
7895                         struct spoolss_ClosePrinter *r = (struct spoolss_ClosePrinter *)_r;
7896                         ZERO_STRUCT(r->out);
7897                         r->out.handle = r->in.handle;
7898                         r->out.result = _spoolss_ClosePrinter(cli->pipes_struct, r);
7899                         return NT_STATUS_OK;
7900                 }
7901
7902                 case NDR_SPOOLSS_ADDFORM: {
7903                         struct spoolss_AddForm *r = (struct spoolss_AddForm *)_r;
7904                         r->out.result = _spoolss_AddForm(cli->pipes_struct, r);
7905                         return NT_STATUS_OK;
7906                 }
7907
7908                 case NDR_SPOOLSS_DELETEFORM: {
7909                         struct spoolss_DeleteForm *r = (struct spoolss_DeleteForm *)_r;
7910                         r->out.result = _spoolss_DeleteForm(cli->pipes_struct, r);
7911                         return NT_STATUS_OK;
7912                 }
7913
7914                 case NDR_SPOOLSS_GETFORM: {
7915                         struct spoolss_GetForm *r = (struct spoolss_GetForm *)_r;
7916                         ZERO_STRUCT(r->out);
7917                         r->out.info = talloc_zero(mem_ctx, union spoolss_FormInfo);
7918                         if (r->out.info == NULL) {
7919                         return NT_STATUS_NO_MEMORY;
7920                         }
7921
7922                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7923                         if (r->out.needed == NULL) {
7924                         return NT_STATUS_NO_MEMORY;
7925                         }
7926
7927                         r->out.result = _spoolss_GetForm(cli->pipes_struct, r);
7928                         return NT_STATUS_OK;
7929                 }
7930
7931                 case NDR_SPOOLSS_SETFORM: {
7932                         struct spoolss_SetForm *r = (struct spoolss_SetForm *)_r;
7933                         r->out.result = _spoolss_SetForm(cli->pipes_struct, r);
7934                         return NT_STATUS_OK;
7935                 }
7936
7937                 case NDR_SPOOLSS_ENUMFORMS: {
7938                         struct spoolss_EnumForms *r = (struct spoolss_EnumForms *)_r;
7939                         ZERO_STRUCT(r->out);
7940                         r->out.count = talloc_zero(mem_ctx, uint32_t);
7941                         if (r->out.count == NULL) {
7942                         return NT_STATUS_NO_MEMORY;
7943                         }
7944
7945                         r->out.info = talloc_zero(mem_ctx, union spoolss_FormInfo *);
7946                         if (r->out.info == NULL) {
7947                         return NT_STATUS_NO_MEMORY;
7948                         }
7949
7950                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7951                         if (r->out.needed == NULL) {
7952                         return NT_STATUS_NO_MEMORY;
7953                         }
7954
7955                         r->out.result = _spoolss_EnumForms(cli->pipes_struct, r);
7956                         return NT_STATUS_OK;
7957                 }
7958
7959                 case NDR_SPOOLSS_ENUMPORTS: {
7960                         struct spoolss_EnumPorts *r = (struct spoolss_EnumPorts *)_r;
7961                         ZERO_STRUCT(r->out);
7962                         r->out.count = talloc_zero(mem_ctx, uint32_t);
7963                         if (r->out.count == NULL) {
7964                         return NT_STATUS_NO_MEMORY;
7965                         }
7966
7967                         r->out.info = talloc_zero(mem_ctx, union spoolss_PortInfo *);
7968                         if (r->out.info == NULL) {
7969                         return NT_STATUS_NO_MEMORY;
7970                         }
7971
7972                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7973                         if (r->out.needed == NULL) {
7974                         return NT_STATUS_NO_MEMORY;
7975                         }
7976
7977                         r->out.result = _spoolss_EnumPorts(cli->pipes_struct, r);
7978                         return NT_STATUS_OK;
7979                 }
7980
7981                 case NDR_SPOOLSS_ENUMMONITORS: {
7982                         struct spoolss_EnumMonitors *r = (struct spoolss_EnumMonitors *)_r;
7983                         ZERO_STRUCT(r->out);
7984                         r->out.count = talloc_zero(mem_ctx, uint32_t);
7985                         if (r->out.count == NULL) {
7986                         return NT_STATUS_NO_MEMORY;
7987                         }
7988
7989                         r->out.info = talloc_zero(mem_ctx, union spoolss_MonitorInfo *);
7990                         if (r->out.info == NULL) {
7991                         return NT_STATUS_NO_MEMORY;
7992                         }
7993
7994                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7995                         if (r->out.needed == NULL) {
7996                         return NT_STATUS_NO_MEMORY;
7997                         }
7998
7999                         r->out.result = _spoolss_EnumMonitors(cli->pipes_struct, r);
8000                         return NT_STATUS_OK;
8001                 }
8002
8003                 case NDR_SPOOLSS_ADDPORT: {
8004                         struct spoolss_AddPort *r = (struct spoolss_AddPort *)_r;
8005                         r->out.result = _spoolss_AddPort(cli->pipes_struct, r);
8006                         return NT_STATUS_OK;
8007                 }
8008
8009                 case NDR_SPOOLSS_CONFIGUREPORT: {
8010                         struct spoolss_ConfigurePort *r = (struct spoolss_ConfigurePort *)_r;
8011                         r->out.result = _spoolss_ConfigurePort(cli->pipes_struct, r);
8012                         return NT_STATUS_OK;
8013                 }
8014
8015                 case NDR_SPOOLSS_DELETEPORT: {
8016                         struct spoolss_DeletePort *r = (struct spoolss_DeletePort *)_r;
8017                         r->out.result = _spoolss_DeletePort(cli->pipes_struct, r);
8018                         return NT_STATUS_OK;
8019                 }
8020
8021                 case NDR_SPOOLSS_CREATEPRINTERIC: {
8022                         struct spoolss_CreatePrinterIC *r = (struct spoolss_CreatePrinterIC *)_r;
8023                         r->out.result = _spoolss_CreatePrinterIC(cli->pipes_struct, r);
8024                         return NT_STATUS_OK;
8025                 }
8026
8027                 case NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC: {
8028                         struct spoolss_PlayGDIScriptOnPrinterIC *r = (struct spoolss_PlayGDIScriptOnPrinterIC *)_r;
8029                         r->out.result = _spoolss_PlayGDIScriptOnPrinterIC(cli->pipes_struct, r);
8030                         return NT_STATUS_OK;
8031                 }
8032
8033                 case NDR_SPOOLSS_DELETEPRINTERIC: {
8034                         struct spoolss_DeletePrinterIC *r = (struct spoolss_DeletePrinterIC *)_r;
8035                         r->out.result = _spoolss_DeletePrinterIC(cli->pipes_struct, r);
8036                         return NT_STATUS_OK;
8037                 }
8038
8039                 case NDR_SPOOLSS_ADDPRINTERCONNECTION: {
8040                         struct spoolss_AddPrinterConnection *r = (struct spoolss_AddPrinterConnection *)_r;
8041                         r->out.result = _spoolss_AddPrinterConnection(cli->pipes_struct, r);
8042                         return NT_STATUS_OK;
8043                 }
8044
8045                 case NDR_SPOOLSS_DELETEPRINTERCONNECTION: {
8046                         struct spoolss_DeletePrinterConnection *r = (struct spoolss_DeletePrinterConnection *)_r;
8047                         r->out.result = _spoolss_DeletePrinterConnection(cli->pipes_struct, r);
8048                         return NT_STATUS_OK;
8049                 }
8050
8051                 case NDR_SPOOLSS_PRINTERMESSAGEBOX: {
8052                         struct spoolss_PrinterMessageBox *r = (struct spoolss_PrinterMessageBox *)_r;
8053                         r->out.result = _spoolss_PrinterMessageBox(cli->pipes_struct, r);
8054                         return NT_STATUS_OK;
8055                 }
8056
8057                 case NDR_SPOOLSS_ADDMONITOR: {
8058                         struct spoolss_AddMonitor *r = (struct spoolss_AddMonitor *)_r;
8059                         r->out.result = _spoolss_AddMonitor(cli->pipes_struct, r);
8060                         return NT_STATUS_OK;
8061                 }
8062
8063                 case NDR_SPOOLSS_DELETEMONITOR: {
8064                         struct spoolss_DeleteMonitor *r = (struct spoolss_DeleteMonitor *)_r;
8065                         r->out.result = _spoolss_DeleteMonitor(cli->pipes_struct, r);
8066                         return NT_STATUS_OK;
8067                 }
8068
8069                 case NDR_SPOOLSS_DELETEPRINTPROCESSOR: {
8070                         struct spoolss_DeletePrintProcessor *r = (struct spoolss_DeletePrintProcessor *)_r;
8071                         r->out.result = _spoolss_DeletePrintProcessor(cli->pipes_struct, r);
8072                         return NT_STATUS_OK;
8073                 }
8074
8075                 case NDR_SPOOLSS_ADDPRINTPROVIDOR: {
8076                         struct spoolss_AddPrintProvidor *r = (struct spoolss_AddPrintProvidor *)_r;
8077                         r->out.result = _spoolss_AddPrintProvidor(cli->pipes_struct, r);
8078                         return NT_STATUS_OK;
8079                 }
8080
8081                 case NDR_SPOOLSS_DELETEPRINTPROVIDOR: {
8082                         struct spoolss_DeletePrintProvidor *r = (struct spoolss_DeletePrintProvidor *)_r;
8083                         r->out.result = _spoolss_DeletePrintProvidor(cli->pipes_struct, r);
8084                         return NT_STATUS_OK;
8085                 }
8086
8087                 case NDR_SPOOLSS_ENUMPRINTPROCDATATYPES: {
8088                         struct spoolss_EnumPrintProcDataTypes *r = (struct spoolss_EnumPrintProcDataTypes *)_r;
8089                         ZERO_STRUCT(r->out);
8090                         r->out.count = talloc_zero(mem_ctx, uint32_t);
8091                         if (r->out.count == NULL) {
8092                         return NT_STATUS_NO_MEMORY;
8093                         }
8094
8095                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrintProcDataTypesInfo *);
8096                         if (r->out.info == NULL) {
8097                         return NT_STATUS_NO_MEMORY;
8098                         }
8099
8100                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8101                         if (r->out.needed == NULL) {
8102                         return NT_STATUS_NO_MEMORY;
8103                         }
8104
8105                         r->out.result = _spoolss_EnumPrintProcDataTypes(cli->pipes_struct, r);
8106                         return NT_STATUS_OK;
8107                 }
8108
8109                 case NDR_SPOOLSS_RESETPRINTER: {
8110                         struct spoolss_ResetPrinter *r = (struct spoolss_ResetPrinter *)_r;
8111                         r->out.result = _spoolss_ResetPrinter(cli->pipes_struct, r);
8112                         return NT_STATUS_OK;
8113                 }
8114
8115                 case NDR_SPOOLSS_GETPRINTERDRIVER2: {
8116                         struct spoolss_GetPrinterDriver2 *r = (struct spoolss_GetPrinterDriver2 *)_r;
8117                         ZERO_STRUCT(r->out);
8118                         r->out.info = talloc_zero(mem_ctx, union spoolss_DriverInfo);
8119                         if (r->out.info == NULL) {
8120                         return NT_STATUS_NO_MEMORY;
8121                         }
8122
8123                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8124                         if (r->out.needed == NULL) {
8125                         return NT_STATUS_NO_MEMORY;
8126                         }
8127
8128                         r->out.server_major_version = talloc_zero(mem_ctx, uint32_t);
8129                         if (r->out.server_major_version == NULL) {
8130                         return NT_STATUS_NO_MEMORY;
8131                         }
8132
8133                         r->out.server_minor_version = talloc_zero(mem_ctx, uint32_t);
8134                         if (r->out.server_minor_version == NULL) {
8135                         return NT_STATUS_NO_MEMORY;
8136                         }
8137
8138                         r->out.result = _spoolss_GetPrinterDriver2(cli->pipes_struct, r);
8139                         return NT_STATUS_OK;
8140                 }
8141
8142                 case NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION: {
8143                         struct spoolss_FindFirstPrinterChangeNotification *r = (struct spoolss_FindFirstPrinterChangeNotification *)_r;
8144                         r->out.result = _spoolss_FindFirstPrinterChangeNotification(cli->pipes_struct, r);
8145                         return NT_STATUS_OK;
8146                 }
8147
8148                 case NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION: {
8149                         struct spoolss_FindNextPrinterChangeNotification *r = (struct spoolss_FindNextPrinterChangeNotification *)_r;
8150                         r->out.result = _spoolss_FindNextPrinterChangeNotification(cli->pipes_struct, r);
8151                         return NT_STATUS_OK;
8152                 }
8153
8154                 case NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY: {
8155                         struct spoolss_FindClosePrinterNotify *r = (struct spoolss_FindClosePrinterNotify *)_r;
8156                         r->out.result = _spoolss_FindClosePrinterNotify(cli->pipes_struct, r);
8157                         return NT_STATUS_OK;
8158                 }
8159
8160                 case NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD: {
8161                         struct spoolss_RouterFindFirstPrinterChangeNotificationOld *r = (struct spoolss_RouterFindFirstPrinterChangeNotificationOld *)_r;
8162                         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotificationOld(cli->pipes_struct, r);
8163                         return NT_STATUS_OK;
8164                 }
8165
8166                 case NDR_SPOOLSS_REPLYOPENPRINTER: {
8167                         struct spoolss_ReplyOpenPrinter *r = (struct spoolss_ReplyOpenPrinter *)_r;
8168                         ZERO_STRUCT(r->out);
8169                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
8170                         if (r->out.handle == NULL) {
8171                         return NT_STATUS_NO_MEMORY;
8172                         }
8173
8174                         r->out.result = _spoolss_ReplyOpenPrinter(cli->pipes_struct, r);
8175                         return NT_STATUS_OK;
8176                 }
8177
8178                 case NDR_SPOOLSS_ROUTERREPLYPRINTER: {
8179                         struct spoolss_RouterReplyPrinter *r = (struct spoolss_RouterReplyPrinter *)_r;
8180                         r->out.result = _spoolss_RouterReplyPrinter(cli->pipes_struct, r);
8181                         return NT_STATUS_OK;
8182                 }
8183
8184                 case NDR_SPOOLSS_REPLYCLOSEPRINTER: {
8185                         struct spoolss_ReplyClosePrinter *r = (struct spoolss_ReplyClosePrinter *)_r;
8186                         ZERO_STRUCT(r->out);
8187                         r->out.handle = r->in.handle;
8188                         r->out.result = _spoolss_ReplyClosePrinter(cli->pipes_struct, r);
8189                         return NT_STATUS_OK;
8190                 }
8191
8192                 case NDR_SPOOLSS_ADDPORTEX: {
8193                         struct spoolss_AddPortEx *r = (struct spoolss_AddPortEx *)_r;
8194                         r->out.result = _spoolss_AddPortEx(cli->pipes_struct, r);
8195                         return NT_STATUS_OK;
8196                 }
8197
8198                 case NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION: {
8199                         struct spoolss_RouterFindFirstPrinterChangeNotification *r = (struct spoolss_RouterFindFirstPrinterChangeNotification *)_r;
8200                         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotification(cli->pipes_struct, r);
8201                         return NT_STATUS_OK;
8202                 }
8203
8204                 case NDR_SPOOLSS_SPOOLERINIT: {
8205                         struct spoolss_SpoolerInit *r = (struct spoolss_SpoolerInit *)_r;
8206                         r->out.result = _spoolss_SpoolerInit(cli->pipes_struct, r);
8207                         return NT_STATUS_OK;
8208                 }
8209
8210                 case NDR_SPOOLSS_RESETPRINTEREX: {
8211                         struct spoolss_ResetPrinterEx *r = (struct spoolss_ResetPrinterEx *)_r;
8212                         r->out.result = _spoolss_ResetPrinterEx(cli->pipes_struct, r);
8213                         return NT_STATUS_OK;
8214                 }
8215
8216                 case NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX: {
8217                         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r = (struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *)_r;
8218                         r->out.result = _spoolss_RemoteFindFirstPrinterChangeNotifyEx(cli->pipes_struct, r);
8219                         return NT_STATUS_OK;
8220                 }
8221
8222                 case NDR_SPOOLSS_ROUTERREPLYPRINTEREX: {
8223                         struct spoolss_RouterReplyPrinterEx *r = (struct spoolss_RouterReplyPrinterEx *)_r;
8224                         ZERO_STRUCT(r->out);
8225                         r->out.reply_result = talloc_zero(mem_ctx, uint32_t);
8226                         if (r->out.reply_result == NULL) {
8227                         return NT_STATUS_NO_MEMORY;
8228                         }
8229
8230                         r->out.result = _spoolss_RouterReplyPrinterEx(cli->pipes_struct, r);
8231                         return NT_STATUS_OK;
8232                 }
8233
8234                 case NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY: {
8235                         struct spoolss_RouterRefreshPrinterChangeNotify *r = (struct spoolss_RouterRefreshPrinterChangeNotify *)_r;
8236                         ZERO_STRUCT(r->out);
8237                         r->out.info = talloc_zero(mem_ctx, struct spoolss_NotifyInfo *);
8238                         if (r->out.info == NULL) {
8239                         return NT_STATUS_NO_MEMORY;
8240                         }
8241
8242                         r->out.result = _spoolss_RouterRefreshPrinterChangeNotify(cli->pipes_struct, r);
8243                         return NT_STATUS_OK;
8244                 }
8245
8246                 case NDR_SPOOLSS_44: {
8247                         struct spoolss_44 *r = (struct spoolss_44 *)_r;
8248                         r->out.result = _spoolss_44(cli->pipes_struct, r);
8249                         return NT_STATUS_OK;
8250                 }
8251
8252                 case NDR_SPOOLSS_OPENPRINTEREX: {
8253                         struct spoolss_OpenPrinterEx *r = (struct spoolss_OpenPrinterEx *)_r;
8254                         ZERO_STRUCT(r->out);
8255                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
8256                         if (r->out.handle == NULL) {
8257                         return NT_STATUS_NO_MEMORY;
8258                         }
8259
8260                         r->out.result = _spoolss_OpenPrinterEx(cli->pipes_struct, r);
8261                         return NT_STATUS_OK;
8262                 }
8263
8264                 case NDR_SPOOLSS_ADDPRINTEREX: {
8265                         struct spoolss_AddPrinterEx *r = (struct spoolss_AddPrinterEx *)_r;
8266                         ZERO_STRUCT(r->out);
8267                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
8268                         if (r->out.handle == NULL) {
8269                         return NT_STATUS_NO_MEMORY;
8270                         }
8271
8272                         r->out.result = _spoolss_AddPrinterEx(cli->pipes_struct, r);
8273                         return NT_STATUS_OK;
8274                 }
8275
8276                 case NDR_SPOOLSS_47: {
8277                         struct spoolss_47 *r = (struct spoolss_47 *)_r;
8278                         r->out.result = _spoolss_47(cli->pipes_struct, r);
8279                         return NT_STATUS_OK;
8280                 }
8281
8282                 case NDR_SPOOLSS_ENUMPRINTERDATA: {
8283                         struct spoolss_EnumPrinterData *r = (struct spoolss_EnumPrinterData *)_r;
8284                         ZERO_STRUCT(r->out);
8285                         r->out.value_name = talloc_zero_array(mem_ctx, const char, r->in.value_offered / 2);
8286                         if (r->out.value_name == NULL) {
8287                         return NT_STATUS_NO_MEMORY;
8288                         }
8289
8290                         r->out.value_needed = talloc_zero(mem_ctx, uint32_t);
8291                         if (r->out.value_needed == NULL) {
8292                         return NT_STATUS_NO_MEMORY;
8293                         }
8294
8295                         r->out.printerdata_type = talloc_zero(mem_ctx, uint32_t);
8296                         if (r->out.printerdata_type == NULL) {
8297                         return NT_STATUS_NO_MEMORY;
8298                         }
8299
8300                         r->out.buffer = talloc_zero(mem_ctx, DATA_BLOB);
8301                         if (r->out.buffer == NULL) {
8302                         return NT_STATUS_NO_MEMORY;
8303                         }
8304
8305                         r->out.data_needed = talloc_zero(mem_ctx, uint32_t);
8306                         if (r->out.data_needed == NULL) {
8307                         return NT_STATUS_NO_MEMORY;
8308                         }
8309
8310                         r->out.result = _spoolss_EnumPrinterData(cli->pipes_struct, r);
8311                         return NT_STATUS_OK;
8312                 }
8313
8314                 case NDR_SPOOLSS_DELETEPRINTERDATA: {
8315                         struct spoolss_DeletePrinterData *r = (struct spoolss_DeletePrinterData *)_r;
8316                         r->out.result = _spoolss_DeletePrinterData(cli->pipes_struct, r);
8317                         return NT_STATUS_OK;
8318                 }
8319
8320                 case NDR_SPOOLSS_4A: {
8321                         struct spoolss_4a *r = (struct spoolss_4a *)_r;
8322                         r->out.result = _spoolss_4a(cli->pipes_struct, r);
8323                         return NT_STATUS_OK;
8324                 }
8325
8326                 case NDR_SPOOLSS_4B: {
8327                         struct spoolss_4b *r = (struct spoolss_4b *)_r;
8328                         r->out.result = _spoolss_4b(cli->pipes_struct, r);
8329                         return NT_STATUS_OK;
8330                 }
8331
8332                 case NDR_SPOOLSS_4C: {
8333                         struct spoolss_4c *r = (struct spoolss_4c *)_r;
8334                         r->out.result = _spoolss_4c(cli->pipes_struct, r);
8335                         return NT_STATUS_OK;
8336                 }
8337
8338                 case NDR_SPOOLSS_SETPRINTERDATAEX: {
8339                         struct spoolss_SetPrinterDataEx *r = (struct spoolss_SetPrinterDataEx *)_r;
8340                         r->out.result = _spoolss_SetPrinterDataEx(cli->pipes_struct, r);
8341                         return NT_STATUS_OK;
8342                 }
8343
8344                 case NDR_SPOOLSS_GETPRINTERDATAEX: {
8345                         struct spoolss_GetPrinterDataEx *r = (struct spoolss_GetPrinterDataEx *)_r;
8346                         ZERO_STRUCT(r->out);
8347                         r->out.type = talloc_zero(mem_ctx, uint32_t);
8348                         if (r->out.type == NULL) {
8349                         return NT_STATUS_NO_MEMORY;
8350                         }
8351
8352                         r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
8353                         if (r->out.buffer == NULL) {
8354                         return NT_STATUS_NO_MEMORY;
8355                         }
8356
8357                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8358                         if (r->out.needed == NULL) {
8359                         return NT_STATUS_NO_MEMORY;
8360                         }
8361
8362                         r->out.result = _spoolss_GetPrinterDataEx(cli->pipes_struct, r);
8363                         return NT_STATUS_OK;
8364                 }
8365
8366                 case NDR_SPOOLSS_ENUMPRINTERDATAEX: {
8367                         struct spoolss_EnumPrinterDataEx *r = (struct spoolss_EnumPrinterDataEx *)_r;
8368                         ZERO_STRUCT(r->out);
8369                         r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
8370                         if (r->out.buffer == NULL) {
8371                         return NT_STATUS_NO_MEMORY;
8372                         }
8373
8374                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8375                         if (r->out.needed == NULL) {
8376                         return NT_STATUS_NO_MEMORY;
8377                         }
8378
8379                         r->out.count = talloc_zero(mem_ctx, uint32_t);
8380                         if (r->out.count == NULL) {
8381                         return NT_STATUS_NO_MEMORY;
8382                         }
8383
8384                         r->out.result = _spoolss_EnumPrinterDataEx(cli->pipes_struct, r);
8385                         return NT_STATUS_OK;
8386                 }
8387
8388                 case NDR_SPOOLSS_ENUMPRINTERKEY: {
8389                         struct spoolss_EnumPrinterKey *r = (struct spoolss_EnumPrinterKey *)_r;
8390                         ZERO_STRUCT(r->out);
8391                         r->out.key_buffer = talloc_zero_array(mem_ctx, uint16_t, r->in.key_buffer_size / 2);
8392                         if (r->out.key_buffer == NULL) {
8393                         return NT_STATUS_NO_MEMORY;
8394                         }
8395
8396                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8397                         if (r->out.needed == NULL) {
8398                         return NT_STATUS_NO_MEMORY;
8399                         }
8400
8401                         r->out.result = _spoolss_EnumPrinterKey(cli->pipes_struct, r);
8402                         return NT_STATUS_OK;
8403                 }
8404
8405                 case NDR_SPOOLSS_DELETEPRINTERDATAEX: {
8406                         struct spoolss_DeletePrinterDataEx *r = (struct spoolss_DeletePrinterDataEx *)_r;
8407                         r->out.result = _spoolss_DeletePrinterDataEx(cli->pipes_struct, r);
8408                         return NT_STATUS_OK;
8409                 }
8410
8411                 case NDR_SPOOLSS_DELETEPRINTERKEY: {
8412                         struct spoolss_DeletePrinterKey *r = (struct spoolss_DeletePrinterKey *)_r;
8413                         r->out.result = _spoolss_DeletePrinterKey(cli->pipes_struct, r);
8414                         return NT_STATUS_OK;
8415                 }
8416
8417                 case NDR_SPOOLSS_53: {
8418                         struct spoolss_53 *r = (struct spoolss_53 *)_r;
8419                         r->out.result = _spoolss_53(cli->pipes_struct, r);
8420                         return NT_STATUS_OK;
8421                 }
8422
8423                 case NDR_SPOOLSS_DELETEPRINTERDRIVEREX: {
8424                         struct spoolss_DeletePrinterDriverEx *r = (struct spoolss_DeletePrinterDriverEx *)_r;
8425                         r->out.result = _spoolss_DeletePrinterDriverEx(cli->pipes_struct, r);
8426                         return NT_STATUS_OK;
8427                 }
8428
8429                 case NDR_SPOOLSS_55: {
8430                         struct spoolss_55 *r = (struct spoolss_55 *)_r;
8431                         r->out.result = _spoolss_55(cli->pipes_struct, r);
8432                         return NT_STATUS_OK;
8433                 }
8434
8435                 case NDR_SPOOLSS_56: {
8436                         struct spoolss_56 *r = (struct spoolss_56 *)_r;
8437                         r->out.result = _spoolss_56(cli->pipes_struct, r);
8438                         return NT_STATUS_OK;
8439                 }
8440
8441                 case NDR_SPOOLSS_57: {
8442                         struct spoolss_57 *r = (struct spoolss_57 *)_r;
8443                         r->out.result = _spoolss_57(cli->pipes_struct, r);
8444                         return NT_STATUS_OK;
8445                 }
8446
8447                 case NDR_SPOOLSS_XCVDATA: {
8448                         struct spoolss_XcvData *r = (struct spoolss_XcvData *)_r;
8449                         ZERO_STRUCT(r->out);
8450                         r->out.status_code = r->in.status_code;
8451                         r->out.out_data = talloc_zero_array(mem_ctx, uint8_t, r->in.out_data_size);
8452                         if (r->out.out_data == NULL) {
8453                         return NT_STATUS_NO_MEMORY;
8454                         }
8455
8456                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8457                         if (r->out.needed == NULL) {
8458                         return NT_STATUS_NO_MEMORY;
8459                         }
8460
8461                         r->out.result = _spoolss_XcvData(cli->pipes_struct, r);
8462                         return NT_STATUS_OK;
8463                 }
8464
8465                 case NDR_SPOOLSS_ADDPRINTERDRIVEREX: {
8466                         struct spoolss_AddPrinterDriverEx *r = (struct spoolss_AddPrinterDriverEx *)_r;
8467                         r->out.result = _spoolss_AddPrinterDriverEx(cli->pipes_struct, r);
8468                         return NT_STATUS_OK;
8469                 }
8470
8471                 case NDR_SPOOLSS_5A: {
8472                         struct spoolss_5a *r = (struct spoolss_5a *)_r;
8473                         r->out.result = _spoolss_5a(cli->pipes_struct, r);
8474                         return NT_STATUS_OK;
8475                 }
8476
8477                 case NDR_SPOOLSS_5B: {
8478                         struct spoolss_5b *r = (struct spoolss_5b *)_r;
8479                         r->out.result = _spoolss_5b(cli->pipes_struct, r);
8480                         return NT_STATUS_OK;
8481                 }
8482
8483                 case NDR_SPOOLSS_5C: {
8484                         struct spoolss_5c *r = (struct spoolss_5c *)_r;
8485                         r->out.result = _spoolss_5c(cli->pipes_struct, r);
8486                         return NT_STATUS_OK;
8487                 }
8488
8489                 case NDR_SPOOLSS_5D: {
8490                         struct spoolss_5d *r = (struct spoolss_5d *)_r;
8491                         r->out.result = _spoolss_5d(cli->pipes_struct, r);
8492                         return NT_STATUS_OK;
8493                 }
8494
8495                 case NDR_SPOOLSS_5E: {
8496                         struct spoolss_5e *r = (struct spoolss_5e *)_r;
8497                         r->out.result = _spoolss_5e(cli->pipes_struct, r);
8498                         return NT_STATUS_OK;
8499                 }
8500
8501                 case NDR_SPOOLSS_5F: {
8502                         struct spoolss_5f *r = (struct spoolss_5f *)_r;
8503                         r->out.result = _spoolss_5f(cli->pipes_struct, r);
8504                         return NT_STATUS_OK;
8505                 }
8506
8507                 default:
8508                         return NT_STATUS_NOT_IMPLEMENTED;
8509         }
8510 }
8511
8512 NTSTATUS rpc_spoolss_init(void)
8513 {
8514         return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "spoolss", "spoolss", &ndr_table_spoolss, api_spoolss_cmds, sizeof(api_spoolss_cmds) / sizeof(struct api_struct));
8515 }