spoolss: pretty-print a struct spoolss_Time.
[samba.git] / 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, NULL);
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, NULL);
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, NULL);
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, NULL);
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, NULL);
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, NULL);
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, NULL);
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, NULL);
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, NULL);
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, NULL);
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.recordid = r->in.recordid;
875         r->out.buffer = talloc_zero(r, struct netr_AccountBuffer);
876         if (r->out.buffer == NULL) {
877                 talloc_free(r);
878                 return false;
879         }
880
881         r->out.count_returned = talloc_zero(r, uint32_t);
882         if (r->out.count_returned == NULL) {
883                 talloc_free(r);
884                 return false;
885         }
886
887         r->out.total_entries = talloc_zero(r, uint32_t);
888         if (r->out.total_entries == NULL) {
889                 talloc_free(r);
890                 return false;
891         }
892
893         r->out.next_reference = talloc_zero(r, uint32_t);
894         if (r->out.next_reference == NULL) {
895                 talloc_free(r);
896                 return false;
897         }
898
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, NULL);
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, NULL);
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.query = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION);
1054         if (r->out.query == 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, NULL);
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, NULL);
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, NULL);
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.negotiate_flags = r->in.negotiate_flags;
1294         r->out.return_credentials = talloc_zero(r, struct netr_Credential);
1295         if (r->out.return_credentials == NULL) {
1296                 talloc_free(r);
1297                 return false;
1298         }
1299
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, NULL);
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, NULL);
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, NULL);
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, NULL);
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, NULL);
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, NULL);
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_LogonGetCapabilities(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_LogonGetCapabilities *r;
1746
1747         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONGETCAPABILITIES];
1748
1749         r = talloc(talloc_tos(), struct netr_LogonGetCapabilities);
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_LogonGetCapabilities, r);
1774         }
1775
1776         ZERO_STRUCT(r->out);
1777         r->out.return_authenticator = r->in.return_authenticator;
1778         r->out.capabilities = talloc_zero(r, union netr_Capabilities);
1779         if (r->out.capabilities == NULL) {
1780                 talloc_free(r);
1781                 return false;
1782         }
1783
1784         r->out.result = _netr_LogonGetCapabilities(p, r);
1785
1786         if (p->rng_fault_state) {
1787                 talloc_free(r);
1788                 /* Return true here, srv_pipe_hnd.c will take care */
1789                 return true;
1790         }
1791
1792         if (DEBUGLEVEL >= 10) {
1793                 NDR_PRINT_OUT_DEBUG(netr_LogonGetCapabilities, r);
1794         }
1795
1796         push = ndr_push_init_ctx(r, NULL);
1797         if (push == NULL) {
1798                 talloc_free(r);
1799                 return false;
1800         }
1801
1802         ndr_err = call->ndr_push(push, NDR_OUT, r);
1803         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1804                 talloc_free(r);
1805                 return false;
1806         }
1807
1808         blob = ndr_push_blob(push);
1809         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1810                 talloc_free(r);
1811                 return false;
1812         }
1813
1814         talloc_free(r);
1815
1816         return true;
1817 }
1818
1819 static bool api_netr_NETRLOGONSETSERVICEBITS(pipes_struct *p)
1820 {
1821         const struct ndr_interface_call *call;
1822         struct ndr_pull *pull;
1823         struct ndr_push *push;
1824         enum ndr_err_code ndr_err;
1825         DATA_BLOB blob;
1826         struct netr_NETRLOGONSETSERVICEBITS *r;
1827
1828         call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONSETSERVICEBITS];
1829
1830         r = talloc(talloc_tos(), struct netr_NETRLOGONSETSERVICEBITS);
1831         if (r == NULL) {
1832                 return false;
1833         }
1834
1835         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1836                 talloc_free(r);
1837                 return false;
1838         }
1839
1840         pull = ndr_pull_init_blob(&blob, r, NULL);
1841         if (pull == NULL) {
1842                 talloc_free(r);
1843                 return false;
1844         }
1845
1846         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1847         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1848         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1849                 talloc_free(r);
1850                 return false;
1851         }
1852
1853         if (DEBUGLEVEL >= 10) {
1854                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONSETSERVICEBITS, r);
1855         }
1856
1857         r->out.result = _netr_NETRLOGONSETSERVICEBITS(p, r);
1858
1859         if (p->rng_fault_state) {
1860                 talloc_free(r);
1861                 /* Return true here, srv_pipe_hnd.c will take care */
1862                 return true;
1863         }
1864
1865         if (DEBUGLEVEL >= 10) {
1866                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSETSERVICEBITS, r);
1867         }
1868
1869         push = ndr_push_init_ctx(r, NULL);
1870         if (push == NULL) {
1871                 talloc_free(r);
1872                 return false;
1873         }
1874
1875         ndr_err = call->ndr_push(push, NDR_OUT, r);
1876         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1877                 talloc_free(r);
1878                 return false;
1879         }
1880
1881         blob = ndr_push_blob(push);
1882         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1883                 talloc_free(r);
1884                 return false;
1885         }
1886
1887         talloc_free(r);
1888
1889         return true;
1890 }
1891
1892 static bool api_netr_LogonGetTrustRid(pipes_struct *p)
1893 {
1894         const struct ndr_interface_call *call;
1895         struct ndr_pull *pull;
1896         struct ndr_push *push;
1897         enum ndr_err_code ndr_err;
1898         DATA_BLOB blob;
1899         struct netr_LogonGetTrustRid *r;
1900
1901         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONGETTRUSTRID];
1902
1903         r = talloc(talloc_tos(), struct netr_LogonGetTrustRid);
1904         if (r == NULL) {
1905                 return false;
1906         }
1907
1908         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1909                 talloc_free(r);
1910                 return false;
1911         }
1912
1913         pull = ndr_pull_init_blob(&blob, r, NULL);
1914         if (pull == NULL) {
1915                 talloc_free(r);
1916                 return false;
1917         }
1918
1919         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1920         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1921         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1922                 talloc_free(r);
1923                 return false;
1924         }
1925
1926         if (DEBUGLEVEL >= 10) {
1927                 NDR_PRINT_IN_DEBUG(netr_LogonGetTrustRid, r);
1928         }
1929
1930         ZERO_STRUCT(r->out);
1931         r->out.rid = talloc_zero(r, uint32_t);
1932         if (r->out.rid == NULL) {
1933                 talloc_free(r);
1934                 return false;
1935         }
1936
1937         r->out.result = _netr_LogonGetTrustRid(p, r);
1938
1939         if (p->rng_fault_state) {
1940                 talloc_free(r);
1941                 /* Return true here, srv_pipe_hnd.c will take care */
1942                 return true;
1943         }
1944
1945         if (DEBUGLEVEL >= 10) {
1946                 NDR_PRINT_OUT_DEBUG(netr_LogonGetTrustRid, r);
1947         }
1948
1949         push = ndr_push_init_ctx(r, NULL);
1950         if (push == NULL) {
1951                 talloc_free(r);
1952                 return false;
1953         }
1954
1955         ndr_err = call->ndr_push(push, NDR_OUT, r);
1956         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1957                 talloc_free(r);
1958                 return false;
1959         }
1960
1961         blob = ndr_push_blob(push);
1962         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1963                 talloc_free(r);
1964                 return false;
1965         }
1966
1967         talloc_free(r);
1968
1969         return true;
1970 }
1971
1972 static bool api_netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p)
1973 {
1974         const struct ndr_interface_call *call;
1975         struct ndr_pull *pull;
1976         struct ndr_push *push;
1977         enum ndr_err_code ndr_err;
1978         DATA_BLOB blob;
1979         struct netr_NETRLOGONCOMPUTESERVERDIGEST *r;
1980
1981         call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST];
1982
1983         r = talloc(talloc_tos(), struct netr_NETRLOGONCOMPUTESERVERDIGEST);
1984         if (r == NULL) {
1985                 return false;
1986         }
1987
1988         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1989                 talloc_free(r);
1990                 return false;
1991         }
1992
1993         pull = ndr_pull_init_blob(&blob, r, NULL);
1994         if (pull == NULL) {
1995                 talloc_free(r);
1996                 return false;
1997         }
1998
1999         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2000         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2001         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2002                 talloc_free(r);
2003                 return false;
2004         }
2005
2006         if (DEBUGLEVEL >= 10) {
2007                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, r);
2008         }
2009
2010         r->out.result = _netr_NETRLOGONCOMPUTESERVERDIGEST(p, r);
2011
2012         if (p->rng_fault_state) {
2013                 talloc_free(r);
2014                 /* Return true here, srv_pipe_hnd.c will take care */
2015                 return true;
2016         }
2017
2018         if (DEBUGLEVEL >= 10) {
2019                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, r);
2020         }
2021
2022         push = ndr_push_init_ctx(r, NULL);
2023         if (push == NULL) {
2024                 talloc_free(r);
2025                 return false;
2026         }
2027
2028         ndr_err = call->ndr_push(push, NDR_OUT, r);
2029         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2030                 talloc_free(r);
2031                 return false;
2032         }
2033
2034         blob = ndr_push_blob(push);
2035         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2036                 talloc_free(r);
2037                 return false;
2038         }
2039
2040         talloc_free(r);
2041
2042         return true;
2043 }
2044
2045 static bool api_netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p)
2046 {
2047         const struct ndr_interface_call *call;
2048         struct ndr_pull *pull;
2049         struct ndr_push *push;
2050         enum ndr_err_code ndr_err;
2051         DATA_BLOB blob;
2052         struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r;
2053
2054         call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST];
2055
2056         r = talloc(talloc_tos(), struct netr_NETRLOGONCOMPUTECLIENTDIGEST);
2057         if (r == NULL) {
2058                 return false;
2059         }
2060
2061         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2062                 talloc_free(r);
2063                 return false;
2064         }
2065
2066         pull = ndr_pull_init_blob(&blob, r, NULL);
2067         if (pull == NULL) {
2068                 talloc_free(r);
2069                 return false;
2070         }
2071
2072         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2073         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2074         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2075                 talloc_free(r);
2076                 return false;
2077         }
2078
2079         if (DEBUGLEVEL >= 10) {
2080                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, r);
2081         }
2082
2083         r->out.result = _netr_NETRLOGONCOMPUTECLIENTDIGEST(p, r);
2084
2085         if (p->rng_fault_state) {
2086                 talloc_free(r);
2087                 /* Return true here, srv_pipe_hnd.c will take care */
2088                 return true;
2089         }
2090
2091         if (DEBUGLEVEL >= 10) {
2092                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, r);
2093         }
2094
2095         push = ndr_push_init_ctx(r, NULL);
2096         if (push == NULL) {
2097                 talloc_free(r);
2098                 return false;
2099         }
2100
2101         ndr_err = call->ndr_push(push, NDR_OUT, r);
2102         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2103                 talloc_free(r);
2104                 return false;
2105         }
2106
2107         blob = ndr_push_blob(push);
2108         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2109                 talloc_free(r);
2110                 return false;
2111         }
2112
2113         talloc_free(r);
2114
2115         return true;
2116 }
2117
2118 static bool api_netr_ServerAuthenticate3(pipes_struct *p)
2119 {
2120         const struct ndr_interface_call *call;
2121         struct ndr_pull *pull;
2122         struct ndr_push *push;
2123         enum ndr_err_code ndr_err;
2124         DATA_BLOB blob;
2125         struct netr_ServerAuthenticate3 *r;
2126
2127         call = &ndr_table_netlogon.calls[NDR_NETR_SERVERAUTHENTICATE3];
2128
2129         r = talloc(talloc_tos(), struct netr_ServerAuthenticate3);
2130         if (r == NULL) {
2131                 return false;
2132         }
2133
2134         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2135                 talloc_free(r);
2136                 return false;
2137         }
2138
2139         pull = ndr_pull_init_blob(&blob, r, NULL);
2140         if (pull == NULL) {
2141                 talloc_free(r);
2142                 return false;
2143         }
2144
2145         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2146         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2147         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2148                 talloc_free(r);
2149                 return false;
2150         }
2151
2152         if (DEBUGLEVEL >= 10) {
2153                 NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate3, r);
2154         }
2155
2156         ZERO_STRUCT(r->out);
2157         r->out.negotiate_flags = r->in.negotiate_flags;
2158         r->out.return_credentials = talloc_zero(r, struct netr_Credential);
2159         if (r->out.return_credentials == NULL) {
2160                 talloc_free(r);
2161                 return false;
2162         }
2163
2164         r->out.rid = talloc_zero(r, uint32_t);
2165         if (r->out.rid == NULL) {
2166                 talloc_free(r);
2167                 return false;
2168         }
2169
2170         r->out.result = _netr_ServerAuthenticate3(p, r);
2171
2172         if (p->rng_fault_state) {
2173                 talloc_free(r);
2174                 /* Return true here, srv_pipe_hnd.c will take care */
2175                 return true;
2176         }
2177
2178         if (DEBUGLEVEL >= 10) {
2179                 NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate3, r);
2180         }
2181
2182         push = ndr_push_init_ctx(r, NULL);
2183         if (push == NULL) {
2184                 talloc_free(r);
2185                 return false;
2186         }
2187
2188         ndr_err = call->ndr_push(push, NDR_OUT, r);
2189         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2190                 talloc_free(r);
2191                 return false;
2192         }
2193
2194         blob = ndr_push_blob(push);
2195         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2196                 talloc_free(r);
2197                 return false;
2198         }
2199
2200         talloc_free(r);
2201
2202         return true;
2203 }
2204
2205 static bool api_netr_DsRGetDCNameEx(pipes_struct *p)
2206 {
2207         const struct ndr_interface_call *call;
2208         struct ndr_pull *pull;
2209         struct ndr_push *push;
2210         enum ndr_err_code ndr_err;
2211         DATA_BLOB blob;
2212         struct netr_DsRGetDCNameEx *r;
2213
2214         call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAMEEX];
2215
2216         r = talloc(talloc_tos(), struct netr_DsRGetDCNameEx);
2217         if (r == NULL) {
2218                 return false;
2219         }
2220
2221         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2222                 talloc_free(r);
2223                 return false;
2224         }
2225
2226         pull = ndr_pull_init_blob(&blob, r, NULL);
2227         if (pull == NULL) {
2228                 talloc_free(r);
2229                 return false;
2230         }
2231
2232         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2233         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2234         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2235                 talloc_free(r);
2236                 return false;
2237         }
2238
2239         if (DEBUGLEVEL >= 10) {
2240                 NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx, r);
2241         }
2242
2243         ZERO_STRUCT(r->out);
2244         r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo *);
2245         if (r->out.info == NULL) {
2246                 talloc_free(r);
2247                 return false;
2248         }
2249
2250         r->out.result = _netr_DsRGetDCNameEx(p, r);
2251
2252         if (p->rng_fault_state) {
2253                 talloc_free(r);
2254                 /* Return true here, srv_pipe_hnd.c will take care */
2255                 return true;
2256         }
2257
2258         if (DEBUGLEVEL >= 10) {
2259                 NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx, r);
2260         }
2261
2262         push = ndr_push_init_ctx(r, NULL);
2263         if (push == NULL) {
2264                 talloc_free(r);
2265                 return false;
2266         }
2267
2268         ndr_err = call->ndr_push(push, NDR_OUT, r);
2269         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2270                 talloc_free(r);
2271                 return false;
2272         }
2273
2274         blob = ndr_push_blob(push);
2275         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2276                 talloc_free(r);
2277                 return false;
2278         }
2279
2280         talloc_free(r);
2281
2282         return true;
2283 }
2284
2285 static bool api_netr_DsRGetSiteName(pipes_struct *p)
2286 {
2287         const struct ndr_interface_call *call;
2288         struct ndr_pull *pull;
2289         struct ndr_push *push;
2290         enum ndr_err_code ndr_err;
2291         DATA_BLOB blob;
2292         struct netr_DsRGetSiteName *r;
2293
2294         call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETSITENAME];
2295
2296         r = talloc(talloc_tos(), struct netr_DsRGetSiteName);
2297         if (r == NULL) {
2298                 return false;
2299         }
2300
2301         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2302                 talloc_free(r);
2303                 return false;
2304         }
2305
2306         pull = ndr_pull_init_blob(&blob, r, NULL);
2307         if (pull == NULL) {
2308                 talloc_free(r);
2309                 return false;
2310         }
2311
2312         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2313         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2314         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2315                 talloc_free(r);
2316                 return false;
2317         }
2318
2319         if (DEBUGLEVEL >= 10) {
2320                 NDR_PRINT_IN_DEBUG(netr_DsRGetSiteName, r);
2321         }
2322
2323         ZERO_STRUCT(r->out);
2324         r->out.site = talloc_zero(r, const char *);
2325         if (r->out.site == NULL) {
2326                 talloc_free(r);
2327                 return false;
2328         }
2329
2330         r->out.result = _netr_DsRGetSiteName(p, r);
2331
2332         if (p->rng_fault_state) {
2333                 talloc_free(r);
2334                 /* Return true here, srv_pipe_hnd.c will take care */
2335                 return true;
2336         }
2337
2338         if (DEBUGLEVEL >= 10) {
2339                 NDR_PRINT_OUT_DEBUG(netr_DsRGetSiteName, r);
2340         }
2341
2342         push = ndr_push_init_ctx(r, NULL);
2343         if (push == NULL) {
2344                 talloc_free(r);
2345                 return false;
2346         }
2347
2348         ndr_err = call->ndr_push(push, NDR_OUT, r);
2349         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2350                 talloc_free(r);
2351                 return false;
2352         }
2353
2354         blob = ndr_push_blob(push);
2355         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2356                 talloc_free(r);
2357                 return false;
2358         }
2359
2360         talloc_free(r);
2361
2362         return true;
2363 }
2364
2365 static bool api_netr_LogonGetDomainInfo(pipes_struct *p)
2366 {
2367         const struct ndr_interface_call *call;
2368         struct ndr_pull *pull;
2369         struct ndr_push *push;
2370         enum ndr_err_code ndr_err;
2371         DATA_BLOB blob;
2372         struct netr_LogonGetDomainInfo *r;
2373
2374         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONGETDOMAININFO];
2375
2376         r = talloc(talloc_tos(), struct netr_LogonGetDomainInfo);
2377         if (r == NULL) {
2378                 return false;
2379         }
2380
2381         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2382                 talloc_free(r);
2383                 return false;
2384         }
2385
2386         pull = ndr_pull_init_blob(&blob, r, NULL);
2387         if (pull == NULL) {
2388                 talloc_free(r);
2389                 return false;
2390         }
2391
2392         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2393         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2394         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2395                 talloc_free(r);
2396                 return false;
2397         }
2398
2399         if (DEBUGLEVEL >= 10) {
2400                 NDR_PRINT_IN_DEBUG(netr_LogonGetDomainInfo, r);
2401         }
2402
2403         ZERO_STRUCT(r->out);
2404         r->out.return_authenticator = r->in.return_authenticator;
2405         r->out.info = talloc_zero(r, union netr_DomainInfo);
2406         if (r->out.info == NULL) {
2407                 talloc_free(r);
2408                 return false;
2409         }
2410
2411         r->out.result = _netr_LogonGetDomainInfo(p, r);
2412
2413         if (p->rng_fault_state) {
2414                 talloc_free(r);
2415                 /* Return true here, srv_pipe_hnd.c will take care */
2416                 return true;
2417         }
2418
2419         if (DEBUGLEVEL >= 10) {
2420                 NDR_PRINT_OUT_DEBUG(netr_LogonGetDomainInfo, r);
2421         }
2422
2423         push = ndr_push_init_ctx(r, NULL);
2424         if (push == NULL) {
2425                 talloc_free(r);
2426                 return false;
2427         }
2428
2429         ndr_err = call->ndr_push(push, NDR_OUT, r);
2430         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2431                 talloc_free(r);
2432                 return false;
2433         }
2434
2435         blob = ndr_push_blob(push);
2436         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2437                 talloc_free(r);
2438                 return false;
2439         }
2440
2441         talloc_free(r);
2442
2443         return true;
2444 }
2445
2446 static bool api_netr_ServerPasswordSet2(pipes_struct *p)
2447 {
2448         const struct ndr_interface_call *call;
2449         struct ndr_pull *pull;
2450         struct ndr_push *push;
2451         enum ndr_err_code ndr_err;
2452         DATA_BLOB blob;
2453         struct netr_ServerPasswordSet2 *r;
2454
2455         call = &ndr_table_netlogon.calls[NDR_NETR_SERVERPASSWORDSET2];
2456
2457         r = talloc(talloc_tos(), struct netr_ServerPasswordSet2);
2458         if (r == NULL) {
2459                 return false;
2460         }
2461
2462         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2463                 talloc_free(r);
2464                 return false;
2465         }
2466
2467         pull = ndr_pull_init_blob(&blob, r, NULL);
2468         if (pull == NULL) {
2469                 talloc_free(r);
2470                 return false;
2471         }
2472
2473         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2474         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2475         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2476                 talloc_free(r);
2477                 return false;
2478         }
2479
2480         if (DEBUGLEVEL >= 10) {
2481                 NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet2, r);
2482         }
2483
2484         ZERO_STRUCT(r->out);
2485         r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
2486         if (r->out.return_authenticator == NULL) {
2487                 talloc_free(r);
2488                 return false;
2489         }
2490
2491         r->out.result = _netr_ServerPasswordSet2(p, r);
2492
2493         if (p->rng_fault_state) {
2494                 talloc_free(r);
2495                 /* Return true here, srv_pipe_hnd.c will take care */
2496                 return true;
2497         }
2498
2499         if (DEBUGLEVEL >= 10) {
2500                 NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet2, r);
2501         }
2502
2503         push = ndr_push_init_ctx(r, NULL);
2504         if (push == NULL) {
2505                 talloc_free(r);
2506                 return false;
2507         }
2508
2509         ndr_err = call->ndr_push(push, NDR_OUT, r);
2510         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2511                 talloc_free(r);
2512                 return false;
2513         }
2514
2515         blob = ndr_push_blob(push);
2516         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2517                 talloc_free(r);
2518                 return false;
2519         }
2520
2521         talloc_free(r);
2522
2523         return true;
2524 }
2525
2526 static bool api_netr_ServerPasswordGet(pipes_struct *p)
2527 {
2528         const struct ndr_interface_call *call;
2529         struct ndr_pull *pull;
2530         struct ndr_push *push;
2531         enum ndr_err_code ndr_err;
2532         DATA_BLOB blob;
2533         struct netr_ServerPasswordGet *r;
2534
2535         call = &ndr_table_netlogon.calls[NDR_NETR_SERVERPASSWORDGET];
2536
2537         r = talloc(talloc_tos(), struct netr_ServerPasswordGet);
2538         if (r == NULL) {
2539                 return false;
2540         }
2541
2542         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2543                 talloc_free(r);
2544                 return false;
2545         }
2546
2547         pull = ndr_pull_init_blob(&blob, r, NULL);
2548         if (pull == NULL) {
2549                 talloc_free(r);
2550                 return false;
2551         }
2552
2553         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2554         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2555         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2556                 talloc_free(r);
2557                 return false;
2558         }
2559
2560         if (DEBUGLEVEL >= 10) {
2561                 NDR_PRINT_IN_DEBUG(netr_ServerPasswordGet, r);
2562         }
2563
2564         ZERO_STRUCT(r->out);
2565         r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
2566         if (r->out.return_authenticator == NULL) {
2567                 talloc_free(r);
2568                 return false;
2569         }
2570
2571         r->out.password = talloc_zero(r, struct samr_Password);
2572         if (r->out.password == NULL) {
2573                 talloc_free(r);
2574                 return false;
2575         }
2576
2577         r->out.result = _netr_ServerPasswordGet(p, r);
2578
2579         if (p->rng_fault_state) {
2580                 talloc_free(r);
2581                 /* Return true here, srv_pipe_hnd.c will take care */
2582                 return true;
2583         }
2584
2585         if (DEBUGLEVEL >= 10) {
2586                 NDR_PRINT_OUT_DEBUG(netr_ServerPasswordGet, r);
2587         }
2588
2589         push = ndr_push_init_ctx(r, NULL);
2590         if (push == NULL) {
2591                 talloc_free(r);
2592                 return false;
2593         }
2594
2595         ndr_err = call->ndr_push(push, NDR_OUT, r);
2596         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2597                 talloc_free(r);
2598                 return false;
2599         }
2600
2601         blob = ndr_push_blob(push);
2602         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2603                 talloc_free(r);
2604                 return false;
2605         }
2606
2607         talloc_free(r);
2608
2609         return true;
2610 }
2611
2612 static bool api_netr_NETRLOGONSENDTOSAM(pipes_struct *p)
2613 {
2614         const struct ndr_interface_call *call;
2615         struct ndr_pull *pull;
2616         struct ndr_push *push;
2617         enum ndr_err_code ndr_err;
2618         DATA_BLOB blob;
2619         struct netr_NETRLOGONSENDTOSAM *r;
2620
2621         call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONSENDTOSAM];
2622
2623         r = talloc(talloc_tos(), struct netr_NETRLOGONSENDTOSAM);
2624         if (r == NULL) {
2625                 return false;
2626         }
2627
2628         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2629                 talloc_free(r);
2630                 return false;
2631         }
2632
2633         pull = ndr_pull_init_blob(&blob, r, NULL);
2634         if (pull == NULL) {
2635                 talloc_free(r);
2636                 return false;
2637         }
2638
2639         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2640         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2641         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2642                 talloc_free(r);
2643                 return false;
2644         }
2645
2646         if (DEBUGLEVEL >= 10) {
2647                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONSENDTOSAM, r);
2648         }
2649
2650         r->out.result = _netr_NETRLOGONSENDTOSAM(p, r);
2651
2652         if (p->rng_fault_state) {
2653                 talloc_free(r);
2654                 /* Return true here, srv_pipe_hnd.c will take care */
2655                 return true;
2656         }
2657
2658         if (DEBUGLEVEL >= 10) {
2659                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSENDTOSAM, r);
2660         }
2661
2662         push = ndr_push_init_ctx(r, NULL);
2663         if (push == NULL) {
2664                 talloc_free(r);
2665                 return false;
2666         }
2667
2668         ndr_err = call->ndr_push(push, NDR_OUT, r);
2669         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2670                 talloc_free(r);
2671                 return false;
2672         }
2673
2674         blob = ndr_push_blob(push);
2675         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2676                 talloc_free(r);
2677                 return false;
2678         }
2679
2680         talloc_free(r);
2681
2682         return true;
2683 }
2684
2685 static bool api_netr_DsRAddressToSitenamesW(pipes_struct *p)
2686 {
2687         const struct ndr_interface_call *call;
2688         struct ndr_pull *pull;
2689         struct ndr_push *push;
2690         enum ndr_err_code ndr_err;
2691         DATA_BLOB blob;
2692         struct netr_DsRAddressToSitenamesW *r;
2693
2694         call = &ndr_table_netlogon.calls[NDR_NETR_DSRADDRESSTOSITENAMESW];
2695
2696         r = talloc(talloc_tos(), struct netr_DsRAddressToSitenamesW);
2697         if (r == NULL) {
2698                 return false;
2699         }
2700
2701         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2702                 talloc_free(r);
2703                 return false;
2704         }
2705
2706         pull = ndr_pull_init_blob(&blob, r, NULL);
2707         if (pull == NULL) {
2708                 talloc_free(r);
2709                 return false;
2710         }
2711
2712         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2713         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2714         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2715                 talloc_free(r);
2716                 return false;
2717         }
2718
2719         if (DEBUGLEVEL >= 10) {
2720                 NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesW, r);
2721         }
2722
2723         ZERO_STRUCT(r->out);
2724         r->out.ctr = talloc_zero(r, struct netr_DsRAddressToSitenamesWCtr *);
2725         if (r->out.ctr == NULL) {
2726                 talloc_free(r);
2727                 return false;
2728         }
2729
2730         r->out.result = _netr_DsRAddressToSitenamesW(p, r);
2731
2732         if (p->rng_fault_state) {
2733                 talloc_free(r);
2734                 /* Return true here, srv_pipe_hnd.c will take care */
2735                 return true;
2736         }
2737
2738         if (DEBUGLEVEL >= 10) {
2739                 NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesW, r);
2740         }
2741
2742         push = ndr_push_init_ctx(r, NULL);
2743         if (push == NULL) {
2744                 talloc_free(r);
2745                 return false;
2746         }
2747
2748         ndr_err = call->ndr_push(push, NDR_OUT, r);
2749         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2750                 talloc_free(r);
2751                 return false;
2752         }
2753
2754         blob = ndr_push_blob(push);
2755         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2756                 talloc_free(r);
2757                 return false;
2758         }
2759
2760         talloc_free(r);
2761
2762         return true;
2763 }
2764
2765 static bool api_netr_DsRGetDCNameEx2(pipes_struct *p)
2766 {
2767         const struct ndr_interface_call *call;
2768         struct ndr_pull *pull;
2769         struct ndr_push *push;
2770         enum ndr_err_code ndr_err;
2771         DATA_BLOB blob;
2772         struct netr_DsRGetDCNameEx2 *r;
2773
2774         call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAMEEX2];
2775
2776         r = talloc(talloc_tos(), struct netr_DsRGetDCNameEx2);
2777         if (r == NULL) {
2778                 return false;
2779         }
2780
2781         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2782                 talloc_free(r);
2783                 return false;
2784         }
2785
2786         pull = ndr_pull_init_blob(&blob, r, NULL);
2787         if (pull == NULL) {
2788                 talloc_free(r);
2789                 return false;
2790         }
2791
2792         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2793         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2794         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2795                 talloc_free(r);
2796                 return false;
2797         }
2798
2799         if (DEBUGLEVEL >= 10) {
2800                 NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx2, r);
2801         }
2802
2803         ZERO_STRUCT(r->out);
2804         r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo *);
2805         if (r->out.info == NULL) {
2806                 talloc_free(r);
2807                 return false;
2808         }
2809
2810         r->out.result = _netr_DsRGetDCNameEx2(p, r);
2811
2812         if (p->rng_fault_state) {
2813                 talloc_free(r);
2814                 /* Return true here, srv_pipe_hnd.c will take care */
2815                 return true;
2816         }
2817
2818         if (DEBUGLEVEL >= 10) {
2819                 NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx2, r);
2820         }
2821
2822         push = ndr_push_init_ctx(r, NULL);
2823         if (push == NULL) {
2824                 talloc_free(r);
2825                 return false;
2826         }
2827
2828         ndr_err = call->ndr_push(push, NDR_OUT, r);
2829         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2830                 talloc_free(r);
2831                 return false;
2832         }
2833
2834         blob = ndr_push_blob(push);
2835         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2836                 talloc_free(r);
2837                 return false;
2838         }
2839
2840         talloc_free(r);
2841
2842         return true;
2843 }
2844
2845 static bool api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p)
2846 {
2847         const struct ndr_interface_call *call;
2848         struct ndr_pull *pull;
2849         struct ndr_push *push;
2850         enum ndr_err_code ndr_err;
2851         DATA_BLOB blob;
2852         struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r;
2853
2854         call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN];
2855
2856         r = talloc(talloc_tos(), struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN);
2857         if (r == NULL) {
2858                 return false;
2859         }
2860
2861         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2862                 talloc_free(r);
2863                 return false;
2864         }
2865
2866         pull = ndr_pull_init_blob(&blob, r, NULL);
2867         if (pull == NULL) {
2868                 talloc_free(r);
2869                 return false;
2870         }
2871
2872         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2873         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2874         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2875                 talloc_free(r);
2876                 return false;
2877         }
2878
2879         if (DEBUGLEVEL >= 10) {
2880                 NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, r);
2881         }
2882
2883         r->out.result = _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(p, r);
2884
2885         if (p->rng_fault_state) {
2886                 talloc_free(r);
2887                 /* Return true here, srv_pipe_hnd.c will take care */
2888                 return true;
2889         }
2890
2891         if (DEBUGLEVEL >= 10) {
2892                 NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, r);
2893         }
2894
2895         push = ndr_push_init_ctx(r, NULL);
2896         if (push == NULL) {
2897                 talloc_free(r);
2898                 return false;
2899         }
2900
2901         ndr_err = call->ndr_push(push, NDR_OUT, r);
2902         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2903                 talloc_free(r);
2904                 return false;
2905         }
2906
2907         blob = ndr_push_blob(push);
2908         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2909                 talloc_free(r);
2910                 return false;
2911         }
2912
2913         talloc_free(r);
2914
2915         return true;
2916 }
2917
2918 static bool api_netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p)
2919 {
2920         const struct ndr_interface_call *call;
2921         struct ndr_pull *pull;
2922         struct ndr_push *push;
2923         enum ndr_err_code ndr_err;
2924         DATA_BLOB blob;
2925         struct netr_NetrEnumerateTrustedDomainsEx *r;
2926
2927         call = &ndr_table_netlogon.calls[NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX];
2928
2929         r = talloc(talloc_tos(), struct netr_NetrEnumerateTrustedDomainsEx);
2930         if (r == NULL) {
2931                 return false;
2932         }
2933
2934         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2935                 talloc_free(r);
2936                 return false;
2937         }
2938
2939         pull = ndr_pull_init_blob(&blob, r, NULL);
2940         if (pull == NULL) {
2941                 talloc_free(r);
2942                 return false;
2943         }
2944
2945         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2946         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2947         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2948                 talloc_free(r);
2949                 return false;
2950         }
2951
2952         if (DEBUGLEVEL >= 10) {
2953                 NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomainsEx, r);
2954         }
2955
2956         ZERO_STRUCT(r->out);
2957         r->out.dom_trust_list = talloc_zero(r, struct netr_DomainTrustList);
2958         if (r->out.dom_trust_list == NULL) {
2959                 talloc_free(r);
2960                 return false;
2961         }
2962
2963         r->out.result = _netr_NetrEnumerateTrustedDomainsEx(p, r);
2964
2965         if (p->rng_fault_state) {
2966                 talloc_free(r);
2967                 /* Return true here, srv_pipe_hnd.c will take care */
2968                 return true;
2969         }
2970
2971         if (DEBUGLEVEL >= 10) {
2972                 NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomainsEx, r);
2973         }
2974
2975         push = ndr_push_init_ctx(r, NULL);
2976         if (push == NULL) {
2977                 talloc_free(r);
2978                 return false;
2979         }
2980
2981         ndr_err = call->ndr_push(push, NDR_OUT, r);
2982         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2983                 talloc_free(r);
2984                 return false;
2985         }
2986
2987         blob = ndr_push_blob(push);
2988         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2989                 talloc_free(r);
2990                 return false;
2991         }
2992
2993         talloc_free(r);
2994
2995         return true;
2996 }
2997
2998 static bool api_netr_DsRAddressToSitenamesExW(pipes_struct *p)
2999 {
3000         const struct ndr_interface_call *call;
3001         struct ndr_pull *pull;
3002         struct ndr_push *push;
3003         enum ndr_err_code ndr_err;
3004         DATA_BLOB blob;
3005         struct netr_DsRAddressToSitenamesExW *r;
3006
3007         call = &ndr_table_netlogon.calls[NDR_NETR_DSRADDRESSTOSITENAMESEXW];
3008
3009         r = talloc(talloc_tos(), struct netr_DsRAddressToSitenamesExW);
3010         if (r == NULL) {
3011                 return false;
3012         }
3013
3014         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3015                 talloc_free(r);
3016                 return false;
3017         }
3018
3019         pull = ndr_pull_init_blob(&blob, r, NULL);
3020         if (pull == NULL) {
3021                 talloc_free(r);
3022                 return false;
3023         }
3024
3025         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3026         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3027         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3028                 talloc_free(r);
3029                 return false;
3030         }
3031
3032         if (DEBUGLEVEL >= 10) {
3033                 NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesExW, r);
3034         }
3035
3036         ZERO_STRUCT(r->out);
3037         r->out.ctr = talloc_zero(r, struct netr_DsRAddressToSitenamesExWCtr *);
3038         if (r->out.ctr == NULL) {
3039                 talloc_free(r);
3040                 return false;
3041         }
3042
3043         r->out.result = _netr_DsRAddressToSitenamesExW(p, r);
3044
3045         if (p->rng_fault_state) {
3046                 talloc_free(r);
3047                 /* Return true here, srv_pipe_hnd.c will take care */
3048                 return true;
3049         }
3050
3051         if (DEBUGLEVEL >= 10) {
3052                 NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesExW, r);
3053         }
3054
3055         push = ndr_push_init_ctx(r, NULL);
3056         if (push == NULL) {
3057                 talloc_free(r);
3058                 return false;
3059         }
3060
3061         ndr_err = call->ndr_push(push, NDR_OUT, r);
3062         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3063                 talloc_free(r);
3064                 return false;
3065         }
3066
3067         blob = ndr_push_blob(push);
3068         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3069                 talloc_free(r);
3070                 return false;
3071         }
3072
3073         talloc_free(r);
3074
3075         return true;
3076 }
3077
3078 static bool api_netr_DsrGetDcSiteCoverageW(pipes_struct *p)
3079 {
3080         const struct ndr_interface_call *call;
3081         struct ndr_pull *pull;
3082         struct ndr_push *push;
3083         enum ndr_err_code ndr_err;
3084         DATA_BLOB blob;
3085         struct netr_DsrGetDcSiteCoverageW *r;
3086
3087         call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCSITECOVERAGEW];
3088
3089         r = talloc(talloc_tos(), struct netr_DsrGetDcSiteCoverageW);
3090         if (r == NULL) {
3091                 return false;
3092         }
3093
3094         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3095                 talloc_free(r);
3096                 return false;
3097         }
3098
3099         pull = ndr_pull_init_blob(&blob, r, NULL);
3100         if (pull == NULL) {
3101                 talloc_free(r);
3102                 return false;
3103         }
3104
3105         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3106         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3107         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3108                 talloc_free(r);
3109                 return false;
3110         }
3111
3112         if (DEBUGLEVEL >= 10) {
3113                 NDR_PRINT_IN_DEBUG(netr_DsrGetDcSiteCoverageW, r);
3114         }
3115
3116         ZERO_STRUCT(r->out);
3117         r->out.ctr = talloc_zero(r, struct DcSitesCtr *);
3118         if (r->out.ctr == NULL) {
3119                 talloc_free(r);
3120                 return false;
3121         }
3122
3123         r->out.result = _netr_DsrGetDcSiteCoverageW(p, r);
3124
3125         if (p->rng_fault_state) {
3126                 talloc_free(r);
3127                 /* Return true here, srv_pipe_hnd.c will take care */
3128                 return true;
3129         }
3130
3131         if (DEBUGLEVEL >= 10) {
3132                 NDR_PRINT_OUT_DEBUG(netr_DsrGetDcSiteCoverageW, r);
3133         }
3134
3135         push = ndr_push_init_ctx(r, NULL);
3136         if (push == NULL) {
3137                 talloc_free(r);
3138                 return false;
3139         }
3140
3141         ndr_err = call->ndr_push(push, NDR_OUT, r);
3142         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3143                 talloc_free(r);
3144                 return false;
3145         }
3146
3147         blob = ndr_push_blob(push);
3148         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3149                 talloc_free(r);
3150                 return false;
3151         }
3152
3153         talloc_free(r);
3154
3155         return true;
3156 }
3157
3158 static bool api_netr_LogonSamLogonEx(pipes_struct *p)
3159 {
3160         const struct ndr_interface_call *call;
3161         struct ndr_pull *pull;
3162         struct ndr_push *push;
3163         enum ndr_err_code ndr_err;
3164         DATA_BLOB blob;
3165         struct netr_LogonSamLogonEx *r;
3166
3167         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGONEX];
3168
3169         r = talloc(talloc_tos(), struct netr_LogonSamLogonEx);
3170         if (r == NULL) {
3171                 return false;
3172         }
3173
3174         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3175                 talloc_free(r);
3176                 return false;
3177         }
3178
3179         pull = ndr_pull_init_blob(&blob, r, NULL);
3180         if (pull == NULL) {
3181                 talloc_free(r);
3182                 return false;
3183         }
3184
3185         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3186         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3187         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3188                 talloc_free(r);
3189                 return false;
3190         }
3191
3192         if (DEBUGLEVEL >= 10) {
3193                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogonEx, r);
3194         }
3195
3196         ZERO_STRUCT(r->out);
3197         r->out.flags = r->in.flags;
3198         r->out.validation = talloc_zero(r, union netr_Validation);
3199         if (r->out.validation == NULL) {
3200                 talloc_free(r);
3201                 return false;
3202         }
3203
3204         r->out.authoritative = talloc_zero(r, uint8_t);
3205         if (r->out.authoritative == NULL) {
3206                 talloc_free(r);
3207                 return false;
3208         }
3209
3210         r->out.result = _netr_LogonSamLogonEx(p, r);
3211
3212         if (p->rng_fault_state) {
3213                 talloc_free(r);
3214                 /* Return true here, srv_pipe_hnd.c will take care */
3215                 return true;
3216         }
3217
3218         if (DEBUGLEVEL >= 10) {
3219                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonEx, r);
3220         }
3221
3222         push = ndr_push_init_ctx(r, NULL);
3223         if (push == NULL) {
3224                 talloc_free(r);
3225                 return false;
3226         }
3227
3228         ndr_err = call->ndr_push(push, NDR_OUT, r);
3229         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3230                 talloc_free(r);
3231                 return false;
3232         }
3233
3234         blob = ndr_push_blob(push);
3235         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3236                 talloc_free(r);
3237                 return false;
3238         }
3239
3240         talloc_free(r);
3241
3242         return true;
3243 }
3244
3245 static bool api_netr_DsrEnumerateDomainTrusts(pipes_struct *p)
3246 {
3247         const struct ndr_interface_call *call;
3248         struct ndr_pull *pull;
3249         struct ndr_push *push;
3250         enum ndr_err_code ndr_err;
3251         DATA_BLOB blob;
3252         struct netr_DsrEnumerateDomainTrusts *r;
3253
3254         call = &ndr_table_netlogon.calls[NDR_NETR_DSRENUMERATEDOMAINTRUSTS];
3255
3256         r = talloc(talloc_tos(), struct netr_DsrEnumerateDomainTrusts);
3257         if (r == NULL) {
3258                 return false;
3259         }
3260
3261         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3262                 talloc_free(r);
3263                 return false;
3264         }
3265
3266         pull = ndr_pull_init_blob(&blob, r, NULL);
3267         if (pull == NULL) {
3268                 talloc_free(r);
3269                 return false;
3270         }
3271
3272         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3273         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3274         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3275                 talloc_free(r);
3276                 return false;
3277         }
3278
3279         if (DEBUGLEVEL >= 10) {
3280                 NDR_PRINT_IN_DEBUG(netr_DsrEnumerateDomainTrusts, r);
3281         }
3282
3283         ZERO_STRUCT(r->out);
3284         r->out.trusts = talloc_zero(r, struct netr_DomainTrustList);
3285         if (r->out.trusts == NULL) {
3286                 talloc_free(r);
3287                 return false;
3288         }
3289
3290         r->out.result = _netr_DsrEnumerateDomainTrusts(p, r);
3291
3292         if (p->rng_fault_state) {
3293                 talloc_free(r);
3294                 /* Return true here, srv_pipe_hnd.c will take care */
3295                 return true;
3296         }
3297
3298         if (DEBUGLEVEL >= 10) {
3299                 NDR_PRINT_OUT_DEBUG(netr_DsrEnumerateDomainTrusts, r);
3300         }
3301
3302         push = ndr_push_init_ctx(r, NULL);
3303         if (push == NULL) {
3304                 talloc_free(r);
3305                 return false;
3306         }
3307
3308         ndr_err = call->ndr_push(push, NDR_OUT, r);
3309         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3310                 talloc_free(r);
3311                 return false;
3312         }
3313
3314         blob = ndr_push_blob(push);
3315         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3316                 talloc_free(r);
3317                 return false;
3318         }
3319
3320         talloc_free(r);
3321
3322         return true;
3323 }
3324
3325 static bool api_netr_DsrDeregisterDNSHostRecords(pipes_struct *p)
3326 {
3327         const struct ndr_interface_call *call;
3328         struct ndr_pull *pull;
3329         struct ndr_push *push;
3330         enum ndr_err_code ndr_err;
3331         DATA_BLOB blob;
3332         struct netr_DsrDeregisterDNSHostRecords *r;
3333
3334         call = &ndr_table_netlogon.calls[NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS];
3335
3336         r = talloc(talloc_tos(), struct netr_DsrDeregisterDNSHostRecords);
3337         if (r == NULL) {
3338                 return false;
3339         }
3340
3341         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3342                 talloc_free(r);
3343                 return false;
3344         }
3345
3346         pull = ndr_pull_init_blob(&blob, r, NULL);
3347         if (pull == NULL) {
3348                 talloc_free(r);
3349                 return false;
3350         }
3351
3352         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3353         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3354         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3355                 talloc_free(r);
3356                 return false;
3357         }
3358
3359         if (DEBUGLEVEL >= 10) {
3360                 NDR_PRINT_IN_DEBUG(netr_DsrDeregisterDNSHostRecords, r);
3361         }
3362
3363         r->out.result = _netr_DsrDeregisterDNSHostRecords(p, r);
3364
3365         if (p->rng_fault_state) {
3366                 talloc_free(r);
3367                 /* Return true here, srv_pipe_hnd.c will take care */
3368                 return true;
3369         }
3370
3371         if (DEBUGLEVEL >= 10) {
3372                 NDR_PRINT_OUT_DEBUG(netr_DsrDeregisterDNSHostRecords, r);
3373         }
3374
3375         push = ndr_push_init_ctx(r, NULL);
3376         if (push == NULL) {
3377                 talloc_free(r);
3378                 return false;
3379         }
3380
3381         ndr_err = call->ndr_push(push, NDR_OUT, r);
3382         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3383                 talloc_free(r);
3384                 return false;
3385         }
3386
3387         blob = ndr_push_blob(push);
3388         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3389                 talloc_free(r);
3390                 return false;
3391         }
3392
3393         talloc_free(r);
3394
3395         return true;
3396 }
3397
3398 static bool api_netr_ServerTrustPasswordsGet(pipes_struct *p)
3399 {
3400         const struct ndr_interface_call *call;
3401         struct ndr_pull *pull;
3402         struct ndr_push *push;
3403         enum ndr_err_code ndr_err;
3404         DATA_BLOB blob;
3405         struct netr_ServerTrustPasswordsGet *r;
3406
3407         call = &ndr_table_netlogon.calls[NDR_NETR_SERVERTRUSTPASSWORDSGET];
3408
3409         r = talloc(talloc_tos(), struct netr_ServerTrustPasswordsGet);
3410         if (r == NULL) {
3411                 return false;
3412         }
3413
3414         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3415                 talloc_free(r);
3416                 return false;
3417         }
3418
3419         pull = ndr_pull_init_blob(&blob, r, NULL);
3420         if (pull == NULL) {
3421                 talloc_free(r);
3422                 return false;
3423         }
3424
3425         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3426         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3427         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3428                 talloc_free(r);
3429                 return false;
3430         }
3431
3432         if (DEBUGLEVEL >= 10) {
3433                 NDR_PRINT_IN_DEBUG(netr_ServerTrustPasswordsGet, r);
3434         }
3435
3436         ZERO_STRUCT(r->out);
3437         r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
3438         if (r->out.return_authenticator == NULL) {
3439                 talloc_free(r);
3440                 return false;
3441         }
3442
3443         r->out.password = talloc_zero(r, struct samr_Password);
3444         if (r->out.password == NULL) {
3445                 talloc_free(r);
3446                 return false;
3447         }
3448
3449         r->out.password2 = talloc_zero(r, struct samr_Password);
3450         if (r->out.password2 == NULL) {
3451                 talloc_free(r);
3452                 return false;
3453         }
3454
3455         r->out.result = _netr_ServerTrustPasswordsGet(p, r);
3456
3457         if (p->rng_fault_state) {
3458                 talloc_free(r);
3459                 /* Return true here, srv_pipe_hnd.c will take care */
3460                 return true;
3461         }
3462
3463         if (DEBUGLEVEL >= 10) {
3464                 NDR_PRINT_OUT_DEBUG(netr_ServerTrustPasswordsGet, r);
3465         }
3466
3467         push = ndr_push_init_ctx(r, NULL);
3468         if (push == NULL) {
3469                 talloc_free(r);
3470                 return false;
3471         }
3472
3473         ndr_err = call->ndr_push(push, NDR_OUT, r);
3474         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3475                 talloc_free(r);
3476                 return false;
3477         }
3478
3479         blob = ndr_push_blob(push);
3480         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3481                 talloc_free(r);
3482                 return false;
3483         }
3484
3485         talloc_free(r);
3486
3487         return true;
3488 }
3489
3490 static bool api_netr_DsRGetForestTrustInformation(pipes_struct *p)
3491 {
3492         const struct ndr_interface_call *call;
3493         struct ndr_pull *pull;
3494         struct ndr_push *push;
3495         enum ndr_err_code ndr_err;
3496         DATA_BLOB blob;
3497         struct netr_DsRGetForestTrustInformation *r;
3498
3499         call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETFORESTTRUSTINFORMATION];
3500
3501         r = talloc(talloc_tos(), struct netr_DsRGetForestTrustInformation);
3502         if (r == NULL) {
3503                 return false;
3504         }
3505
3506         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3507                 talloc_free(r);
3508                 return false;
3509         }
3510
3511         pull = ndr_pull_init_blob(&blob, r, NULL);
3512         if (pull == NULL) {
3513                 talloc_free(r);
3514                 return false;
3515         }
3516
3517         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3518         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3519         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3520                 talloc_free(r);
3521                 return false;
3522         }
3523
3524         if (DEBUGLEVEL >= 10) {
3525                 NDR_PRINT_IN_DEBUG(netr_DsRGetForestTrustInformation, r);
3526         }
3527
3528         ZERO_STRUCT(r->out);
3529         r->out.forest_trust_info = talloc_zero(r, struct lsa_ForestTrustInformation *);
3530         if (r->out.forest_trust_info == NULL) {
3531                 talloc_free(r);
3532                 return false;
3533         }
3534
3535         r->out.result = _netr_DsRGetForestTrustInformation(p, r);
3536
3537         if (p->rng_fault_state) {
3538                 talloc_free(r);
3539                 /* Return true here, srv_pipe_hnd.c will take care */
3540                 return true;
3541         }
3542
3543         if (DEBUGLEVEL >= 10) {
3544                 NDR_PRINT_OUT_DEBUG(netr_DsRGetForestTrustInformation, r);
3545         }
3546
3547         push = ndr_push_init_ctx(r, NULL);
3548         if (push == NULL) {
3549                 talloc_free(r);
3550                 return false;
3551         }
3552
3553         ndr_err = call->ndr_push(push, NDR_OUT, r);
3554         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3555                 talloc_free(r);
3556                 return false;
3557         }
3558
3559         blob = ndr_push_blob(push);
3560         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3561                 talloc_free(r);
3562                 return false;
3563         }
3564
3565         talloc_free(r);
3566
3567         return true;
3568 }
3569
3570 static bool api_netr_GetForestTrustInformation(pipes_struct *p)
3571 {
3572         const struct ndr_interface_call *call;
3573         struct ndr_pull *pull;
3574         struct ndr_push *push;
3575         enum ndr_err_code ndr_err;
3576         DATA_BLOB blob;
3577         struct netr_GetForestTrustInformation *r;
3578
3579         call = &ndr_table_netlogon.calls[NDR_NETR_GETFORESTTRUSTINFORMATION];
3580
3581         r = talloc(talloc_tos(), struct netr_GetForestTrustInformation);
3582         if (r == NULL) {
3583                 return false;
3584         }
3585
3586         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3587                 talloc_free(r);
3588                 return false;
3589         }
3590
3591         pull = ndr_pull_init_blob(&blob, r, NULL);
3592         if (pull == NULL) {
3593                 talloc_free(r);
3594                 return false;
3595         }
3596
3597         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3598         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3599         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3600                 talloc_free(r);
3601                 return false;
3602         }
3603
3604         if (DEBUGLEVEL >= 10) {
3605                 NDR_PRINT_IN_DEBUG(netr_GetForestTrustInformation, r);
3606         }
3607
3608         ZERO_STRUCT(r->out);
3609         r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
3610         if (r->out.return_authenticator == NULL) {
3611                 talloc_free(r);
3612                 return false;
3613         }
3614
3615         r->out.forest_trust_info = talloc_zero(r, struct lsa_ForestTrustInformation *);
3616         if (r->out.forest_trust_info == NULL) {
3617                 talloc_free(r);
3618                 return false;
3619         }
3620
3621         r->out.result = _netr_GetForestTrustInformation(p, r);
3622
3623         if (p->rng_fault_state) {
3624                 talloc_free(r);
3625                 /* Return true here, srv_pipe_hnd.c will take care */
3626                 return true;
3627         }
3628
3629         if (DEBUGLEVEL >= 10) {
3630                 NDR_PRINT_OUT_DEBUG(netr_GetForestTrustInformation, r);
3631         }
3632
3633         push = ndr_push_init_ctx(r, NULL);
3634         if (push == NULL) {
3635                 talloc_free(r);
3636                 return false;
3637         }
3638
3639         ndr_err = call->ndr_push(push, NDR_OUT, r);
3640         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3641                 talloc_free(r);
3642                 return false;
3643         }
3644
3645         blob = ndr_push_blob(push);
3646         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3647                 talloc_free(r);
3648                 return false;
3649         }
3650
3651         talloc_free(r);
3652
3653         return true;
3654 }
3655
3656 static bool api_netr_LogonSamLogonWithFlags(pipes_struct *p)
3657 {
3658         const struct ndr_interface_call *call;
3659         struct ndr_pull *pull;
3660         struct ndr_push *push;
3661         enum ndr_err_code ndr_err;
3662         DATA_BLOB blob;
3663         struct netr_LogonSamLogonWithFlags *r;
3664
3665         call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGONWITHFLAGS];
3666
3667         r = talloc(talloc_tos(), struct netr_LogonSamLogonWithFlags);
3668         if (r == NULL) {
3669                 return false;
3670         }
3671
3672         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3673                 talloc_free(r);
3674                 return false;
3675         }
3676
3677         pull = ndr_pull_init_blob(&blob, r, NULL);
3678         if (pull == NULL) {
3679                 talloc_free(r);
3680                 return false;
3681         }
3682
3683         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3684         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3685         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3686                 talloc_free(r);
3687                 return false;
3688         }
3689
3690         if (DEBUGLEVEL >= 10) {
3691                 NDR_PRINT_IN_DEBUG(netr_LogonSamLogonWithFlags, r);
3692         }
3693
3694         ZERO_STRUCT(r->out);
3695         r->out.return_authenticator = r->in.return_authenticator;
3696         r->out.flags = r->in.flags;
3697         r->out.validation = talloc_zero(r, union netr_Validation);
3698         if (r->out.validation == NULL) {
3699                 talloc_free(r);
3700                 return false;
3701         }
3702
3703         r->out.authoritative = talloc_zero(r, uint8_t);
3704         if (r->out.authoritative == NULL) {
3705                 talloc_free(r);
3706                 return false;
3707         }
3708
3709         r->out.result = _netr_LogonSamLogonWithFlags(p, r);
3710
3711         if (p->rng_fault_state) {
3712                 talloc_free(r);
3713                 /* Return true here, srv_pipe_hnd.c will take care */
3714                 return true;
3715         }
3716
3717         if (DEBUGLEVEL >= 10) {
3718                 NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonWithFlags, r);
3719         }
3720
3721         push = ndr_push_init_ctx(r, NULL);
3722         if (push == NULL) {
3723                 talloc_free(r);
3724                 return false;
3725         }
3726
3727         ndr_err = call->ndr_push(push, NDR_OUT, r);
3728         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3729                 talloc_free(r);
3730                 return false;
3731         }
3732
3733         blob = ndr_push_blob(push);
3734         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3735                 talloc_free(r);
3736                 return false;
3737         }
3738
3739         talloc_free(r);
3740
3741         return true;
3742 }
3743
3744 static bool api_netr_ServerGetTrustInfo(pipes_struct *p)
3745 {
3746         const struct ndr_interface_call *call;
3747         struct ndr_pull *pull;
3748         struct ndr_push *push;
3749         enum ndr_err_code ndr_err;
3750         DATA_BLOB blob;
3751         struct netr_ServerGetTrustInfo *r;
3752
3753         call = &ndr_table_netlogon.calls[NDR_NETR_SERVERGETTRUSTINFO];
3754
3755         r = talloc(talloc_tos(), struct netr_ServerGetTrustInfo);
3756         if (r == NULL) {
3757                 return false;
3758         }
3759
3760         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3761                 talloc_free(r);
3762                 return false;
3763         }
3764
3765         pull = ndr_pull_init_blob(&blob, r, NULL);
3766         if (pull == NULL) {
3767                 talloc_free(r);
3768                 return false;
3769         }
3770
3771         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3772         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3773         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3774                 talloc_free(r);
3775                 return false;
3776         }
3777
3778         if (DEBUGLEVEL >= 10) {
3779                 NDR_PRINT_IN_DEBUG(netr_ServerGetTrustInfo, r);
3780         }
3781
3782         ZERO_STRUCT(r->out);
3783         r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
3784         if (r->out.return_authenticator == NULL) {
3785                 talloc_free(r);
3786                 return false;
3787         }
3788
3789         r->out.new_owf_password = talloc_zero(r, struct samr_Password);
3790         if (r->out.new_owf_password == NULL) {
3791                 talloc_free(r);
3792                 return false;
3793         }
3794
3795         r->out.old_owf_password = talloc_zero(r, struct samr_Password);
3796         if (r->out.old_owf_password == NULL) {
3797                 talloc_free(r);
3798                 return false;
3799         }
3800
3801         r->out.trust_info = talloc_zero(r, struct netr_TrustInfo *);
3802         if (r->out.trust_info == NULL) {
3803                 talloc_free(r);
3804                 return false;
3805         }
3806
3807         r->out.result = _netr_ServerGetTrustInfo(p, r);
3808
3809         if (p->rng_fault_state) {
3810                 talloc_free(r);
3811                 /* Return true here, srv_pipe_hnd.c will take care */
3812                 return true;
3813         }
3814
3815         if (DEBUGLEVEL >= 10) {
3816                 NDR_PRINT_OUT_DEBUG(netr_ServerGetTrustInfo, r);
3817         }
3818
3819         push = ndr_push_init_ctx(r, NULL);
3820         if (push == NULL) {
3821                 talloc_free(r);
3822                 return false;
3823         }
3824
3825         ndr_err = call->ndr_push(push, NDR_OUT, r);
3826         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3827                 talloc_free(r);
3828                 return false;
3829         }
3830
3831         blob = ndr_push_blob(push);
3832         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3833                 talloc_free(r);
3834                 return false;
3835         }
3836
3837         talloc_free(r);
3838
3839         return true;
3840 }
3841
3842
3843 /* Tables */
3844 static struct api_struct api_netlogon_cmds[] = 
3845 {
3846         {"NETR_LOGONUASLOGON", NDR_NETR_LOGONUASLOGON, api_netr_LogonUasLogon},
3847         {"NETR_LOGONUASLOGOFF", NDR_NETR_LOGONUASLOGOFF, api_netr_LogonUasLogoff},
3848         {"NETR_LOGONSAMLOGON", NDR_NETR_LOGONSAMLOGON, api_netr_LogonSamLogon},
3849         {"NETR_LOGONSAMLOGOFF", NDR_NETR_LOGONSAMLOGOFF, api_netr_LogonSamLogoff},
3850         {"NETR_SERVERREQCHALLENGE", NDR_NETR_SERVERREQCHALLENGE, api_netr_ServerReqChallenge},
3851         {"NETR_SERVERAUTHENTICATE", NDR_NETR_SERVERAUTHENTICATE, api_netr_ServerAuthenticate},
3852         {"NETR_SERVERPASSWORDSET", NDR_NETR_SERVERPASSWORDSET, api_netr_ServerPasswordSet},
3853         {"NETR_DATABASEDELTAS", NDR_NETR_DATABASEDELTAS, api_netr_DatabaseDeltas},
3854         {"NETR_DATABASESYNC", NDR_NETR_DATABASESYNC, api_netr_DatabaseSync},
3855         {"NETR_ACCOUNTDELTAS", NDR_NETR_ACCOUNTDELTAS, api_netr_AccountDeltas},
3856         {"NETR_ACCOUNTSYNC", NDR_NETR_ACCOUNTSYNC, api_netr_AccountSync},
3857         {"NETR_GETDCNAME", NDR_NETR_GETDCNAME, api_netr_GetDcName},
3858         {"NETR_LOGONCONTROL", NDR_NETR_LOGONCONTROL, api_netr_LogonControl},
3859         {"NETR_GETANYDCNAME", NDR_NETR_GETANYDCNAME, api_netr_GetAnyDCName},
3860         {"NETR_LOGONCONTROL2", NDR_NETR_LOGONCONTROL2, api_netr_LogonControl2},
3861         {"NETR_SERVERAUTHENTICATE2", NDR_NETR_SERVERAUTHENTICATE2, api_netr_ServerAuthenticate2},
3862         {"NETR_DATABASESYNC2", NDR_NETR_DATABASESYNC2, api_netr_DatabaseSync2},
3863         {"NETR_DATABASEREDO", NDR_NETR_DATABASEREDO, api_netr_DatabaseRedo},
3864         {"NETR_LOGONCONTROL2EX", NDR_NETR_LOGONCONTROL2EX, api_netr_LogonControl2Ex},
3865         {"NETR_NETRENUMERATETRUSTEDDOMAINS", NDR_NETR_NETRENUMERATETRUSTEDDOMAINS, api_netr_NetrEnumerateTrustedDomains},
3866         {"NETR_DSRGETDCNAME", NDR_NETR_DSRGETDCNAME, api_netr_DsRGetDCName},
3867         {"NETR_LOGONGETCAPABILITIES", NDR_NETR_LOGONGETCAPABILITIES, api_netr_LogonGetCapabilities},
3868         {"NETR_NETRLOGONSETSERVICEBITS", NDR_NETR_NETRLOGONSETSERVICEBITS, api_netr_NETRLOGONSETSERVICEBITS},
3869         {"NETR_LOGONGETTRUSTRID", NDR_NETR_LOGONGETTRUSTRID, api_netr_LogonGetTrustRid},
3870         {"NETR_NETRLOGONCOMPUTESERVERDIGEST", NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST, api_netr_NETRLOGONCOMPUTESERVERDIGEST},
3871         {"NETR_NETRLOGONCOMPUTECLIENTDIGEST", NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST, api_netr_NETRLOGONCOMPUTECLIENTDIGEST},
3872         {"NETR_SERVERAUTHENTICATE3", NDR_NETR_SERVERAUTHENTICATE3, api_netr_ServerAuthenticate3},
3873         {"NETR_DSRGETDCNAMEEX", NDR_NETR_DSRGETDCNAMEEX, api_netr_DsRGetDCNameEx},
3874         {"NETR_DSRGETSITENAME", NDR_NETR_DSRGETSITENAME, api_netr_DsRGetSiteName},
3875         {"NETR_LOGONGETDOMAININFO", NDR_NETR_LOGONGETDOMAININFO, api_netr_LogonGetDomainInfo},
3876         {"NETR_SERVERPASSWORDSET2", NDR_NETR_SERVERPASSWORDSET2, api_netr_ServerPasswordSet2},
3877         {"NETR_SERVERPASSWORDGET", NDR_NETR_SERVERPASSWORDGET, api_netr_ServerPasswordGet},
3878         {"NETR_NETRLOGONSENDTOSAM", NDR_NETR_NETRLOGONSENDTOSAM, api_netr_NETRLOGONSENDTOSAM},
3879         {"NETR_DSRADDRESSTOSITENAMESW", NDR_NETR_DSRADDRESSTOSITENAMESW, api_netr_DsRAddressToSitenamesW},
3880         {"NETR_DSRGETDCNAMEEX2", NDR_NETR_DSRGETDCNAMEEX2, api_netr_DsRGetDCNameEx2},
3881         {"NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN", NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN, api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN},
3882         {"NETR_NETRENUMERATETRUSTEDDOMAINSEX", NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX, api_netr_NetrEnumerateTrustedDomainsEx},
3883         {"NETR_DSRADDRESSTOSITENAMESEXW", NDR_NETR_DSRADDRESSTOSITENAMESEXW, api_netr_DsRAddressToSitenamesExW},
3884         {"NETR_DSRGETDCSITECOVERAGEW", NDR_NETR_DSRGETDCSITECOVERAGEW, api_netr_DsrGetDcSiteCoverageW},
3885         {"NETR_LOGONSAMLOGONEX", NDR_NETR_LOGONSAMLOGONEX, api_netr_LogonSamLogonEx},
3886         {"NETR_DSRENUMERATEDOMAINTRUSTS", NDR_NETR_DSRENUMERATEDOMAINTRUSTS, api_netr_DsrEnumerateDomainTrusts},
3887         {"NETR_DSRDEREGISTERDNSHOSTRECORDS", NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS, api_netr_DsrDeregisterDNSHostRecords},
3888         {"NETR_SERVERTRUSTPASSWORDSGET", NDR_NETR_SERVERTRUSTPASSWORDSGET, api_netr_ServerTrustPasswordsGet},
3889         {"NETR_DSRGETFORESTTRUSTINFORMATION", NDR_NETR_DSRGETFORESTTRUSTINFORMATION, api_netr_DsRGetForestTrustInformation},
3890         {"NETR_GETFORESTTRUSTINFORMATION", NDR_NETR_GETFORESTTRUSTINFORMATION, api_netr_GetForestTrustInformation},
3891         {"NETR_LOGONSAMLOGONWITHFLAGS", NDR_NETR_LOGONSAMLOGONWITHFLAGS, api_netr_LogonSamLogonWithFlags},
3892         {"NETR_SERVERGETTRUSTINFO", NDR_NETR_SERVERGETTRUSTINFO, api_netr_ServerGetTrustInfo},
3893 };
3894
3895 void netlogon_get_pipe_fns(struct api_struct **fns, int *n_fns)
3896 {
3897         *fns = api_netlogon_cmds;
3898         *n_fns = sizeof(api_netlogon_cmds) / sizeof(struct api_struct);
3899 }
3900
3901 NTSTATUS rpc_netlogon_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
3902 {
3903         if (cli->pipes_struct == NULL) {
3904                 return NT_STATUS_INVALID_PARAMETER;
3905         }
3906
3907         switch (opnum)
3908         {
3909                 case NDR_NETR_LOGONUASLOGON: {
3910                         struct netr_LogonUasLogon *r = (struct netr_LogonUasLogon *)_r;
3911                         ZERO_STRUCT(r->out);
3912                         r->out.info = talloc_zero(mem_ctx, struct netr_UasInfo *);
3913                         if (r->out.info == NULL) {
3914                         return NT_STATUS_NO_MEMORY;
3915                         }
3916
3917                         r->out.result = _netr_LogonUasLogon(cli->pipes_struct, r);
3918                         return NT_STATUS_OK;
3919                 }
3920
3921                 case NDR_NETR_LOGONUASLOGOFF: {
3922                         struct netr_LogonUasLogoff *r = (struct netr_LogonUasLogoff *)_r;
3923                         ZERO_STRUCT(r->out);
3924                         r->out.info = talloc_zero(mem_ctx, struct netr_UasLogoffInfo);
3925                         if (r->out.info == NULL) {
3926                         return NT_STATUS_NO_MEMORY;
3927                         }
3928
3929                         r->out.result = _netr_LogonUasLogoff(cli->pipes_struct, r);
3930                         return NT_STATUS_OK;
3931                 }
3932
3933                 case NDR_NETR_LOGONSAMLOGON: {
3934                         struct netr_LogonSamLogon *r = (struct netr_LogonSamLogon *)_r;
3935                         ZERO_STRUCT(r->out);
3936                         r->out.return_authenticator = r->in.return_authenticator;
3937                         r->out.validation = talloc_zero(mem_ctx, union netr_Validation);
3938                         if (r->out.validation == NULL) {
3939                         return NT_STATUS_NO_MEMORY;
3940                         }
3941
3942                         r->out.authoritative = talloc_zero(mem_ctx, uint8_t);
3943                         if (r->out.authoritative == NULL) {
3944                         return NT_STATUS_NO_MEMORY;
3945                         }
3946
3947                         r->out.result = _netr_LogonSamLogon(cli->pipes_struct, r);
3948                         return NT_STATUS_OK;
3949                 }
3950
3951                 case NDR_NETR_LOGONSAMLOGOFF: {
3952                         struct netr_LogonSamLogoff *r = (struct netr_LogonSamLogoff *)_r;
3953                         ZERO_STRUCT(r->out);
3954                         r->out.return_authenticator = r->in.return_authenticator;
3955                         r->out.result = _netr_LogonSamLogoff(cli->pipes_struct, r);
3956                         return NT_STATUS_OK;
3957                 }
3958
3959                 case NDR_NETR_SERVERREQCHALLENGE: {
3960                         struct netr_ServerReqChallenge *r = (struct netr_ServerReqChallenge *)_r;
3961                         ZERO_STRUCT(r->out);
3962                         r->out.return_credentials = talloc_zero(mem_ctx, struct netr_Credential);
3963                         if (r->out.return_credentials == NULL) {
3964                         return NT_STATUS_NO_MEMORY;
3965                         }
3966
3967                         r->out.result = _netr_ServerReqChallenge(cli->pipes_struct, r);
3968                         return NT_STATUS_OK;
3969                 }
3970
3971                 case NDR_NETR_SERVERAUTHENTICATE: {
3972                         struct netr_ServerAuthenticate *r = (struct netr_ServerAuthenticate *)_r;
3973                         ZERO_STRUCT(r->out);
3974                         r->out.return_credentials = talloc_zero(mem_ctx, struct netr_Credential);
3975                         if (r->out.return_credentials == NULL) {
3976                         return NT_STATUS_NO_MEMORY;
3977                         }
3978
3979                         r->out.result = _netr_ServerAuthenticate(cli->pipes_struct, r);
3980                         return NT_STATUS_OK;
3981                 }
3982
3983                 case NDR_NETR_SERVERPASSWORDSET: {
3984                         struct netr_ServerPasswordSet *r = (struct netr_ServerPasswordSet *)_r;
3985                         ZERO_STRUCT(r->out);
3986                         r->out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator);
3987                         if (r->out.return_authenticator == NULL) {
3988                         return NT_STATUS_NO_MEMORY;
3989                         }
3990
3991                         r->out.result = _netr_ServerPasswordSet(cli->pipes_struct, r);
3992                         return NT_STATUS_OK;
3993                 }
3994
3995                 case NDR_NETR_DATABASEDELTAS: {
3996                         struct netr_DatabaseDeltas *r = (struct netr_DatabaseDeltas *)_r;
3997                         ZERO_STRUCT(r->out);
3998                         r->out.return_authenticator = r->in.return_authenticator;
3999                         r->out.sequence_num = r->in.sequence_num;
4000                         r->out.delta_enum_array = talloc_zero(mem_ctx, struct netr_DELTA_ENUM_ARRAY *);
4001                         if (r->out.delta_enum_array == NULL) {
4002                         return NT_STATUS_NO_MEMORY;
4003                         }
4004
4005                         r->out.result = _netr_DatabaseDeltas(cli->pipes_struct, r);
4006                         return NT_STATUS_OK;
4007                 }
4008
4009                 case NDR_NETR_DATABASESYNC: {
4010                         struct netr_DatabaseSync *r = (struct netr_DatabaseSync *)_r;
4011                         ZERO_STRUCT(r->out);
4012                         r->out.return_authenticator = r->in.return_authenticator;
4013                         r->out.sync_context = r->in.sync_context;
4014                         r->out.delta_enum_array = talloc_zero(mem_ctx, struct netr_DELTA_ENUM_ARRAY *);
4015                         if (r->out.delta_enum_array == NULL) {
4016                         return NT_STATUS_NO_MEMORY;
4017                         }
4018
4019                         r->out.result = _netr_DatabaseSync(cli->pipes_struct, r);
4020                         return NT_STATUS_OK;
4021                 }
4022
4023                 case NDR_NETR_ACCOUNTDELTAS: {
4024                         struct netr_AccountDeltas *r = (struct netr_AccountDeltas *)_r;
4025                         ZERO_STRUCT(r->out);
4026                         r->out.return_authenticator = r->in.return_authenticator;
4027                         r->out.buffer = talloc_zero(mem_ctx, struct netr_AccountBuffer);
4028                         if (r->out.buffer == NULL) {
4029                         return NT_STATUS_NO_MEMORY;
4030                         }
4031
4032                         r->out.count_returned = talloc_zero(mem_ctx, uint32_t);
4033                         if (r->out.count_returned == NULL) {
4034                         return NT_STATUS_NO_MEMORY;
4035                         }
4036
4037                         r->out.total_entries = talloc_zero(mem_ctx, uint32_t);
4038                         if (r->out.total_entries == NULL) {
4039                         return NT_STATUS_NO_MEMORY;
4040                         }
4041
4042                         r->out.recordid = talloc_zero(mem_ctx, struct netr_UAS_INFO_0);
4043                         if (r->out.recordid == NULL) {
4044                         return NT_STATUS_NO_MEMORY;
4045                         }
4046
4047                         r->out.result = _netr_AccountDeltas(cli->pipes_struct, r);
4048                         return NT_STATUS_OK;
4049                 }
4050
4051                 case NDR_NETR_ACCOUNTSYNC: {
4052                         struct netr_AccountSync *r = (struct netr_AccountSync *)_r;
4053                         ZERO_STRUCT(r->out);
4054                         r->out.return_authenticator = r->in.return_authenticator;
4055                         r->out.recordid = r->in.recordid;
4056                         r->out.buffer = talloc_zero(mem_ctx, struct netr_AccountBuffer);
4057                         if (r->out.buffer == NULL) {
4058                         return NT_STATUS_NO_MEMORY;
4059                         }
4060
4061                         r->out.count_returned = talloc_zero(mem_ctx, uint32_t);
4062                         if (r->out.count_returned == NULL) {
4063                         return NT_STATUS_NO_MEMORY;
4064                         }
4065
4066                         r->out.total_entries = talloc_zero(mem_ctx, uint32_t);
4067                         if (r->out.total_entries == NULL) {
4068                         return NT_STATUS_NO_MEMORY;
4069                         }
4070
4071                         r->out.next_reference = talloc_zero(mem_ctx, uint32_t);
4072                         if (r->out.next_reference == NULL) {
4073                         return NT_STATUS_NO_MEMORY;
4074                         }
4075
4076                         r->out.result = _netr_AccountSync(cli->pipes_struct, r);
4077                         return NT_STATUS_OK;
4078                 }
4079
4080                 case NDR_NETR_GETDCNAME: {
4081                         struct netr_GetDcName *r = (struct netr_GetDcName *)_r;
4082                         ZERO_STRUCT(r->out);
4083                         r->out.dcname = talloc_zero(mem_ctx, const char *);
4084                         if (r->out.dcname == NULL) {
4085                         return NT_STATUS_NO_MEMORY;
4086                         }
4087
4088                         r->out.result = _netr_GetDcName(cli->pipes_struct, r);
4089                         return NT_STATUS_OK;
4090                 }
4091
4092                 case NDR_NETR_LOGONCONTROL: {
4093                         struct netr_LogonControl *r = (struct netr_LogonControl *)_r;
4094                         ZERO_STRUCT(r->out);
4095                         r->out.query = talloc_zero(mem_ctx, union netr_CONTROL_QUERY_INFORMATION);
4096                         if (r->out.query == NULL) {
4097                         return NT_STATUS_NO_MEMORY;
4098                         }
4099
4100                         r->out.result = _netr_LogonControl(cli->pipes_struct, r);
4101                         return NT_STATUS_OK;
4102                 }
4103
4104                 case NDR_NETR_GETANYDCNAME: {
4105                         struct netr_GetAnyDCName *r = (struct netr_GetAnyDCName *)_r;
4106                         ZERO_STRUCT(r->out);
4107                         r->out.dcname = talloc_zero(mem_ctx, const char *);
4108                         if (r->out.dcname == NULL) {
4109                         return NT_STATUS_NO_MEMORY;
4110                         }
4111
4112                         r->out.result = _netr_GetAnyDCName(cli->pipes_struct, r);
4113                         return NT_STATUS_OK;
4114                 }
4115
4116                 case NDR_NETR_LOGONCONTROL2: {
4117                         struct netr_LogonControl2 *r = (struct netr_LogonControl2 *)_r;
4118                         ZERO_STRUCT(r->out);
4119                         r->out.query = talloc_zero(mem_ctx, union netr_CONTROL_QUERY_INFORMATION);
4120                         if (r->out.query == NULL) {
4121                         return NT_STATUS_NO_MEMORY;
4122                         }
4123
4124                         r->out.result = _netr_LogonControl2(cli->pipes_struct, r);
4125                         return NT_STATUS_OK;
4126                 }
4127
4128                 case NDR_NETR_SERVERAUTHENTICATE2: {
4129                         struct netr_ServerAuthenticate2 *r = (struct netr_ServerAuthenticate2 *)_r;
4130                         ZERO_STRUCT(r->out);
4131                         r->out.negotiate_flags = r->in.negotiate_flags;
4132                         r->out.return_credentials = talloc_zero(mem_ctx, struct netr_Credential);
4133                         if (r->out.return_credentials == NULL) {
4134                         return NT_STATUS_NO_MEMORY;
4135                         }
4136
4137                         r->out.result = _netr_ServerAuthenticate2(cli->pipes_struct, r);
4138                         return NT_STATUS_OK;
4139                 }
4140
4141                 case NDR_NETR_DATABASESYNC2: {
4142                         struct netr_DatabaseSync2 *r = (struct netr_DatabaseSync2 *)_r;
4143                         ZERO_STRUCT(r->out);
4144                         r->out.return_authenticator = r->in.return_authenticator;
4145                         r->out.sync_context = r->in.sync_context;
4146                         r->out.delta_enum_array = talloc_zero(mem_ctx, struct netr_DELTA_ENUM_ARRAY *);
4147                         if (r->out.delta_enum_array == NULL) {
4148                         return NT_STATUS_NO_MEMORY;
4149                         }
4150
4151                         r->out.result = _netr_DatabaseSync2(cli->pipes_struct, r);
4152                         return NT_STATUS_OK;
4153                 }
4154
4155                 case NDR_NETR_DATABASEREDO: {
4156                         struct netr_DatabaseRedo *r = (struct netr_DatabaseRedo *)_r;
4157                         ZERO_STRUCT(r->out);
4158                         r->out.return_authenticator = r->in.return_authenticator;
4159                         r->out.delta_enum_array = talloc_zero(mem_ctx, struct netr_DELTA_ENUM_ARRAY *);
4160                         if (r->out.delta_enum_array == NULL) {
4161                         return NT_STATUS_NO_MEMORY;
4162                         }
4163
4164                         r->out.result = _netr_DatabaseRedo(cli->pipes_struct, r);
4165                         return NT_STATUS_OK;
4166                 }
4167
4168                 case NDR_NETR_LOGONCONTROL2EX: {
4169                         struct netr_LogonControl2Ex *r = (struct netr_LogonControl2Ex *)_r;
4170                         ZERO_STRUCT(r->out);
4171                         r->out.query = talloc_zero(mem_ctx, union netr_CONTROL_QUERY_INFORMATION);
4172                         if (r->out.query == NULL) {
4173                         return NT_STATUS_NO_MEMORY;
4174                         }
4175
4176                         r->out.result = _netr_LogonControl2Ex(cli->pipes_struct, r);
4177                         return NT_STATUS_OK;
4178                 }
4179
4180                 case NDR_NETR_NETRENUMERATETRUSTEDDOMAINS: {
4181                         struct netr_NetrEnumerateTrustedDomains *r = (struct netr_NetrEnumerateTrustedDomains *)_r;
4182                         ZERO_STRUCT(r->out);
4183                         r->out.trusted_domains_blob = talloc_zero(mem_ctx, struct netr_Blob);
4184                         if (r->out.trusted_domains_blob == NULL) {
4185                         return NT_STATUS_NO_MEMORY;
4186                         }
4187
4188                         r->out.result = _netr_NetrEnumerateTrustedDomains(cli->pipes_struct, r);
4189                         return NT_STATUS_OK;
4190                 }
4191
4192                 case NDR_NETR_DSRGETDCNAME: {
4193                         struct netr_DsRGetDCName *r = (struct netr_DsRGetDCName *)_r;
4194                         ZERO_STRUCT(r->out);
4195                         r->out.info = talloc_zero(mem_ctx, struct netr_DsRGetDCNameInfo *);
4196                         if (r->out.info == NULL) {
4197                         return NT_STATUS_NO_MEMORY;
4198                         }
4199
4200                         r->out.result = _netr_DsRGetDCName(cli->pipes_struct, r);
4201                         return NT_STATUS_OK;
4202                 }
4203
4204                 case NDR_NETR_LOGONGETCAPABILITIES: {
4205                         struct netr_LogonGetCapabilities *r = (struct netr_LogonGetCapabilities *)_r;
4206                         ZERO_STRUCT(r->out);
4207                         r->out.return_authenticator = r->in.return_authenticator;
4208                         r->out.capabilities = talloc_zero(mem_ctx, union netr_Capabilities);
4209                         if (r->out.capabilities == NULL) {
4210                         return NT_STATUS_NO_MEMORY;
4211                         }
4212
4213                         r->out.result = _netr_LogonGetCapabilities(cli->pipes_struct, r);
4214                         return NT_STATUS_OK;
4215                 }
4216
4217                 case NDR_NETR_NETRLOGONSETSERVICEBITS: {
4218                         struct netr_NETRLOGONSETSERVICEBITS *r = (struct netr_NETRLOGONSETSERVICEBITS *)_r;
4219                         r->out.result = _netr_NETRLOGONSETSERVICEBITS(cli->pipes_struct, r);
4220                         return NT_STATUS_OK;
4221                 }
4222
4223                 case NDR_NETR_LOGONGETTRUSTRID: {
4224                         struct netr_LogonGetTrustRid *r = (struct netr_LogonGetTrustRid *)_r;
4225                         ZERO_STRUCT(r->out);
4226                         r->out.rid = talloc_zero(mem_ctx, uint32_t);
4227                         if (r->out.rid == NULL) {
4228                         return NT_STATUS_NO_MEMORY;
4229                         }
4230
4231                         r->out.result = _netr_LogonGetTrustRid(cli->pipes_struct, r);
4232                         return NT_STATUS_OK;
4233                 }
4234
4235                 case NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST: {
4236                         struct netr_NETRLOGONCOMPUTESERVERDIGEST *r = (struct netr_NETRLOGONCOMPUTESERVERDIGEST *)_r;
4237                         r->out.result = _netr_NETRLOGONCOMPUTESERVERDIGEST(cli->pipes_struct, r);
4238                         return NT_STATUS_OK;
4239                 }
4240
4241                 case NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST: {
4242                         struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r = (struct netr_NETRLOGONCOMPUTECLIENTDIGEST *)_r;
4243                         r->out.result = _netr_NETRLOGONCOMPUTECLIENTDIGEST(cli->pipes_struct, r);
4244                         return NT_STATUS_OK;
4245                 }
4246
4247                 case NDR_NETR_SERVERAUTHENTICATE3: {
4248                         struct netr_ServerAuthenticate3 *r = (struct netr_ServerAuthenticate3 *)_r;
4249                         ZERO_STRUCT(r->out);
4250                         r->out.negotiate_flags = r->in.negotiate_flags;
4251                         r->out.return_credentials = talloc_zero(mem_ctx, struct netr_Credential);
4252                         if (r->out.return_credentials == NULL) {
4253                         return NT_STATUS_NO_MEMORY;
4254                         }
4255
4256                         r->out.rid = talloc_zero(mem_ctx, uint32_t);
4257                         if (r->out.rid == NULL) {
4258                         return NT_STATUS_NO_MEMORY;
4259                         }
4260
4261                         r->out.result = _netr_ServerAuthenticate3(cli->pipes_struct, r);
4262                         return NT_STATUS_OK;
4263                 }
4264
4265                 case NDR_NETR_DSRGETDCNAMEEX: {
4266                         struct netr_DsRGetDCNameEx *r = (struct netr_DsRGetDCNameEx *)_r;
4267                         ZERO_STRUCT(r->out);
4268                         r->out.info = talloc_zero(mem_ctx, struct netr_DsRGetDCNameInfo *);
4269                         if (r->out.info == NULL) {
4270                         return NT_STATUS_NO_MEMORY;
4271                         }
4272
4273                         r->out.result = _netr_DsRGetDCNameEx(cli->pipes_struct, r);
4274                         return NT_STATUS_OK;
4275                 }
4276
4277                 case NDR_NETR_DSRGETSITENAME: {
4278                         struct netr_DsRGetSiteName *r = (struct netr_DsRGetSiteName *)_r;
4279                         ZERO_STRUCT(r->out);
4280                         r->out.site = talloc_zero(mem_ctx, const char *);
4281                         if (r->out.site == NULL) {
4282                         return NT_STATUS_NO_MEMORY;
4283                         }
4284
4285                         r->out.result = _netr_DsRGetSiteName(cli->pipes_struct, r);
4286                         return NT_STATUS_OK;
4287                 }
4288
4289                 case NDR_NETR_LOGONGETDOMAININFO: {
4290                         struct netr_LogonGetDomainInfo *r = (struct netr_LogonGetDomainInfo *)_r;
4291                         ZERO_STRUCT(r->out);
4292                         r->out.return_authenticator = r->in.return_authenticator;
4293                         r->out.info = talloc_zero(mem_ctx, union netr_DomainInfo);
4294                         if (r->out.info == NULL) {
4295                         return NT_STATUS_NO_MEMORY;
4296                         }
4297
4298                         r->out.result = _netr_LogonGetDomainInfo(cli->pipes_struct, r);
4299                         return NT_STATUS_OK;
4300                 }
4301
4302                 case NDR_NETR_SERVERPASSWORDSET2: {
4303                         struct netr_ServerPasswordSet2 *r = (struct netr_ServerPasswordSet2 *)_r;
4304                         ZERO_STRUCT(r->out);
4305                         r->out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator);
4306                         if (r->out.return_authenticator == NULL) {
4307                         return NT_STATUS_NO_MEMORY;
4308                         }
4309
4310                         r->out.result = _netr_ServerPasswordSet2(cli->pipes_struct, r);
4311                         return NT_STATUS_OK;
4312                 }
4313
4314                 case NDR_NETR_SERVERPASSWORDGET: {
4315                         struct netr_ServerPasswordGet *r = (struct netr_ServerPasswordGet *)_r;
4316                         ZERO_STRUCT(r->out);
4317                         r->out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator);
4318                         if (r->out.return_authenticator == NULL) {
4319                         return NT_STATUS_NO_MEMORY;
4320                         }
4321
4322                         r->out.password = talloc_zero(mem_ctx, struct samr_Password);
4323                         if (r->out.password == NULL) {
4324                         return NT_STATUS_NO_MEMORY;
4325                         }
4326
4327                         r->out.result = _netr_ServerPasswordGet(cli->pipes_struct, r);
4328                         return NT_STATUS_OK;
4329                 }
4330
4331                 case NDR_NETR_NETRLOGONSENDTOSAM: {
4332                         struct netr_NETRLOGONSENDTOSAM *r = (struct netr_NETRLOGONSENDTOSAM *)_r;
4333                         r->out.result = _netr_NETRLOGONSENDTOSAM(cli->pipes_struct, r);
4334                         return NT_STATUS_OK;
4335                 }
4336
4337                 case NDR_NETR_DSRADDRESSTOSITENAMESW: {
4338                         struct netr_DsRAddressToSitenamesW *r = (struct netr_DsRAddressToSitenamesW *)_r;
4339                         ZERO_STRUCT(r->out);
4340                         r->out.ctr = talloc_zero(mem_ctx, struct netr_DsRAddressToSitenamesWCtr *);
4341                         if (r->out.ctr == NULL) {
4342                         return NT_STATUS_NO_MEMORY;
4343                         }
4344
4345                         r->out.result = _netr_DsRAddressToSitenamesW(cli->pipes_struct, r);
4346                         return NT_STATUS_OK;
4347                 }
4348
4349                 case NDR_NETR_DSRGETDCNAMEEX2: {
4350                         struct netr_DsRGetDCNameEx2 *r = (struct netr_DsRGetDCNameEx2 *)_r;
4351                         ZERO_STRUCT(r->out);
4352                         r->out.info = talloc_zero(mem_ctx, struct netr_DsRGetDCNameInfo *);
4353                         if (r->out.info == NULL) {
4354                         return NT_STATUS_NO_MEMORY;
4355                         }
4356
4357                         r->out.result = _netr_DsRGetDCNameEx2(cli->pipes_struct, r);
4358                         return NT_STATUS_OK;
4359                 }
4360
4361                 case NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN: {
4362                         struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r = (struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *)_r;
4363                         r->out.result = _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(cli->pipes_struct, r);
4364                         return NT_STATUS_OK;
4365                 }
4366
4367                 case NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX: {
4368                         struct netr_NetrEnumerateTrustedDomainsEx *r = (struct netr_NetrEnumerateTrustedDomainsEx *)_r;
4369                         ZERO_STRUCT(r->out);
4370                         r->out.dom_trust_list = talloc_zero(mem_ctx, struct netr_DomainTrustList);
4371                         if (r->out.dom_trust_list == NULL) {
4372                         return NT_STATUS_NO_MEMORY;
4373                         }
4374
4375                         r->out.result = _netr_NetrEnumerateTrustedDomainsEx(cli->pipes_struct, r);
4376                         return NT_STATUS_OK;
4377                 }
4378
4379                 case NDR_NETR_DSRADDRESSTOSITENAMESEXW: {
4380                         struct netr_DsRAddressToSitenamesExW *r = (struct netr_DsRAddressToSitenamesExW *)_r;
4381                         ZERO_STRUCT(r->out);
4382                         r->out.ctr = talloc_zero(mem_ctx, struct netr_DsRAddressToSitenamesExWCtr *);
4383                         if (r->out.ctr == NULL) {
4384                         return NT_STATUS_NO_MEMORY;
4385                         }
4386
4387                         r->out.result = _netr_DsRAddressToSitenamesExW(cli->pipes_struct, r);
4388                         return NT_STATUS_OK;
4389                 }
4390
4391                 case NDR_NETR_DSRGETDCSITECOVERAGEW: {
4392                         struct netr_DsrGetDcSiteCoverageW *r = (struct netr_DsrGetDcSiteCoverageW *)_r;
4393                         ZERO_STRUCT(r->out);
4394                         r->out.ctr = talloc_zero(mem_ctx, struct DcSitesCtr *);
4395                         if (r->out.ctr == NULL) {
4396                         return NT_STATUS_NO_MEMORY;
4397                         }
4398
4399                         r->out.result = _netr_DsrGetDcSiteCoverageW(cli->pipes_struct, r);
4400                         return NT_STATUS_OK;
4401                 }
4402
4403                 case NDR_NETR_LOGONSAMLOGONEX: {
4404                         struct netr_LogonSamLogonEx *r = (struct netr_LogonSamLogonEx *)_r;
4405                         ZERO_STRUCT(r->out);
4406                         r->out.flags = r->in.flags;
4407                         r->out.validation = talloc_zero(mem_ctx, union netr_Validation);
4408                         if (r->out.validation == NULL) {
4409                         return NT_STATUS_NO_MEMORY;
4410                         }
4411
4412                         r->out.authoritative = talloc_zero(mem_ctx, uint8_t);
4413                         if (r->out.authoritative == NULL) {
4414                         return NT_STATUS_NO_MEMORY;
4415                         }
4416
4417                         r->out.result = _netr_LogonSamLogonEx(cli->pipes_struct, r);
4418                         return NT_STATUS_OK;
4419                 }
4420
4421                 case NDR_NETR_DSRENUMERATEDOMAINTRUSTS: {
4422                         struct netr_DsrEnumerateDomainTrusts *r = (struct netr_DsrEnumerateDomainTrusts *)_r;
4423                         ZERO_STRUCT(r->out);
4424                         r->out.trusts = talloc_zero(mem_ctx, struct netr_DomainTrustList);
4425                         if (r->out.trusts == NULL) {
4426                         return NT_STATUS_NO_MEMORY;
4427                         }
4428
4429                         r->out.result = _netr_DsrEnumerateDomainTrusts(cli->pipes_struct, r);
4430                         return NT_STATUS_OK;
4431                 }
4432
4433                 case NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS: {
4434                         struct netr_DsrDeregisterDNSHostRecords *r = (struct netr_DsrDeregisterDNSHostRecords *)_r;
4435                         r->out.result = _netr_DsrDeregisterDNSHostRecords(cli->pipes_struct, r);
4436                         return NT_STATUS_OK;
4437                 }
4438
4439                 case NDR_NETR_SERVERTRUSTPASSWORDSGET: {
4440                         struct netr_ServerTrustPasswordsGet *r = (struct netr_ServerTrustPasswordsGet *)_r;
4441                         ZERO_STRUCT(r->out);
4442                         r->out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator);
4443                         if (r->out.return_authenticator == NULL) {
4444                         return NT_STATUS_NO_MEMORY;
4445                         }
4446
4447                         r->out.password = talloc_zero(mem_ctx, struct samr_Password);
4448                         if (r->out.password == NULL) {
4449                         return NT_STATUS_NO_MEMORY;
4450                         }
4451
4452                         r->out.password2 = talloc_zero(mem_ctx, struct samr_Password);
4453                         if (r->out.password2 == NULL) {
4454                         return NT_STATUS_NO_MEMORY;
4455                         }
4456
4457                         r->out.result = _netr_ServerTrustPasswordsGet(cli->pipes_struct, r);
4458                         return NT_STATUS_OK;
4459                 }
4460
4461                 case NDR_NETR_DSRGETFORESTTRUSTINFORMATION: {
4462                         struct netr_DsRGetForestTrustInformation *r = (struct netr_DsRGetForestTrustInformation *)_r;
4463                         ZERO_STRUCT(r->out);
4464                         r->out.forest_trust_info = talloc_zero(mem_ctx, struct lsa_ForestTrustInformation *);
4465                         if (r->out.forest_trust_info == NULL) {
4466                         return NT_STATUS_NO_MEMORY;
4467                         }
4468
4469                         r->out.result = _netr_DsRGetForestTrustInformation(cli->pipes_struct, r);
4470                         return NT_STATUS_OK;
4471                 }
4472
4473                 case NDR_NETR_GETFORESTTRUSTINFORMATION: {
4474                         struct netr_GetForestTrustInformation *r = (struct netr_GetForestTrustInformation *)_r;
4475                         ZERO_STRUCT(r->out);
4476                         r->out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator);
4477                         if (r->out.return_authenticator == NULL) {
4478                         return NT_STATUS_NO_MEMORY;
4479                         }
4480
4481                         r->out.forest_trust_info = talloc_zero(mem_ctx, struct lsa_ForestTrustInformation *);
4482                         if (r->out.forest_trust_info == NULL) {
4483                         return NT_STATUS_NO_MEMORY;
4484                         }
4485
4486                         r->out.result = _netr_GetForestTrustInformation(cli->pipes_struct, r);
4487                         return NT_STATUS_OK;
4488                 }
4489
4490                 case NDR_NETR_LOGONSAMLOGONWITHFLAGS: {
4491                         struct netr_LogonSamLogonWithFlags *r = (struct netr_LogonSamLogonWithFlags *)_r;
4492                         ZERO_STRUCT(r->out);
4493                         r->out.return_authenticator = r->in.return_authenticator;
4494                         r->out.flags = r->in.flags;
4495                         r->out.validation = talloc_zero(mem_ctx, union netr_Validation);
4496                         if (r->out.validation == NULL) {
4497                         return NT_STATUS_NO_MEMORY;
4498                         }
4499
4500                         r->out.authoritative = talloc_zero(mem_ctx, uint8_t);
4501                         if (r->out.authoritative == NULL) {
4502                         return NT_STATUS_NO_MEMORY;
4503                         }
4504
4505                         r->out.result = _netr_LogonSamLogonWithFlags(cli->pipes_struct, r);
4506                         return NT_STATUS_OK;
4507                 }
4508
4509                 case NDR_NETR_SERVERGETTRUSTINFO: {
4510                         struct netr_ServerGetTrustInfo *r = (struct netr_ServerGetTrustInfo *)_r;
4511                         ZERO_STRUCT(r->out);
4512                         r->out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator);
4513                         if (r->out.return_authenticator == NULL) {
4514                         return NT_STATUS_NO_MEMORY;
4515                         }
4516
4517                         r->out.new_owf_password = talloc_zero(mem_ctx, struct samr_Password);
4518                         if (r->out.new_owf_password == NULL) {
4519                         return NT_STATUS_NO_MEMORY;
4520                         }
4521
4522                         r->out.old_owf_password = talloc_zero(mem_ctx, struct samr_Password);
4523                         if (r->out.old_owf_password == NULL) {
4524                         return NT_STATUS_NO_MEMORY;
4525                         }
4526
4527                         r->out.trust_info = talloc_zero(mem_ctx, struct netr_TrustInfo *);
4528                         if (r->out.trust_info == NULL) {
4529                         return NT_STATUS_NO_MEMORY;
4530                         }
4531
4532                         r->out.result = _netr_ServerGetTrustInfo(cli->pipes_struct, r);
4533                         return NT_STATUS_OK;
4534                 }
4535
4536                 default:
4537                         return NT_STATUS_NOT_IMPLEMENTED;
4538         }
4539 }
4540
4541 NTSTATUS rpc_netlogon_init(void)
4542 {
4543         return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "netlogon", "netlogon", &ndr_table_netlogon, api_netlogon_cmds, sizeof(api_netlogon_cmds) / sizeof(struct api_struct));
4544 }