Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/rpcclient/cmd_srvsvc.c

    r414 r745  
    2323#include "includes.h"
    2424#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"
    2628
    2729/* Display server query info */
     
    174176        WERROR result;
    175177        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) {
    183187                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,
    187196                                             info_level,
    188197                                             &info,
     
    268277        uint32_t *resume_handle_p = NULL;
    269278        uint32 preferred_len = 0xffffffff, i;
     279        struct dcerpc_binding_handle *b = cli->binding_handle;
    270280
    271281        if (argc > 3) {
     
    332342        switch (opcode) {
    333343                case NDR_SRVSVC_NETSHAREENUM:
    334                         status = rpccli_srvsvc_NetShareEnum(cli, mem_ctx,
     344                        status = dcerpc_srvsvc_NetShareEnum(b, mem_ctx,
    335345                                                            cli->desthost,
    336346                                                            &info_ctr,
     
    341351                        break;
    342352                case NDR_SRVSVC_NETSHAREENUMALL:
    343                         status = rpccli_srvsvc_NetShareEnumAll(cli, mem_ctx,
     353                        status = dcerpc_srvsvc_NetShareEnumAll(b, mem_ctx,
    344354                                                               cli->desthost,
    345355                                                               &info_ctr,
     
    353363        }
    354364
    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)) {
    356370                goto done;
    357371        }
     
    407421        WERROR result;
    408422        NTSTATUS status;
     423        struct dcerpc_binding_handle *b = cli->binding_handle;
    409424
    410425        if (argc < 2 || argc > 3) {
     
    416431                info_level = atoi(argv[2]);
    417432
    418         status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx,
     433        status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx,
    419434                                               cli->desthost,
    420435                                               argv[1],
     
    423438                                               &result);
    424439
    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)) {
    426445                goto done;
    427446        }
     
    457476        NTSTATUS status;
    458477        uint32_t parm_err = 0;
     478        struct dcerpc_binding_handle *b = cli->binding_handle;
    459479
    460480        if (argc > 3) {
     
    464484
    465485        /* retrieve share info */
    466         status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx,
     486        status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx,
    467487                                               cli->desthost,
    468488                                               argv[1],
     
    471491                                               &result);
    472492
    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)) {
    474498                goto done;
    475499        }
     
    478502
    479503        /* set share info */
    480         status = rpccli_srvsvc_NetShareSetInfo(cli, mem_ctx,
     504        status = dcerpc_srvsvc_NetShareSetInfo(b, mem_ctx,
    481505                                               cli->desthost,
    482506                                               argv[1],
     
    486510                                               &result);
    487511
    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)) {
    489517                goto done;
    490518        }
    491519
    492520        /* re-retrieve share info and display */
    493         status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx,
     521        status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx,
    494522                                               cli->desthost,
    495523                                               argv[1],
     
    497525                                               &info_get,
    498526                                               &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)) {
    501532                goto done;
    502533        }
     
    515546        WERROR result;
    516547        NTSTATUS status;
     548        struct dcerpc_binding_handle *b = cli->binding_handle;
    517549
    518550        if (argc > 1) {
     
    521553        }
    522554
    523         status = rpccli_srvsvc_NetRemoteTOD(cli, mem_ctx,
     555        status = dcerpc_srvsvc_NetRemoteTOD(b, mem_ctx,
    524556                                            cli->srv_name_slash,
    525557                                            &tod,
     
    549581        uint32_t total_entries = 0;
    550582        uint32_t resume_handle = 0;
     583        struct dcerpc_binding_handle *b = cli->binding_handle;
    551584
    552585        if (argc > 2) {
     
    564597        info_ctr.ctr.ctr3 = &ctr3;
    565598
    566         status = rpccli_srvsvc_NetFileEnum(cli, mem_ctx,
     599        status = dcerpc_srvsvc_NetFileEnum(b, mem_ctx,
    567600                                           cli->desthost,
    568601                                           NULL,
     
    573606                                           &resume_handle,
    574607                                           &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        }
    578616
    579617 done:
     
    589627        uint32_t name_type = 9;
    590628        uint32_t flags = 0;
     629        struct dcerpc_binding_handle *b = cli->binding_handle;
    591630
    592631        if (argc < 2 || argc > 3) {
     
    599638        }
    600639
    601         status = rpccli_srvsvc_NetNameValidate(cli, mem_ctx,
     640        status = dcerpc_srvsvc_NetNameValidate(b, mem_ctx,
    602641                                               cli->desthost,
    603642                                               argv[1],
     
    605644                                               flags,
    606645                                               &result);
     646        if (!NT_STATUS_IS_OK(status)) {
     647                result = ntstatus_to_werror(status);
     648                goto done;
     649        }
    607650
    608651        if (!W_ERROR_IS_OK(result))
     
    620663        NTSTATUS status;
    621664        struct sec_desc_buf *sd_buf = NULL;
     665        struct dcerpc_binding_handle *b = cli->binding_handle;
    622666
    623667        if (argc < 2 || argc > 4) {
     
    626670        }
    627671
    628         status = rpccli_srvsvc_NetGetFileSecurity(cli, mem_ctx,
     672        status = dcerpc_srvsvc_NetGetFileSecurity(b, mem_ctx,
    629673                                                  cli->desthost,
    630674                                                  argv[1],
     
    633677                                                  &sd_buf,
    634678                                                  &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)) {
    637685                goto done;
    638686        }
     
    650698        WERROR result;
    651699        NTSTATUS status;
     700        struct dcerpc_binding_handle *b = cli->binding_handle;
    652701
    653702        if (argc < 2 || argc > 4) {
     
    656705        }
    657706
    658         status = rpccli_srvsvc_NetSessDel(cli, mem_ctx,
     707        status = dcerpc_srvsvc_NetSessDel(b, mem_ctx,
    659708                                          cli->desthost,
    660709                                          argv[1],
    661710                                          argv[2],
    662711                                          &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)) {
    665718                goto done;
    666719        }
     
    688741        const char *client = NULL;
    689742        const char *user = NULL;
     743        struct dcerpc_binding_handle *b = cli->binding_handle;
    690744
    691745        if (argc > 6) {
     
    740794        }
    741795
    742         status = rpccli_srvsvc_NetSessEnum(cli, mem_ctx,
     796        status = dcerpc_srvsvc_NetSessEnum(b, mem_ctx,
    743797                                          cli->desthost,
    744798                                          client,
     
    750804                                          &result);
    751805
    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)) {
    753812                goto done;
    754813        }
     
    768827        uint32_t resume_handle = 0;
    769828        uint32_t level = 0;
     829        struct dcerpc_binding_handle *b = cli->binding_handle;
    770830
    771831        if (argc > 4) {
     
    784844        ZERO_STRUCT(info);
    785845
    786         status = rpccli_srvsvc_NetDiskEnum(cli, mem_ctx,
     846        status = dcerpc_srvsvc_NetDiskEnum(b, mem_ctx,
    787847                                           cli->desthost,
    788848                                           level,
     
    792852                                           &resume_handle,
    793853                                           &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)) {
    796860                goto done;
    797861        }
     
    815879        uint32_t level = 1;
    816880        const char *path = "IPC$";
     881        struct dcerpc_binding_handle *b = cli->binding_handle;
    817882
    818883        if (argc > 4) {
     
    851916        }
    852917
    853         status = rpccli_srvsvc_NetConnEnum(cli, mem_ctx,
     918        status = dcerpc_srvsvc_NetConnEnum(b, mem_ctx,
    854919                                           cli->desthost,
    855920                                           path,
     
    860925                                           &result);
    861926
    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)) {
    863933                goto done;
    864934        }
Note: See TracChangeset for help on using the changeset viewer.