Changeset 745 for trunk/server/source3/rpcclient/cmd_srvsvc.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/rpcclient/cmd_srvsvc.c
r414 r745 23 23 #include "includes.h" 24 24 #include "rpcclient.h" 25 #include "../librpc/gen_ndr/cli_srvsvc.h" 25 #include "../librpc/gen_ndr/ndr_srvsvc.h" 26 #include "../librpc/gen_ndr/ndr_srvsvc_c.h" 27 #include "../libcli/security/display_sec.h" 26 28 27 29 /* Display server query info */ … … 174 176 WERROR result; 175 177 NTSTATUS status; 176 177 if (argc > 2) { 178 printf("Usage: %s [infolevel]\n", argv[0]); 179 return WERR_OK; 180 } 181 182 if (argc == 2) 178 const char *server_unc = cli->srv_name_slash; 179 struct dcerpc_binding_handle *b = cli->binding_handle; 180 181 if (argc > 3) { 182 printf("Usage: %s [infolevel] [server_unc]\n", argv[0]); 183 return WERR_OK; 184 } 185 186 if (argc >= 2) { 183 187 info_level = atoi(argv[1]); 184 185 status = rpccli_srvsvc_NetSrvGetInfo(cli, mem_ctx, 186 cli->srv_name_slash, 188 } 189 190 if (argc >= 3) { 191 server_unc = argv[2]; 192 } 193 194 status = dcerpc_srvsvc_NetSrvGetInfo(b, mem_ctx, 195 server_unc, 187 196 info_level, 188 197 &info, … … 268 277 uint32_t *resume_handle_p = NULL; 269 278 uint32 preferred_len = 0xffffffff, i; 279 struct dcerpc_binding_handle *b = cli->binding_handle; 270 280 271 281 if (argc > 3) { … … 332 342 switch (opcode) { 333 343 case NDR_SRVSVC_NETSHAREENUM: 334 status = rpccli_srvsvc_NetShareEnum(cli, mem_ctx,344 status = dcerpc_srvsvc_NetShareEnum(b, mem_ctx, 335 345 cli->desthost, 336 346 &info_ctr, … … 341 351 break; 342 352 case NDR_SRVSVC_NETSHAREENUMALL: 343 status = rpccli_srvsvc_NetShareEnumAll(cli, mem_ctx,353 status = dcerpc_srvsvc_NetShareEnumAll(b, mem_ctx, 344 354 cli->desthost, 345 355 &info_ctr, … … 353 363 } 354 364 355 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) { 365 if (!NT_STATUS_IS_OK(status)) { 366 result = ntstatus_to_werror(status); 367 goto done; 368 } 369 if (!W_ERROR_IS_OK(result)) { 356 370 goto done; 357 371 } … … 407 421 WERROR result; 408 422 NTSTATUS status; 423 struct dcerpc_binding_handle *b = cli->binding_handle; 409 424 410 425 if (argc < 2 || argc > 3) { … … 416 431 info_level = atoi(argv[2]); 417 432 418 status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx,433 status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx, 419 434 cli->desthost, 420 435 argv[1], … … 423 438 &result); 424 439 425 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) { 440 if (!NT_STATUS_IS_OK(status)) { 441 result = ntstatus_to_werror(status); 442 goto done; 443 } 444 if (!W_ERROR_IS_OK(result)) { 426 445 goto done; 427 446 } … … 457 476 NTSTATUS status; 458 477 uint32_t parm_err = 0; 478 struct dcerpc_binding_handle *b = cli->binding_handle; 459 479 460 480 if (argc > 3) { … … 464 484 465 485 /* retrieve share info */ 466 status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx,486 status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx, 467 487 cli->desthost, 468 488 argv[1], … … 471 491 &result); 472 492 473 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) { 493 if (!NT_STATUS_IS_OK(status)) { 494 result = ntstatus_to_werror(status); 495 goto done; 496 } 497 if (!W_ERROR_IS_OK(result)) { 474 498 goto done; 475 499 } … … 478 502 479 503 /* set share info */ 480 status = rpccli_srvsvc_NetShareSetInfo(cli, mem_ctx,504 status = dcerpc_srvsvc_NetShareSetInfo(b, mem_ctx, 481 505 cli->desthost, 482 506 argv[1], … … 486 510 &result); 487 511 488 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) { 512 if (!NT_STATUS_IS_OK(status)) { 513 result = ntstatus_to_werror(status); 514 goto done; 515 } 516 if (!W_ERROR_IS_OK(result)) { 489 517 goto done; 490 518 } 491 519 492 520 /* re-retrieve share info and display */ 493 status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx,521 status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx, 494 522 cli->desthost, 495 523 argv[1], … … 497 525 &info_get, 498 526 &result); 499 500 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) { 527 if (!NT_STATUS_IS_OK(status)) { 528 result = ntstatus_to_werror(status); 529 goto done; 530 } 531 if (!W_ERROR_IS_OK(result)) { 501 532 goto done; 502 533 } … … 515 546 WERROR result; 516 547 NTSTATUS status; 548 struct dcerpc_binding_handle *b = cli->binding_handle; 517 549 518 550 if (argc > 1) { … … 521 553 } 522 554 523 status = rpccli_srvsvc_NetRemoteTOD(cli, mem_ctx,555 status = dcerpc_srvsvc_NetRemoteTOD(b, mem_ctx, 524 556 cli->srv_name_slash, 525 557 &tod, … … 549 581 uint32_t total_entries = 0; 550 582 uint32_t resume_handle = 0; 583 struct dcerpc_binding_handle *b = cli->binding_handle; 551 584 552 585 if (argc > 2) { … … 564 597 info_ctr.ctr.ctr3 = &ctr3; 565 598 566 status = rpccli_srvsvc_NetFileEnum(cli, mem_ctx,599 status = dcerpc_srvsvc_NetFileEnum(b, mem_ctx, 567 600 cli->desthost, 568 601 NULL, … … 573 606 &resume_handle, 574 607 &result); 575 576 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) 577 goto done; 608 if (!NT_STATUS_IS_OK(status)) { 609 result = ntstatus_to_werror(status); 610 goto done; 611 } 612 613 if (!W_ERROR_IS_OK(result)) { 614 goto done; 615 } 578 616 579 617 done: … … 589 627 uint32_t name_type = 9; 590 628 uint32_t flags = 0; 629 struct dcerpc_binding_handle *b = cli->binding_handle; 591 630 592 631 if (argc < 2 || argc > 3) { … … 599 638 } 600 639 601 status = rpccli_srvsvc_NetNameValidate(cli, mem_ctx,640 status = dcerpc_srvsvc_NetNameValidate(b, mem_ctx, 602 641 cli->desthost, 603 642 argv[1], … … 605 644 flags, 606 645 &result); 646 if (!NT_STATUS_IS_OK(status)) { 647 result = ntstatus_to_werror(status); 648 goto done; 649 } 607 650 608 651 if (!W_ERROR_IS_OK(result)) … … 620 663 NTSTATUS status; 621 664 struct sec_desc_buf *sd_buf = NULL; 665 struct dcerpc_binding_handle *b = cli->binding_handle; 622 666 623 667 if (argc < 2 || argc > 4) { … … 626 670 } 627 671 628 status = rpccli_srvsvc_NetGetFileSecurity(cli, mem_ctx,672 status = dcerpc_srvsvc_NetGetFileSecurity(b, mem_ctx, 629 673 cli->desthost, 630 674 argv[1], … … 633 677 &sd_buf, 634 678 &result); 635 636 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) { 679 if (!NT_STATUS_IS_OK(status)) { 680 result = ntstatus_to_werror(status); 681 goto done; 682 } 683 684 if (!W_ERROR_IS_OK(result)) { 637 685 goto done; 638 686 } … … 650 698 WERROR result; 651 699 NTSTATUS status; 700 struct dcerpc_binding_handle *b = cli->binding_handle; 652 701 653 702 if (argc < 2 || argc > 4) { … … 656 705 } 657 706 658 status = rpccli_srvsvc_NetSessDel(cli, mem_ctx,707 status = dcerpc_srvsvc_NetSessDel(b, mem_ctx, 659 708 cli->desthost, 660 709 argv[1], 661 710 argv[2], 662 711 &result); 663 664 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) { 712 if (!NT_STATUS_IS_OK(status)) { 713 result = ntstatus_to_werror(status); 714 goto done; 715 } 716 717 if (!W_ERROR_IS_OK(result)) { 665 718 goto done; 666 719 } … … 688 741 const char *client = NULL; 689 742 const char *user = NULL; 743 struct dcerpc_binding_handle *b = cli->binding_handle; 690 744 691 745 if (argc > 6) { … … 740 794 } 741 795 742 status = rpccli_srvsvc_NetSessEnum(cli, mem_ctx,796 status = dcerpc_srvsvc_NetSessEnum(b, mem_ctx, 743 797 cli->desthost, 744 798 client, … … 750 804 &result); 751 805 752 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) { 806 if (!NT_STATUS_IS_OK(status)) { 807 result = ntstatus_to_werror(status); 808 goto done; 809 } 810 811 if (!W_ERROR_IS_OK(result)) { 753 812 goto done; 754 813 } … … 768 827 uint32_t resume_handle = 0; 769 828 uint32_t level = 0; 829 struct dcerpc_binding_handle *b = cli->binding_handle; 770 830 771 831 if (argc > 4) { … … 784 844 ZERO_STRUCT(info); 785 845 786 status = rpccli_srvsvc_NetDiskEnum(cli, mem_ctx,846 status = dcerpc_srvsvc_NetDiskEnum(b, mem_ctx, 787 847 cli->desthost, 788 848 level, … … 792 852 &resume_handle, 793 853 &result); 794 795 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) { 854 if (!NT_STATUS_IS_OK(status)) { 855 result = ntstatus_to_werror(status); 856 goto done; 857 } 858 859 if (!W_ERROR_IS_OK(result)) { 796 860 goto done; 797 861 } … … 815 879 uint32_t level = 1; 816 880 const char *path = "IPC$"; 881 struct dcerpc_binding_handle *b = cli->binding_handle; 817 882 818 883 if (argc > 4) { … … 851 916 } 852 917 853 status = rpccli_srvsvc_NetConnEnum(cli, mem_ctx,918 status = dcerpc_srvsvc_NetConnEnum(b, mem_ctx, 854 919 cli->desthost, 855 920 path, … … 860 925 &result); 861 926 862 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) { 927 if (!NT_STATUS_IS_OK(status)) { 928 result = ntstatus_to_werror(status); 929 goto done; 930 } 931 932 if (!W_ERROR_IS_OK(result)) { 863 933 goto done; 864 934 }
Note:
See TracChangeset
for help on using the changeset viewer.