git add -f bin/default/librpc/gen_ndr/*.[ch] bin/default/source*/librpc/gen_ndr/...
[metze/samba/wip.git] / bin.gen_ndr / default / librpc / gen_ndr / srv_dnsserver.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * server auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "ntdomain.h"
8 #include "bin/default/librpc/gen_ndr/srv_dnsserver.h"
9
10 static bool api_DnssrvOperation(struct pipes_struct *p)
11 {
12         const struct ndr_interface_call *call;
13         struct ndr_pull *pull;
14         struct ndr_push *push;
15         enum ndr_err_code ndr_err;
16         struct DnssrvOperation *r;
17
18         call = &ndr_table_dnsserver.calls[NDR_DNSSRVOPERATION];
19
20         r = talloc(talloc_tos(), struct DnssrvOperation);
21         if (r == NULL) {
22                 return false;
23         }
24
25         pull = ndr_pull_init_blob(&p->in_data.data, r);
26         if (pull == NULL) {
27                 talloc_free(r);
28                 return false;
29         }
30
31         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
32         if (p->endian) {
33                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
34         }
35         ndr_err = call->ndr_pull(pull, NDR_IN, r);
36         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
37                 talloc_free(r);
38                 return false;
39         }
40
41         if (DEBUGLEVEL >= 10) {
42                 NDR_PRINT_FUNCTION_DEBUG(DnssrvOperation, NDR_IN, r);
43         }
44
45         r->out.result = _DnssrvOperation(p, r);
46
47         if (p->fault_state) {
48                 talloc_free(r);
49                 /* Return true here, srv_pipe_hnd.c will take care */
50                 return true;
51         }
52
53         if (DEBUGLEVEL >= 10) {
54                 NDR_PRINT_FUNCTION_DEBUG(DnssrvOperation, NDR_OUT | NDR_SET_VALUES, r);
55         }
56
57         push = ndr_push_init_ctx(r);
58         if (push == NULL) {
59                 talloc_free(r);
60                 return false;
61         }
62
63         /*
64          * carry over the pointer count to the reply in case we are
65          * using full pointer. See NDR specification for full pointers
66          */
67         push->ptr_count = pull->ptr_count;
68
69         ndr_err = call->ndr_push(push, NDR_OUT, r);
70         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
71                 talloc_free(r);
72                 return false;
73         }
74
75         p->out_data.rdata = ndr_push_blob(push);
76         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
77
78         talloc_free(r);
79
80         return true;
81 }
82
83 static bool api_DnssrvQuery(struct pipes_struct *p)
84 {
85         const struct ndr_interface_call *call;
86         struct ndr_pull *pull;
87         struct ndr_push *push;
88         enum ndr_err_code ndr_err;
89         struct DnssrvQuery *r;
90
91         call = &ndr_table_dnsserver.calls[NDR_DNSSRVQUERY];
92
93         r = talloc(talloc_tos(), struct DnssrvQuery);
94         if (r == NULL) {
95                 return false;
96         }
97
98         pull = ndr_pull_init_blob(&p->in_data.data, r);
99         if (pull == NULL) {
100                 talloc_free(r);
101                 return false;
102         }
103
104         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
105         if (p->endian) {
106                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
107         }
108         ndr_err = call->ndr_pull(pull, NDR_IN, r);
109         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
110                 talloc_free(r);
111                 return false;
112         }
113
114         if (DEBUGLEVEL >= 10) {
115                 NDR_PRINT_FUNCTION_DEBUG(DnssrvQuery, NDR_IN, r);
116         }
117
118         ZERO_STRUCT(r->out);
119         r->out.pdwTypeId = talloc_zero(r, enum DNS_RPC_TYPEID);
120         if (r->out.pdwTypeId == NULL) {
121                 talloc_free(r);
122                 return false;
123         }
124
125         r->out.ppData = talloc_zero(r, union DNSSRV_RPC_UNION);
126         if (r->out.ppData == NULL) {
127                 talloc_free(r);
128                 return false;
129         }
130
131         r->out.result = _DnssrvQuery(p, r);
132
133         if (p->fault_state) {
134                 talloc_free(r);
135                 /* Return true here, srv_pipe_hnd.c will take care */
136                 return true;
137         }
138
139         if (DEBUGLEVEL >= 10) {
140                 NDR_PRINT_FUNCTION_DEBUG(DnssrvQuery, NDR_OUT | NDR_SET_VALUES, r);
141         }
142
143         push = ndr_push_init_ctx(r);
144         if (push == NULL) {
145                 talloc_free(r);
146                 return false;
147         }
148
149         /*
150          * carry over the pointer count to the reply in case we are
151          * using full pointer. See NDR specification for full pointers
152          */
153         push->ptr_count = pull->ptr_count;
154
155         ndr_err = call->ndr_push(push, NDR_OUT, r);
156         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
157                 talloc_free(r);
158                 return false;
159         }
160
161         p->out_data.rdata = ndr_push_blob(push);
162         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
163
164         talloc_free(r);
165
166         return true;
167 }
168
169 static bool api_DnssrvComplexOperation(struct pipes_struct *p)
170 {
171         const struct ndr_interface_call *call;
172         struct ndr_pull *pull;
173         struct ndr_push *push;
174         enum ndr_err_code ndr_err;
175         struct DnssrvComplexOperation *r;
176
177         call = &ndr_table_dnsserver.calls[NDR_DNSSRVCOMPLEXOPERATION];
178
179         r = talloc(talloc_tos(), struct DnssrvComplexOperation);
180         if (r == NULL) {
181                 return false;
182         }
183
184         pull = ndr_pull_init_blob(&p->in_data.data, r);
185         if (pull == NULL) {
186                 talloc_free(r);
187                 return false;
188         }
189
190         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
191         if (p->endian) {
192                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
193         }
194         ndr_err = call->ndr_pull(pull, NDR_IN, r);
195         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
196                 talloc_free(r);
197                 return false;
198         }
199
200         if (DEBUGLEVEL >= 10) {
201                 NDR_PRINT_FUNCTION_DEBUG(DnssrvComplexOperation, NDR_IN, r);
202         }
203
204         ZERO_STRUCT(r->out);
205         r->out.pdwTypeOut = talloc_zero(r, enum DNS_RPC_TYPEID);
206         if (r->out.pdwTypeOut == NULL) {
207                 talloc_free(r);
208                 return false;
209         }
210
211         r->out.ppDataOut = talloc_zero(r, union DNSSRV_RPC_UNION);
212         if (r->out.ppDataOut == NULL) {
213                 talloc_free(r);
214                 return false;
215         }
216
217         r->out.result = _DnssrvComplexOperation(p, r);
218
219         if (p->fault_state) {
220                 talloc_free(r);
221                 /* Return true here, srv_pipe_hnd.c will take care */
222                 return true;
223         }
224
225         if (DEBUGLEVEL >= 10) {
226                 NDR_PRINT_FUNCTION_DEBUG(DnssrvComplexOperation, NDR_OUT | NDR_SET_VALUES, r);
227         }
228
229         push = ndr_push_init_ctx(r);
230         if (push == NULL) {
231                 talloc_free(r);
232                 return false;
233         }
234
235         /*
236          * carry over the pointer count to the reply in case we are
237          * using full pointer. See NDR specification for full pointers
238          */
239         push->ptr_count = pull->ptr_count;
240
241         ndr_err = call->ndr_push(push, NDR_OUT, r);
242         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
243                 talloc_free(r);
244                 return false;
245         }
246
247         p->out_data.rdata = ndr_push_blob(push);
248         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
249
250         talloc_free(r);
251
252         return true;
253 }
254
255 static bool api_DnssrvEnumRecords(struct pipes_struct *p)
256 {
257         const struct ndr_interface_call *call;
258         struct ndr_pull *pull;
259         struct ndr_push *push;
260         enum ndr_err_code ndr_err;
261         struct DnssrvEnumRecords *r;
262
263         call = &ndr_table_dnsserver.calls[NDR_DNSSRVENUMRECORDS];
264
265         r = talloc(talloc_tos(), struct DnssrvEnumRecords);
266         if (r == NULL) {
267                 return false;
268         }
269
270         pull = ndr_pull_init_blob(&p->in_data.data, r);
271         if (pull == NULL) {
272                 talloc_free(r);
273                 return false;
274         }
275
276         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
277         if (p->endian) {
278                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
279         }
280         ndr_err = call->ndr_pull(pull, NDR_IN, r);
281         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
282                 talloc_free(r);
283                 return false;
284         }
285
286         if (DEBUGLEVEL >= 10) {
287                 NDR_PRINT_FUNCTION_DEBUG(DnssrvEnumRecords, NDR_IN, r);
288         }
289
290         ZERO_STRUCT(r->out);
291         r->out.pdwBufferLength = talloc_zero(r, uint32_t);
292         if (r->out.pdwBufferLength == NULL) {
293                 talloc_free(r);
294                 return false;
295         }
296
297         r->out.pBuffer = talloc_zero(r, struct DNS_RPC_RECORDS_ARRAY *);
298         if (r->out.pBuffer == NULL) {
299                 talloc_free(r);
300                 return false;
301         }
302
303         r->out.result = _DnssrvEnumRecords(p, r);
304
305         if (p->fault_state) {
306                 talloc_free(r);
307                 /* Return true here, srv_pipe_hnd.c will take care */
308                 return true;
309         }
310
311         if (DEBUGLEVEL >= 10) {
312                 NDR_PRINT_FUNCTION_DEBUG(DnssrvEnumRecords, NDR_OUT | NDR_SET_VALUES, r);
313         }
314
315         push = ndr_push_init_ctx(r);
316         if (push == NULL) {
317                 talloc_free(r);
318                 return false;
319         }
320
321         /*
322          * carry over the pointer count to the reply in case we are
323          * using full pointer. See NDR specification for full pointers
324          */
325         push->ptr_count = pull->ptr_count;
326
327         ndr_err = call->ndr_push(push, NDR_OUT, r);
328         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
329                 talloc_free(r);
330                 return false;
331         }
332
333         p->out_data.rdata = ndr_push_blob(push);
334         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
335
336         talloc_free(r);
337
338         return true;
339 }
340
341 static bool api_DnssrvUpdateRecord(struct pipes_struct *p)
342 {
343         const struct ndr_interface_call *call;
344         struct ndr_pull *pull;
345         struct ndr_push *push;
346         enum ndr_err_code ndr_err;
347         struct DnssrvUpdateRecord *r;
348
349         call = &ndr_table_dnsserver.calls[NDR_DNSSRVUPDATERECORD];
350
351         r = talloc(talloc_tos(), struct DnssrvUpdateRecord);
352         if (r == NULL) {
353                 return false;
354         }
355
356         pull = ndr_pull_init_blob(&p->in_data.data, r);
357         if (pull == NULL) {
358                 talloc_free(r);
359                 return false;
360         }
361
362         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
363         if (p->endian) {
364                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
365         }
366         ndr_err = call->ndr_pull(pull, NDR_IN, r);
367         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
368                 talloc_free(r);
369                 return false;
370         }
371
372         if (DEBUGLEVEL >= 10) {
373                 NDR_PRINT_FUNCTION_DEBUG(DnssrvUpdateRecord, NDR_IN, r);
374         }
375
376         r->out.result = _DnssrvUpdateRecord(p, r);
377
378         if (p->fault_state) {
379                 talloc_free(r);
380                 /* Return true here, srv_pipe_hnd.c will take care */
381                 return true;
382         }
383
384         if (DEBUGLEVEL >= 10) {
385                 NDR_PRINT_FUNCTION_DEBUG(DnssrvUpdateRecord, NDR_OUT | NDR_SET_VALUES, r);
386         }
387
388         push = ndr_push_init_ctx(r);
389         if (push == NULL) {
390                 talloc_free(r);
391                 return false;
392         }
393
394         /*
395          * carry over the pointer count to the reply in case we are
396          * using full pointer. See NDR specification for full pointers
397          */
398         push->ptr_count = pull->ptr_count;
399
400         ndr_err = call->ndr_push(push, NDR_OUT, r);
401         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
402                 talloc_free(r);
403                 return false;
404         }
405
406         p->out_data.rdata = ndr_push_blob(push);
407         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
408
409         talloc_free(r);
410
411         return true;
412 }
413
414 static bool api_DnssrvOperation2(struct pipes_struct *p)
415 {
416         const struct ndr_interface_call *call;
417         struct ndr_pull *pull;
418         struct ndr_push *push;
419         enum ndr_err_code ndr_err;
420         struct DnssrvOperation2 *r;
421
422         call = &ndr_table_dnsserver.calls[NDR_DNSSRVOPERATION2];
423
424         r = talloc(talloc_tos(), struct DnssrvOperation2);
425         if (r == NULL) {
426                 return false;
427         }
428
429         pull = ndr_pull_init_blob(&p->in_data.data, r);
430         if (pull == NULL) {
431                 talloc_free(r);
432                 return false;
433         }
434
435         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
436         if (p->endian) {
437                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
438         }
439         ndr_err = call->ndr_pull(pull, NDR_IN, r);
440         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
441                 talloc_free(r);
442                 return false;
443         }
444
445         if (DEBUGLEVEL >= 10) {
446                 NDR_PRINT_FUNCTION_DEBUG(DnssrvOperation2, NDR_IN, r);
447         }
448
449         r->out.result = _DnssrvOperation2(p, r);
450
451         if (p->fault_state) {
452                 talloc_free(r);
453                 /* Return true here, srv_pipe_hnd.c will take care */
454                 return true;
455         }
456
457         if (DEBUGLEVEL >= 10) {
458                 NDR_PRINT_FUNCTION_DEBUG(DnssrvOperation2, NDR_OUT | NDR_SET_VALUES, r);
459         }
460
461         push = ndr_push_init_ctx(r);
462         if (push == NULL) {
463                 talloc_free(r);
464                 return false;
465         }
466
467         /*
468          * carry over the pointer count to the reply in case we are
469          * using full pointer. See NDR specification for full pointers
470          */
471         push->ptr_count = pull->ptr_count;
472
473         ndr_err = call->ndr_push(push, NDR_OUT, r);
474         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
475                 talloc_free(r);
476                 return false;
477         }
478
479         p->out_data.rdata = ndr_push_blob(push);
480         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
481
482         talloc_free(r);
483
484         return true;
485 }
486
487 static bool api_DnssrvQuery2(struct pipes_struct *p)
488 {
489         const struct ndr_interface_call *call;
490         struct ndr_pull *pull;
491         struct ndr_push *push;
492         enum ndr_err_code ndr_err;
493         struct DnssrvQuery2 *r;
494
495         call = &ndr_table_dnsserver.calls[NDR_DNSSRVQUERY2];
496
497         r = talloc(talloc_tos(), struct DnssrvQuery2);
498         if (r == NULL) {
499                 return false;
500         }
501
502         pull = ndr_pull_init_blob(&p->in_data.data, r);
503         if (pull == NULL) {
504                 talloc_free(r);
505                 return false;
506         }
507
508         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
509         if (p->endian) {
510                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
511         }
512         ndr_err = call->ndr_pull(pull, NDR_IN, r);
513         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
514                 talloc_free(r);
515                 return false;
516         }
517
518         if (DEBUGLEVEL >= 10) {
519                 NDR_PRINT_FUNCTION_DEBUG(DnssrvQuery2, NDR_IN, r);
520         }
521
522         ZERO_STRUCT(r->out);
523         r->out.pdwTypeId = talloc_zero(r, enum DNS_RPC_TYPEID);
524         if (r->out.pdwTypeId == NULL) {
525                 talloc_free(r);
526                 return false;
527         }
528
529         r->out.ppData = talloc_zero(r, union DNSSRV_RPC_UNION);
530         if (r->out.ppData == NULL) {
531                 talloc_free(r);
532                 return false;
533         }
534
535         r->out.result = _DnssrvQuery2(p, r);
536
537         if (p->fault_state) {
538                 talloc_free(r);
539                 /* Return true here, srv_pipe_hnd.c will take care */
540                 return true;
541         }
542
543         if (DEBUGLEVEL >= 10) {
544                 NDR_PRINT_FUNCTION_DEBUG(DnssrvQuery2, NDR_OUT | NDR_SET_VALUES, r);
545         }
546
547         push = ndr_push_init_ctx(r);
548         if (push == NULL) {
549                 talloc_free(r);
550                 return false;
551         }
552
553         /*
554          * carry over the pointer count to the reply in case we are
555          * using full pointer. See NDR specification for full pointers
556          */
557         push->ptr_count = pull->ptr_count;
558
559         ndr_err = call->ndr_push(push, NDR_OUT, r);
560         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
561                 talloc_free(r);
562                 return false;
563         }
564
565         p->out_data.rdata = ndr_push_blob(push);
566         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
567
568         talloc_free(r);
569
570         return true;
571 }
572
573 static bool api_DnssrvComplexOperation2(struct pipes_struct *p)
574 {
575         const struct ndr_interface_call *call;
576         struct ndr_pull *pull;
577         struct ndr_push *push;
578         enum ndr_err_code ndr_err;
579         struct DnssrvComplexOperation2 *r;
580
581         call = &ndr_table_dnsserver.calls[NDR_DNSSRVCOMPLEXOPERATION2];
582
583         r = talloc(talloc_tos(), struct DnssrvComplexOperation2);
584         if (r == NULL) {
585                 return false;
586         }
587
588         pull = ndr_pull_init_blob(&p->in_data.data, r);
589         if (pull == NULL) {
590                 talloc_free(r);
591                 return false;
592         }
593
594         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
595         if (p->endian) {
596                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
597         }
598         ndr_err = call->ndr_pull(pull, NDR_IN, r);
599         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
600                 talloc_free(r);
601                 return false;
602         }
603
604         if (DEBUGLEVEL >= 10) {
605                 NDR_PRINT_FUNCTION_DEBUG(DnssrvComplexOperation2, NDR_IN, r);
606         }
607
608         ZERO_STRUCT(r->out);
609         r->out.pdwTypeOut = talloc_zero(r, enum DNS_RPC_TYPEID);
610         if (r->out.pdwTypeOut == NULL) {
611                 talloc_free(r);
612                 return false;
613         }
614
615         r->out.ppDataOut = talloc_zero(r, union DNSSRV_RPC_UNION);
616         if (r->out.ppDataOut == NULL) {
617                 talloc_free(r);
618                 return false;
619         }
620
621         r->out.result = _DnssrvComplexOperation2(p, r);
622
623         if (p->fault_state) {
624                 talloc_free(r);
625                 /* Return true here, srv_pipe_hnd.c will take care */
626                 return true;
627         }
628
629         if (DEBUGLEVEL >= 10) {
630                 NDR_PRINT_FUNCTION_DEBUG(DnssrvComplexOperation2, NDR_OUT | NDR_SET_VALUES, r);
631         }
632
633         push = ndr_push_init_ctx(r);
634         if (push == NULL) {
635                 talloc_free(r);
636                 return false;
637         }
638
639         /*
640          * carry over the pointer count to the reply in case we are
641          * using full pointer. See NDR specification for full pointers
642          */
643         push->ptr_count = pull->ptr_count;
644
645         ndr_err = call->ndr_push(push, NDR_OUT, r);
646         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
647                 talloc_free(r);
648                 return false;
649         }
650
651         p->out_data.rdata = ndr_push_blob(push);
652         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
653
654         talloc_free(r);
655
656         return true;
657 }
658
659 static bool api_DnssrvEnumRecords2(struct pipes_struct *p)
660 {
661         const struct ndr_interface_call *call;
662         struct ndr_pull *pull;
663         struct ndr_push *push;
664         enum ndr_err_code ndr_err;
665         struct DnssrvEnumRecords2 *r;
666
667         call = &ndr_table_dnsserver.calls[NDR_DNSSRVENUMRECORDS2];
668
669         r = talloc(talloc_tos(), struct DnssrvEnumRecords2);
670         if (r == NULL) {
671                 return false;
672         }
673
674         pull = ndr_pull_init_blob(&p->in_data.data, r);
675         if (pull == NULL) {
676                 talloc_free(r);
677                 return false;
678         }
679
680         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
681         if (p->endian) {
682                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
683         }
684         ndr_err = call->ndr_pull(pull, NDR_IN, r);
685         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
686                 talloc_free(r);
687                 return false;
688         }
689
690         if (DEBUGLEVEL >= 10) {
691                 NDR_PRINT_FUNCTION_DEBUG(DnssrvEnumRecords2, NDR_IN, r);
692         }
693
694         ZERO_STRUCT(r->out);
695         r->out.pdwBufferLength = talloc_zero(r, uint32_t);
696         if (r->out.pdwBufferLength == NULL) {
697                 talloc_free(r);
698                 return false;
699         }
700
701         r->out.pBuffer = talloc_zero(r, struct DNS_RPC_RECORDS_ARRAY *);
702         if (r->out.pBuffer == NULL) {
703                 talloc_free(r);
704                 return false;
705         }
706
707         r->out.result = _DnssrvEnumRecords2(p, r);
708
709         if (p->fault_state) {
710                 talloc_free(r);
711                 /* Return true here, srv_pipe_hnd.c will take care */
712                 return true;
713         }
714
715         if (DEBUGLEVEL >= 10) {
716                 NDR_PRINT_FUNCTION_DEBUG(DnssrvEnumRecords2, NDR_OUT | NDR_SET_VALUES, r);
717         }
718
719         push = ndr_push_init_ctx(r);
720         if (push == NULL) {
721                 talloc_free(r);
722                 return false;
723         }
724
725         /*
726          * carry over the pointer count to the reply in case we are
727          * using full pointer. See NDR specification for full pointers
728          */
729         push->ptr_count = pull->ptr_count;
730
731         ndr_err = call->ndr_push(push, NDR_OUT, r);
732         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
733                 talloc_free(r);
734                 return false;
735         }
736
737         p->out_data.rdata = ndr_push_blob(push);
738         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
739
740         talloc_free(r);
741
742         return true;
743 }
744
745 static bool api_DnssrvUpdateRecord2(struct pipes_struct *p)
746 {
747         const struct ndr_interface_call *call;
748         struct ndr_pull *pull;
749         struct ndr_push *push;
750         enum ndr_err_code ndr_err;
751         struct DnssrvUpdateRecord2 *r;
752
753         call = &ndr_table_dnsserver.calls[NDR_DNSSRVUPDATERECORD2];
754
755         r = talloc(talloc_tos(), struct DnssrvUpdateRecord2);
756         if (r == NULL) {
757                 return false;
758         }
759
760         pull = ndr_pull_init_blob(&p->in_data.data, r);
761         if (pull == NULL) {
762                 talloc_free(r);
763                 return false;
764         }
765
766         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
767         if (p->endian) {
768                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
769         }
770         ndr_err = call->ndr_pull(pull, NDR_IN, r);
771         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
772                 talloc_free(r);
773                 return false;
774         }
775
776         if (DEBUGLEVEL >= 10) {
777                 NDR_PRINT_FUNCTION_DEBUG(DnssrvUpdateRecord2, NDR_IN, r);
778         }
779
780         r->out.result = _DnssrvUpdateRecord2(p, r);
781
782         if (p->fault_state) {
783                 talloc_free(r);
784                 /* Return true here, srv_pipe_hnd.c will take care */
785                 return true;
786         }
787
788         if (DEBUGLEVEL >= 10) {
789                 NDR_PRINT_FUNCTION_DEBUG(DnssrvUpdateRecord2, NDR_OUT | NDR_SET_VALUES, r);
790         }
791
792         push = ndr_push_init_ctx(r);
793         if (push == NULL) {
794                 talloc_free(r);
795                 return false;
796         }
797
798         /*
799          * carry over the pointer count to the reply in case we are
800          * using full pointer. See NDR specification for full pointers
801          */
802         push->ptr_count = pull->ptr_count;
803
804         ndr_err = call->ndr_push(push, NDR_OUT, r);
805         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
806                 talloc_free(r);
807                 return false;
808         }
809
810         p->out_data.rdata = ndr_push_blob(push);
811         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
812
813         talloc_free(r);
814
815         return true;
816 }
817
818
819 /* Tables */
820 static struct api_struct api_dnsserver_cmds[] = 
821 {
822         {"DNSSRVOPERATION", NDR_DNSSRVOPERATION, api_DnssrvOperation},
823         {"DNSSRVQUERY", NDR_DNSSRVQUERY, api_DnssrvQuery},
824         {"DNSSRVCOMPLEXOPERATION", NDR_DNSSRVCOMPLEXOPERATION, api_DnssrvComplexOperation},
825         {"DNSSRVENUMRECORDS", NDR_DNSSRVENUMRECORDS, api_DnssrvEnumRecords},
826         {"DNSSRVUPDATERECORD", NDR_DNSSRVUPDATERECORD, api_DnssrvUpdateRecord},
827         {"DNSSRVOPERATION2", NDR_DNSSRVOPERATION2, api_DnssrvOperation2},
828         {"DNSSRVQUERY2", NDR_DNSSRVQUERY2, api_DnssrvQuery2},
829         {"DNSSRVCOMPLEXOPERATION2", NDR_DNSSRVCOMPLEXOPERATION2, api_DnssrvComplexOperation2},
830         {"DNSSRVENUMRECORDS2", NDR_DNSSRVENUMRECORDS2, api_DnssrvEnumRecords2},
831         {"DNSSRVUPDATERECORD2", NDR_DNSSRVUPDATERECORD2, api_DnssrvUpdateRecord2},
832 };
833
834 void dnsserver_get_pipe_fns(struct api_struct **fns, int *n_fns)
835 {
836         *fns = api_dnsserver_cmds;
837         *n_fns = sizeof(api_dnsserver_cmds) / sizeof(struct api_struct);
838 }
839
840 NTSTATUS rpc_dnsserver_init(const struct rpc_srv_callbacks *rpc_srv_cb)
841 {
842         return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "dnsserver", "dnsserver", &ndr_table_dnsserver, api_dnsserver_cmds, sizeof(api_dnsserver_cmds) / sizeof(struct api_struct), rpc_srv_cb);
843 }
844
845 NTSTATUS rpc_dnsserver_shutdown(void)
846 {
847         return rpc_srv_unregister(&ndr_table_dnsserver);
848 }