root/librpc/gen_ndr/srv_echo.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. api_echo_AddOne
  2. api_echo_EchoData
  3. api_echo_SinkData
  4. api_echo_SourceData
  5. api_echo_TestCall
  6. api_echo_TestCall2
  7. api_echo_TestSleep
  8. api_echo_TestEnum
  9. api_echo_TestSurrounding
  10. api_echo_TestDoublePointer
  11. rpcecho_get_pipe_fns
  12. rpc_rpcecho_dispatch
  13. rpc_rpcecho_init

   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_echo.h"
   8 
   9 static bool api_echo_AddOne(pipes_struct *p)
     /* [<][>][^][v][top][bottom][index][help] */
  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 echo_AddOne *r;
  17 
  18         call = &ndr_table_rpcecho.calls[NDR_ECHO_ADDONE];
  19 
  20         r = talloc(talloc_tos(), struct echo_AddOne);
  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(echo_AddOne, r);
  45         }
  46 
  47         ZERO_STRUCT(r->out);
  48         r->out.out_data = talloc_zero(r, uint32_t);
  49         if (r->out.out_data == NULL) {
  50                 talloc_free(r);
  51                 return false;
  52         }
  53 
  54         _echo_AddOne(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(echo_AddOne, 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_echo_EchoData(pipes_struct *p)
     /* [<][>][^][v][top][bottom][index][help] */
  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 echo_EchoData *r;
  97 
  98         call = &ndr_table_rpcecho.calls[NDR_ECHO_ECHODATA];
  99 
 100         r = talloc(talloc_tos(), struct echo_EchoData);
 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(echo_EchoData, r);
 125         }
 126 
 127         ZERO_STRUCT(r->out);
 128         r->out.out_data = talloc_zero_array(r, uint8_t, r->in.len);
 129         if (r->out.out_data == NULL) {
 130                 talloc_free(r);
 131                 return false;
 132         }
 133 
 134         _echo_EchoData(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(echo_EchoData, 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_echo_SinkData(pipes_struct *p)
     /* [<][>][^][v][top][bottom][index][help] */
 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 echo_SinkData *r;
 177 
 178         call = &ndr_table_rpcecho.calls[NDR_ECHO_SINKDATA];
 179 
 180         r = talloc(talloc_tos(), struct echo_SinkData);
 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(echo_SinkData, r);
 205         }
 206 
 207         _echo_SinkData(p, r);
 208 
 209         if (p->rng_fault_state) {
 210                 talloc_free(r);
 211                 /* Return true here, srv_pipe_hnd.c will take care */
 212                 return true;
 213         }
 214 
 215         if (DEBUGLEVEL >= 10) {
 216                 NDR_PRINT_OUT_DEBUG(echo_SinkData, r);
 217         }
 218 
 219         push = ndr_push_init_ctx(r, NULL);
 220         if (push == NULL) {
 221                 talloc_free(r);
 222                 return false;
 223         }
 224 
 225         ndr_err = call->ndr_push(push, NDR_OUT, r);
 226         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 227                 talloc_free(r);
 228                 return false;
 229         }
 230 
 231         blob = ndr_push_blob(push);
 232         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
 233                 talloc_free(r);
 234                 return false;
 235         }
 236 
 237         talloc_free(r);
 238 
 239         return true;
 240 }
 241 
 242 static bool api_echo_SourceData(pipes_struct *p)
     /* [<][>][^][v][top][bottom][index][help] */
 243 {
 244         const struct ndr_interface_call *call;
 245         struct ndr_pull *pull;
 246         struct ndr_push *push;
 247         enum ndr_err_code ndr_err;
 248         DATA_BLOB blob;
 249         struct echo_SourceData *r;
 250 
 251         call = &ndr_table_rpcecho.calls[NDR_ECHO_SOURCEDATA];
 252 
 253         r = talloc(talloc_tos(), struct echo_SourceData);
 254         if (r == NULL) {
 255                 return false;
 256         }
 257 
 258         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
 259                 talloc_free(r);
 260                 return false;
 261         }
 262 
 263         pull = ndr_pull_init_blob(&blob, r, NULL);
 264         if (pull == NULL) {
 265                 talloc_free(r);
 266                 return false;
 267         }
 268 
 269         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 270         ndr_err = call->ndr_pull(pull, NDR_IN, r);
 271         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 272                 talloc_free(r);
 273                 return false;
 274         }
 275 
 276         if (DEBUGLEVEL >= 10) {
 277                 NDR_PRINT_IN_DEBUG(echo_SourceData, r);
 278         }
 279 
 280         ZERO_STRUCT(r->out);
 281         r->out.data = talloc_zero_array(r, uint8_t, r->in.len);
 282         if (r->out.data == NULL) {
 283                 talloc_free(r);
 284                 return false;
 285         }
 286 
 287         _echo_SourceData(p, r);
 288 
 289         if (p->rng_fault_state) {
 290                 talloc_free(r);
 291                 /* Return true here, srv_pipe_hnd.c will take care */
 292                 return true;
 293         }
 294 
 295         if (DEBUGLEVEL >= 10) {
 296                 NDR_PRINT_OUT_DEBUG(echo_SourceData, r);
 297         }
 298 
 299         push = ndr_push_init_ctx(r, NULL);
 300         if (push == NULL) {
 301                 talloc_free(r);
 302                 return false;
 303         }
 304 
 305         ndr_err = call->ndr_push(push, NDR_OUT, r);
 306         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 307                 talloc_free(r);
 308                 return false;
 309         }
 310 
 311         blob = ndr_push_blob(push);
 312         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
 313                 talloc_free(r);
 314                 return false;
 315         }
 316 
 317         talloc_free(r);
 318 
 319         return true;
 320 }
 321 
 322 static bool api_echo_TestCall(pipes_struct *p)
     /* [<][>][^][v][top][bottom][index][help] */
 323 {
 324         const struct ndr_interface_call *call;
 325         struct ndr_pull *pull;
 326         struct ndr_push *push;
 327         enum ndr_err_code ndr_err;
 328         DATA_BLOB blob;
 329         struct echo_TestCall *r;
 330 
 331         call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTCALL];
 332 
 333         r = talloc(talloc_tos(), struct echo_TestCall);
 334         if (r == NULL) {
 335                 return false;
 336         }
 337 
 338         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
 339                 talloc_free(r);
 340                 return false;
 341         }
 342 
 343         pull = ndr_pull_init_blob(&blob, r, NULL);
 344         if (pull == NULL) {
 345                 talloc_free(r);
 346                 return false;
 347         }
 348 
 349         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 350         ndr_err = call->ndr_pull(pull, NDR_IN, r);
 351         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 352                 talloc_free(r);
 353                 return false;
 354         }
 355 
 356         if (DEBUGLEVEL >= 10) {
 357                 NDR_PRINT_IN_DEBUG(echo_TestCall, r);
 358         }
 359 
 360         ZERO_STRUCT(r->out);
 361         r->out.s2 = talloc_zero(r, const char *);
 362         if (r->out.s2 == NULL) {
 363                 talloc_free(r);
 364                 return false;
 365         }
 366 
 367         _echo_TestCall(p, r);
 368 
 369         if (p->rng_fault_state) {
 370                 talloc_free(r);
 371                 /* Return true here, srv_pipe_hnd.c will take care */
 372                 return true;
 373         }
 374 
 375         if (DEBUGLEVEL >= 10) {
 376                 NDR_PRINT_OUT_DEBUG(echo_TestCall, r);
 377         }
 378 
 379         push = ndr_push_init_ctx(r, NULL);
 380         if (push == NULL) {
 381                 talloc_free(r);
 382                 return false;
 383         }
 384 
 385         ndr_err = call->ndr_push(push, NDR_OUT, r);
 386         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 387                 talloc_free(r);
 388                 return false;
 389         }
 390 
 391         blob = ndr_push_blob(push);
 392         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
 393                 talloc_free(r);
 394                 return false;
 395         }
 396 
 397         talloc_free(r);
 398 
 399         return true;
 400 }
 401 
 402 static bool api_echo_TestCall2(pipes_struct *p)
     /* [<][>][^][v][top][bottom][index][help] */
 403 {
 404         const struct ndr_interface_call *call;
 405         struct ndr_pull *pull;
 406         struct ndr_push *push;
 407         enum ndr_err_code ndr_err;
 408         DATA_BLOB blob;
 409         struct echo_TestCall2 *r;
 410 
 411         call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTCALL2];
 412 
 413         r = talloc(talloc_tos(), struct echo_TestCall2);
 414         if (r == NULL) {
 415                 return false;
 416         }
 417 
 418         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
 419                 talloc_free(r);
 420                 return false;
 421         }
 422 
 423         pull = ndr_pull_init_blob(&blob, r, NULL);
 424         if (pull == NULL) {
 425                 talloc_free(r);
 426                 return false;
 427         }
 428 
 429         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 430         ndr_err = call->ndr_pull(pull, NDR_IN, r);
 431         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 432                 talloc_free(r);
 433                 return false;
 434         }
 435 
 436         if (DEBUGLEVEL >= 10) {
 437                 NDR_PRINT_IN_DEBUG(echo_TestCall2, r);
 438         }
 439 
 440         ZERO_STRUCT(r->out);
 441         r->out.info = talloc_zero(r, union echo_Info);
 442         if (r->out.info == NULL) {
 443                 talloc_free(r);
 444                 return false;
 445         }
 446 
 447         r->out.result = _echo_TestCall2(p, r);
 448 
 449         if (p->rng_fault_state) {
 450                 talloc_free(r);
 451                 /* Return true here, srv_pipe_hnd.c will take care */
 452                 return true;
 453         }
 454 
 455         if (DEBUGLEVEL >= 10) {
 456                 NDR_PRINT_OUT_DEBUG(echo_TestCall2, r);
 457         }
 458 
 459         push = ndr_push_init_ctx(r, NULL);
 460         if (push == NULL) {
 461                 talloc_free(r);
 462                 return false;
 463         }
 464 
 465         ndr_err = call->ndr_push(push, NDR_OUT, r);
 466         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 467                 talloc_free(r);
 468                 return false;
 469         }
 470 
 471         blob = ndr_push_blob(push);
 472         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
 473                 talloc_free(r);
 474                 return false;
 475         }
 476 
 477         talloc_free(r);
 478 
 479         return true;
 480 }
 481 
 482 static bool api_echo_TestSleep(pipes_struct *p)
     /* [<][>][^][v][top][bottom][index][help] */
 483 {
 484         const struct ndr_interface_call *call;
 485         struct ndr_pull *pull;
 486         struct ndr_push *push;
 487         enum ndr_err_code ndr_err;
 488         DATA_BLOB blob;
 489         struct echo_TestSleep *r;
 490 
 491         call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTSLEEP];
 492 
 493         r = talloc(talloc_tos(), struct echo_TestSleep);
 494         if (r == NULL) {
 495                 return false;
 496         }
 497 
 498         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
 499                 talloc_free(r);
 500                 return false;
 501         }
 502 
 503         pull = ndr_pull_init_blob(&blob, r, NULL);
 504         if (pull == NULL) {
 505                 talloc_free(r);
 506                 return false;
 507         }
 508 
 509         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 510         ndr_err = call->ndr_pull(pull, NDR_IN, r);
 511         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 512                 talloc_free(r);
 513                 return false;
 514         }
 515 
 516         if (DEBUGLEVEL >= 10) {
 517                 NDR_PRINT_IN_DEBUG(echo_TestSleep, r);
 518         }
 519 
 520         r->out.result = _echo_TestSleep(p, r);
 521 
 522         if (p->rng_fault_state) {
 523                 talloc_free(r);
 524                 /* Return true here, srv_pipe_hnd.c will take care */
 525                 return true;
 526         }
 527 
 528         if (DEBUGLEVEL >= 10) {
 529                 NDR_PRINT_OUT_DEBUG(echo_TestSleep, r);
 530         }
 531 
 532         push = ndr_push_init_ctx(r, NULL);
 533         if (push == NULL) {
 534                 talloc_free(r);
 535                 return false;
 536         }
 537 
 538         ndr_err = call->ndr_push(push, NDR_OUT, r);
 539         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 540                 talloc_free(r);
 541                 return false;
 542         }
 543 
 544         blob = ndr_push_blob(push);
 545         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
 546                 talloc_free(r);
 547                 return false;
 548         }
 549 
 550         talloc_free(r);
 551 
 552         return true;
 553 }
 554 
 555 static bool api_echo_TestEnum(pipes_struct *p)
     /* [<][>][^][v][top][bottom][index][help] */
 556 {
 557         const struct ndr_interface_call *call;
 558         struct ndr_pull *pull;
 559         struct ndr_push *push;
 560         enum ndr_err_code ndr_err;
 561         DATA_BLOB blob;
 562         struct echo_TestEnum *r;
 563 
 564         call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTENUM];
 565 
 566         r = talloc(talloc_tos(), struct echo_TestEnum);
 567         if (r == NULL) {
 568                 return false;
 569         }
 570 
 571         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
 572                 talloc_free(r);
 573                 return false;
 574         }
 575 
 576         pull = ndr_pull_init_blob(&blob, r, NULL);
 577         if (pull == NULL) {
 578                 talloc_free(r);
 579                 return false;
 580         }
 581 
 582         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 583         ndr_err = call->ndr_pull(pull, NDR_IN, r);
 584         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 585                 talloc_free(r);
 586                 return false;
 587         }
 588 
 589         if (DEBUGLEVEL >= 10) {
 590                 NDR_PRINT_IN_DEBUG(echo_TestEnum, r);
 591         }
 592 
 593         ZERO_STRUCT(r->out);
 594         r->out.foo1 = r->in.foo1;
 595         r->out.foo2 = r->in.foo2;
 596         r->out.foo3 = r->in.foo3;
 597         _echo_TestEnum(p, r);
 598 
 599         if (p->rng_fault_state) {
 600                 talloc_free(r);
 601                 /* Return true here, srv_pipe_hnd.c will take care */
 602                 return true;
 603         }
 604 
 605         if (DEBUGLEVEL >= 10) {
 606                 NDR_PRINT_OUT_DEBUG(echo_TestEnum, r);
 607         }
 608 
 609         push = ndr_push_init_ctx(r, NULL);
 610         if (push == NULL) {
 611                 talloc_free(r);
 612                 return false;
 613         }
 614 
 615         ndr_err = call->ndr_push(push, NDR_OUT, r);
 616         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 617                 talloc_free(r);
 618                 return false;
 619         }
 620 
 621         blob = ndr_push_blob(push);
 622         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
 623                 talloc_free(r);
 624                 return false;
 625         }
 626 
 627         talloc_free(r);
 628 
 629         return true;
 630 }
 631 
 632 static bool api_echo_TestSurrounding(pipes_struct *p)
     /* [<][>][^][v][top][bottom][index][help] */
 633 {
 634         const struct ndr_interface_call *call;
 635         struct ndr_pull *pull;
 636         struct ndr_push *push;
 637         enum ndr_err_code ndr_err;
 638         DATA_BLOB blob;
 639         struct echo_TestSurrounding *r;
 640 
 641         call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTSURROUNDING];
 642 
 643         r = talloc(talloc_tos(), struct echo_TestSurrounding);
 644         if (r == NULL) {
 645                 return false;
 646         }
 647 
 648         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
 649                 talloc_free(r);
 650                 return false;
 651         }
 652 
 653         pull = ndr_pull_init_blob(&blob, r, NULL);
 654         if (pull == NULL) {
 655                 talloc_free(r);
 656                 return false;
 657         }
 658 
 659         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 660         ndr_err = call->ndr_pull(pull, NDR_IN, r);
 661         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 662                 talloc_free(r);
 663                 return false;
 664         }
 665 
 666         if (DEBUGLEVEL >= 10) {
 667                 NDR_PRINT_IN_DEBUG(echo_TestSurrounding, r);
 668         }
 669 
 670         ZERO_STRUCT(r->out);
 671         r->out.data = r->in.data;
 672         _echo_TestSurrounding(p, r);
 673 
 674         if (p->rng_fault_state) {
 675                 talloc_free(r);
 676                 /* Return true here, srv_pipe_hnd.c will take care */
 677                 return true;
 678         }
 679 
 680         if (DEBUGLEVEL >= 10) {
 681                 NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, r);
 682         }
 683 
 684         push = ndr_push_init_ctx(r, NULL);
 685         if (push == NULL) {
 686                 talloc_free(r);
 687                 return false;
 688         }
 689 
 690         ndr_err = call->ndr_push(push, NDR_OUT, r);
 691         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 692                 talloc_free(r);
 693                 return false;
 694         }
 695 
 696         blob = ndr_push_blob(push);
 697         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
 698                 talloc_free(r);
 699                 return false;
 700         }
 701 
 702         talloc_free(r);
 703 
 704         return true;
 705 }
 706 
 707 static bool api_echo_TestDoublePointer(pipes_struct *p)
     /* [<][>][^][v][top][bottom][index][help] */
 708 {
 709         const struct ndr_interface_call *call;
 710         struct ndr_pull *pull;
 711         struct ndr_push *push;
 712         enum ndr_err_code ndr_err;
 713         DATA_BLOB blob;
 714         struct echo_TestDoublePointer *r;
 715 
 716         call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTDOUBLEPOINTER];
 717 
 718         r = talloc(talloc_tos(), struct echo_TestDoublePointer);
 719         if (r == NULL) {
 720                 return false;
 721         }
 722 
 723         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
 724                 talloc_free(r);
 725                 return false;
 726         }
 727 
 728         pull = ndr_pull_init_blob(&blob, r, NULL);
 729         if (pull == NULL) {
 730                 talloc_free(r);
 731                 return false;
 732         }
 733 
 734         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 735         ndr_err = call->ndr_pull(pull, NDR_IN, r);
 736         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 737                 talloc_free(r);
 738                 return false;
 739         }
 740 
 741         if (DEBUGLEVEL >= 10) {
 742                 NDR_PRINT_IN_DEBUG(echo_TestDoublePointer, r);
 743         }
 744 
 745         r->out.result = _echo_TestDoublePointer(p, r);
 746 
 747         if (p->rng_fault_state) {
 748                 talloc_free(r);
 749                 /* Return true here, srv_pipe_hnd.c will take care */
 750                 return true;
 751         }
 752 
 753         if (DEBUGLEVEL >= 10) {
 754                 NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, r);
 755         }
 756 
 757         push = ndr_push_init_ctx(r, NULL);
 758         if (push == NULL) {
 759                 talloc_free(r);
 760                 return false;
 761         }
 762 
 763         ndr_err = call->ndr_push(push, NDR_OUT, r);
 764         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 765                 talloc_free(r);
 766                 return false;
 767         }
 768 
 769         blob = ndr_push_blob(push);
 770         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
 771                 talloc_free(r);
 772                 return false;
 773         }
 774 
 775         talloc_free(r);
 776 
 777         return true;
 778 }
 779 
 780 
 781 /* Tables */
 782 static struct api_struct api_rpcecho_cmds[] = 
 783 {
 784         {"ECHO_ADDONE", NDR_ECHO_ADDONE, api_echo_AddOne},
 785         {"ECHO_ECHODATA", NDR_ECHO_ECHODATA, api_echo_EchoData},
 786         {"ECHO_SINKDATA", NDR_ECHO_SINKDATA, api_echo_SinkData},
 787         {"ECHO_SOURCEDATA", NDR_ECHO_SOURCEDATA, api_echo_SourceData},
 788         {"ECHO_TESTCALL", NDR_ECHO_TESTCALL, api_echo_TestCall},
 789         {"ECHO_TESTCALL2", NDR_ECHO_TESTCALL2, api_echo_TestCall2},
 790         {"ECHO_TESTSLEEP", NDR_ECHO_TESTSLEEP, api_echo_TestSleep},
 791         {"ECHO_TESTENUM", NDR_ECHO_TESTENUM, api_echo_TestEnum},
 792         {"ECHO_TESTSURROUNDING", NDR_ECHO_TESTSURROUNDING, api_echo_TestSurrounding},
 793         {"ECHO_TESTDOUBLEPOINTER", NDR_ECHO_TESTDOUBLEPOINTER, api_echo_TestDoublePointer},
 794 };
 795 
 796 void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns)
     /* [<][>][^][v][top][bottom][index][help] */
 797 {
 798         *fns = api_rpcecho_cmds;
 799         *n_fns = sizeof(api_rpcecho_cmds) / sizeof(struct api_struct);
 800 }
 801 
 802 NTSTATUS rpc_rpcecho_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
     /* [<][>][^][v][top][bottom][index][help] */
 803 {
 804         if (cli->pipes_struct == NULL) {
 805                 return NT_STATUS_INVALID_PARAMETER;
 806         }
 807 
 808         switch (opnum)
 809         {
 810                 case NDR_ECHO_ADDONE: {
 811                         struct echo_AddOne *r = (struct echo_AddOne *)_r;
 812                         ZERO_STRUCT(r->out);
 813                         r->out.out_data = talloc_zero(mem_ctx, uint32_t);
 814                         if (r->out.out_data == NULL) {
 815                         return NT_STATUS_NO_MEMORY;
 816                         }
 817 
 818                         _echo_AddOne(cli->pipes_struct, r);
 819                         return NT_STATUS_OK;
 820                 }
 821 
 822                 case NDR_ECHO_ECHODATA: {
 823                         struct echo_EchoData *r = (struct echo_EchoData *)_r;
 824                         ZERO_STRUCT(r->out);
 825                         r->out.out_data = talloc_zero_array(mem_ctx, uint8_t, r->in.len);
 826                         if (r->out.out_data == NULL) {
 827                         return NT_STATUS_NO_MEMORY;
 828                         }
 829 
 830                         _echo_EchoData(cli->pipes_struct, r);
 831                         return NT_STATUS_OK;
 832                 }
 833 
 834                 case NDR_ECHO_SINKDATA: {
 835                         struct echo_SinkData *r = (struct echo_SinkData *)_r;
 836                         _echo_SinkData(cli->pipes_struct, r);
 837                         return NT_STATUS_OK;
 838                 }
 839 
 840                 case NDR_ECHO_SOURCEDATA: {
 841                         struct echo_SourceData *r = (struct echo_SourceData *)_r;
 842                         ZERO_STRUCT(r->out);
 843                         r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.len);
 844                         if (r->out.data == NULL) {
 845                         return NT_STATUS_NO_MEMORY;
 846                         }
 847 
 848                         _echo_SourceData(cli->pipes_struct, r);
 849                         return NT_STATUS_OK;
 850                 }
 851 
 852                 case NDR_ECHO_TESTCALL: {
 853                         struct echo_TestCall *r = (struct echo_TestCall *)_r;
 854                         ZERO_STRUCT(r->out);
 855                         r->out.s2 = talloc_zero(mem_ctx, const char *);
 856                         if (r->out.s2 == NULL) {
 857                         return NT_STATUS_NO_MEMORY;
 858                         }
 859 
 860                         _echo_TestCall(cli->pipes_struct, r);
 861                         return NT_STATUS_OK;
 862                 }
 863 
 864                 case NDR_ECHO_TESTCALL2: {
 865                         struct echo_TestCall2 *r = (struct echo_TestCall2 *)_r;
 866                         ZERO_STRUCT(r->out);
 867                         r->out.info = talloc_zero(mem_ctx, union echo_Info);
 868                         if (r->out.info == NULL) {
 869                         return NT_STATUS_NO_MEMORY;
 870                         }
 871 
 872                         r->out.result = _echo_TestCall2(cli->pipes_struct, r);
 873                         return NT_STATUS_OK;
 874                 }
 875 
 876                 case NDR_ECHO_TESTSLEEP: {
 877                         struct echo_TestSleep *r = (struct echo_TestSleep *)_r;
 878                         r->out.result = _echo_TestSleep(cli->pipes_struct, r);
 879                         return NT_STATUS_OK;
 880                 }
 881 
 882                 case NDR_ECHO_TESTENUM: {
 883                         struct echo_TestEnum *r = (struct echo_TestEnum *)_r;
 884                         ZERO_STRUCT(r->out);
 885                         r->out.foo1 = r->in.foo1;
 886                         r->out.foo2 = r->in.foo2;
 887                         r->out.foo3 = r->in.foo3;
 888                         _echo_TestEnum(cli->pipes_struct, r);
 889                         return NT_STATUS_OK;
 890                 }
 891 
 892                 case NDR_ECHO_TESTSURROUNDING: {
 893                         struct echo_TestSurrounding *r = (struct echo_TestSurrounding *)_r;
 894                         ZERO_STRUCT(r->out);
 895                         r->out.data = r->in.data;
 896                         _echo_TestSurrounding(cli->pipes_struct, r);
 897                         return NT_STATUS_OK;
 898                 }
 899 
 900                 case NDR_ECHO_TESTDOUBLEPOINTER: {
 901                         struct echo_TestDoublePointer *r = (struct echo_TestDoublePointer *)_r;
 902                         r->out.result = _echo_TestDoublePointer(cli->pipes_struct, r);
 903                         return NT_STATUS_OK;
 904                 }
 905 
 906                 default:
 907                         return NT_STATUS_NOT_IMPLEMENTED;
 908         }
 909 }
 910 
 911 NTSTATUS rpc_rpcecho_init(void)
     /* [<][>][^][v][top][bottom][index][help] */
 912 {
 913         return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "rpcecho", "rpcecho", &ndr_table_rpcecho, api_rpcecho_cmds, sizeof(api_rpcecho_cmds) / sizeof(struct api_struct));
 914 }

/* [<][>][^][v][top][bottom][index][help] */