r25068: Older samba3 DCs will return DCERPC_FAULT_OP_RNG_ERROR for every opcode on the
[Samba.git] / source / librpc / gen_ndr / srv_echo.c
blob046f448040bc35c93409b41e232fe984440d3ba4
1 /*
2 * Unix SMB/CIFS implementation.
3 * server auto-generated by pidl. DO NOT MODIFY!
4 */
6 #include "includes.h"
7 #include "librpc/gen_ndr/srv_echo.h"
9 static BOOL api_echo_AddOne(pipes_struct *p)
11 struct ndr_pull *pull;
12 struct ndr_push *push;
13 NTSTATUS status;
14 DATA_BLOB blob;
15 struct echo_AddOne r;
16 TALLOC_CTX *mem_ctx = talloc_init("api_echo_AddOne");
18 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
19 talloc_free(mem_ctx);
20 return False;
23 pull = ndr_pull_init_blob(&blob, mem_ctx);
24 if (pull == NULL) {
25 talloc_free(mem_ctx);
26 return False;
29 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
30 status = ndr_pull_echo_AddOne(pull, NDR_IN, &r);
31 if (NT_STATUS_IS_ERR(status)) {
32 talloc_free(mem_ctx);
33 return False;
36 if (DEBUGLEVEL >= 10)
37 NDR_PRINT_IN_DEBUG(echo_AddOne, &r);
39 ZERO_STRUCT(r.out);
40 r.out.out_data = talloc_zero(mem_ctx, uint32_t);
41 if (r.out.out_data == NULL) {
42 talloc_free(mem_ctx);
43 return False;
46 _echo_AddOne(p, &r);
48 if (p->rng_fault_state) {
49 talloc_free(mem_ctx);
50 /* Return True here, srv_pipe_hnd.c will take care */
51 return True;
54 if (DEBUGLEVEL >= 10)
55 NDR_PRINT_OUT_DEBUG(echo_AddOne, &r);
57 push = ndr_push_init_ctx(mem_ctx);
58 if (push == NULL) {
59 talloc_free(mem_ctx);
60 return False;
63 status = ndr_push_echo_AddOne(push, NDR_OUT, &r);
64 if (NT_STATUS_IS_ERR(status)) {
65 talloc_free(mem_ctx);
66 return False;
69 blob = ndr_push_blob(push);
70 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
71 talloc_free(mem_ctx);
72 return False;
75 talloc_free(mem_ctx);
77 return True;
80 static BOOL api_echo_EchoData(pipes_struct *p)
82 struct ndr_pull *pull;
83 struct ndr_push *push;
84 NTSTATUS status;
85 DATA_BLOB blob;
86 struct echo_EchoData r;
87 TALLOC_CTX *mem_ctx = talloc_init("api_echo_EchoData");
89 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
90 talloc_free(mem_ctx);
91 return False;
94 pull = ndr_pull_init_blob(&blob, mem_ctx);
95 if (pull == NULL) {
96 talloc_free(mem_ctx);
97 return False;
100 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
101 status = ndr_pull_echo_EchoData(pull, NDR_IN, &r);
102 if (NT_STATUS_IS_ERR(status)) {
103 talloc_free(mem_ctx);
104 return False;
107 if (DEBUGLEVEL >= 10)
108 NDR_PRINT_IN_DEBUG(echo_EchoData, &r);
110 ZERO_STRUCT(r.out);
111 r.out.out_data = talloc_zero_array(mem_ctx, uint8_t, r.in.len);
112 if (r.out.out_data == NULL) {
113 talloc_free(mem_ctx);
114 return False;
117 _echo_EchoData(p, &r);
119 if (p->rng_fault_state) {
120 talloc_free(mem_ctx);
121 /* Return True here, srv_pipe_hnd.c will take care */
122 return True;
125 if (DEBUGLEVEL >= 10)
126 NDR_PRINT_OUT_DEBUG(echo_EchoData, &r);
128 push = ndr_push_init_ctx(mem_ctx);
129 if (push == NULL) {
130 talloc_free(mem_ctx);
131 return False;
134 status = ndr_push_echo_EchoData(push, NDR_OUT, &r);
135 if (NT_STATUS_IS_ERR(status)) {
136 talloc_free(mem_ctx);
137 return False;
140 blob = ndr_push_blob(push);
141 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
142 talloc_free(mem_ctx);
143 return False;
146 talloc_free(mem_ctx);
148 return True;
151 static BOOL api_echo_SinkData(pipes_struct *p)
153 struct ndr_pull *pull;
154 struct ndr_push *push;
155 NTSTATUS status;
156 DATA_BLOB blob;
157 struct echo_SinkData r;
158 TALLOC_CTX *mem_ctx = talloc_init("api_echo_SinkData");
160 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
161 talloc_free(mem_ctx);
162 return False;
165 pull = ndr_pull_init_blob(&blob, mem_ctx);
166 if (pull == NULL) {
167 talloc_free(mem_ctx);
168 return False;
171 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
172 status = ndr_pull_echo_SinkData(pull, NDR_IN, &r);
173 if (NT_STATUS_IS_ERR(status)) {
174 talloc_free(mem_ctx);
175 return False;
178 if (DEBUGLEVEL >= 10)
179 NDR_PRINT_IN_DEBUG(echo_SinkData, &r);
181 _echo_SinkData(p, &r);
183 if (p->rng_fault_state) {
184 talloc_free(mem_ctx);
185 /* Return True here, srv_pipe_hnd.c will take care */
186 return True;
189 if (DEBUGLEVEL >= 10)
190 NDR_PRINT_OUT_DEBUG(echo_SinkData, &r);
192 push = ndr_push_init_ctx(mem_ctx);
193 if (push == NULL) {
194 talloc_free(mem_ctx);
195 return False;
198 status = ndr_push_echo_SinkData(push, NDR_OUT, &r);
199 if (NT_STATUS_IS_ERR(status)) {
200 talloc_free(mem_ctx);
201 return False;
204 blob = ndr_push_blob(push);
205 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
206 talloc_free(mem_ctx);
207 return False;
210 talloc_free(mem_ctx);
212 return True;
215 static BOOL api_echo_SourceData(pipes_struct *p)
217 struct ndr_pull *pull;
218 struct ndr_push *push;
219 NTSTATUS status;
220 DATA_BLOB blob;
221 struct echo_SourceData r;
222 TALLOC_CTX *mem_ctx = talloc_init("api_echo_SourceData");
224 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
225 talloc_free(mem_ctx);
226 return False;
229 pull = ndr_pull_init_blob(&blob, mem_ctx);
230 if (pull == NULL) {
231 talloc_free(mem_ctx);
232 return False;
235 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
236 status = ndr_pull_echo_SourceData(pull, NDR_IN, &r);
237 if (NT_STATUS_IS_ERR(status)) {
238 talloc_free(mem_ctx);
239 return False;
242 if (DEBUGLEVEL >= 10)
243 NDR_PRINT_IN_DEBUG(echo_SourceData, &r);
245 ZERO_STRUCT(r.out);
246 r.out.data = talloc_zero_array(mem_ctx, uint8_t, r.in.len);
247 if (r.out.data == NULL) {
248 talloc_free(mem_ctx);
249 return False;
252 _echo_SourceData(p, &r);
254 if (p->rng_fault_state) {
255 talloc_free(mem_ctx);
256 /* Return True here, srv_pipe_hnd.c will take care */
257 return True;
260 if (DEBUGLEVEL >= 10)
261 NDR_PRINT_OUT_DEBUG(echo_SourceData, &r);
263 push = ndr_push_init_ctx(mem_ctx);
264 if (push == NULL) {
265 talloc_free(mem_ctx);
266 return False;
269 status = ndr_push_echo_SourceData(push, NDR_OUT, &r);
270 if (NT_STATUS_IS_ERR(status)) {
271 talloc_free(mem_ctx);
272 return False;
275 blob = ndr_push_blob(push);
276 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
277 talloc_free(mem_ctx);
278 return False;
281 talloc_free(mem_ctx);
283 return True;
286 static BOOL api_echo_TestCall(pipes_struct *p)
288 struct ndr_pull *pull;
289 struct ndr_push *push;
290 NTSTATUS status;
291 DATA_BLOB blob;
292 struct echo_TestCall r;
293 TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestCall");
295 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
296 talloc_free(mem_ctx);
297 return False;
300 pull = ndr_pull_init_blob(&blob, mem_ctx);
301 if (pull == NULL) {
302 talloc_free(mem_ctx);
303 return False;
306 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
307 status = ndr_pull_echo_TestCall(pull, NDR_IN, &r);
308 if (NT_STATUS_IS_ERR(status)) {
309 talloc_free(mem_ctx);
310 return False;
313 if (DEBUGLEVEL >= 10)
314 NDR_PRINT_IN_DEBUG(echo_TestCall, &r);
316 ZERO_STRUCT(r.out);
317 r.out.s2 = talloc_zero(mem_ctx, const char *);
318 if (r.out.s2 == NULL) {
319 talloc_free(mem_ctx);
320 return False;
323 _echo_TestCall(p, &r);
325 if (p->rng_fault_state) {
326 talloc_free(mem_ctx);
327 /* Return True here, srv_pipe_hnd.c will take care */
328 return True;
331 if (DEBUGLEVEL >= 10)
332 NDR_PRINT_OUT_DEBUG(echo_TestCall, &r);
334 push = ndr_push_init_ctx(mem_ctx);
335 if (push == NULL) {
336 talloc_free(mem_ctx);
337 return False;
340 status = ndr_push_echo_TestCall(push, NDR_OUT, &r);
341 if (NT_STATUS_IS_ERR(status)) {
342 talloc_free(mem_ctx);
343 return False;
346 blob = ndr_push_blob(push);
347 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
348 talloc_free(mem_ctx);
349 return False;
352 talloc_free(mem_ctx);
354 return True;
357 static BOOL api_echo_TestCall2(pipes_struct *p)
359 struct ndr_pull *pull;
360 struct ndr_push *push;
361 NTSTATUS status;
362 DATA_BLOB blob;
363 struct echo_TestCall2 r;
364 TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestCall2");
366 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
367 talloc_free(mem_ctx);
368 return False;
371 pull = ndr_pull_init_blob(&blob, mem_ctx);
372 if (pull == NULL) {
373 talloc_free(mem_ctx);
374 return False;
377 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
378 status = ndr_pull_echo_TestCall2(pull, NDR_IN, &r);
379 if (NT_STATUS_IS_ERR(status)) {
380 talloc_free(mem_ctx);
381 return False;
384 if (DEBUGLEVEL >= 10)
385 NDR_PRINT_IN_DEBUG(echo_TestCall2, &r);
387 ZERO_STRUCT(r.out);
388 r.out.info = talloc_zero(mem_ctx, union echo_Info);
389 if (r.out.info == NULL) {
390 talloc_free(mem_ctx);
391 return False;
394 r.out.result = _echo_TestCall2(p, &r);
396 if (p->rng_fault_state) {
397 talloc_free(mem_ctx);
398 /* Return True here, srv_pipe_hnd.c will take care */
399 return True;
402 if (DEBUGLEVEL >= 10)
403 NDR_PRINT_OUT_DEBUG(echo_TestCall2, &r);
405 push = ndr_push_init_ctx(mem_ctx);
406 if (push == NULL) {
407 talloc_free(mem_ctx);
408 return False;
411 status = ndr_push_echo_TestCall2(push, NDR_OUT, &r);
412 if (NT_STATUS_IS_ERR(status)) {
413 talloc_free(mem_ctx);
414 return False;
417 blob = ndr_push_blob(push);
418 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
419 talloc_free(mem_ctx);
420 return False;
423 talloc_free(mem_ctx);
425 return True;
428 static BOOL api_echo_TestSleep(pipes_struct *p)
430 struct ndr_pull *pull;
431 struct ndr_push *push;
432 NTSTATUS status;
433 DATA_BLOB blob;
434 struct echo_TestSleep r;
435 TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestSleep");
437 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
438 talloc_free(mem_ctx);
439 return False;
442 pull = ndr_pull_init_blob(&blob, mem_ctx);
443 if (pull == NULL) {
444 talloc_free(mem_ctx);
445 return False;
448 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
449 status = ndr_pull_echo_TestSleep(pull, NDR_IN, &r);
450 if (NT_STATUS_IS_ERR(status)) {
451 talloc_free(mem_ctx);
452 return False;
455 if (DEBUGLEVEL >= 10)
456 NDR_PRINT_IN_DEBUG(echo_TestSleep, &r);
458 r.out.result = _echo_TestSleep(p, &r);
460 if (p->rng_fault_state) {
461 talloc_free(mem_ctx);
462 /* Return True here, srv_pipe_hnd.c will take care */
463 return True;
466 if (DEBUGLEVEL >= 10)
467 NDR_PRINT_OUT_DEBUG(echo_TestSleep, &r);
469 push = ndr_push_init_ctx(mem_ctx);
470 if (push == NULL) {
471 talloc_free(mem_ctx);
472 return False;
475 status = ndr_push_echo_TestSleep(push, NDR_OUT, &r);
476 if (NT_STATUS_IS_ERR(status)) {
477 talloc_free(mem_ctx);
478 return False;
481 blob = ndr_push_blob(push);
482 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
483 talloc_free(mem_ctx);
484 return False;
487 talloc_free(mem_ctx);
489 return True;
492 static BOOL api_echo_TestEnum(pipes_struct *p)
494 struct ndr_pull *pull;
495 struct ndr_push *push;
496 NTSTATUS status;
497 DATA_BLOB blob;
498 struct echo_TestEnum r;
499 TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestEnum");
501 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
502 talloc_free(mem_ctx);
503 return False;
506 pull = ndr_pull_init_blob(&blob, mem_ctx);
507 if (pull == NULL) {
508 talloc_free(mem_ctx);
509 return False;
512 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
513 status = ndr_pull_echo_TestEnum(pull, NDR_IN, &r);
514 if (NT_STATUS_IS_ERR(status)) {
515 talloc_free(mem_ctx);
516 return False;
519 if (DEBUGLEVEL >= 10)
520 NDR_PRINT_IN_DEBUG(echo_TestEnum, &r);
522 ZERO_STRUCT(r.out);
523 r.out.foo1 = r.in.foo1;
524 r.out.foo2 = r.in.foo2;
525 r.out.foo3 = r.in.foo3;
526 _echo_TestEnum(p, &r);
528 if (p->rng_fault_state) {
529 talloc_free(mem_ctx);
530 /* Return True here, srv_pipe_hnd.c will take care */
531 return True;
534 if (DEBUGLEVEL >= 10)
535 NDR_PRINT_OUT_DEBUG(echo_TestEnum, &r);
537 push = ndr_push_init_ctx(mem_ctx);
538 if (push == NULL) {
539 talloc_free(mem_ctx);
540 return False;
543 status = ndr_push_echo_TestEnum(push, NDR_OUT, &r);
544 if (NT_STATUS_IS_ERR(status)) {
545 talloc_free(mem_ctx);
546 return False;
549 blob = ndr_push_blob(push);
550 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
551 talloc_free(mem_ctx);
552 return False;
555 talloc_free(mem_ctx);
557 return True;
560 static BOOL api_echo_TestSurrounding(pipes_struct *p)
562 struct ndr_pull *pull;
563 struct ndr_push *push;
564 NTSTATUS status;
565 DATA_BLOB blob;
566 struct echo_TestSurrounding r;
567 TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestSurrounding");
569 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
570 talloc_free(mem_ctx);
571 return False;
574 pull = ndr_pull_init_blob(&blob, mem_ctx);
575 if (pull == NULL) {
576 talloc_free(mem_ctx);
577 return False;
580 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
581 status = ndr_pull_echo_TestSurrounding(pull, NDR_IN, &r);
582 if (NT_STATUS_IS_ERR(status)) {
583 talloc_free(mem_ctx);
584 return False;
587 if (DEBUGLEVEL >= 10)
588 NDR_PRINT_IN_DEBUG(echo_TestSurrounding, &r);
590 ZERO_STRUCT(r.out);
591 r.out.data = r.in.data;
592 _echo_TestSurrounding(p, &r);
594 if (p->rng_fault_state) {
595 talloc_free(mem_ctx);
596 /* Return True here, srv_pipe_hnd.c will take care */
597 return True;
600 if (DEBUGLEVEL >= 10)
601 NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, &r);
603 push = ndr_push_init_ctx(mem_ctx);
604 if (push == NULL) {
605 talloc_free(mem_ctx);
606 return False;
609 status = ndr_push_echo_TestSurrounding(push, NDR_OUT, &r);
610 if (NT_STATUS_IS_ERR(status)) {
611 talloc_free(mem_ctx);
612 return False;
615 blob = ndr_push_blob(push);
616 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
617 talloc_free(mem_ctx);
618 return False;
621 talloc_free(mem_ctx);
623 return True;
626 static BOOL api_echo_TestDoublePointer(pipes_struct *p)
628 struct ndr_pull *pull;
629 struct ndr_push *push;
630 NTSTATUS status;
631 DATA_BLOB blob;
632 struct echo_TestDoublePointer r;
633 TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestDoublePointer");
635 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
636 talloc_free(mem_ctx);
637 return False;
640 pull = ndr_pull_init_blob(&blob, mem_ctx);
641 if (pull == NULL) {
642 talloc_free(mem_ctx);
643 return False;
646 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
647 status = ndr_pull_echo_TestDoublePointer(pull, NDR_IN, &r);
648 if (NT_STATUS_IS_ERR(status)) {
649 talloc_free(mem_ctx);
650 return False;
653 if (DEBUGLEVEL >= 10)
654 NDR_PRINT_IN_DEBUG(echo_TestDoublePointer, &r);
656 r.out.result = _echo_TestDoublePointer(p, &r);
658 if (p->rng_fault_state) {
659 talloc_free(mem_ctx);
660 /* Return True here, srv_pipe_hnd.c will take care */
661 return True;
664 if (DEBUGLEVEL >= 10)
665 NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, &r);
667 push = ndr_push_init_ctx(mem_ctx);
668 if (push == NULL) {
669 talloc_free(mem_ctx);
670 return False;
673 status = ndr_push_echo_TestDoublePointer(push, NDR_OUT, &r);
674 if (NT_STATUS_IS_ERR(status)) {
675 talloc_free(mem_ctx);
676 return False;
679 blob = ndr_push_blob(push);
680 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
681 talloc_free(mem_ctx);
682 return False;
685 talloc_free(mem_ctx);
687 return True;
691 /* Tables */
692 static struct api_struct api_rpcecho_cmds[] =
694 {"ECHO_ADDONE", DCERPC_ECHO_ADDONE, api_echo_AddOne},
695 {"ECHO_ECHODATA", DCERPC_ECHO_ECHODATA, api_echo_EchoData},
696 {"ECHO_SINKDATA", DCERPC_ECHO_SINKDATA, api_echo_SinkData},
697 {"ECHO_SOURCEDATA", DCERPC_ECHO_SOURCEDATA, api_echo_SourceData},
698 {"ECHO_TESTCALL", DCERPC_ECHO_TESTCALL, api_echo_TestCall},
699 {"ECHO_TESTCALL2", DCERPC_ECHO_TESTCALL2, api_echo_TestCall2},
700 {"ECHO_TESTSLEEP", DCERPC_ECHO_TESTSLEEP, api_echo_TestSleep},
701 {"ECHO_TESTENUM", DCERPC_ECHO_TESTENUM, api_echo_TestEnum},
702 {"ECHO_TESTSURROUNDING", DCERPC_ECHO_TESTSURROUNDING, api_echo_TestSurrounding},
703 {"ECHO_TESTDOUBLEPOINTER", DCERPC_ECHO_TESTDOUBLEPOINTER, api_echo_TestDoublePointer},
706 void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns)
708 *fns = api_rpcecho_cmds;
709 *n_fns = sizeof(api_rpcecho_cmds) / sizeof(struct api_struct);
712 NTSTATUS rpc_rpcecho_init(void)
714 return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "rpcecho", "rpcecho", api_rpcecho_cmds, sizeof(api_rpcecho_cmds) / sizeof(struct api_struct));