9ec98bf638a9ce6cedd3bcf2bc740071ce0066fa
[kai/samba.git] / source3 / librpc / gen_ndr / srv_netlogon.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_netlogon.h"
8
9 static bool api_netr_LogonUasLogon(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 netr_LogonUasLogon *r;
17
18         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONUASLOGON];
19
20         r = talloc(talloc_tos(), struct netr_LogonUasLogon);
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(netr_LogonUasLogon, r);
45         }
46
47         ZERO_STRUCT(r->out);
48         r->out.info = talloc_zero(r, struct netr_UasInfo);
49         if (r->out.info == NULL) {
50                 talloc_free(r);
51                 return false;
52         }
53
54         r->out.result = _netr_LogonUasLogon(p, r);
55
56         if (p->rng_fault_state) {
57                 talloc_free(r);
58                 /* Return true here, srv_pipe_hnd.c will take care */
59                 return true;
60         }
61
62         if (DEBUGLEVEL >= 10) {
63                 NDR_PRINT_OUT_DEBUG(netr_LogonUasLogon, r);
64         }
65
66         push = ndr_push_init_ctx(r);
67         if (push == NULL) {
68                 talloc_free(r);
69                 return false;
70         }
71
72         ndr_err = call->ndr_push(push, NDR_OUT, r);
73         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
74                 talloc_free(r);
75                 return false;
76         }
77
78         blob = ndr_push_blob(push);
79         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
80                 talloc_free(r);
81                 return false;
82         }
83
84         talloc_free(r);
85
86         return true;
87 }
88
89 static bool api_netr_LogonUasLogoff(pipes_struct *p)
90 {
91         const struct ndr_interface_call *call;
92         struct ndr_pull *pull;
93         struct ndr_push *push;
94         enum ndr_err_code ndr_err;
95         DATA_BLOB blob;
96         struct netr_LogonUasLogoff *r;
97
98         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONUASLOGOFF];
99
100         r = talloc(talloc_tos(), struct netr_LogonUasLogoff);
101         if (r == NULL) {
102                 return false;
103         }
104
105         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
106                 talloc_free(r);
107                 return false;
108         }
109
110         pull = ndr_pull_init_blob(&blob, r, NULL);
111         if (pull == NULL) {
112                 talloc_free(r);
113                 return false;
114         }
115
116         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
117         ndr_err = call->ndr_pull(pull, NDR_IN, r);
118         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
119                 talloc_free(r);
120                 return false;
121         }
122
123         if (DEBUGLEVEL >= 10) {
124                 NDR_PRINT_IN_DEBUG(netr_LogonUasLogoff, r);
125         }
126
127         ZERO_STRUCT(r->out);
128         r->out.info = talloc_zero(r, struct netr_UasLogoffInfo);
129         if (r->out.info == NULL) {
130                 talloc_free(r);
131                 return false;
132         }
133
134         r->out.result = _netr_LogonUasLogoff(p, r);
135
136         if (p->rng_fault_state) {
137                 talloc_free(r);
138                 /* Return true here, srv_pipe_hnd.c will take care */
139                 return true;
140         }
141
142         if (DEBUGLEVEL >= 10) {
143                 NDR_PRINT_OUT_DEBUG(netr_LogonUasLogoff, r);
144         }
145
146         push = ndr_push_init_ctx(r);
147         if (push == NULL) {
148                 talloc_free(r);
149                 return false;
150         }
151
152         ndr_err = call->ndr_push(push, NDR_OUT, r);
153         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
154                 talloc_free(r);
155                 return false;
156         }
157
158         blob = ndr_push_blob(push);
159         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
160                 talloc_free(r);
161                 return false;
162         }
163
164         talloc_free(r);
165
166         return true;
167 }
168
169 static bool api_netr_LogonSamLogon(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         DATA_BLOB blob;
176         struct netr_LogonSamLogon *r;
177
178         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGON];
179
180         r = talloc(talloc_tos(), struct netr_LogonSamLogon);
181         if (r == NULL) {
182                 return false;
183         }
184
185         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
186                 talloc_free(r);
187                 return false;
188         }
189
190         pull = ndr_pull_init_blob(&blob, r, NULL);
191         if (pull == NULL) {
192                 talloc_free(r);
193                 return false;
194         }
195
196         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
197         ndr_err = call->ndr_pull(pull, NDR_IN, r);
198         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
199                 talloc_free(r);
200                 return false;
201         }
202
203         if (DEBUGLEVEL >= 10) {
204                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogon, r);
205         }
206
207         ZERO_STRUCT(r->out);
208         r->out.return_authenticator = r->in.return_authenticator;
209         r->out.validation = talloc_zero(r, union netr_Validation);
210         if (r->out.validation == NULL) {
211                 talloc_free(r);
212                 return false;
213         }
214
215         r->out.authoritative = talloc_zero(r, uint8_t);
216         if (r->out.authoritative == NULL) {
217                 talloc_free(r);
218                 return false;
219         }
220
221         r->out.result = _netr_LogonSamLogon(p, r);
222
223         if (p->rng_fault_state) {
224                 talloc_free(r);
225                 /* Return true here, srv_pipe_hnd.c will take care */
226                 return true;
227         }
228
229         if (DEBUGLEVEL >= 10) {
230                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogon, r);
231         }
232
233         push = ndr_push_init_ctx(r);
234         if (push == NULL) {
235                 talloc_free(r);
236                 return false;
237         }
238
239         ndr_err = call->ndr_push(push, NDR_OUT, r);
240         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
241                 talloc_free(r);
242                 return false;
243         }
244
245         blob = ndr_push_blob(push);
246         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
247                 talloc_free(r);
248                 return false;
249         }
250
251         talloc_free(r);
252
253         return true;
254 }
255
256 static bool api_netr_LogonSamLogoff(pipes_struct *p)
257 {
258         const struct ndr_interface_call *call;
259         struct ndr_pull *pull;
260         struct ndr_push *push;
261         enum ndr_err_code ndr_err;
262         DATA_BLOB blob;
263         struct netr_LogonSamLogoff *r;
264
265         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGOFF];
266
267         r = talloc(talloc_tos(), struct netr_LogonSamLogoff);
268         if (r == NULL) {
269                 return false;
270         }
271
272         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
273                 talloc_free(r);
274                 return false;
275         }
276
277         pull = ndr_pull_init_blob(&blob, r, NULL);
278         if (pull == NULL) {
279                 talloc_free(r);
280                 return false;
281         }
282
283         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
284         ndr_err = call->ndr_pull(pull, NDR_IN, r);
285         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
286                 talloc_free(r);
287                 return false;
288         }
289
290         if (DEBUGLEVEL >= 10) {
291                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogoff, r);
292         }
293
294         ZERO_STRUCT(r->out);
295         r->out.return_authenticator = r->in.return_authenticator;
296         r->out.result = _netr_LogonSamLogoff(p, r);
297
298         if (p->rng_fault_state) {
299                 talloc_free(r);
300                 /* Return true here, srv_pipe_hnd.c will take care */
301                 return true;
302         }
303
304         if (DEBUGLEVEL >= 10) {
305                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogoff, r);
306         }
307
308         push = ndr_push_init_ctx(r);
309         if (push == NULL) {
310                 talloc_free(r);
311                 return false;
312         }
313
314         ndr_err = call->ndr_push(push, NDR_OUT, r);
315         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
316                 talloc_free(r);
317                 return false;
318         }
319
320         blob = ndr_push_blob(push);
321         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
322                 talloc_free(r);
323                 return false;
324         }
325
326         talloc_free(r);
327
328         return true;
329 }
330
331 static bool api_netr_ServerReqChallenge(pipes_struct *p)
332 {
333         const struct ndr_interface_call *call;
334         struct ndr_pull *pull;
335         struct ndr_push *push;
336         enum ndr_err_code ndr_err;
337         DATA_BLOB blob;
338         struct netr_ServerReqChallenge *r;
339
340         call = &ndr_table_netlogon.calls[NDR_NETR_SERVERREQCHALLENGE];
341
342         r = talloc(talloc_tos(), struct netr_ServerReqChallenge);
343         if (r == NULL) {
344                 return false;
345         }
346
347         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
348                 talloc_free(r);
349                 return false;
350         }
351
352         pull = ndr_pull_init_blob(&blob, r, NULL);
353         if (pull == NULL) {
354                 talloc_free(r);
355                 return false;
356         }
357
358         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
359         ndr_err = call->ndr_pull(pull, NDR_IN, r);
360         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
361                 talloc_free(r);
362                 return false;
363         }
364
365         if (DEBUGLEVEL >= 10) {
366                 NDR_PRINT_IN_DEBUG(netr_ServerReqChallenge, r);
367         }
368
369         ZERO_STRUCT(r->out);
370         r->out.return_credentials = talloc_zero(r, struct netr_Credential);
371         if (r->out.return_credentials == NULL) {
372                 talloc_free(r);
373                 return false;
374         }
375
376         r->out.result = _netr_ServerReqChallenge(p, r);
377
378         if (p->rng_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_OUT_DEBUG(netr_ServerReqChallenge, r);
386         }
387
388         push = ndr_push_init_ctx(r);
389         if (push == NULL) {
390                 talloc_free(r);
391                 return false;
392         }
393
394         ndr_err = call->ndr_push(push, NDR_OUT, r);
395         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
396                 talloc_free(r);
397                 return false;
398         }
399
400         blob = ndr_push_blob(push);
401         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
402                 talloc_free(r);
403                 return false;
404         }
405
406         talloc_free(r);
407
408         return true;
409 }
410
411 static bool api_netr_ServerAuthenticate(pipes_struct *p)
412 {
413         const struct ndr_interface_call *call;
414         struct ndr_pull *pull;
415         struct ndr_push *push;
416         enum ndr_err_code ndr_err;
417         DATA_BLOB blob;
418         struct netr_ServerAuthenticate *r;
419
420         call = &ndr_table_netlogon.calls[NDR_NETR_SERVERAUTHENTICATE];
421
422         r = talloc(talloc_tos(), struct netr_ServerAuthenticate);
423         if (r == NULL) {
424                 return false;
425         }
426
427         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
428                 talloc_free(r);
429                 return false;
430         }
431
432         pull = ndr_pull_init_blob(&blob, r, NULL);
433         if (pull == NULL) {
434                 talloc_free(r);
435                 return false;
436         }
437
438         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
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_IN_DEBUG(netr_ServerAuthenticate, r);
447         }
448
449         ZERO_STRUCT(r->out);
450         r->out.return_credentials = talloc_zero(r, struct netr_Credential);
451         if (r->out.return_credentials == NULL) {
452                 talloc_free(r);
453                 return false;
454         }
455
456         r->out.result = _netr_ServerAuthenticate(p, r);
457
458         if (p->rng_fault_state) {
459                 talloc_free(r);
460                 /* Return true here, srv_pipe_hnd.c will take care */
461                 return true;
462         }
463
464         if (DEBUGLEVEL >= 10) {
465                 NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate, r);
466         }
467
468         push = ndr_push_init_ctx(r);
469         if (push == NULL) {
470                 talloc_free(r);
471                 return false;
472         }
473
474         ndr_err = call->ndr_push(push, NDR_OUT, r);
475         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
476                 talloc_free(r);
477                 return false;
478         }
479
480         blob = ndr_push_blob(push);
481         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
482                 talloc_free(r);
483                 return false;
484         }
485
486         talloc_free(r);
487
488         return true;
489 }
490
491 static bool api_netr_ServerPasswordSet(pipes_struct *p)
492 {
493         const struct ndr_interface_call *call;
494         struct ndr_pull *pull;
495         struct ndr_push *push;
496         enum ndr_err_code ndr_err;
497         DATA_BLOB blob;
498         struct netr_ServerPasswordSet *r;
499
500         call = &ndr_table_netlogon.calls[NDR_NETR_SERVERPASSWORDSET];
501
502         r = talloc(talloc_tos(), struct netr_ServerPasswordSet);
503         if (r == NULL) {
504                 return false;
505         }
506
507         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
508                 talloc_free(r);
509                 return false;
510         }
511
512         pull = ndr_pull_init_blob(&blob, r, NULL);
513         if (pull == NULL) {
514                 talloc_free(r);
515                 return false;
516         }
517
518         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
519         ndr_err = call->ndr_pull(pull, NDR_IN, r);
520         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
521                 talloc_free(r);
522                 return false;
523         }
524
525         if (DEBUGLEVEL >= 10) {
526                 NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet, r);
527         }
528
529         ZERO_STRUCT(r->out);
530         r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
531         if (r->out.return_authenticator == NULL) {
532                 talloc_free(r);
533                 return false;
534         }
535
536         r->out.result = _netr_ServerPasswordSet(p, r);
537
538         if (p->rng_fault_state) {
539                 talloc_free(r);
540                 /* Return true here, srv_pipe_hnd.c will take care */
541                 return true;
542         }
543
544         if (DEBUGLEVEL >= 10) {
545                 NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet, r);
546         }
547
548         push = ndr_push_init_ctx(r);
549         if (push == NULL) {
550                 talloc_free(r);
551                 return false;
552         }
553
554         ndr_err = call->ndr_push(push, NDR_OUT, r);
555         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
556                 talloc_free(r);
557                 return false;
558         }
559
560         blob = ndr_push_blob(push);
561         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
562                 talloc_free(r);
563                 return false;
564         }
565
566         talloc_free(r);
567
568         return true;
569 }
570
571 static bool api_netr_DatabaseDeltas(pipes_struct *p)
572 {
573         const struct ndr_interface_call *call;
574         struct ndr_pull *pull;
575         struct ndr_push *push;
576         enum ndr_err_code ndr_err;
577         DATA_BLOB blob;
578         struct netr_DatabaseDeltas *r;
579
580         call = &ndr_table_netlogon.calls[NDR_NETR_DATABASEDELTAS];
581
582         r = talloc(talloc_tos(), struct netr_DatabaseDeltas);
583         if (r == NULL) {
584                 return false;
585         }
586
587         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
588                 talloc_free(r);
589                 return false;
590         }
591
592         pull = ndr_pull_init_blob(&blob, r, NULL);
593         if (pull == NULL) {
594                 talloc_free(r);
595                 return false;
596         }
597
598         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
599         ndr_err = call->ndr_pull(pull, NDR_IN, r);
600         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
601                 talloc_free(r);
602                 return false;
603         }
604
605         if (DEBUGLEVEL >= 10) {
606                 NDR_PRINT_IN_DEBUG(netr_DatabaseDeltas, r);
607         }
608
609         ZERO_STRUCT(r->out);
610         r->out.return_authenticator = r->in.return_authenticator;
611         r->out.sequence_num = r->in.sequence_num;
612         r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY *);
613         if (r->out.delta_enum_array == NULL) {
614                 talloc_free(r);
615                 return false;
616         }
617
618         r->out.result = _netr_DatabaseDeltas(p, r);
619
620         if (p->rng_fault_state) {
621                 talloc_free(r);
622                 /* Return true here, srv_pipe_hnd.c will take care */
623                 return true;
624         }
625
626         if (DEBUGLEVEL >= 10) {
627                 NDR_PRINT_OUT_DEBUG(netr_DatabaseDeltas, r);
628         }
629
630         push = ndr_push_init_ctx(r);
631         if (push == NULL) {
632                 talloc_free(r);
633                 return false;
634         }
635
636         ndr_err = call->ndr_push(push, NDR_OUT, r);
637         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
638                 talloc_free(r);
639                 return false;
640         }
641
642         blob = ndr_push_blob(push);
643         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
644                 talloc_free(r);
645                 return false;
646         }
647
648         talloc_free(r);
649
650         return true;
651 }
652
653 static bool api_netr_DatabaseSync(pipes_struct *p)
654 {
655         const struct ndr_interface_call *call;
656         struct ndr_pull *pull;
657         struct ndr_push *push;
658         enum ndr_err_code ndr_err;
659         DATA_BLOB blob;
660         struct netr_DatabaseSync *r;
661
662         call = &ndr_table_netlogon.calls[NDR_NETR_DATABASESYNC];
663
664         r = talloc(talloc_tos(), struct netr_DatabaseSync);
665         if (r == NULL) {
666                 return false;
667         }
668
669         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
670                 talloc_free(r);
671                 return false;
672         }
673
674         pull = ndr_pull_init_blob(&blob, r, NULL);
675         if (pull == NULL) {
676                 talloc_free(r);
677                 return false;
678         }
679
680         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
681         ndr_err = call->ndr_pull(pull, NDR_IN, r);
682         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
683                 talloc_free(r);
684                 return false;
685         }
686
687         if (DEBUGLEVEL >= 10) {
688                 NDR_PRINT_IN_DEBUG(netr_DatabaseSync, r);
689         }
690
691         ZERO_STRUCT(r->out);
692         r->out.return_authenticator = r->in.return_authenticator;
693         r->out.sync_context = r->in.sync_context;
694         r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY);
695         if (r->out.delta_enum_array == NULL) {
696                 talloc_free(r);
697                 return false;
698         }
699
700         r->out.result = _netr_DatabaseSync(p, r);
701
702         if (p->rng_fault_state) {
703                 talloc_free(r);
704                 /* Return true here, srv_pipe_hnd.c will take care */
705                 return true;
706         }
707
708         if (DEBUGLEVEL >= 10) {
709                 NDR_PRINT_OUT_DEBUG(netr_DatabaseSync, r);
710         }
711
712         push = ndr_push_init_ctx(r);
713         if (push == NULL) {
714                 talloc_free(r);
715                 return false;
716         }
717
718         ndr_err = call->ndr_push(push, NDR_OUT, r);
719         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
720                 talloc_free(r);
721                 return false;
722         }
723
724         blob = ndr_push_blob(push);
725         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
726                 talloc_free(r);
727                 return false;
728         }
729
730         talloc_free(r);
731
732         return true;
733 }
734
735 static bool api_netr_AccountDeltas(pipes_struct *p)
736 {
737         const struct ndr_interface_call *call;
738         struct ndr_pull *pull;
739         struct ndr_push *push;
740         enum ndr_err_code ndr_err;
741         DATA_BLOB blob;
742         struct netr_AccountDeltas *r;
743
744         call = &ndr_table_netlogon.calls[NDR_NETR_ACCOUNTDELTAS];
745
746         r = talloc(talloc_tos(), struct netr_AccountDeltas);
747         if (r == NULL) {
748                 return false;
749         }
750
751         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
752                 talloc_free(r);
753                 return false;
754         }
755
756         pull = ndr_pull_init_blob(&blob, r, NULL);
757         if (pull == NULL) {
758                 talloc_free(r);
759                 return false;
760         }
761
762         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
763         ndr_err = call->ndr_pull(pull, NDR_IN, r);
764         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
765                 talloc_free(r);
766                 return false;
767         }
768
769         if (DEBUGLEVEL >= 10) {
770                 NDR_PRINT_IN_DEBUG(netr_AccountDeltas, r);
771         }
772
773         ZERO_STRUCT(r->out);
774         r->out.return_authenticator = r->in.return_authenticator;
775         r->out.buffer = talloc_zero(r, struct netr_AccountBuffer);
776         if (r->out.buffer == NULL) {
777                 talloc_free(r);
778                 return false;
779         }
780
781         r->out.count_returned = talloc_zero(r, uint32_t);
782         if (r->out.count_returned == NULL) {
783                 talloc_free(r);
784                 return false;
785         }
786
787         r->out.total_entries = talloc_zero(r, uint32_t);
788         if (r->out.total_entries == NULL) {
789                 talloc_free(r);
790                 return false;
791         }
792
793         r->out.recordid = talloc_zero(r, struct netr_UAS_INFO_0);
794         if (r->out.recordid == NULL) {
795                 talloc_free(r);
796                 return false;
797         }
798
799         r->out.result = _netr_AccountDeltas(p, r);
800
801         if (p->rng_fault_state) {
802                 talloc_free(r);
803                 /* Return true here, srv_pipe_hnd.c will take care */
804                 return true;
805         }
806
807         if (DEBUGLEVEL >= 10) {
808                 NDR_PRINT_OUT_DEBUG(netr_AccountDeltas, r);
809         }
810
811         push = ndr_push_init_ctx(r);
812         if (push == NULL) {
813                 talloc_free(r);
814                 return false;
815         }
816
817         ndr_err = call->ndr_push(push, NDR_OUT, r);
818         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
819                 talloc_free(r);
820                 return false;
821         }
822
823         blob = ndr_push_blob(push);
824         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
825                 talloc_free(r);
826                 return false;
827         }
828
829         talloc_free(r);
830
831         return true;
832 }
833
834 static bool api_netr_AccountSync(pipes_struct *p)
835 {
836         const struct ndr_interface_call *call;
837         struct ndr_pull *pull;
838         struct ndr_push *push;
839         enum ndr_err_code ndr_err;
840         DATA_BLOB blob;
841         struct netr_AccountSync *r;
842
843         call = &ndr_table_netlogon.calls[NDR_NETR_ACCOUNTSYNC];
844
845         r = talloc(talloc_tos(), struct netr_AccountSync);
846         if (r == NULL) {
847                 return false;
848         }
849
850         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
851                 talloc_free(r);
852                 return false;
853         }
854
855         pull = ndr_pull_init_blob(&blob, r, NULL);
856         if (pull == NULL) {
857                 talloc_free(r);
858                 return false;
859         }
860
861         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
862         ndr_err = call->ndr_pull(pull, NDR_IN, r);
863         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
864                 talloc_free(r);
865                 return false;
866         }
867
868         if (DEBUGLEVEL >= 10) {
869                 NDR_PRINT_IN_DEBUG(netr_AccountSync, r);
870         }
871
872         ZERO_STRUCT(r->out);
873         r->out.return_authenticator = r->in.return_authenticator;
874         r->out.buffer = talloc_zero(r, struct netr_AccountBuffer);
875         if (r->out.buffer == NULL) {
876                 talloc_free(r);
877                 return false;
878         }
879
880         r->out.count_returned = talloc_zero(r, uint32_t);
881         if (r->out.count_returned == NULL) {
882                 talloc_free(r);
883                 return false;
884         }
885
886         r->out.total_entries = talloc_zero(r, uint32_t);
887         if (r->out.total_entries == NULL) {
888                 talloc_free(r);
889                 return false;
890         }
891
892         r->out.next_reference = talloc_zero(r, uint32_t);
893         if (r->out.next_reference == NULL) {
894                 talloc_free(r);
895                 return false;
896         }
897
898         r->out.recordid = r->in.recordid;
899         r->out.result = _netr_AccountSync(p, r);
900
901         if (p->rng_fault_state) {
902                 talloc_free(r);
903                 /* Return true here, srv_pipe_hnd.c will take care */
904                 return true;
905         }
906
907         if (DEBUGLEVEL >= 10) {
908                 NDR_PRINT_OUT_DEBUG(netr_AccountSync, r);
909         }
910
911         push = ndr_push_init_ctx(r);
912         if (push == NULL) {
913                 talloc_free(r);
914                 return false;
915         }
916
917         ndr_err = call->ndr_push(push, NDR_OUT, r);
918         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
919                 talloc_free(r);
920                 return false;
921         }
922
923         blob = ndr_push_blob(push);
924         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
925                 talloc_free(r);
926                 return false;
927         }
928
929         talloc_free(r);
930
931         return true;
932 }
933
934 static bool api_netr_GetDcName(pipes_struct *p)
935 {
936         const struct ndr_interface_call *call;
937         struct ndr_pull *pull;
938         struct ndr_push *push;
939         enum ndr_err_code ndr_err;
940         DATA_BLOB blob;
941         struct netr_GetDcName *r;
942
943         call = &ndr_table_netlogon.calls[NDR_NETR_GETDCNAME];
944
945         r = talloc(talloc_tos(), struct netr_GetDcName);
946         if (r == NULL) {
947                 return false;
948         }
949
950         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
951                 talloc_free(r);
952                 return false;
953         }
954
955         pull = ndr_pull_init_blob(&blob, r, NULL);
956         if (pull == NULL) {
957                 talloc_free(r);
958                 return false;
959         }
960
961         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
962         ndr_err = call->ndr_pull(pull, NDR_IN, r);
963         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
964                 talloc_free(r);
965                 return false;
966         }
967
968         if (DEBUGLEVEL >= 10) {
969                 NDR_PRINT_IN_DEBUG(netr_GetDcName, r);
970         }
971
972         ZERO_STRUCT(r->out);
973         r->out.dcname = talloc_zero(r, const char *);
974         if (r->out.dcname == NULL) {
975                 talloc_free(r);
976                 return false;
977         }
978
979         r->out.result = _netr_GetDcName(p, r);
980
981         if (p->rng_fault_state) {
982                 talloc_free(r);
983                 /* Return true here, srv_pipe_hnd.c will take care */
984                 return true;
985         }
986
987         if (DEBUGLEVEL >= 10) {
988                 NDR_PRINT_OUT_DEBUG(netr_GetDcName, r);
989         }
990
991         push = ndr_push_init_ctx(r);
992         if (push == NULL) {
993                 talloc_free(r);
994                 return false;
995         }
996
997         ndr_err = call->ndr_push(push, NDR_OUT, r);
998         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
999                 talloc_free(r);
1000                 return false;
1001         }
1002
1003         blob = ndr_push_blob(push);
1004         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1005                 talloc_free(r);
1006                 return false;
1007         }
1008
1009         talloc_free(r);
1010
1011         return true;
1012 }
1013
1014 static bool api_netr_LogonControl(pipes_struct *p)
1015 {
1016         const struct ndr_interface_call *call;
1017         struct ndr_pull *pull;
1018         struct ndr_push *push;
1019         enum ndr_err_code ndr_err;
1020         DATA_BLOB blob;
1021         struct netr_LogonControl *r;
1022
1023         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONCONTROL];
1024
1025         r = talloc(talloc_tos(), struct netr_LogonControl);
1026         if (r == NULL) {
1027                 return false;
1028         }
1029
1030         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1031                 talloc_free(r);
1032                 return false;
1033         }
1034
1035         pull = ndr_pull_init_blob(&blob, r, NULL);
1036         if (pull == NULL) {
1037                 talloc_free(r);
1038                 return false;
1039         }
1040
1041         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1042         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1043         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1044                 talloc_free(r);
1045                 return false;
1046         }
1047
1048         if (DEBUGLEVEL >= 10) {
1049                 NDR_PRINT_IN_DEBUG(netr_LogonControl, r);
1050         }
1051
1052         ZERO_STRUCT(r->out);
1053         r->out.info = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION);
1054         if (r->out.info == NULL) {
1055                 talloc_free(r);
1056                 return false;
1057         }
1058
1059         r->out.result = _netr_LogonControl(p, r);
1060
1061         if (p->rng_fault_state) {
1062                 talloc_free(r);
1063                 /* Return true here, srv_pipe_hnd.c will take care */
1064                 return true;
1065         }
1066
1067         if (DEBUGLEVEL >= 10) {
1068                 NDR_PRINT_OUT_DEBUG(netr_LogonControl, r);
1069         }
1070
1071         push = ndr_push_init_ctx(r);
1072         if (push == NULL) {
1073                 talloc_free(r);
1074                 return false;
1075         }
1076
1077         ndr_err = call->ndr_push(push, NDR_OUT, r);
1078         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1079                 talloc_free(r);
1080                 return false;
1081         }
1082
1083         blob = ndr_push_blob(push);
1084         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1085                 talloc_free(r);
1086                 return false;
1087         }
1088
1089         talloc_free(r);
1090
1091         return true;
1092 }
1093
1094 static bool api_netr_GetAnyDCName(pipes_struct *p)
1095 {
1096         const struct ndr_interface_call *call;
1097         struct ndr_pull *pull;
1098         struct ndr_push *push;
1099         enum ndr_err_code ndr_err;
1100         DATA_BLOB blob;
1101         struct netr_GetAnyDCName *r;
1102
1103         call = &ndr_table_netlogon.calls[NDR_NETR_GETANYDCNAME];
1104
1105         r = talloc(talloc_tos(), struct netr_GetAnyDCName);
1106         if (r == NULL) {
1107                 return false;
1108         }
1109
1110         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1111                 talloc_free(r);
1112                 return false;
1113         }
1114
1115         pull = ndr_pull_init_blob(&blob, r, NULL);
1116         if (pull == NULL) {
1117                 talloc_free(r);
1118                 return false;
1119         }
1120
1121         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1122         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1123         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1124                 talloc_free(r);
1125                 return false;
1126         }
1127
1128         if (DEBUGLEVEL >= 10) {
1129                 NDR_PRINT_IN_DEBUG(netr_GetAnyDCName, r);
1130         }
1131
1132         ZERO_STRUCT(r->out);
1133         r->out.dcname = talloc_zero(r, const char *);
1134         if (r->out.dcname == NULL) {
1135                 talloc_free(r);
1136                 return false;
1137         }
1138
1139         r->out.result = _netr_GetAnyDCName(p, r);
1140
1141         if (p->rng_fault_state) {
1142                 talloc_free(r);
1143                 /* Return true here, srv_pipe_hnd.c will take care */
1144                 return true;
1145         }
1146
1147         if (DEBUGLEVEL >= 10) {
1148                 NDR_PRINT_OUT_DEBUG(netr_GetAnyDCName, r);
1149         }
1150
1151         push = ndr_push_init_ctx(r);
1152         if (push == NULL) {
1153                 talloc_free(r);
1154                 return false;
1155         }
1156
1157         ndr_err = call->ndr_push(push, NDR_OUT, r);
1158         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1159                 talloc_free(r);
1160                 return false;
1161         }
1162
1163         blob = ndr_push_blob(push);
1164         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1165                 talloc_free(r);
1166                 return false;
1167         }
1168
1169         talloc_free(r);
1170
1171         return true;
1172 }
1173
1174 static bool api_netr_LogonControl2(pipes_struct *p)
1175 {
1176         const struct ndr_interface_call *call;
1177         struct ndr_pull *pull;
1178         struct ndr_push *push;
1179         enum ndr_err_code ndr_err;
1180         DATA_BLOB blob;
1181         struct netr_LogonControl2 *r;
1182
1183         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONCONTROL2];
1184
1185         r = talloc(talloc_tos(), struct netr_LogonControl2);
1186         if (r == NULL) {
1187                 return false;
1188         }
1189
1190         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1191                 talloc_free(r);
1192                 return false;
1193         }
1194
1195         pull = ndr_pull_init_blob(&blob, r, NULL);
1196         if (pull == NULL) {
1197                 talloc_free(r);
1198                 return false;
1199         }
1200
1201         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1202         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1203         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1204                 talloc_free(r);
1205                 return false;
1206         }
1207
1208         if (DEBUGLEVEL >= 10) {
1209                 NDR_PRINT_IN_DEBUG(netr_LogonControl2, r);
1210         }
1211
1212         ZERO_STRUCT(r->out);
1213         r->out.query = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION);
1214         if (r->out.query == NULL) {
1215                 talloc_free(r);
1216                 return false;
1217         }
1218
1219         r->out.result = _netr_LogonControl2(p, r);
1220
1221         if (p->rng_fault_state) {
1222                 talloc_free(r);
1223                 /* Return true here, srv_pipe_hnd.c will take care */
1224                 return true;
1225         }
1226
1227         if (DEBUGLEVEL >= 10) {
1228                 NDR_PRINT_OUT_DEBUG(netr_LogonControl2, r);
1229         }
1230
1231         push = ndr_push_init_ctx(r);
1232         if (push == NULL) {
1233                 talloc_free(r);
1234                 return false;
1235         }
1236
1237         ndr_err = call->ndr_push(push, NDR_OUT, r);
1238         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1239                 talloc_free(r);
1240                 return false;
1241         }
1242
1243         blob = ndr_push_blob(push);
1244         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1245                 talloc_free(r);
1246                 return false;
1247         }
1248
1249         talloc_free(r);
1250
1251         return true;
1252 }
1253
1254 static bool api_netr_ServerAuthenticate2(pipes_struct *p)
1255 {
1256         const struct ndr_interface_call *call;
1257         struct ndr_pull *pull;
1258         struct ndr_push *push;
1259         enum ndr_err_code ndr_err;
1260         DATA_BLOB blob;
1261         struct netr_ServerAuthenticate2 *r;
1262
1263         call = &ndr_table_netlogon.calls[NDR_NETR_SERVERAUTHENTICATE2];
1264
1265         r = talloc(talloc_tos(), struct netr_ServerAuthenticate2);
1266         if (r == NULL) {
1267                 return false;
1268         }
1269
1270         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1271                 talloc_free(r);
1272                 return false;
1273         }
1274
1275         pull = ndr_pull_init_blob(&blob, r, NULL);
1276         if (pull == NULL) {
1277                 talloc_free(r);
1278                 return false;
1279         }
1280
1281         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1282         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1283         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1284                 talloc_free(r);
1285                 return false;
1286         }
1287
1288         if (DEBUGLEVEL >= 10) {
1289                 NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate2, r);
1290         }
1291
1292         ZERO_STRUCT(r->out);
1293         r->out.return_credentials = talloc_zero(r, struct netr_Credential);
1294         if (r->out.return_credentials == NULL) {
1295                 talloc_free(r);
1296                 return false;
1297         }
1298
1299         r->out.negotiate_flags = r->in.negotiate_flags;
1300         r->out.result = _netr_ServerAuthenticate2(p, r);
1301
1302         if (p->rng_fault_state) {
1303                 talloc_free(r);
1304                 /* Return true here, srv_pipe_hnd.c will take care */
1305                 return true;
1306         }
1307
1308         if (DEBUGLEVEL >= 10) {
1309                 NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate2, r);
1310         }
1311
1312         push = ndr_push_init_ctx(r);
1313         if (push == NULL) {
1314                 talloc_free(r);
1315                 return false;
1316         }
1317
1318         ndr_err = call->ndr_push(push, NDR_OUT, r);
1319         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1320                 talloc_free(r);
1321                 return false;
1322         }
1323
1324         blob = ndr_push_blob(push);
1325         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1326                 talloc_free(r);
1327                 return false;
1328         }
1329
1330         talloc_free(r);
1331
1332         return true;
1333 }
1334
1335 static bool api_netr_DatabaseSync2(pipes_struct *p)
1336 {
1337         const struct ndr_interface_call *call;
1338         struct ndr_pull *pull;
1339         struct ndr_push *push;
1340         enum ndr_err_code ndr_err;
1341         DATA_BLOB blob;
1342         struct netr_DatabaseSync2 *r;
1343
1344         call = &ndr_table_netlogon.calls[NDR_NETR_DATABASESYNC2];
1345
1346         r = talloc(talloc_tos(), struct netr_DatabaseSync2);
1347         if (r == NULL) {
1348                 return false;
1349         }
1350
1351         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1352                 talloc_free(r);
1353                 return false;
1354         }
1355
1356         pull = ndr_pull_init_blob(&blob, r, NULL);
1357         if (pull == NULL) {
1358                 talloc_free(r);
1359                 return false;
1360         }
1361
1362         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1363         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1364         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1365                 talloc_free(r);
1366                 return false;
1367         }
1368
1369         if (DEBUGLEVEL >= 10) {
1370                 NDR_PRINT_IN_DEBUG(netr_DatabaseSync2, r);
1371         }
1372
1373         ZERO_STRUCT(r->out);
1374         r->out.return_authenticator = r->in.return_authenticator;
1375         r->out.sync_context = r->in.sync_context;
1376         r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY *);
1377         if (r->out.delta_enum_array == NULL) {
1378                 talloc_free(r);
1379                 return false;
1380         }
1381
1382         r->out.result = _netr_DatabaseSync2(p, r);
1383
1384         if (p->rng_fault_state) {
1385                 talloc_free(r);
1386                 /* Return true here, srv_pipe_hnd.c will take care */
1387                 return true;
1388         }
1389
1390         if (DEBUGLEVEL >= 10) {
1391                 NDR_PRINT_OUT_DEBUG(netr_DatabaseSync2, r);
1392         }
1393
1394         push = ndr_push_init_ctx(r);
1395         if (push == NULL) {
1396                 talloc_free(r);
1397                 return false;
1398         }
1399
1400         ndr_err = call->ndr_push(push, NDR_OUT, r);
1401         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1402                 talloc_free(r);
1403                 return false;
1404         }
1405
1406         blob = ndr_push_blob(push);
1407         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1408                 talloc_free(r);
1409                 return false;
1410         }
1411
1412         talloc_free(r);
1413
1414         return true;
1415 }
1416
1417 static bool api_netr_DatabaseRedo(pipes_struct *p)
1418 {
1419         const struct ndr_interface_call *call;
1420         struct ndr_pull *pull;
1421         struct ndr_push *push;
1422         enum ndr_err_code ndr_err;
1423         DATA_BLOB blob;
1424         struct netr_DatabaseRedo *r;
1425
1426         call = &ndr_table_netlogon.calls[NDR_NETR_DATABASEREDO];
1427
1428         r = talloc(talloc_tos(), struct netr_DatabaseRedo);
1429         if (r == NULL) {
1430                 return false;
1431         }
1432
1433         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1434                 talloc_free(r);
1435                 return false;
1436         }
1437
1438         pull = ndr_pull_init_blob(&blob, r, NULL);
1439         if (pull == NULL) {
1440                 talloc_free(r);
1441                 return false;
1442         }
1443
1444         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1445         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1446         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1447                 talloc_free(r);
1448                 return false;
1449         }
1450
1451         if (DEBUGLEVEL >= 10) {
1452                 NDR_PRINT_IN_DEBUG(netr_DatabaseRedo, r);
1453         }
1454
1455         ZERO_STRUCT(r->out);
1456         r->out.return_authenticator = r->in.return_authenticator;
1457         r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY);
1458         if (r->out.delta_enum_array == NULL) {
1459                 talloc_free(r);
1460                 return false;
1461         }
1462
1463         r->out.result = _netr_DatabaseRedo(p, r);
1464
1465         if (p->rng_fault_state) {
1466                 talloc_free(r);
1467                 /* Return true here, srv_pipe_hnd.c will take care */
1468                 return true;
1469         }
1470
1471         if (DEBUGLEVEL >= 10) {
1472                 NDR_PRINT_OUT_DEBUG(netr_DatabaseRedo, r);
1473         }
1474
1475         push = ndr_push_init_ctx(r);
1476         if (push == NULL) {
1477                 talloc_free(r);
1478                 return false;
1479         }
1480
1481         ndr_err = call->ndr_push(push, NDR_OUT, r);
1482         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1483                 talloc_free(r);
1484                 return false;
1485         }
1486
1487         blob = ndr_push_blob(push);
1488         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1489                 talloc_free(r);
1490                 return false;
1491         }
1492
1493         talloc_free(r);
1494
1495         return true;
1496 }
1497
1498 static bool api_netr_LogonControl2Ex(pipes_struct *p)
1499 {
1500         const struct ndr_interface_call *call;
1501         struct ndr_pull *pull;
1502         struct ndr_push *push;
1503         enum ndr_err_code ndr_err;
1504         DATA_BLOB blob;
1505         struct netr_LogonControl2Ex *r;
1506
1507         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONCONTROL2EX];
1508
1509         r = talloc(talloc_tos(), struct netr_LogonControl2Ex);
1510         if (r == NULL) {
1511                 return false;
1512         }
1513
1514         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1515                 talloc_free(r);
1516                 return false;
1517         }
1518
1519         pull = ndr_pull_init_blob(&blob, r, NULL);
1520         if (pull == NULL) {
1521                 talloc_free(r);
1522                 return false;
1523         }
1524
1525         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1526         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1527         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1528                 talloc_free(r);
1529                 return false;
1530         }
1531
1532         if (DEBUGLEVEL >= 10) {
1533                 NDR_PRINT_IN_DEBUG(netr_LogonControl2Ex, r);
1534         }
1535
1536         ZERO_STRUCT(r->out);
1537         r->out.query = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION);
1538         if (r->out.query == NULL) {
1539                 talloc_free(r);
1540                 return false;
1541         }
1542
1543         r->out.result = _netr_LogonControl2Ex(p, r);
1544
1545         if (p->rng_fault_state) {
1546                 talloc_free(r);
1547                 /* Return true here, srv_pipe_hnd.c will take care */
1548                 return true;
1549         }
1550
1551         if (DEBUGLEVEL >= 10) {
1552                 NDR_PRINT_OUT_DEBUG(netr_LogonControl2Ex, r);
1553         }
1554
1555         push = ndr_push_init_ctx(r);
1556         if (push == NULL) {
1557                 talloc_free(r);
1558                 return false;
1559         }
1560
1561         ndr_err = call->ndr_push(push, NDR_OUT, r);
1562         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1563                 talloc_free(r);
1564                 return false;
1565         }
1566
1567         blob = ndr_push_blob(push);
1568         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1569                 talloc_free(r);
1570                 return false;
1571         }
1572
1573         talloc_free(r);
1574
1575         return true;
1576 }
1577
1578 static bool api_netr_NetrEnumerateTrustedDomains(pipes_struct *p)
1579 {
1580         const struct ndr_interface_call *call;
1581         struct ndr_pull *pull;
1582         struct ndr_push *push;
1583         enum ndr_err_code ndr_err;
1584         DATA_BLOB blob;
1585         struct netr_NetrEnumerateTrustedDomains *r;
1586
1587         call = &ndr_table_netlogon.calls[NDR_NETR_NETRENUMERATETRUSTEDDOMAINS];
1588
1589         r = talloc(talloc_tos(), struct netr_NetrEnumerateTrustedDomains);
1590         if (r == NULL) {
1591                 return false;
1592         }
1593
1594         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1595                 talloc_free(r);
1596                 return false;
1597         }
1598
1599         pull = ndr_pull_init_blob(&blob, r, NULL);
1600         if (pull == NULL) {
1601                 talloc_free(r);
1602                 return false;
1603         }
1604
1605         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1606         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1607         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1608                 talloc_free(r);
1609                 return false;
1610         }
1611
1612         if (DEBUGLEVEL >= 10) {
1613                 NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomains, r);
1614         }
1615
1616         ZERO_STRUCT(r->out);
1617         r->out.trusted_domains_blob = talloc_zero(r, struct netr_Blob);
1618         if (r->out.trusted_domains_blob == NULL) {
1619                 talloc_free(r);
1620                 return false;
1621         }
1622
1623         r->out.result = _netr_NetrEnumerateTrustedDomains(p, r);
1624
1625         if (p->rng_fault_state) {
1626                 talloc_free(r);
1627                 /* Return true here, srv_pipe_hnd.c will take care */
1628                 return true;
1629         }
1630
1631         if (DEBUGLEVEL >= 10) {
1632                 NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomains, r);
1633         }
1634
1635         push = ndr_push_init_ctx(r);
1636         if (push == NULL) {
1637                 talloc_free(r);
1638                 return false;
1639         }
1640
1641         ndr_err = call->ndr_push(push, NDR_OUT, r);
1642         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1643                 talloc_free(r);
1644                 return false;
1645         }
1646
1647         blob = ndr_push_blob(push);
1648         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1649                 talloc_free(r);
1650                 return false;
1651         }
1652
1653         talloc_free(r);
1654
1655         return true;
1656 }
1657
1658 static bool api_netr_DsRGetDCName(pipes_struct *p)
1659 {
1660         const struct ndr_interface_call *call;
1661         struct ndr_pull *pull;
1662         struct ndr_push *push;
1663         enum ndr_err_code ndr_err;
1664         DATA_BLOB blob;
1665         struct netr_DsRGetDCName *r;
1666
1667         call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAME];
1668
1669         r = talloc(talloc_tos(), struct netr_DsRGetDCName);
1670         if (r == NULL) {
1671                 return false;
1672         }
1673
1674         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1675                 talloc_free(r);
1676                 return false;
1677         }
1678
1679         pull = ndr_pull_init_blob(&blob, r, NULL);
1680         if (pull == NULL) {
1681                 talloc_free(r);
1682                 return false;
1683         }
1684
1685         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1686         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1687         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1688                 talloc_free(r);
1689                 return false;
1690         }
1691
1692         if (DEBUGLEVEL >= 10) {
1693                 NDR_PRINT_IN_DEBUG(netr_DsRGetDCName, r);
1694         }
1695
1696         ZERO_STRUCT(r->out);
1697         r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo *);
1698         if (r->out.info == NULL) {
1699                 talloc_free(r);
1700                 return false;
1701         }
1702
1703         r->out.result = _netr_DsRGetDCName(p, r);
1704
1705         if (p->rng_fault_state) {
1706                 talloc_free(r);
1707                 /* Return true here, srv_pipe_hnd.c will take care */
1708                 return true;
1709         }
1710
1711         if (DEBUGLEVEL >= 10) {
1712                 NDR_PRINT_OUT_DEBUG(netr_DsRGetDCName, r);
1713         }
1714
1715         push = ndr_push_init_ctx(r);
1716         if (push == NULL) {
1717                 talloc_free(r);
1718                 return false;
1719         }
1720
1721         ndr_err = call->ndr_push(push, NDR_OUT, r);
1722         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1723                 talloc_free(r);
1724                 return false;
1725         }
1726
1727         blob = ndr_push_blob(push);
1728         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1729                 talloc_free(r);
1730                 return false;
1731         }
1732
1733         talloc_free(r);
1734
1735         return true;
1736 }
1737
1738 static bool api_netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p)
1739 {
1740         const struct ndr_interface_call *call;
1741         struct ndr_pull *pull;
1742         struct ndr_push *push;
1743         enum ndr_err_code ndr_err;
1744         DATA_BLOB blob;
1745         struct netr_NETRLOGONDUMMYROUTINE1 *r;
1746
1747         call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONDUMMYROUTINE1];
1748
1749         r = talloc(talloc_tos(), struct netr_NETRLOGONDUMMYROUTINE1);
1750         if (r == NULL) {
1751                 return false;
1752         }
1753
1754         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1755                 talloc_free(r);
1756                 return false;
1757         }
1758
1759         pull = ndr_pull_init_blob(&blob, r, NULL);
1760         if (pull == NULL) {
1761                 talloc_free(r);
1762                 return false;
1763         }
1764
1765         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1766         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1767         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1768                 talloc_free(r);
1769                 return false;
1770         }
1771
1772         if (DEBUGLEVEL >= 10) {
1773                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONDUMMYROUTINE1, r);
1774         }
1775
1776         r->out.result = _netr_NETRLOGONDUMMYROUTINE1(p, r);
1777
1778         if (p->rng_fault_state) {
1779                 talloc_free(r);
1780                 /* Return true here, srv_pipe_hnd.c will take care */
1781                 return true;
1782         }
1783
1784         if (DEBUGLEVEL >= 10) {
1785                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONDUMMYROUTINE1, r);
1786         }
1787
1788         push = ndr_push_init_ctx(r);
1789         if (push == NULL) {
1790                 talloc_free(r);
1791                 return false;
1792         }
1793
1794         ndr_err = call->ndr_push(push, NDR_OUT, r);
1795         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1796                 talloc_free(r);
1797                 return false;
1798         }
1799
1800         blob = ndr_push_blob(push);
1801         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1802                 talloc_free(r);
1803                 return false;
1804         }
1805
1806         talloc_free(r);
1807
1808         return true;
1809 }
1810
1811 static bool api_netr_NETRLOGONSETSERVICEBITS(pipes_struct *p)
1812 {
1813         const struct ndr_interface_call *call;
1814         struct ndr_pull *pull;
1815         struct ndr_push *push;
1816         enum ndr_err_code ndr_err;
1817         DATA_BLOB blob;
1818         struct netr_NETRLOGONSETSERVICEBITS *r;
1819
1820         call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONSETSERVICEBITS];
1821
1822         r = talloc(talloc_tos(), struct netr_NETRLOGONSETSERVICEBITS);
1823         if (r == NULL) {
1824                 return false;
1825         }
1826
1827         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1828                 talloc_free(r);
1829                 return false;
1830         }
1831
1832         pull = ndr_pull_init_blob(&blob, r, NULL);
1833         if (pull == NULL) {
1834                 talloc_free(r);
1835                 return false;
1836         }
1837
1838         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1839         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1840         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1841                 talloc_free(r);
1842                 return false;
1843         }
1844
1845         if (DEBUGLEVEL >= 10) {
1846                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONSETSERVICEBITS, r);
1847         }
1848
1849         r->out.result = _netr_NETRLOGONSETSERVICEBITS(p, r);
1850
1851         if (p->rng_fault_state) {
1852                 talloc_free(r);
1853                 /* Return true here, srv_pipe_hnd.c will take care */
1854                 return true;
1855         }
1856
1857         if (DEBUGLEVEL >= 10) {
1858                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSETSERVICEBITS, r);
1859         }
1860
1861         push = ndr_push_init_ctx(r);
1862         if (push == NULL) {
1863                 talloc_free(r);
1864                 return false;
1865         }
1866
1867         ndr_err = call->ndr_push(push, NDR_OUT, r);
1868         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1869                 talloc_free(r);
1870                 return false;
1871         }
1872
1873         blob = ndr_push_blob(push);
1874         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1875                 talloc_free(r);
1876                 return false;
1877         }
1878
1879         talloc_free(r);
1880
1881         return true;
1882 }
1883
1884 static bool api_netr_LogonGetTrustRid(pipes_struct *p)
1885 {
1886         const struct ndr_interface_call *call;
1887         struct ndr_pull *pull;
1888         struct ndr_push *push;
1889         enum ndr_err_code ndr_err;
1890         DATA_BLOB blob;
1891         struct netr_LogonGetTrustRid *r;
1892
1893         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONGETTRUSTRID];
1894
1895         r = talloc(talloc_tos(), struct netr_LogonGetTrustRid);
1896         if (r == NULL) {
1897                 return false;
1898         }
1899
1900         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1901                 talloc_free(r);
1902                 return false;
1903         }
1904
1905         pull = ndr_pull_init_blob(&blob, r, NULL);
1906         if (pull == NULL) {
1907                 talloc_free(r);
1908                 return false;
1909         }
1910
1911         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1912         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1913         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1914                 talloc_free(r);
1915                 return false;
1916         }
1917
1918         if (DEBUGLEVEL >= 10) {
1919                 NDR_PRINT_IN_DEBUG(netr_LogonGetTrustRid, r);
1920         }
1921
1922         ZERO_STRUCT(r->out);
1923         r->out.rid = talloc_zero(r, uint32_t);
1924         if (r->out.rid == NULL) {
1925                 talloc_free(r);
1926                 return false;
1927         }
1928
1929         r->out.result = _netr_LogonGetTrustRid(p, r);
1930
1931         if (p->rng_fault_state) {
1932                 talloc_free(r);
1933                 /* Return true here, srv_pipe_hnd.c will take care */
1934                 return true;
1935         }
1936
1937         if (DEBUGLEVEL >= 10) {
1938                 NDR_PRINT_OUT_DEBUG(netr_LogonGetTrustRid, r);
1939         }
1940
1941         push = ndr_push_init_ctx(r);
1942         if (push == NULL) {
1943                 talloc_free(r);
1944                 return false;
1945         }
1946
1947         ndr_err = call->ndr_push(push, NDR_OUT, r);
1948         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1949                 talloc_free(r);
1950                 return false;
1951         }
1952
1953         blob = ndr_push_blob(push);
1954         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1955                 talloc_free(r);
1956                 return false;
1957         }
1958
1959         talloc_free(r);
1960
1961         return true;
1962 }
1963
1964 static bool api_netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p)
1965 {
1966         const struct ndr_interface_call *call;
1967         struct ndr_pull *pull;
1968         struct ndr_push *push;
1969         enum ndr_err_code ndr_err;
1970         DATA_BLOB blob;
1971         struct netr_NETRLOGONCOMPUTESERVERDIGEST *r;
1972
1973         call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST];
1974
1975         r = talloc(talloc_tos(), struct netr_NETRLOGONCOMPUTESERVERDIGEST);
1976         if (r == NULL) {
1977                 return false;
1978         }
1979
1980         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1981                 talloc_free(r);
1982                 return false;
1983         }
1984
1985         pull = ndr_pull_init_blob(&blob, r, NULL);
1986         if (pull == NULL) {
1987                 talloc_free(r);
1988                 return false;
1989         }
1990
1991         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1992         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1993         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1994                 talloc_free(r);
1995                 return false;
1996         }
1997
1998         if (DEBUGLEVEL >= 10) {
1999                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, r);
2000         }
2001
2002         r->out.result = _netr_NETRLOGONCOMPUTESERVERDIGEST(p, r);
2003
2004         if (p->rng_fault_state) {
2005                 talloc_free(r);
2006                 /* Return true here, srv_pipe_hnd.c will take care */
2007                 return true;
2008         }
2009
2010         if (DEBUGLEVEL >= 10) {
2011                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, r);
2012         }
2013
2014         push = ndr_push_init_ctx(r);
2015         if (push == NULL) {
2016                 talloc_free(r);
2017                 return false;
2018         }
2019
2020         ndr_err = call->ndr_push(push, NDR_OUT, r);
2021         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2022                 talloc_free(r);
2023                 return false;
2024         }
2025
2026         blob = ndr_push_blob(push);
2027         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2028                 talloc_free(r);
2029                 return false;
2030         }
2031
2032         talloc_free(r);
2033
2034         return true;
2035 }
2036
2037 static bool api_netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p)
2038 {
2039         const struct ndr_interface_call *call;
2040         struct ndr_pull *pull;
2041         struct ndr_push *push;
2042         enum ndr_err_code ndr_err;
2043         DATA_BLOB blob;
2044         struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r;
2045
2046         call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST];
2047
2048         r = talloc(talloc_tos(), struct netr_NETRLOGONCOMPUTECLIENTDIGEST);
2049         if (r == NULL) {
2050                 return false;
2051         }
2052
2053         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2054                 talloc_free(r);
2055                 return false;
2056         }
2057
2058         pull = ndr_pull_init_blob(&blob, r, NULL);
2059         if (pull == NULL) {
2060                 talloc_free(r);
2061                 return false;
2062         }
2063
2064         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2065         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2066         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2067                 talloc_free(r);
2068                 return false;
2069         }
2070
2071         if (DEBUGLEVEL >= 10) {
2072                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, r);
2073         }
2074
2075         r->out.result = _netr_NETRLOGONCOMPUTECLIENTDIGEST(p, r);
2076
2077         if (p->rng_fault_state) {
2078                 talloc_free(r);
2079                 /* Return true here, srv_pipe_hnd.c will take care */
2080                 return true;
2081         }
2082
2083         if (DEBUGLEVEL >= 10) {
2084                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, r);
2085         }
2086
2087         push = ndr_push_init_ctx(r);
2088         if (push == NULL) {
2089                 talloc_free(r);
2090                 return false;
2091         }
2092
2093         ndr_err = call->ndr_push(push, NDR_OUT, r);
2094         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2095                 talloc_free(r);
2096                 return false;
2097         }
2098
2099         blob = ndr_push_blob(push);
2100         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2101                 talloc_free(r);
2102                 return false;
2103         }
2104
2105         talloc_free(r);
2106
2107         return true;
2108 }
2109
2110 static bool api_netr_ServerAuthenticate3(pipes_struct *p)
2111 {
2112         const struct ndr_interface_call *call;
2113         struct ndr_pull *pull;
2114         struct ndr_push *push;
2115         enum ndr_err_code ndr_err;
2116         DATA_BLOB blob;
2117         struct netr_ServerAuthenticate3 *r;
2118
2119         call = &ndr_table_netlogon.calls[NDR_NETR_SERVERAUTHENTICATE3];
2120
2121         r = talloc(talloc_tos(), struct netr_ServerAuthenticate3);
2122         if (r == NULL) {
2123                 return false;
2124         }
2125
2126         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2127                 talloc_free(r);
2128                 return false;
2129         }
2130
2131         pull = ndr_pull_init_blob(&blob, r, NULL);
2132         if (pull == NULL) {
2133                 talloc_free(r);
2134                 return false;
2135         }
2136
2137         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2138         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2139         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2140                 talloc_free(r);
2141                 return false;
2142         }
2143
2144         if (DEBUGLEVEL >= 10) {
2145                 NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate3, r);
2146         }
2147
2148         ZERO_STRUCT(r->out);
2149         r->out.credentials = r->in.credentials;
2150         r->out.negotiate_flags = r->in.negotiate_flags;
2151         r->out.rid = talloc_zero(r, uint32_t);
2152         if (r->out.rid == NULL) {
2153                 talloc_free(r);
2154                 return false;
2155         }
2156
2157         r->out.result = _netr_ServerAuthenticate3(p, r);
2158
2159         if (p->rng_fault_state) {
2160                 talloc_free(r);
2161                 /* Return true here, srv_pipe_hnd.c will take care */
2162                 return true;
2163         }
2164
2165         if (DEBUGLEVEL >= 10) {
2166                 NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate3, r);
2167         }
2168
2169         push = ndr_push_init_ctx(r);
2170         if (push == NULL) {
2171                 talloc_free(r);
2172                 return false;
2173         }
2174
2175         ndr_err = call->ndr_push(push, NDR_OUT, r);
2176         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2177                 talloc_free(r);
2178                 return false;
2179         }
2180
2181         blob = ndr_push_blob(push);
2182         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2183                 talloc_free(r);
2184                 return false;
2185         }
2186
2187         talloc_free(r);
2188
2189         return true;
2190 }
2191
2192 static bool api_netr_DsRGetDCNameEx(pipes_struct *p)
2193 {
2194         const struct ndr_interface_call *call;
2195         struct ndr_pull *pull;
2196         struct ndr_push *push;
2197         enum ndr_err_code ndr_err;
2198         DATA_BLOB blob;
2199         struct netr_DsRGetDCNameEx *r;
2200
2201         call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAMEEX];
2202
2203         r = talloc(talloc_tos(), struct netr_DsRGetDCNameEx);
2204         if (r == NULL) {
2205                 return false;
2206         }
2207
2208         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2209                 talloc_free(r);
2210                 return false;
2211         }
2212
2213         pull = ndr_pull_init_blob(&blob, r, NULL);
2214         if (pull == NULL) {
2215                 talloc_free(r);
2216                 return false;
2217         }
2218
2219         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2220         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2221         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2222                 talloc_free(r);
2223                 return false;
2224         }
2225
2226         if (DEBUGLEVEL >= 10) {
2227                 NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx, r);
2228         }
2229
2230         ZERO_STRUCT(r->out);
2231         r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo *);
2232         if (r->out.info == NULL) {
2233                 talloc_free(r);
2234                 return false;
2235         }
2236
2237         r->out.result = _netr_DsRGetDCNameEx(p, r);
2238
2239         if (p->rng_fault_state) {
2240                 talloc_free(r);
2241                 /* Return true here, srv_pipe_hnd.c will take care */
2242                 return true;
2243         }
2244
2245         if (DEBUGLEVEL >= 10) {
2246                 NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx, r);
2247         }
2248
2249         push = ndr_push_init_ctx(r);
2250         if (push == NULL) {
2251                 talloc_free(r);
2252                 return false;
2253         }
2254
2255         ndr_err = call->ndr_push(push, NDR_OUT, r);
2256         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2257                 talloc_free(r);
2258                 return false;
2259         }
2260
2261         blob = ndr_push_blob(push);
2262         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2263                 talloc_free(r);
2264                 return false;
2265         }
2266
2267         talloc_free(r);
2268
2269         return true;
2270 }
2271
2272 static bool api_netr_DsRGetSiteName(pipes_struct *p)
2273 {
2274         const struct ndr_interface_call *call;
2275         struct ndr_pull *pull;
2276         struct ndr_push *push;
2277         enum ndr_err_code ndr_err;
2278         DATA_BLOB blob;
2279         struct netr_DsRGetSiteName *r;
2280
2281         call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETSITENAME];
2282
2283         r = talloc(talloc_tos(), struct netr_DsRGetSiteName);
2284         if (r == NULL) {
2285                 return false;
2286         }
2287
2288         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2289                 talloc_free(r);
2290                 return false;
2291         }
2292
2293         pull = ndr_pull_init_blob(&blob, r, NULL);
2294         if (pull == NULL) {
2295                 talloc_free(r);
2296                 return false;
2297         }
2298
2299         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2300         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2301         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2302                 talloc_free(r);
2303                 return false;
2304         }
2305
2306         if (DEBUGLEVEL >= 10) {
2307                 NDR_PRINT_IN_DEBUG(netr_DsRGetSiteName, r);
2308         }
2309
2310         ZERO_STRUCT(r->out);
2311         r->out.site = talloc_zero(r, const char *);
2312         if (r->out.site == NULL) {
2313                 talloc_free(r);
2314                 return false;
2315         }
2316
2317         r->out.result = _netr_DsRGetSiteName(p, r);
2318
2319         if (p->rng_fault_state) {
2320                 talloc_free(r);
2321                 /* Return true here, srv_pipe_hnd.c will take care */
2322                 return true;
2323         }
2324
2325         if (DEBUGLEVEL >= 10) {
2326                 NDR_PRINT_OUT_DEBUG(netr_DsRGetSiteName, r);
2327         }
2328
2329         push = ndr_push_init_ctx(r);
2330         if (push == NULL) {
2331                 talloc_free(r);
2332                 return false;
2333         }
2334
2335         ndr_err = call->ndr_push(push, NDR_OUT, r);
2336         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2337                 talloc_free(r);
2338                 return false;
2339         }
2340
2341         blob = ndr_push_blob(push);
2342         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2343                 talloc_free(r);
2344                 return false;
2345         }
2346
2347         talloc_free(r);
2348
2349         return true;
2350 }
2351
2352 static bool api_netr_LogonGetDomainInfo(pipes_struct *p)
2353 {
2354         const struct ndr_interface_call *call;
2355         struct ndr_pull *pull;
2356         struct ndr_push *push;
2357         enum ndr_err_code ndr_err;
2358         DATA_BLOB blob;
2359         struct netr_LogonGetDomainInfo *r;
2360
2361         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONGETDOMAININFO];
2362
2363         r = talloc(talloc_tos(), struct netr_LogonGetDomainInfo);
2364         if (r == NULL) {
2365                 return false;
2366         }
2367
2368         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2369                 talloc_free(r);
2370                 return false;
2371         }
2372
2373         pull = ndr_pull_init_blob(&blob, r, NULL);
2374         if (pull == NULL) {
2375                 talloc_free(r);
2376                 return false;
2377         }
2378
2379         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2380         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2381         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2382                 talloc_free(r);
2383                 return false;
2384         }
2385
2386         if (DEBUGLEVEL >= 10) {
2387                 NDR_PRINT_IN_DEBUG(netr_LogonGetDomainInfo, r);
2388         }
2389
2390         ZERO_STRUCT(r->out);
2391         r->out.return_authenticator = r->in.return_authenticator;
2392         r->out.info = talloc_zero(r, union netr_DomainInfo);
2393         if (r->out.info == NULL) {
2394                 talloc_free(r);
2395                 return false;
2396         }
2397
2398         r->out.result = _netr_LogonGetDomainInfo(p, r);
2399
2400         if (p->rng_fault_state) {
2401                 talloc_free(r);
2402                 /* Return true here, srv_pipe_hnd.c will take care */
2403                 return true;
2404         }
2405
2406         if (DEBUGLEVEL >= 10) {
2407                 NDR_PRINT_OUT_DEBUG(netr_LogonGetDomainInfo, r);
2408         }
2409
2410         push = ndr_push_init_ctx(r);
2411         if (push == NULL) {
2412                 talloc_free(r);
2413                 return false;
2414         }
2415
2416         ndr_err = call->ndr_push(push, NDR_OUT, r);
2417         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2418                 talloc_free(r);
2419                 return false;
2420         }
2421
2422         blob = ndr_push_blob(push);
2423         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2424                 talloc_free(r);
2425                 return false;
2426         }
2427
2428         talloc_free(r);
2429
2430         return true;
2431 }
2432
2433 static bool api_netr_ServerPasswordSet2(pipes_struct *p)
2434 {
2435         const struct ndr_interface_call *call;
2436         struct ndr_pull *pull;
2437         struct ndr_push *push;
2438         enum ndr_err_code ndr_err;
2439         DATA_BLOB blob;
2440         struct netr_ServerPasswordSet2 *r;
2441
2442         call = &ndr_table_netlogon.calls[NDR_NETR_SERVERPASSWORDSET2];
2443
2444         r = talloc(talloc_tos(), struct netr_ServerPasswordSet2);
2445         if (r == NULL) {
2446                 return false;
2447         }
2448
2449         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2450                 talloc_free(r);
2451                 return false;
2452         }
2453
2454         pull = ndr_pull_init_blob(&blob, r, NULL);
2455         if (pull == NULL) {
2456                 talloc_free(r);
2457                 return false;
2458         }
2459
2460         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2461         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2462         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2463                 talloc_free(r);
2464                 return false;
2465         }
2466
2467         if (DEBUGLEVEL >= 10) {
2468                 NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet2, r);
2469         }
2470
2471         ZERO_STRUCT(r->out);
2472         r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
2473         if (r->out.return_authenticator == NULL) {
2474                 talloc_free(r);
2475                 return false;
2476         }
2477
2478         r->out.result = _netr_ServerPasswordSet2(p, r);
2479
2480         if (p->rng_fault_state) {
2481                 talloc_free(r);
2482                 /* Return true here, srv_pipe_hnd.c will take care */
2483                 return true;
2484         }
2485
2486         if (DEBUGLEVEL >= 10) {
2487                 NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet2, r);
2488         }
2489
2490         push = ndr_push_init_ctx(r);
2491         if (push == NULL) {
2492                 talloc_free(r);
2493                 return false;
2494         }
2495
2496         ndr_err = call->ndr_push(push, NDR_OUT, r);
2497         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2498                 talloc_free(r);
2499                 return false;
2500         }
2501
2502         blob = ndr_push_blob(push);
2503         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2504                 talloc_free(r);
2505                 return false;
2506         }
2507
2508         talloc_free(r);
2509
2510         return true;
2511 }
2512
2513 static bool api_netr_ServerPasswordGet(pipes_struct *p)
2514 {
2515         const struct ndr_interface_call *call;
2516         struct ndr_pull *pull;
2517         struct ndr_push *push;
2518         enum ndr_err_code ndr_err;
2519         DATA_BLOB blob;
2520         struct netr_ServerPasswordGet *r;
2521
2522         call = &ndr_table_netlogon.calls[NDR_NETR_SERVERPASSWORDGET];
2523
2524         r = talloc(talloc_tos(), struct netr_ServerPasswordGet);
2525         if (r == NULL) {
2526                 return false;
2527         }
2528
2529         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2530                 talloc_free(r);
2531                 return false;
2532         }
2533
2534         pull = ndr_pull_init_blob(&blob, r, NULL);
2535         if (pull == NULL) {
2536                 talloc_free(r);
2537                 return false;
2538         }
2539
2540         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2541         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2542         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2543                 talloc_free(r);
2544                 return false;
2545         }
2546
2547         if (DEBUGLEVEL >= 10) {
2548                 NDR_PRINT_IN_DEBUG(netr_ServerPasswordGet, r);
2549         }
2550
2551         ZERO_STRUCT(r->out);
2552         r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
2553         if (r->out.return_authenticator == NULL) {
2554                 talloc_free(r);
2555                 return false;
2556         }
2557
2558         r->out.password = talloc_zero(r, struct samr_Password);
2559         if (r->out.password == NULL) {
2560                 talloc_free(r);
2561                 return false;
2562         }
2563
2564         r->out.result = _netr_ServerPasswordGet(p, r);
2565
2566         if (p->rng_fault_state) {
2567                 talloc_free(r);
2568                 /* Return true here, srv_pipe_hnd.c will take care */
2569                 return true;
2570         }
2571
2572         if (DEBUGLEVEL >= 10) {
2573                 NDR_PRINT_OUT_DEBUG(netr_ServerPasswordGet, r);
2574         }
2575
2576         push = ndr_push_init_ctx(r);
2577         if (push == NULL) {
2578                 talloc_free(r);
2579                 return false;
2580         }
2581
2582         ndr_err = call->ndr_push(push, NDR_OUT, r);
2583         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2584                 talloc_free(r);
2585                 return false;
2586         }
2587
2588         blob = ndr_push_blob(push);
2589         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2590                 talloc_free(r);
2591                 return false;
2592         }
2593
2594         talloc_free(r);
2595
2596         return true;
2597 }
2598
2599 static bool api_netr_NETRLOGONSENDTOSAM(pipes_struct *p)
2600 {
2601         const struct ndr_interface_call *call;
2602         struct ndr_pull *pull;
2603         struct ndr_push *push;
2604         enum ndr_err_code ndr_err;
2605         DATA_BLOB blob;
2606         struct netr_NETRLOGONSENDTOSAM *r;
2607
2608         call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONSENDTOSAM];
2609
2610         r = talloc(talloc_tos(), struct netr_NETRLOGONSENDTOSAM);
2611         if (r == NULL) {
2612                 return false;
2613         }
2614
2615         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2616                 talloc_free(r);
2617                 return false;
2618         }
2619
2620         pull = ndr_pull_init_blob(&blob, r, NULL);
2621         if (pull == NULL) {
2622                 talloc_free(r);
2623                 return false;
2624         }
2625
2626         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2627         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2628         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2629                 talloc_free(r);
2630                 return false;
2631         }
2632
2633         if (DEBUGLEVEL >= 10) {
2634                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONSENDTOSAM, r);
2635         }
2636
2637         r->out.result = _netr_NETRLOGONSENDTOSAM(p, r);
2638
2639         if (p->rng_fault_state) {
2640                 talloc_free(r);
2641                 /* Return true here, srv_pipe_hnd.c will take care */
2642                 return true;
2643         }
2644
2645         if (DEBUGLEVEL >= 10) {
2646                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSENDTOSAM, r);
2647         }
2648
2649         push = ndr_push_init_ctx(r);
2650         if (push == NULL) {
2651                 talloc_free(r);
2652                 return false;
2653         }
2654
2655         ndr_err = call->ndr_push(push, NDR_OUT, r);
2656         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2657                 talloc_free(r);
2658                 return false;
2659         }
2660
2661         blob = ndr_push_blob(push);
2662         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2663                 talloc_free(r);
2664                 return false;
2665         }
2666
2667         talloc_free(r);
2668
2669         return true;
2670 }
2671
2672 static bool api_netr_DsRAddressToSitenamesW(pipes_struct *p)
2673 {
2674         const struct ndr_interface_call *call;
2675         struct ndr_pull *pull;
2676         struct ndr_push *push;
2677         enum ndr_err_code ndr_err;
2678         DATA_BLOB blob;
2679         struct netr_DsRAddressToSitenamesW *r;
2680
2681         call = &ndr_table_netlogon.calls[NDR_NETR_DSRADDRESSTOSITENAMESW];
2682
2683         r = talloc(talloc_tos(), struct netr_DsRAddressToSitenamesW);
2684         if (r == NULL) {
2685                 return false;
2686         }
2687
2688         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2689                 talloc_free(r);
2690                 return false;
2691         }
2692
2693         pull = ndr_pull_init_blob(&blob, r, NULL);
2694         if (pull == NULL) {
2695                 talloc_free(r);
2696                 return false;
2697         }
2698
2699         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2700         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2701         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2702                 talloc_free(r);
2703                 return false;
2704         }
2705
2706         if (DEBUGLEVEL >= 10) {
2707                 NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesW, r);
2708         }
2709
2710         ZERO_STRUCT(r->out);
2711         r->out.ctr = talloc_zero(r, struct netr_DsRAddressToSitenamesWCtr *);
2712         if (r->out.ctr == NULL) {
2713                 talloc_free(r);
2714                 return false;
2715         }
2716
2717         r->out.result = _netr_DsRAddressToSitenamesW(p, r);
2718
2719         if (p->rng_fault_state) {
2720                 talloc_free(r);
2721                 /* Return true here, srv_pipe_hnd.c will take care */
2722                 return true;
2723         }
2724
2725         if (DEBUGLEVEL >= 10) {
2726                 NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesW, r);
2727         }
2728
2729         push = ndr_push_init_ctx(r);
2730         if (push == NULL) {
2731                 talloc_free(r);
2732                 return false;
2733         }
2734
2735         ndr_err = call->ndr_push(push, NDR_OUT, r);
2736         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2737                 talloc_free(r);
2738                 return false;
2739         }
2740
2741         blob = ndr_push_blob(push);
2742         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2743                 talloc_free(r);
2744                 return false;
2745         }
2746
2747         talloc_free(r);
2748
2749         return true;
2750 }
2751
2752 static bool api_netr_DsRGetDCNameEx2(pipes_struct *p)
2753 {
2754         const struct ndr_interface_call *call;
2755         struct ndr_pull *pull;
2756         struct ndr_push *push;
2757         enum ndr_err_code ndr_err;
2758         DATA_BLOB blob;
2759         struct netr_DsRGetDCNameEx2 *r;
2760
2761         call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAMEEX2];
2762
2763         r = talloc(talloc_tos(), struct netr_DsRGetDCNameEx2);
2764         if (r == NULL) {
2765                 return false;
2766         }
2767
2768         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2769                 talloc_free(r);
2770                 return false;
2771         }
2772
2773         pull = ndr_pull_init_blob(&blob, r, NULL);
2774         if (pull == NULL) {
2775                 talloc_free(r);
2776                 return false;
2777         }
2778
2779         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2780         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2781         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2782                 talloc_free(r);
2783                 return false;
2784         }
2785
2786         if (DEBUGLEVEL >= 10) {
2787                 NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx2, r);
2788         }
2789
2790         ZERO_STRUCT(r->out);
2791         r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo *);
2792         if (r->out.info == NULL) {
2793                 talloc_free(r);
2794                 return false;
2795         }
2796
2797         r->out.result = _netr_DsRGetDCNameEx2(p, r);
2798
2799         if (p->rng_fault_state) {
2800                 talloc_free(r);
2801                 /* Return true here, srv_pipe_hnd.c will take care */
2802                 return true;
2803         }
2804
2805         if (DEBUGLEVEL >= 10) {
2806                 NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx2, r);
2807         }
2808
2809         push = ndr_push_init_ctx(r);
2810         if (push == NULL) {
2811                 talloc_free(r);
2812                 return false;
2813         }
2814
2815         ndr_err = call->ndr_push(push, NDR_OUT, r);
2816         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2817                 talloc_free(r);
2818                 return false;
2819         }
2820
2821         blob = ndr_push_blob(push);
2822         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2823                 talloc_free(r);
2824                 return false;
2825         }
2826
2827         talloc_free(r);
2828
2829         return true;
2830 }
2831
2832 static bool api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p)
2833 {
2834         const struct ndr_interface_call *call;
2835         struct ndr_pull *pull;
2836         struct ndr_push *push;
2837         enum ndr_err_code ndr_err;
2838         DATA_BLOB blob;
2839         struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r;
2840
2841         call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN];
2842
2843         r = talloc(talloc_tos(), struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN);
2844         if (r == NULL) {
2845                 return false;
2846         }
2847
2848         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2849                 talloc_free(r);
2850                 return false;
2851         }
2852
2853         pull = ndr_pull_init_blob(&blob, r, NULL);
2854         if (pull == NULL) {
2855                 talloc_free(r);
2856                 return false;
2857         }
2858
2859         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2860         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2861         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2862                 talloc_free(r);
2863                 return false;
2864         }
2865
2866         if (DEBUGLEVEL >= 10) {
2867                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, r);
2868         }
2869
2870         r->out.result = _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(p, r);
2871
2872         if (p->rng_fault_state) {
2873                 talloc_free(r);
2874                 /* Return true here, srv_pipe_hnd.c will take care */
2875                 return true;
2876         }
2877
2878         if (DEBUGLEVEL >= 10) {
2879                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, r);
2880         }
2881
2882         push = ndr_push_init_ctx(r);
2883         if (push == NULL) {
2884                 talloc_free(r);
2885                 return false;
2886         }
2887
2888         ndr_err = call->ndr_push(push, NDR_OUT, r);
2889         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2890                 talloc_free(r);
2891                 return false;
2892         }
2893
2894         blob = ndr_push_blob(push);
2895         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2896                 talloc_free(r);
2897                 return false;
2898         }
2899
2900         talloc_free(r);
2901
2902         return true;
2903 }
2904
2905 static bool api_netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p)
2906 {
2907         const struct ndr_interface_call *call;
2908         struct ndr_pull *pull;
2909         struct ndr_push *push;
2910         enum ndr_err_code ndr_err;
2911         DATA_BLOB blob;
2912         struct netr_NetrEnumerateTrustedDomainsEx *r;
2913
2914         call = &ndr_table_netlogon.calls[NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX];
2915
2916         r = talloc(talloc_tos(), struct netr_NetrEnumerateTrustedDomainsEx);
2917         if (r == NULL) {
2918                 return false;
2919         }
2920
2921         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2922                 talloc_free(r);
2923                 return false;
2924         }
2925
2926         pull = ndr_pull_init_blob(&blob, r, NULL);
2927         if (pull == NULL) {
2928                 talloc_free(r);
2929                 return false;
2930         }
2931
2932         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2933         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2934         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2935                 talloc_free(r);
2936                 return false;
2937         }
2938
2939         if (DEBUGLEVEL >= 10) {
2940                 NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomainsEx, r);
2941         }
2942
2943         ZERO_STRUCT(r->out);
2944         r->out.dom_trust_list = talloc_zero(r, struct netr_DomainTrustList);
2945         if (r->out.dom_trust_list == NULL) {
2946                 talloc_free(r);
2947                 return false;
2948         }
2949
2950         r->out.result = _netr_NetrEnumerateTrustedDomainsEx(p, r);
2951
2952         if (p->rng_fault_state) {
2953                 talloc_free(r);
2954                 /* Return true here, srv_pipe_hnd.c will take care */
2955                 return true;
2956         }
2957
2958         if (DEBUGLEVEL >= 10) {
2959                 NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomainsEx, r);
2960         }
2961
2962         push = ndr_push_init_ctx(r);
2963         if (push == NULL) {
2964                 talloc_free(r);
2965                 return false;
2966         }
2967
2968         ndr_err = call->ndr_push(push, NDR_OUT, r);
2969         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2970                 talloc_free(r);
2971                 return false;
2972         }
2973
2974         blob = ndr_push_blob(push);
2975         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2976                 talloc_free(r);
2977                 return false;
2978         }
2979
2980         talloc_free(r);
2981
2982         return true;
2983 }
2984
2985 static bool api_netr_DsRAddressToSitenamesExW(pipes_struct *p)
2986 {
2987         const struct ndr_interface_call *call;
2988         struct ndr_pull *pull;
2989         struct ndr_push *push;
2990         enum ndr_err_code ndr_err;
2991         DATA_BLOB blob;
2992         struct netr_DsRAddressToSitenamesExW *r;
2993
2994         call = &ndr_table_netlogon.calls[NDR_NETR_DSRADDRESSTOSITENAMESEXW];
2995
2996         r = talloc(talloc_tos(), struct netr_DsRAddressToSitenamesExW);
2997         if (r == NULL) {
2998                 return false;
2999         }
3000
3001         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3002                 talloc_free(r);
3003                 return false;
3004         }
3005
3006         pull = ndr_pull_init_blob(&blob, r, NULL);
3007         if (pull == NULL) {
3008                 talloc_free(r);
3009                 return false;
3010         }
3011
3012         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3013         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3014         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3015                 talloc_free(r);
3016                 return false;
3017         }
3018
3019         if (DEBUGLEVEL >= 10) {
3020                 NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesExW, r);
3021         }
3022
3023         ZERO_STRUCT(r->out);
3024         r->out.ctr = talloc_zero(r, struct netr_DsRAddressToSitenamesExWCtr *);
3025         if (r->out.ctr == NULL) {
3026                 talloc_free(r);
3027                 return false;
3028         }
3029
3030         r->out.result = _netr_DsRAddressToSitenamesExW(p, r);
3031
3032         if (p->rng_fault_state) {
3033                 talloc_free(r);
3034                 /* Return true here, srv_pipe_hnd.c will take care */
3035                 return true;
3036         }
3037
3038         if (DEBUGLEVEL >= 10) {
3039                 NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesExW, r);
3040         }
3041
3042         push = ndr_push_init_ctx(r);
3043         if (push == NULL) {
3044                 talloc_free(r);
3045                 return false;
3046         }
3047
3048         ndr_err = call->ndr_push(push, NDR_OUT, r);
3049         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3050                 talloc_free(r);
3051                 return false;
3052         }
3053
3054         blob = ndr_push_blob(push);
3055         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3056                 talloc_free(r);
3057                 return false;
3058         }
3059
3060         talloc_free(r);
3061
3062         return true;
3063 }
3064
3065 static bool api_netr_DsrGetDcSiteCoverageW(pipes_struct *p)
3066 {
3067         const struct ndr_interface_call *call;
3068         struct ndr_pull *pull;
3069         struct ndr_push *push;
3070         enum ndr_err_code ndr_err;
3071         DATA_BLOB blob;
3072         struct netr_DsrGetDcSiteCoverageW *r;
3073
3074         call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCSITECOVERAGEW];
3075
3076         r = talloc(talloc_tos(), struct netr_DsrGetDcSiteCoverageW);
3077         if (r == NULL) {
3078                 return false;
3079         }
3080
3081         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3082                 talloc_free(r);
3083                 return false;
3084         }
3085
3086         pull = ndr_pull_init_blob(&blob, r, NULL);
3087         if (pull == NULL) {
3088                 talloc_free(r);
3089                 return false;
3090         }
3091
3092         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3093         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3094         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3095                 talloc_free(r);
3096                 return false;
3097         }
3098
3099         if (DEBUGLEVEL >= 10) {
3100                 NDR_PRINT_IN_DEBUG(netr_DsrGetDcSiteCoverageW, r);
3101         }
3102
3103         ZERO_STRUCT(r->out);
3104         r->out.ctr = talloc_zero(r, struct DcSitesCtr);
3105         if (r->out.ctr == NULL) {
3106                 talloc_free(r);
3107                 return false;
3108         }
3109
3110         r->out.result = _netr_DsrGetDcSiteCoverageW(p, r);
3111
3112         if (p->rng_fault_state) {
3113                 talloc_free(r);
3114                 /* Return true here, srv_pipe_hnd.c will take care */
3115                 return true;
3116         }
3117
3118         if (DEBUGLEVEL >= 10) {
3119                 NDR_PRINT_OUT_DEBUG(netr_DsrGetDcSiteCoverageW, r);
3120         }
3121
3122         push = ndr_push_init_ctx(r);
3123         if (push == NULL) {
3124                 talloc_free(r);
3125                 return false;
3126         }
3127
3128         ndr_err = call->ndr_push(push, NDR_OUT, r);
3129         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3130                 talloc_free(r);
3131                 return false;
3132         }
3133
3134         blob = ndr_push_blob(push);
3135         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3136                 talloc_free(r);
3137                 return false;
3138         }
3139
3140         talloc_free(r);
3141
3142         return true;
3143 }
3144
3145 static bool api_netr_LogonSamLogonEx(pipes_struct *p)
3146 {
3147         const struct ndr_interface_call *call;
3148         struct ndr_pull *pull;
3149         struct ndr_push *push;
3150         enum ndr_err_code ndr_err;
3151         DATA_BLOB blob;
3152         struct netr_LogonSamLogonEx *r;
3153
3154         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGONEX];
3155
3156         r = talloc(talloc_tos(), struct netr_LogonSamLogonEx);
3157         if (r == NULL) {
3158                 return false;
3159         }
3160
3161         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3162                 talloc_free(r);
3163                 return false;
3164         }
3165
3166         pull = ndr_pull_init_blob(&blob, r, NULL);
3167         if (pull == NULL) {
3168                 talloc_free(r);
3169                 return false;
3170         }
3171
3172         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3173         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3174         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3175                 talloc_free(r);
3176                 return false;
3177         }
3178
3179         if (DEBUGLEVEL >= 10) {
3180                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogonEx, r);
3181         }
3182
3183         ZERO_STRUCT(r->out);
3184         r->out.validation = talloc_zero(r, union netr_Validation);
3185         if (r->out.validation == NULL) {
3186                 talloc_free(r);
3187                 return false;
3188         }
3189
3190         r->out.authoritative = talloc_zero(r, uint8_t);
3191         if (r->out.authoritative == NULL) {
3192                 talloc_free(r);
3193                 return false;
3194         }
3195
3196         r->out.flags = r->in.flags;
3197         r->out.result = _netr_LogonSamLogonEx(p, r);
3198
3199         if (p->rng_fault_state) {
3200                 talloc_free(r);
3201                 /* Return true here, srv_pipe_hnd.c will take care */
3202                 return true;
3203         }
3204
3205         if (DEBUGLEVEL >= 10) {
3206                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonEx, r);
3207         }
3208
3209         push = ndr_push_init_ctx(r);
3210         if (push == NULL) {
3211                 talloc_free(r);
3212                 return false;
3213         }
3214
3215         ndr_err = call->ndr_push(push, NDR_OUT, r);
3216         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3217                 talloc_free(r);
3218                 return false;
3219         }
3220
3221         blob = ndr_push_blob(push);
3222         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3223                 talloc_free(r);
3224                 return false;
3225         }
3226
3227         talloc_free(r);
3228
3229         return true;
3230 }
3231
3232 static bool api_netr_DsrEnumerateDomainTrusts(pipes_struct *p)
3233 {
3234         const struct ndr_interface_call *call;
3235         struct ndr_pull *pull;
3236         struct ndr_push *push;
3237         enum ndr_err_code ndr_err;
3238         DATA_BLOB blob;
3239         struct netr_DsrEnumerateDomainTrusts *r;
3240
3241         call = &ndr_table_netlogon.calls[NDR_NETR_DSRENUMERATEDOMAINTRUSTS];
3242
3243         r = talloc(talloc_tos(), struct netr_DsrEnumerateDomainTrusts);
3244         if (r == NULL) {
3245                 return false;
3246         }
3247
3248         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3249                 talloc_free(r);
3250                 return false;
3251         }
3252
3253         pull = ndr_pull_init_blob(&blob, r, NULL);
3254         if (pull == NULL) {
3255                 talloc_free(r);
3256                 return false;
3257         }
3258
3259         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3260         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3261         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3262                 talloc_free(r);
3263                 return false;
3264         }
3265
3266         if (DEBUGLEVEL >= 10) {
3267                 NDR_PRINT_IN_DEBUG(netr_DsrEnumerateDomainTrusts, r);
3268         }
3269
3270         ZERO_STRUCT(r->out);
3271         r->out.trusts = talloc_zero(r, struct netr_DomainTrustList);
3272         if (r->out.trusts == NULL) {
3273                 talloc_free(r);
3274                 return false;
3275         }
3276
3277         r->out.result = _netr_DsrEnumerateDomainTrusts(p, r);
3278
3279         if (p->rng_fault_state) {
3280                 talloc_free(r);
3281                 /* Return true here, srv_pipe_hnd.c will take care */
3282                 return true;
3283         }
3284
3285         if (DEBUGLEVEL >= 10) {
3286                 NDR_PRINT_OUT_DEBUG(netr_DsrEnumerateDomainTrusts, r);
3287         }
3288
3289         push = ndr_push_init_ctx(r);
3290         if (push == NULL) {
3291                 talloc_free(r);
3292                 return false;
3293         }
3294
3295         ndr_err = call->ndr_push(push, NDR_OUT, r);
3296         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3297                 talloc_free(r);
3298                 return false;
3299         }
3300
3301         blob = ndr_push_blob(push);
3302         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3303                 talloc_free(r);
3304                 return false;
3305         }
3306
3307         talloc_free(r);
3308
3309         return true;
3310 }
3311
3312 static bool api_netr_DsrDeregisterDNSHostRecords(pipes_struct *p)
3313 {
3314         const struct ndr_interface_call *call;
3315         struct ndr_pull *pull;
3316         struct ndr_push *push;
3317         enum ndr_err_code ndr_err;
3318         DATA_BLOB blob;
3319         struct netr_DsrDeregisterDNSHostRecords *r;
3320
3321         call = &ndr_table_netlogon.calls[NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS];
3322
3323         r = talloc(talloc_tos(), struct netr_DsrDeregisterDNSHostRecords);
3324         if (r == NULL) {
3325                 return false;
3326         }
3327
3328         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3329                 talloc_free(r);
3330                 return false;
3331         }
3332
3333         pull = ndr_pull_init_blob(&blob, r, NULL);
3334         if (pull == NULL) {
3335                 talloc_free(r);
3336                 return false;
3337         }
3338
3339         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3340         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3341         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3342                 talloc_free(r);
3343                 return false;
3344         }
3345
3346         if (DEBUGLEVEL >= 10) {
3347                 NDR_PRINT_IN_DEBUG(netr_DsrDeregisterDNSHostRecords, r);
3348         }
3349
3350         r->out.result = _netr_DsrDeregisterDNSHostRecords(p, r);
3351
3352         if (p->rng_fault_state) {
3353                 talloc_free(r);
3354                 /* Return true here, srv_pipe_hnd.c will take care */
3355                 return true;
3356         }
3357
3358         if (DEBUGLEVEL >= 10) {
3359                 NDR_PRINT_OUT_DEBUG(netr_DsrDeregisterDNSHostRecords, r);
3360         }
3361
3362         push = ndr_push_init_ctx(r);
3363         if (push == NULL) {
3364                 talloc_free(r);
3365                 return false;
3366         }
3367
3368         ndr_err = call->ndr_push(push, NDR_OUT, r);
3369         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3370                 talloc_free(r);
3371                 return false;
3372         }
3373
3374         blob = ndr_push_blob(push);
3375         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3376                 talloc_free(r);
3377                 return false;
3378         }
3379
3380         talloc_free(r);
3381
3382         return true;
3383 }
3384
3385 static bool api_netr_ServerTrustPasswordsGet(pipes_struct *p)
3386 {
3387         const struct ndr_interface_call *call;
3388         struct ndr_pull *pull;
3389         struct ndr_push *push;
3390         enum ndr_err_code ndr_err;
3391         DATA_BLOB blob;
3392         struct netr_ServerTrustPasswordsGet *r;
3393
3394         call = &ndr_table_netlogon.calls[NDR_NETR_SERVERTRUSTPASSWORDSGET];
3395
3396         r = talloc(talloc_tos(), struct netr_ServerTrustPasswordsGet);
3397         if (r == NULL) {
3398                 return false;
3399         }
3400
3401         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3402                 talloc_free(r);
3403                 return false;
3404         }
3405
3406         pull = ndr_pull_init_blob(&blob, r, NULL);
3407         if (pull == NULL) {
3408                 talloc_free(r);
3409                 return false;
3410         }
3411
3412         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3413         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3414         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3415                 talloc_free(r);
3416                 return false;
3417         }
3418
3419         if (DEBUGLEVEL >= 10) {
3420                 NDR_PRINT_IN_DEBUG(netr_ServerTrustPasswordsGet, r);
3421         }
3422
3423         ZERO_STRUCT(r->out);
3424         r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
3425         if (r->out.return_authenticator == NULL) {
3426                 talloc_free(r);
3427                 return false;
3428         }
3429
3430         r->out.password = talloc_zero(r, struct samr_Password);
3431         if (r->out.password == NULL) {
3432                 talloc_free(r);
3433                 return false;
3434         }
3435
3436         r->out.password2 = talloc_zero(r, struct samr_Password);
3437         if (r->out.password2 == NULL) {
3438                 talloc_free(r);
3439                 return false;
3440         }
3441
3442         r->out.result = _netr_ServerTrustPasswordsGet(p, r);
3443
3444         if (p->rng_fault_state) {
3445                 talloc_free(r);
3446                 /* Return true here, srv_pipe_hnd.c will take care */
3447                 return true;
3448         }
3449
3450         if (DEBUGLEVEL >= 10) {
3451                 NDR_PRINT_OUT_DEBUG(netr_ServerTrustPasswordsGet, r);
3452         }
3453
3454         push = ndr_push_init_ctx(r);
3455         if (push == NULL) {
3456                 talloc_free(r);
3457                 return false;
3458         }
3459
3460         ndr_err = call->ndr_push(push, NDR_OUT, r);
3461         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3462                 talloc_free(r);
3463                 return false;
3464         }
3465
3466         blob = ndr_push_blob(push);
3467         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3468                 talloc_free(r);
3469                 return false;
3470         }
3471
3472         talloc_free(r);
3473
3474         return true;
3475 }
3476
3477 static bool api_netr_DsRGetForestTrustInformation(pipes_struct *p)
3478 {
3479         const struct ndr_interface_call *call;
3480         struct ndr_pull *pull;
3481         struct ndr_push *push;
3482         enum ndr_err_code ndr_err;
3483         DATA_BLOB blob;
3484         struct netr_DsRGetForestTrustInformation *r;
3485
3486         call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETFORESTTRUSTINFORMATION];
3487
3488         r = talloc(talloc_tos(), struct netr_DsRGetForestTrustInformation);
3489         if (r == NULL) {
3490                 return false;
3491         }
3492
3493         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3494                 talloc_free(r);
3495                 return false;
3496         }
3497
3498         pull = ndr_pull_init_blob(&blob, r, NULL);
3499         if (pull == NULL) {
3500                 talloc_free(r);
3501                 return false;
3502         }
3503
3504         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3505         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3506         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3507                 talloc_free(r);
3508                 return false;
3509         }
3510
3511         if (DEBUGLEVEL >= 10) {
3512                 NDR_PRINT_IN_DEBUG(netr_DsRGetForestTrustInformation, r);
3513         }
3514
3515         ZERO_STRUCT(r->out);
3516         r->out.forest_trust_info = talloc_zero(r, struct lsa_ForestTrustInformation *);
3517         if (r->out.forest_trust_info == NULL) {
3518                 talloc_free(r);
3519                 return false;
3520         }
3521
3522         r->out.result = _netr_DsRGetForestTrustInformation(p, r);
3523
3524         if (p->rng_fault_state) {
3525                 talloc_free(r);
3526                 /* Return true here, srv_pipe_hnd.c will take care */
3527                 return true;
3528         }
3529
3530         if (DEBUGLEVEL >= 10) {
3531                 NDR_PRINT_OUT_DEBUG(netr_DsRGetForestTrustInformation, r);
3532         }
3533
3534         push = ndr_push_init_ctx(r);
3535         if (push == NULL) {
3536                 talloc_free(r);
3537                 return false;
3538         }
3539
3540         ndr_err = call->ndr_push(push, NDR_OUT, r);
3541         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3542                 talloc_free(r);
3543                 return false;
3544         }
3545
3546         blob = ndr_push_blob(push);
3547         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3548                 talloc_free(r);
3549                 return false;
3550         }
3551
3552         talloc_free(r);
3553
3554         return true;
3555 }
3556
3557 static bool api_netr_GetForestTrustInformation(pipes_struct *p)
3558 {
3559         const struct ndr_interface_call *call;
3560         struct ndr_pull *pull;
3561         struct ndr_push *push;
3562         enum ndr_err_code ndr_err;
3563         DATA_BLOB blob;
3564         struct netr_GetForestTrustInformation *r;
3565
3566         call = &ndr_table_netlogon.calls[NDR_NETR_GETFORESTTRUSTINFORMATION];
3567
3568         r = talloc(talloc_tos(), struct netr_GetForestTrustInformation);
3569         if (r == NULL) {
3570                 return false;
3571         }
3572
3573         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3574                 talloc_free(r);
3575                 return false;
3576         }
3577
3578         pull = ndr_pull_init_blob(&blob, r, NULL);
3579         if (pull == NULL) {
3580                 talloc_free(r);
3581                 return false;
3582         }
3583
3584         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3585         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3586         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3587                 talloc_free(r);
3588                 return false;
3589         }
3590
3591         if (DEBUGLEVEL >= 10) {
3592                 NDR_PRINT_IN_DEBUG(netr_GetForestTrustInformation, r);
3593         }
3594
3595         ZERO_STRUCT(r->out);
3596         r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
3597         if (r->out.return_authenticator == NULL) {
3598                 talloc_free(r);
3599                 return false;
3600         }
3601
3602         r->out.forest_trust_info = talloc_zero(r, struct lsa_ForestTrustInformation *);
3603         if (r->out.forest_trust_info == NULL) {
3604                 talloc_free(r);
3605                 return false;
3606         }
3607
3608         r->out.result = _netr_GetForestTrustInformation(p, r);
3609
3610         if (p->rng_fault_state) {
3611                 talloc_free(r);
3612                 /* Return true here, srv_pipe_hnd.c will take care */
3613                 return true;
3614         }
3615
3616         if (DEBUGLEVEL >= 10) {
3617                 NDR_PRINT_OUT_DEBUG(netr_GetForestTrustInformation, r);
3618         }
3619
3620         push = ndr_push_init_ctx(r);
3621         if (push == NULL) {
3622                 talloc_free(r);
3623                 return false;
3624         }
3625
3626         ndr_err = call->ndr_push(push, NDR_OUT, r);
3627         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3628                 talloc_free(r);
3629                 return false;
3630         }
3631
3632         blob = ndr_push_blob(push);
3633         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3634                 talloc_free(r);
3635                 return false;
3636         }
3637
3638         talloc_free(r);
3639
3640         return true;
3641 }
3642
3643 static bool api_netr_LogonSamLogonWithFlags(pipes_struct *p)
3644 {
3645         const struct ndr_interface_call *call;
3646         struct ndr_pull *pull;
3647         struct ndr_push *push;
3648         enum ndr_err_code ndr_err;
3649         DATA_BLOB blob;
3650         struct netr_LogonSamLogonWithFlags *r;
3651
3652         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGONWITHFLAGS];
3653
3654         r = talloc(talloc_tos(), struct netr_LogonSamLogonWithFlags);
3655         if (r == NULL) {
3656                 return false;
3657         }
3658
3659         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3660                 talloc_free(r);
3661                 return false;
3662         }
3663
3664         pull = ndr_pull_init_blob(&blob, r, NULL);
3665         if (pull == NULL) {
3666                 talloc_free(r);
3667                 return false;
3668         }
3669
3670         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3671         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3672         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3673                 talloc_free(r);
3674                 return false;
3675         }
3676
3677         if (DEBUGLEVEL >= 10) {
3678                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogonWithFlags, r);
3679         }
3680
3681         ZERO_STRUCT(r->out);
3682         r->out.return_authenticator = r->in.return_authenticator;
3683         r->out.validation = talloc_zero(r, union netr_Validation);
3684         if (r->out.validation == NULL) {
3685                 talloc_free(r);
3686                 return false;
3687         }
3688
3689         r->out.authoritative = talloc_zero(r, uint8_t);
3690         if (r->out.authoritative == NULL) {
3691                 talloc_free(r);
3692                 return false;
3693         }
3694
3695         r->out.flags = r->in.flags;
3696         r->out.result = _netr_LogonSamLogonWithFlags(p, r);
3697
3698         if (p->rng_fault_state) {
3699                 talloc_free(r);
3700                 /* Return true here, srv_pipe_hnd.c will take care */
3701                 return true;
3702         }
3703
3704         if (DEBUGLEVEL >= 10) {
3705                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonWithFlags, r);
3706         }
3707
3708         push = ndr_push_init_ctx(r);
3709         if (push == NULL) {
3710                 talloc_free(r);
3711                 return false;
3712         }
3713
3714         ndr_err = call->ndr_push(push, NDR_OUT, r);
3715         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3716                 talloc_free(r);
3717                 return false;
3718         }
3719
3720         blob = ndr_push_blob(push);
3721         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3722                 talloc_free(r);
3723                 return false;
3724         }
3725
3726         talloc_free(r);
3727
3728         return true;
3729 }
3730
3731 static bool api_netr_NETRSERVERGETTRUSTINFO(pipes_struct *p)
3732 {
3733         const struct ndr_interface_call *call;
3734         struct ndr_pull *pull;
3735         struct ndr_push *push;
3736         enum ndr_err_code ndr_err;
3737         DATA_BLOB blob;
3738         struct netr_NETRSERVERGETTRUSTINFO *r;
3739
3740         call = &ndr_table_netlogon.calls[NDR_NETR_NETRSERVERGETTRUSTINFO];
3741
3742         r = talloc(talloc_tos(), struct netr_NETRSERVERGETTRUSTINFO);
3743         if (r == NULL) {
3744                 return false;
3745         }
3746
3747         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3748                 talloc_free(r);
3749                 return false;
3750         }
3751
3752         pull = ndr_pull_init_blob(&blob, r, NULL);
3753         if (pull == NULL) {
3754                 talloc_free(r);
3755                 return false;
3756         }
3757
3758         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3759         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3760         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3761                 talloc_free(r);
3762                 return false;
3763         }
3764
3765         if (DEBUGLEVEL >= 10) {
3766                 NDR_PRINT_IN_DEBUG(netr_NETRSERVERGETTRUSTINFO, r);
3767         }
3768
3769         r->out.result = _netr_NETRSERVERGETTRUSTINFO(p, r);
3770
3771         if (p->rng_fault_state) {
3772                 talloc_free(r);
3773                 /* Return true here, srv_pipe_hnd.c will take care */
3774                 return true;
3775         }
3776
3777         if (DEBUGLEVEL >= 10) {
3778                 NDR_PRINT_OUT_DEBUG(netr_NETRSERVERGETTRUSTINFO, r);
3779         }
3780
3781         push = ndr_push_init_ctx(r);
3782         if (push == NULL) {
3783                 talloc_free(r);
3784                 return false;
3785         }
3786
3787         ndr_err = call->ndr_push(push, NDR_OUT, r);
3788         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3789                 talloc_free(r);
3790                 return false;
3791         }
3792
3793         blob = ndr_push_blob(push);
3794         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3795                 talloc_free(r);
3796                 return false;
3797         }
3798
3799         talloc_free(r);
3800
3801         return true;
3802 }
3803
3804
3805 /* Tables */
3806 static struct api_struct api_netlogon_cmds[] = 
3807 {
3808         {"NETR_LOGONUASLOGON", NDR_NETR_LOGONUASLOGON, api_netr_LogonUasLogon},
3809         {"NETR_LOGONUASLOGOFF", NDR_NETR_LOGONUASLOGOFF, api_netr_LogonUasLogoff},
3810         {"NETR_LOGONSAMLOGON", NDR_NETR_LOGONSAMLOGON, api_netr_LogonSamLogon},
3811         {"NETR_LOGONSAMLOGOFF", NDR_NETR_LOGONSAMLOGOFF, api_netr_LogonSamLogoff},
3812         {"NETR_SERVERREQCHALLENGE", NDR_NETR_SERVERREQCHALLENGE, api_netr_ServerReqChallenge},
3813         {"NETR_SERVERAUTHENTICATE", NDR_NETR_SERVERAUTHENTICATE, api_netr_ServerAuthenticate},
3814         {"NETR_SERVERPASSWORDSET", NDR_NETR_SERVERPASSWORDSET, api_netr_ServerPasswordSet},
3815         {"NETR_DATABASEDELTAS", NDR_NETR_DATABASEDELTAS, api_netr_DatabaseDeltas},
3816         {"NETR_DATABASESYNC", NDR_NETR_DATABASESYNC, api_netr_DatabaseSync},
3817         {"NETR_ACCOUNTDELTAS", NDR_NETR_ACCOUNTDELTAS, api_netr_AccountDeltas},
3818         {"NETR_ACCOUNTSYNC", NDR_NETR_ACCOUNTSYNC, api_netr_AccountSync},
3819         {"NETR_GETDCNAME", NDR_NETR_GETDCNAME, api_netr_GetDcName},
3820         {"NETR_LOGONCONTROL", NDR_NETR_LOGONCONTROL, api_netr_LogonControl},
3821         {"NETR_GETANYDCNAME", NDR_NETR_GETANYDCNAME, api_netr_GetAnyDCName},
3822         {"NETR_LOGONCONTROL2", NDR_NETR_LOGONCONTROL2, api_netr_LogonControl2},
3823         {"NETR_SERVERAUTHENTICATE2", NDR_NETR_SERVERAUTHENTICATE2, api_netr_ServerAuthenticate2},
3824         {"NETR_DATABASESYNC2", NDR_NETR_DATABASESYNC2, api_netr_DatabaseSync2},
3825         {"NETR_DATABASEREDO", NDR_NETR_DATABASEREDO, api_netr_DatabaseRedo},
3826         {"NETR_LOGONCONTROL2EX", NDR_NETR_LOGONCONTROL2EX, api_netr_LogonControl2Ex},
3827         {"NETR_NETRENUMERATETRUSTEDDOMAINS", NDR_NETR_NETRENUMERATETRUSTEDDOMAINS, api_netr_NetrEnumerateTrustedDomains},
3828         {"NETR_DSRGETDCNAME", NDR_NETR_DSRGETDCNAME, api_netr_DsRGetDCName},
3829         {"NETR_NETRLOGONDUMMYROUTINE1", NDR_NETR_NETRLOGONDUMMYROUTINE1, api_netr_NETRLOGONDUMMYROUTINE1},
3830         {"NETR_NETRLOGONSETSERVICEBITS", NDR_NETR_NETRLOGONSETSERVICEBITS, api_netr_NETRLOGONSETSERVICEBITS},
3831         {"NETR_LOGONGETTRUSTRID", NDR_NETR_LOGONGETTRUSTRID, api_netr_LogonGetTrustRid},
3832         {"NETR_NETRLOGONCOMPUTESERVERDIGEST", NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST, api_netr_NETRLOGONCOMPUTESERVERDIGEST},
3833         {"NETR_NETRLOGONCOMPUTECLIENTDIGEST", NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST, api_netr_NETRLOGONCOMPUTECLIENTDIGEST},
3834         {"NETR_SERVERAUTHENTICATE3", NDR_NETR_SERVERAUTHENTICATE3, api_netr_ServerAuthenticate3},
3835         {"NETR_DSRGETDCNAMEEX", NDR_NETR_DSRGETDCNAMEEX, api_netr_DsRGetDCNameEx},
3836         {"NETR_DSRGETSITENAME", NDR_NETR_DSRGETSITENAME, api_netr_DsRGetSiteName},
3837         {"NETR_LOGONGETDOMAININFO", NDR_NETR_LOGONGETDOMAININFO, api_netr_LogonGetDomainInfo},
3838         {"NETR_SERVERPASSWORDSET2", NDR_NETR_SERVERPASSWORDSET2, api_netr_ServerPasswordSet2},
3839         {"NETR_SERVERPASSWORDGET", NDR_NETR_SERVERPASSWORDGET, api_netr_ServerPasswordGet},
3840         {"NETR_NETRLOGONSENDTOSAM", NDR_NETR_NETRLOGONSENDTOSAM, api_netr_NETRLOGONSENDTOSAM},
3841         {"NETR_DSRADDRESSTOSITENAMESW", NDR_NETR_DSRADDRESSTOSITENAMESW, api_netr_DsRAddressToSitenamesW},
3842         {"NETR_DSRGETDCNAMEEX2", NDR_NETR_DSRGETDCNAMEEX2, api_netr_DsRGetDCNameEx2},
3843         {"NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN", NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN, api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN},
3844         {"NETR_NETRENUMERATETRUSTEDDOMAINSEX", NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX, api_netr_NetrEnumerateTrustedDomainsEx},
3845         {"NETR_DSRADDRESSTOSITENAMESEXW", NDR_NETR_DSRADDRESSTOSITENAMESEXW, api_netr_DsRAddressToSitenamesExW},
3846         {"NETR_DSRGETDCSITECOVERAGEW", NDR_NETR_DSRGETDCSITECOVERAGEW, api_netr_DsrGetDcSiteCoverageW},
3847         {"NETR_LOGONSAMLOGONEX", NDR_NETR_LOGONSAMLOGONEX, api_netr_LogonSamLogonEx},
3848         {"NETR_DSRENUMERATEDOMAINTRUSTS", NDR_NETR_DSRENUMERATEDOMAINTRUSTS, api_netr_DsrEnumerateDomainTrusts},
3849         {"NETR_DSRDEREGISTERDNSHOSTRECORDS", NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS, api_netr_DsrDeregisterDNSHostRecords},
3850         {"NETR_SERVERTRUSTPASSWORDSGET", NDR_NETR_SERVERTRUSTPASSWORDSGET, api_netr_ServerTrustPasswordsGet},
3851         {"NETR_DSRGETFORESTTRUSTINFORMATION", NDR_NETR_DSRGETFORESTTRUSTINFORMATION, api_netr_DsRGetForestTrustInformation},
3852         {"NETR_GETFORESTTRUSTINFORMATION", NDR_NETR_GETFORESTTRUSTINFORMATION, api_netr_GetForestTrustInformation},
3853         {"NETR_LOGONSAMLOGONWITHFLAGS", NDR_NETR_LOGONSAMLOGONWITHFLAGS, api_netr_LogonSamLogonWithFlags},
3854         {"NETR_NETRSERVERGETTRUSTINFO", NDR_NETR_NETRSERVERGETTRUSTINFO, api_netr_NETRSERVERGETTRUSTINFO},
3855 };
3856
3857 void netlogon_get_pipe_fns(struct api_struct **fns, int *n_fns)
3858 {
3859         *fns = api_netlogon_cmds;
3860         *n_fns = sizeof(api_netlogon_cmds) / sizeof(struct api_struct);
3861 }
3862
3863 NTSTATUS rpc_netlogon_init(void)
3864 {
3865         return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "netlogon", "netlogon", &ndr_table_netlogon.syntax_id, api_netlogon_cmds, sizeof(api_netlogon_cmds) / sizeof(struct api_struct));
3866 }