LCOV - code coverage report
Current view: top level - source3/rpcclient - cmd_srvsvc.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 182 604 30.1 %
Date: 2024-04-21 15:09:00 Functions: 12 25 48.0 %

          Line data    Source code
       1             : /* 
       2             :    Unix SMB/CIFS implementation.
       3             :    RPC pipe client
       4             : 
       5             :    Copyright (C) Andrew Tridgell 1992-1999
       6             :    Copyright (C) Luke Kenneth Casson Leighton 1996 - 1999
       7             :    Copyright (C) Tim Potter 2000,2002
       8             : 
       9             :    This program is free software; you can redistribute it and/or modify
      10             :    it under the terms of the GNU General Public License as published by
      11             :    the Free Software Foundation; either version 3 of the License, or
      12             :    (at your option) any later version.
      13             :    
      14             :    This program is distributed in the hope that it will be useful,
      15             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      16             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17             :    GNU General Public License for more details.
      18             :    
      19             :    You should have received a copy of the GNU General Public License
      20             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      21             : */
      22             : 
      23             : #include "includes.h"
      24             : #include "rpcclient.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"
      28             : #include "lib/util/string_wrappers.h"
      29             : 
      30             : /* Display server query info */
      31             : 
      32           0 : static char *get_server_type_str(uint32_t type)
      33             : {
      34             :         static fstring typestr;
      35             :         int i;
      36             : 
      37           0 :         if (type == SV_TYPE_ALL) {
      38           0 :                 fstrcpy(typestr, "All");
      39           0 :                 return typestr;
      40             :         }
      41             :                 
      42           0 :         typestr[0] = 0;
      43             : 
      44           0 :         for (i = 0; i < 32; i++) {
      45           0 :                 if (type & ((uint32_t)1 << i)) {
      46           0 :                         switch (1 << i) {
      47           0 :                         case SV_TYPE_WORKSTATION:
      48           0 :                                 fstrcat(typestr, "Wk ");
      49           0 :                                 break;
      50           0 :                         case SV_TYPE_SERVER:
      51           0 :                                 fstrcat(typestr, "Sv ");
      52           0 :                                 break;
      53           0 :                         case SV_TYPE_SQLSERVER:
      54           0 :                                 fstrcat(typestr, "Sql ");
      55           0 :                                 break;
      56           0 :                         case SV_TYPE_DOMAIN_CTRL:
      57           0 :                                 fstrcat(typestr, "PDC ");
      58           0 :                                 break;
      59           0 :                         case SV_TYPE_DOMAIN_BAKCTRL:
      60           0 :                                 fstrcat(typestr, "BDC ");
      61           0 :                                 break;
      62           0 :                         case SV_TYPE_TIME_SOURCE:
      63           0 :                                 fstrcat(typestr, "Tim ");
      64           0 :                                 break;
      65           0 :                         case SV_TYPE_AFP:
      66           0 :                                 fstrcat(typestr, "AFP ");
      67           0 :                                 break;
      68           0 :                         case SV_TYPE_NOVELL:
      69           0 :                                 fstrcat(typestr, "Nov ");
      70           0 :                                 break;
      71           0 :                         case SV_TYPE_DOMAIN_MEMBER:
      72           0 :                                 fstrcat(typestr, "Dom ");
      73           0 :                                 break;
      74           0 :                         case SV_TYPE_PRINTQ_SERVER:
      75           0 :                                 fstrcat(typestr, "PrQ ");
      76           0 :                                 break;
      77           0 :                         case SV_TYPE_DIALIN_SERVER:
      78           0 :                                 fstrcat(typestr, "Din ");
      79           0 :                                 break;
      80           0 :                         case SV_TYPE_SERVER_UNIX:
      81           0 :                                 fstrcat(typestr, "Unx ");
      82           0 :                                 break;
      83           0 :                         case SV_TYPE_NT:
      84           0 :                                 fstrcat(typestr, "NT ");
      85           0 :                                 break;
      86           0 :                         case SV_TYPE_WFW:
      87           0 :                                 fstrcat(typestr, "Wfw ");
      88           0 :                                 break;
      89           0 :                         case SV_TYPE_SERVER_MFPN:
      90           0 :                                 fstrcat(typestr, "Mfp ");
      91           0 :                                 break;
      92           0 :                         case SV_TYPE_SERVER_NT:
      93           0 :                                 fstrcat(typestr, "SNT ");
      94           0 :                                 break;
      95           0 :                         case SV_TYPE_POTENTIAL_BROWSER:
      96           0 :                                 fstrcat(typestr, "PtB ");
      97           0 :                                 break;
      98           0 :                         case SV_TYPE_BACKUP_BROWSER:
      99           0 :                                 fstrcat(typestr, "BMB ");
     100           0 :                                 break;
     101           0 :                         case SV_TYPE_MASTER_BROWSER:
     102           0 :                                 fstrcat(typestr, "LMB ");
     103           0 :                                 break;
     104           0 :                         case SV_TYPE_DOMAIN_MASTER:
     105           0 :                                 fstrcat(typestr, "DMB ");
     106           0 :                                 break;
     107           0 :                         case SV_TYPE_SERVER_OSF:
     108           0 :                                 fstrcat(typestr, "OSF ");
     109           0 :                                 break;
     110           0 :                         case SV_TYPE_SERVER_VMS:
     111           0 :                                 fstrcat(typestr, "VMS ");
     112           0 :                                 break;
     113           0 :                         case SV_TYPE_WIN95_PLUS:
     114           0 :                                 fstrcat(typestr, "W95 ");
     115           0 :                                 break;
     116           0 :                         case SV_TYPE_ALTERNATE_XPORT:
     117           0 :                                 fstrcat(typestr, "Xpt ");
     118           0 :                                 break;
     119           0 :                         case SV_TYPE_LOCAL_LIST_ONLY:
     120           0 :                                 fstrcat(typestr, "Dom ");
     121           0 :                                 break;
     122           0 :                         case SV_TYPE_DOMAIN_ENUM:
     123           0 :                                 fstrcat(typestr, "Loc ");
     124           0 :                                 break;
     125             :                         }
     126             :                 }
     127             :         }
     128             : 
     129           0 :         i = strlen(typestr) - 1;
     130             : 
     131           0 :         if (typestr[i] == ' ')
     132           0 :                 typestr[i] = 0;
     133             :         
     134           0 :         return typestr;
     135             : }
     136             : 
     137           0 : static void display_server(const char *sname, uint32_t type, const char *comment)
     138             : {
     139           0 :         printf("\t%-15.15s%-20s %s\n", sname, get_server_type_str(type), 
     140             :                comment);
     141           0 : }
     142             : 
     143           0 : static void display_srv_info_101(struct srvsvc_NetSrvInfo101 *r)
     144             : {
     145           0 :         display_server(r->server_name, r->server_type, r->comment);
     146             : 
     147           0 :         printf("\tplatform_id     :\t%d\n", r->platform_id);
     148           0 :         printf("\tos version      :\t%d.%d\n",
     149             :                 r->version_major, r->version_minor);
     150           0 :         printf("\tserver type     :\t0x%x\n", r->server_type);
     151           0 : }
     152             : 
     153           0 : static void display_srv_info_102(struct srvsvc_NetSrvInfo102 *r)
     154             : {
     155           0 :         display_server(r->server_name, r->server_type, r->comment);
     156             : 
     157           0 :         printf("\tplatform_id     :\t%d\n", r->platform_id);
     158           0 :         printf("\tos version      :\t%d.%d\n",
     159             :                 r->version_major, r->version_minor);
     160           0 :         printf("\tserver type     :\t0x%x\n", r->server_type);
     161             : 
     162           0 :         printf("\tusers           :\t%x\n", r->users);
     163           0 :         printf("\tdisc, hidden    :\t%x, %x\n", r->disc, r->hidden);
     164           0 :         printf("\tannounce, delta :\t%d, %d\n", r->announce,
     165             :                r->anndelta);
     166           0 :         printf("\tlicenses        :\t%d\n", r->licenses);
     167           0 :         printf("\tuser path       :\t%s\n", r->userpath);
     168           0 : }
     169             : 
     170             : /* Server query info */
     171           0 : static WERROR cmd_srvsvc_srv_query_info(struct rpc_pipe_client *cli, 
     172             :                                           TALLOC_CTX *mem_ctx,
     173             :                                           int argc, const char **argv)
     174             : {
     175           0 :         uint32_t info_level = 101;
     176             :         union srvsvc_NetSrvInfo info;
     177             :         WERROR result;
     178             :         NTSTATUS status;
     179           0 :         const char *server_unc = cli->srv_name_slash;
     180           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     181             : 
     182           0 :         if (argc > 3) {
     183           0 :                 printf("Usage: %s [infolevel] [server_unc]\n", argv[0]);
     184           0 :                 return WERR_OK;
     185             :         }
     186             : 
     187           0 :         if (argc >= 2) {
     188           0 :                 info_level = atoi(argv[1]);
     189             :         }
     190             : 
     191           0 :         if (argc >= 3) {
     192           0 :                 server_unc = argv[2];
     193             :         }
     194             : 
     195           0 :         status = dcerpc_srvsvc_NetSrvGetInfo(b, mem_ctx,
     196             :                                              server_unc,
     197             :                                              info_level,
     198             :                                              &info,
     199             :                                              &result);
     200           0 :         if (!NT_STATUS_IS_OK(status)) {
     201           0 :                 return ntstatus_to_werror(status);
     202             :         }
     203             : 
     204           0 :         if (!W_ERROR_IS_OK(result)) {
     205           0 :                 goto done;
     206             :         }
     207             : 
     208             :         /* Display results */
     209             : 
     210           0 :         switch (info_level) {
     211           0 :         case 101:
     212           0 :                 display_srv_info_101(info.info101);
     213           0 :                 break;
     214           0 :         case 102:
     215           0 :                 display_srv_info_102(info.info102);
     216           0 :                 break;
     217           0 :         default:
     218           0 :                 printf("unsupported info level %d\n", info_level);
     219           0 :                 break;
     220             :         }
     221             : 
     222           0 :  done:
     223           0 :         return result;
     224             : }
     225             : 
     226           0 : static void display_share_info_1(struct srvsvc_NetShareInfo1 *r)
     227             : {
     228           0 :         printf("netname: %s\n", r->name);
     229           0 :         printf("\tremark:\t%s\n", r->comment);
     230           0 : }
     231             : 
     232        2298 : static void display_share_info_2(struct srvsvc_NetShareInfo2 *r)
     233             : {
     234        2298 :         printf("netname: %s\n", r->name);
     235        2298 :         printf("\tremark:\t%s\n", r->comment);
     236        2298 :         printf("\tpath:\t%s\n", r->path);
     237        2298 :         printf("\tpassword:\t%s\n", r->password);
     238        2298 : }
     239             : 
     240          12 : static void display_share_info_502(struct srvsvc_NetShareInfo502 *r)
     241             : {
     242          12 :         printf("netname: %s\n", r->name);
     243          12 :         printf("\tremark:\t%s\n", r->comment);
     244          12 :         printf("\tpath:\t%s\n", r->path);
     245          12 :         printf("\tpassword:\t%s\n", r->password);
     246             : 
     247          12 :         printf("\ttype:\t0x%x\n", r->type);
     248          12 :         printf("\tperms:\t%d\n", r->permissions);
     249          12 :         printf("\tmax_uses:\t%d\n", r->max_users);
     250          12 :         printf("\tnum_uses:\t%d\n", r->current_users);
     251             : 
     252          12 :         if (r->sd_buf.sd)
     253          12 :                 display_sec_desc(r->sd_buf.sd);
     254             : 
     255          12 : }
     256             : 
     257           6 : static void display_share_info_1005(struct srvsvc_NetShareInfo1005 *r)
     258             : {
     259           6 :         printf("flags: 0x%x\n", r->dfs_flags);
     260           6 :         printf("csc caching: %u\n",
     261           6 :                (r->dfs_flags & SHARE_1005_CSC_POLICY_MASK) >>
     262             :                SHARE_1005_CSC_POLICY_SHIFT);
     263           6 : }
     264             : 
     265          18 : static WERROR cmd_srvsvc_net_share_enum_int(struct rpc_pipe_client *cli,
     266             :                                             TALLOC_CTX *mem_ctx,
     267             :                                             int argc, const char **argv,
     268             :                                             uint32_t opcode)
     269             : {
     270          18 :         uint32_t info_level = 2;
     271             :         struct srvsvc_NetShareInfoCtr info_ctr;
     272             :         struct srvsvc_NetShareCtr0 ctr0;
     273             :         struct srvsvc_NetShareCtr1 ctr1;
     274             :         struct srvsvc_NetShareCtr2 ctr2;
     275             :         struct srvsvc_NetShareCtr501 ctr501;
     276             :         struct srvsvc_NetShareCtr502 ctr502;
     277             :         struct srvsvc_NetShareCtr1004 ctr1004;
     278             :         struct srvsvc_NetShareCtr1005 ctr1005;
     279             :         struct srvsvc_NetShareCtr1006 ctr1006;
     280             :         struct srvsvc_NetShareCtr1007 ctr1007;
     281             :         struct srvsvc_NetShareCtr1501 ctr1501;
     282             :         WERROR result;
     283             :         NTSTATUS status;
     284          18 :         uint32_t totalentries = 0;
     285          18 :         uint32_t count = 0;
     286          18 :         uint32_t resume_handle = 0;
     287          18 :         uint32_t *resume_handle_p = NULL;
     288          18 :         uint32_t preferred_len = 0xffffffff, i;
     289          18 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     290             : 
     291          18 :         if (argc > 3) {
     292           0 :                 printf("Usage: %s [infolevel] [resume_handle]\n", argv[0]);
     293           0 :                 return WERR_OK;
     294             :         }
     295             : 
     296          18 :         if (argc >= 2) {
     297           0 :                 info_level = atoi(argv[1]);
     298             :         }
     299             : 
     300          18 :         if (argc == 3) {
     301           0 :                 resume_handle = atoi(argv[2]);
     302           0 :                 resume_handle_p = &resume_handle;
     303             :         }
     304             : 
     305          18 :         ZERO_STRUCT(info_ctr);
     306             : 
     307          18 :         info_ctr.level = info_level;
     308             : 
     309          18 :         switch (info_level) {
     310           0 :         case 0:
     311           0 :                 ZERO_STRUCT(ctr0);
     312           0 :                 info_ctr.ctr.ctr0 = &ctr0;
     313           0 :                 break;
     314           0 :         case 1:
     315           0 :                 ZERO_STRUCT(ctr1);
     316           0 :                 info_ctr.ctr.ctr1 = &ctr1;
     317           0 :                 break;
     318          18 :         case 2:
     319          18 :                 ZERO_STRUCT(ctr2);
     320          18 :                 info_ctr.ctr.ctr2 = &ctr2;
     321          18 :                 break;
     322           0 :         case 501:
     323           0 :                 ZERO_STRUCT(ctr501);
     324           0 :                 info_ctr.ctr.ctr501 = &ctr501;
     325           0 :                 break;
     326           0 :         case 502:
     327           0 :                 ZERO_STRUCT(ctr502);
     328           0 :                 info_ctr.ctr.ctr502 = &ctr502;
     329           0 :                 break;
     330           0 :         case 1004:
     331           0 :                 ZERO_STRUCT(ctr1004);
     332           0 :                 info_ctr.ctr.ctr1004 = &ctr1004;
     333           0 :                 break;
     334           0 :         case 1005:
     335           0 :                 ZERO_STRUCT(ctr1005);
     336           0 :                 info_ctr.ctr.ctr1005 = &ctr1005;
     337           0 :                 break;
     338           0 :         case 1006:
     339           0 :                 ZERO_STRUCT(ctr1006);
     340           0 :                 info_ctr.ctr.ctr1006 = &ctr1006;
     341           0 :                 break;
     342           0 :         case 1007:
     343           0 :                 ZERO_STRUCT(ctr1007);
     344           0 :                 info_ctr.ctr.ctr1007 = &ctr1007;
     345           0 :                 break;
     346           0 :         case 1501:
     347           0 :                 ZERO_STRUCT(ctr1501);
     348           0 :                 info_ctr.ctr.ctr1501 = &ctr1501;
     349           0 :                 break;
     350             :         }
     351             : 
     352          18 :         switch (opcode) {
     353           6 :                 case NDR_SRVSVC_NETSHAREENUM:
     354           6 :                         status = dcerpc_srvsvc_NetShareEnum(b, mem_ctx,
     355           6 :                                                             cli->desthost,
     356             :                                                             &info_ctr,
     357             :                                                             preferred_len,
     358             :                                                             &totalentries,
     359             :                                                             resume_handle_p,
     360             :                                                             &result);
     361           6 :                         break;
     362          12 :                 case NDR_SRVSVC_NETSHAREENUMALL:
     363          12 :                         status = dcerpc_srvsvc_NetShareEnumAll(b, mem_ctx,
     364          12 :                                                                cli->desthost,
     365             :                                                                &info_ctr,
     366             :                                                                preferred_len,
     367             :                                                                &totalentries,
     368             :                                                                resume_handle_p,
     369             :                                                                &result);
     370          12 :                         break;
     371           0 :                 default:
     372           0 :                         return WERR_INVALID_PARAMETER;
     373             :         }
     374             : 
     375          18 :         if (!NT_STATUS_IS_OK(status)) {
     376           0 :                 result = ntstatus_to_werror(status);
     377           0 :                 goto done;
     378             :         }
     379          18 :         if (!W_ERROR_IS_OK(result)) {
     380           0 :                 goto done;
     381             :         }
     382             : 
     383             :         /* Display results */
     384             : 
     385          18 :         switch (info_level) {
     386           0 :         case 1:
     387           0 :                 count = info_ctr.ctr.ctr1->count;
     388           0 :                 for (i = 0; i < count; i++)
     389           0 :                         display_share_info_1(&info_ctr.ctr.ctr1->array[i]);
     390           0 :                 break;
     391          18 :         case 2:
     392          18 :                 count = info_ctr.ctr.ctr2->count;
     393        2316 :                 for (i = 0; i < count; i++)
     394        2298 :                         display_share_info_2(&info_ctr.ctr.ctr2->array[i]);
     395          18 :                 break;
     396           0 :         case 502:
     397           0 :                 count = info_ctr.ctr.ctr502->count;
     398           0 :                 for (i = 0; i < count; i++)
     399           0 :                         display_share_info_502(&info_ctr.ctr.ctr502->array[i]);
     400           0 :                 break;
     401           0 :         default:
     402           0 :                 printf("unsupported info level %d\n", info_level);
     403           0 :                 break;
     404             :         }
     405             : 
     406          18 :  done:
     407          18 :         return result;
     408             : }
     409             : 
     410           6 : static WERROR cmd_srvsvc_net_share_enum(struct rpc_pipe_client *cli,
     411             :                                         TALLOC_CTX *mem_ctx,
     412             :                                         int argc, const char **argv)
     413             : {
     414           6 :         return cmd_srvsvc_net_share_enum_int(cli, mem_ctx,
     415             :                                              argc, argv,
     416             :                                              NDR_SRVSVC_NETSHAREENUM);
     417             : }
     418             : 
     419          12 : static WERROR cmd_srvsvc_net_share_enum_all(struct rpc_pipe_client *cli,
     420             :                                             TALLOC_CTX *mem_ctx,
     421             :                                             int argc, const char **argv)
     422             : {
     423          12 :         return cmd_srvsvc_net_share_enum_int(cli, mem_ctx,
     424             :                                              argc, argv,
     425             :                                              NDR_SRVSVC_NETSHAREENUMALL);
     426             : }
     427             : 
     428          18 : static WERROR cmd_srvsvc_net_share_get_info(struct rpc_pipe_client *cli, 
     429             :                                             TALLOC_CTX *mem_ctx,
     430             :                                             int argc, const char **argv)
     431             : {
     432          18 :         uint32_t info_level = 502;
     433             :         union srvsvc_NetShareInfo info;
     434             :         WERROR result;
     435             :         NTSTATUS status;
     436          18 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     437             : 
     438          18 :         if (argc < 2 || argc > 3) {
     439           0 :                 printf("Usage: %s sharename [infolevel 1|2|502|1005]\n",
     440             :                        argv[0]);
     441           0 :                 return WERR_OK;
     442             :         }
     443             : 
     444          18 :         if (argc == 3)
     445           6 :                 info_level = atoi(argv[2]);
     446             : 
     447          18 :         status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx,
     448          18 :                                                cli->desthost,
     449          18 :                                                argv[1],
     450             :                                                info_level,
     451             :                                                &info,
     452             :                                                &result);
     453             : 
     454          18 :         if (!NT_STATUS_IS_OK(status)) {
     455           0 :                 result = ntstatus_to_werror(status);
     456           0 :                 goto done;
     457             :         }
     458          18 :         if (!W_ERROR_IS_OK(result)) {
     459           3 :                 goto done;
     460             :         }
     461             : 
     462             :         /* Display results */
     463             : 
     464          15 :         switch (info_level) {
     465           0 :         case 1:
     466           0 :                 display_share_info_1(info.info1);
     467           0 :                 break;
     468           0 :         case 2:
     469           0 :                 display_share_info_2(info.info2);
     470           0 :                 break;
     471          12 :         case 502:
     472          12 :                 display_share_info_502(info.info502);
     473          12 :                 break;
     474           3 :         case 1005:
     475           3 :                 display_share_info_1005(info.info1005);
     476           3 :                 break;
     477           0 :         default:
     478           0 :                 printf("unsupported info level %d\n", info_level);
     479           0 :                 break;
     480             :         }
     481             : 
     482          18 :  done:
     483          18 :         return result;
     484             : }
     485             : 
     486           0 : static WERROR cmd_srvsvc_net_share_set_info(struct rpc_pipe_client *cli, 
     487             :                                             TALLOC_CTX *mem_ctx,
     488             :                                             int argc, const char **argv)
     489             : {
     490           0 :         uint32_t info_level = 502;
     491             :         union srvsvc_NetShareInfo info_get;
     492             :         WERROR result;
     493             :         NTSTATUS status;
     494           0 :         uint32_t parm_err = 0;
     495           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     496             : 
     497           0 :         if (argc > 3) {
     498           0 :                 printf("Usage: %s [sharename] [comment]\n", argv[0]);
     499           0 :                 return WERR_OK;
     500             :         }
     501             : 
     502             :         /* retrieve share info */
     503           0 :         status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx,
     504           0 :                                                cli->desthost,
     505           0 :                                                argv[1],
     506             :                                                info_level,
     507             :                                                &info_get,
     508             :                                                &result);
     509             : 
     510           0 :         if (!NT_STATUS_IS_OK(status)) {
     511           0 :                 result = ntstatus_to_werror(status);
     512           0 :                 goto done;
     513             :         }
     514           0 :         if (!W_ERROR_IS_OK(result)) {
     515           0 :                 goto done;
     516             :         }
     517             : 
     518           0 :         info_get.info502->comment = argv[2];
     519             : 
     520             :         /* set share info */
     521           0 :         status = dcerpc_srvsvc_NetShareSetInfo(b, mem_ctx,
     522           0 :                                                cli->desthost,
     523           0 :                                                argv[1],
     524             :                                                info_level,
     525             :                                                &info_get,
     526             :                                                &parm_err,
     527             :                                                &result);
     528             : 
     529           0 :         if (!NT_STATUS_IS_OK(status)) {
     530           0 :                 result = ntstatus_to_werror(status);
     531           0 :                 goto done;
     532             :         }
     533           0 :         if (!W_ERROR_IS_OK(result)) {
     534           0 :                 goto done;
     535             :         }
     536             : 
     537             :         /* re-retrieve share info and display */
     538           0 :         status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx,
     539           0 :                                                cli->desthost,
     540           0 :                                                argv[1],
     541             :                                                info_level,
     542             :                                                &info_get,
     543             :                                                &result);
     544           0 :         if (!NT_STATUS_IS_OK(status)) {
     545           0 :                 result = ntstatus_to_werror(status);
     546           0 :                 goto done;
     547             :         }
     548           0 :         if (!W_ERROR_IS_OK(result)) {
     549           0 :                 goto done;
     550             :         }
     551             : 
     552           0 :         display_share_info_502(info_get.info502);
     553             : 
     554           0 :  done:
     555           0 :         return result;
     556             : }
     557             : 
     558           3 : static WERROR cmd_srvsvc_net_share_set_dfs_flags(struct rpc_pipe_client *cli,
     559             :                                             TALLOC_CTX *mem_ctx,
     560             :                                             int argc, const char **argv)
     561             : {
     562           3 :         struct srvsvc_NetShareInfo1005 info1005 = { 0 };
     563           3 :         union srvsvc_NetShareInfo info = { .info1005 = &info1005 };
     564             :         WERROR result;
     565             :         NTSTATUS status;
     566           3 :         uint32_t parm_err = 0;
     567           3 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     568             : 
     569           3 :         if (argc > 3) {
     570           0 :                 printf("Usage: %s [sharename] [dfsflags]\n", argv[0]);
     571           0 :                 return WERR_OK;
     572             :         }
     573             : 
     574           3 :         if (argc > 2) {
     575           3 :                 info.info1005->dfs_flags = strtol(argv[2], NULL, 0);
     576             :         }
     577             : 
     578             :         /* set share info */
     579           3 :         status = dcerpc_srvsvc_NetShareSetInfo(b, mem_ctx,
     580           3 :                                                cli->desthost,
     581           3 :                                                argv[1],
     582             :                                                1005,
     583             :                                                &info,
     584             :                                                &parm_err,
     585             :                                                &result);
     586             : 
     587           3 :         if (!NT_STATUS_IS_OK(status)) {
     588           0 :                 return ntstatus_to_werror(status);
     589             :         }
     590           3 :         if (!W_ERROR_IS_OK(result)) {
     591           0 :                 return result;
     592             :         }
     593             : 
     594             :         /* re-retrieve share info and display */
     595           3 :         status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx,
     596           3 :                                                cli->desthost,
     597           3 :                                                argv[1],
     598             :                                                1005,
     599             :                                                &info,
     600             :                                                &result);
     601           3 :         if (!NT_STATUS_IS_OK(status)) {
     602           0 :                 return ntstatus_to_werror(status);
     603             :         }
     604           3 :         if (!W_ERROR_IS_OK(result)) {
     605           0 :                 return result;
     606             :         }
     607             : 
     608           3 :         display_share_info_1005(info.info1005);
     609             : 
     610           3 :         return result;
     611             : }
     612             : 
     613           0 : static WERROR cmd_srvsvc_net_remote_tod(struct rpc_pipe_client *cli, 
     614             :                                           TALLOC_CTX *mem_ctx,
     615             :                                           int argc, const char **argv)
     616             : {
     617           0 :         struct srvsvc_NetRemoteTODInfo *tod = NULL;
     618             :         WERROR result;
     619             :         NTSTATUS status;
     620           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     621             : 
     622           0 :         if (argc > 1) {
     623           0 :                 printf("Usage: %s\n", argv[0]);
     624           0 :                 return WERR_OK;
     625             :         }
     626             : 
     627           0 :         status = dcerpc_srvsvc_NetRemoteTOD(b, mem_ctx,
     628           0 :                                             cli->srv_name_slash,
     629             :                                             &tod,
     630             :                                             &result);
     631           0 :         if (!NT_STATUS_IS_OK(status)) {
     632           0 :                 result = ntstatus_to_werror(status);
     633           0 :                 goto done;
     634             :         }
     635             : 
     636           0 :         if (!W_ERROR_IS_OK(result))
     637           0 :                 goto done;
     638             : 
     639           0 :  done:
     640           0 :         return result;
     641             : }
     642             : 
     643           2 : static WERROR cmd_srvsvc_net_file_enum(struct rpc_pipe_client *cli, 
     644             :                                          TALLOC_CTX *mem_ctx,
     645             :                                          int argc, const char **argv)
     646             : {
     647           2 :         struct srvsvc_NetFileCtr3 ctr3 = { 0 };
     648           2 :         struct srvsvc_NetFileInfoCtr info_ctr = {
     649             :                 .level = 3,
     650             :                 .ctr = {
     651             :                         .ctr3 = &ctr3,
     652             :                 },
     653             :         };
     654             :         WERROR result;
     655             :         NTSTATUS status;
     656           2 :         uint32_t preferred_len = 0xffff;
     657           2 :         uint32_t total_entries = 0;
     658           2 :         uint32_t resume_handle = 0;
     659           2 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     660             : 
     661           2 :         if (argc > 2) {
     662           0 :                 printf("Usage: %s [infolevel]\n", argv[0]);
     663           0 :                 return WERR_OK;
     664             :         }
     665             : 
     666           2 :         if (argc == 2) {
     667           0 :                 info_ctr.level = atoi(argv[1]);
     668             :         }
     669             : 
     670           2 :         status = dcerpc_srvsvc_NetFileEnum(b, mem_ctx,
     671           2 :                                            cli->desthost,
     672             :                                            NULL,
     673             :                                            NULL,
     674             :                                            &info_ctr,
     675             :                                            preferred_len,
     676             :                                            &total_entries,
     677             :                                            &resume_handle,
     678             :                                            &result);
     679           2 :         if (!NT_STATUS_IS_OK(status)) {
     680           0 :                 result = ntstatus_to_werror(status);
     681           0 :                 goto done;
     682             :         }
     683             : 
     684           2 :         if (!W_ERROR_IS_OK(result)) {
     685           0 :                 goto done;
     686             :         }
     687             : 
     688           2 :         if (info_ctr.level == 3) {
     689           2 :                 struct srvsvc_NetFileCtr3 *ret = info_ctr.ctr.ctr3;
     690             :                 uint32_t i;
     691             : 
     692           4 :                 for (i=0; i<ret->count; i++) {
     693           2 :                         printf("%s\n", ret->array[i].path);
     694             :                 }
     695             :         }
     696           2 :  done:
     697           2 :         return result;
     698             : }
     699             : 
     700           0 : static WERROR cmd_srvsvc_net_name_validate(struct rpc_pipe_client *cli,
     701             :                                            TALLOC_CTX *mem_ctx,
     702             :                                            int argc, const char **argv)
     703             : {
     704             :         WERROR result;
     705             :         NTSTATUS status;
     706           0 :         uint32_t name_type = 9;
     707           0 :         uint32_t flags = 0;
     708           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     709             : 
     710           0 :         if (argc < 2 || argc > 3) {
     711           0 :                 printf("Usage: %s [sharename] [type]\n", argv[0]);
     712           0 :                 return WERR_OK;
     713             :         }
     714             : 
     715           0 :         if (argc == 3) {
     716           0 :                 name_type = atoi(argv[2]);
     717             :         }
     718             : 
     719           0 :         status = dcerpc_srvsvc_NetNameValidate(b, mem_ctx,
     720           0 :                                                cli->desthost,
     721           0 :                                                argv[1],
     722             :                                                name_type,
     723             :                                                flags,
     724             :                                                &result);
     725           0 :         if (!NT_STATUS_IS_OK(status)) {
     726           0 :                 result = ntstatus_to_werror(status);
     727           0 :                 goto done;
     728             :         }
     729             : 
     730           0 :         if (!W_ERROR_IS_OK(result))
     731           0 :                 goto done;
     732             : 
     733           0 :  done:
     734           0 :         return result;
     735             : }
     736             : 
     737           0 : static WERROR cmd_srvsvc_net_file_get_sec(struct rpc_pipe_client *cli,
     738             :                                           TALLOC_CTX *mem_ctx,
     739             :                                           int argc, const char **argv)
     740             : {
     741             :         WERROR result;
     742             :         NTSTATUS status;
     743           0 :         struct sec_desc_buf *sd_buf = NULL;
     744           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     745             : 
     746           0 :         if (argc < 2 || argc > 4) {
     747           0 :                 printf("Usage: %s [sharename] [file]\n", argv[0]);
     748           0 :                 return WERR_OK;
     749             :         }
     750             : 
     751           0 :         status = dcerpc_srvsvc_NetGetFileSecurity(b, mem_ctx,
     752           0 :                                                   cli->desthost,
     753           0 :                                                   argv[1],
     754           0 :                                                   argv[2],
     755             :                                                   SECINFO_DACL,
     756             :                                                   &sd_buf,
     757             :                                                   &result);
     758           0 :         if (!NT_STATUS_IS_OK(status)) {
     759           0 :                 result = ntstatus_to_werror(status);
     760           0 :                 goto done;
     761             :         }
     762             : 
     763           0 :         if (!W_ERROR_IS_OK(result)) {
     764           0 :                 goto done;
     765             :         }
     766             : 
     767           0 :         display_sec_desc(sd_buf->sd);
     768             : 
     769           0 :  done:
     770           0 :         return result;
     771             : }
     772             : 
     773           0 : static WERROR cmd_srvsvc_net_sess_del(struct rpc_pipe_client *cli,
     774             :                                       TALLOC_CTX *mem_ctx,
     775             :                                       int argc, const char **argv)
     776             : {
     777             :         WERROR result;
     778             :         NTSTATUS status;
     779           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     780             : 
     781           0 :         if (argc < 2 || argc > 4) {
     782           0 :                 printf("Usage: %s [client] [user]\n", argv[0]);
     783           0 :                 return WERR_OK;
     784             :         }
     785             : 
     786           0 :         status = dcerpc_srvsvc_NetSessDel(b, mem_ctx,
     787           0 :                                           cli->desthost,
     788           0 :                                           argv[1],
     789           0 :                                           argv[2],
     790             :                                           &result);
     791           0 :         if (!NT_STATUS_IS_OK(status)) {
     792           0 :                 result = ntstatus_to_werror(status);
     793           0 :                 goto done;
     794             :         }
     795             : 
     796           0 :         if (!W_ERROR_IS_OK(result)) {
     797           0 :                 goto done;
     798             :         }
     799             : 
     800           0 :  done:
     801           0 :         return result;
     802             : }
     803             : 
     804           6 : static WERROR cmd_srvsvc_net_sess_enum(struct rpc_pipe_client *cli,
     805             :                                        TALLOC_CTX *mem_ctx,
     806             :                                        int argc, const char **argv)
     807             : {
     808             :         WERROR result;
     809             :         NTSTATUS status;
     810             :         struct srvsvc_NetSessInfoCtr info_ctr;
     811             :         struct srvsvc_NetSessCtr0 ctr0;
     812             :         struct srvsvc_NetSessCtr1 ctr1;
     813             :         struct srvsvc_NetSessCtr2 ctr2;
     814             :         struct srvsvc_NetSessCtr10 ctr10;
     815             :         struct srvsvc_NetSessCtr502 ctr502;
     816           6 :         uint32_t total_entries = 0;
     817           6 :         uint32_t resume_handle = 0;
     818           6 :         uint32_t *resume_handle_p = NULL;
     819           6 :         uint32_t level = 1;
     820           6 :         const char *client = NULL;
     821           6 :         const char *user = NULL;
     822           6 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     823             : 
     824           6 :         if (argc > 6) {
     825           0 :                 printf("Usage: %s [client] [user] [level] [resume_handle]\n", argv[0]);
     826           0 :                 return WERR_OK;
     827             :         }
     828             : 
     829           6 :         if (argc >= 2) {
     830           0 :                 client = argv[1];
     831             :         }
     832             : 
     833           6 :         if (argc >= 3) {
     834           0 :                 user = argv[2];
     835             :         }
     836             : 
     837           6 :         if (argc >= 4) {
     838           0 :                 level = atoi(argv[3]);
     839             :         }
     840             : 
     841           6 :         if (argc >= 5) {
     842           0 :                 resume_handle = atoi(argv[4]);
     843           0 :                 resume_handle_p = &resume_handle;
     844             :         }
     845             : 
     846           6 :         ZERO_STRUCT(info_ctr);
     847             : 
     848           6 :         info_ctr.level = level;
     849             : 
     850           6 :         d_printf("trying level: %d\n", level);
     851             : 
     852           6 :         switch (level) {
     853           0 :         case 0:
     854           0 :                 ZERO_STRUCT(ctr0);
     855           0 :                 info_ctr.ctr.ctr0 = &ctr0;
     856           0 :                 break;
     857           6 :         case 1:
     858           6 :                 ZERO_STRUCT(ctr1);
     859           6 :                 info_ctr.ctr.ctr1 = &ctr1;
     860           6 :                 break;
     861           0 :         case 2:
     862           0 :                 ZERO_STRUCT(ctr2);
     863           0 :                 info_ctr.ctr.ctr2 = &ctr2;
     864           0 :                 break;
     865           0 :         case 10:
     866           0 :                 ZERO_STRUCT(ctr10);
     867           0 :                 info_ctr.ctr.ctr10 = &ctr10;
     868           0 :                 break;
     869           0 :         case 502:
     870           0 :                 ZERO_STRUCT(ctr502);
     871           0 :                 info_ctr.ctr.ctr502 = &ctr502;
     872           0 :                 break;
     873             :         }
     874             : 
     875           6 :         status = dcerpc_srvsvc_NetSessEnum(b, mem_ctx,
     876           6 :                                           cli->desthost,
     877             :                                           client,
     878             :                                           user,
     879             :                                           &info_ctr,
     880             :                                           0xffffffff,
     881             :                                           &total_entries,
     882             :                                           resume_handle_p,
     883             :                                           &result);
     884             : 
     885           6 :         if (!NT_STATUS_IS_OK(status)) {
     886           0 :                 result = ntstatus_to_werror(status);
     887           0 :                 goto done;
     888             :         }
     889             : 
     890           6 :         if (!W_ERROR_IS_OK(result)) {
     891           0 :                 goto done;
     892             :         }
     893             : 
     894           6 :         d_printf("Received %d entries.\n", total_entries);
     895             : 
     896           6 :  done:
     897           6 :         return result;
     898             : }
     899             : 
     900           0 : static WERROR cmd_srvsvc_net_disk_enum(struct rpc_pipe_client *cli,
     901             :                                        TALLOC_CTX *mem_ctx,
     902             :                                        int argc, const char **argv)
     903             : {
     904             :         struct srvsvc_NetDiskInfo info;
     905             :         WERROR result;
     906             :         NTSTATUS status;
     907           0 :         uint32_t total_entries = 0;
     908           0 :         uint32_t resume_handle = 0;
     909           0 :         uint32_t level = 0;
     910           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     911             : 
     912           0 :         if (argc > 4) {
     913           0 :                 printf("Usage: %s [level] [resume_handle]\n", argv[0]);
     914           0 :                 return WERR_OK;
     915             :         }
     916             : 
     917           0 :         if (argc >= 2) {
     918           0 :                 level = atoi(argv[1]);
     919             :         }
     920             : 
     921           0 :         if (argc >= 3) {
     922           0 :                 resume_handle = atoi(argv[2]);
     923             :         }
     924             : 
     925           0 :         ZERO_STRUCT(info);
     926             : 
     927           0 :         status = dcerpc_srvsvc_NetDiskEnum(b, mem_ctx,
     928           0 :                                            cli->desthost,
     929             :                                            level,
     930             :                                            &info,
     931             :                                            0xffffffff,
     932             :                                            &total_entries,
     933             :                                            &resume_handle,
     934             :                                            &result);
     935           0 :         if (!NT_STATUS_IS_OK(status)) {
     936           0 :                 result = ntstatus_to_werror(status);
     937           0 :                 goto done;
     938             :         }
     939             : 
     940           0 :         if (!W_ERROR_IS_OK(result)) {
     941           0 :                 goto done;
     942             :         }
     943             : 
     944           0 :  done:
     945           0 :         return result;
     946             : }
     947             : 
     948           0 : static WERROR cmd_srvsvc_net_conn_enum(struct rpc_pipe_client *cli,
     949             :                                        TALLOC_CTX *mem_ctx,
     950             :                                        int argc, const char **argv)
     951             : {
     952             :         struct srvsvc_NetConnInfoCtr info_ctr;
     953             :         struct srvsvc_NetConnCtr0 ctr0;
     954             :         struct srvsvc_NetConnCtr1 ctr1;
     955             :         WERROR result;
     956             :         NTSTATUS status;
     957           0 :         uint32_t total_entries = 0;
     958           0 :         uint32_t resume_handle = 0;
     959           0 :         uint32_t *resume_handle_p = NULL;
     960           0 :         uint32_t level = 1;
     961           0 :         const char *path = "IPC$";
     962           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     963             : 
     964           0 :         if (argc > 4) {
     965           0 :                 printf("Usage: %s [level] [path] [resume_handle]\n", argv[0]);
     966           0 :                 return WERR_OK;
     967             :         }
     968             : 
     969           0 :         if (argc >= 2) {
     970           0 :                 level = atoi(argv[1]);
     971             :         }
     972             : 
     973           0 :         if (argc >= 3) {
     974           0 :                 path = argv[2];
     975             :         }
     976             : 
     977           0 :         if (argc >= 4) {
     978           0 :                 resume_handle = atoi(argv[3]);
     979           0 :                 resume_handle_p = &resume_handle;
     980             :         }
     981             : 
     982           0 :         ZERO_STRUCT(info_ctr);
     983             : 
     984           0 :         info_ctr.level = level;
     985             : 
     986           0 :         switch (level) {
     987           0 :                 case 0:
     988           0 :                         ZERO_STRUCT(ctr0);
     989           0 :                         info_ctr.ctr.ctr0 = &ctr0;
     990           0 :                         break;
     991           0 :                 case 1:
     992           0 :                         ZERO_STRUCT(ctr1);
     993           0 :                         info_ctr.ctr.ctr1 = &ctr1;
     994           0 :                         break;
     995           0 :                 default:
     996           0 :                         return WERR_INVALID_PARAMETER;
     997             :         }
     998             : 
     999           0 :         status = dcerpc_srvsvc_NetConnEnum(b, mem_ctx,
    1000           0 :                                            cli->desthost,
    1001             :                                            path,
    1002             :                                            &info_ctr,
    1003             :                                            0xffffffff,
    1004             :                                            &total_entries,
    1005             :                                            resume_handle_p,
    1006             :                                            &result);
    1007             : 
    1008           0 :         if (!NT_STATUS_IS_OK(status)) {
    1009           0 :                 result = ntstatus_to_werror(status);
    1010           0 :                 goto done;
    1011             :         }
    1012             : 
    1013           0 :         if (!W_ERROR_IS_OK(result)) {
    1014           0 :                 goto done;
    1015             :         }
    1016             : 
    1017           0 :  done:
    1018           0 :         return result;
    1019             : }
    1020             : 
    1021           3 : static WERROR cmd_srvsvc_net_share_add(struct rpc_pipe_client *cli,
    1022             :                                        TALLOC_CTX *mem_ctx,
    1023             :                                        int argc, const char **argv)
    1024             : {
    1025           3 :         struct srvsvc_NetShareInfo502 info502 = { 0 };
    1026           3 :         union srvsvc_NetShareInfo info = { .info502 = &info502 };
    1027             :         WERROR result;
    1028             :         NTSTATUS status;
    1029           3 :         uint32_t max_users = -1, parm_error;
    1030           3 :         struct sec_desc_buf sd_buf = { 0 };
    1031           3 :         const char *path, *share_name, *comment = NULL;
    1032           3 :         struct dcerpc_binding_handle *b = cli->binding_handle;
    1033             : 
    1034           3 :         if (argc < 3 || argc > 5) {
    1035           0 :                 printf("Usage: %s path share_name [max_users] [comment]\n",
    1036             :                        argv[0]);
    1037           0 :                 return WERR_OK;
    1038             :         }
    1039             : 
    1040           3 :         path = argv[1];
    1041           3 :         share_name = argv[2];
    1042             : 
    1043           3 :         if (argc >= 4) {
    1044           3 :                 max_users = atoi(argv[3]);
    1045             :         }
    1046             : 
    1047           3 :         if (argc >= 5) {
    1048           3 :                 comment = argv[4];
    1049             :         }
    1050             : 
    1051           3 :         info.info502->name = share_name;
    1052           3 :         info.info502->type = STYPE_DISKTREE;
    1053           3 :         info.info502->comment = comment;
    1054           3 :         info.info502->max_users = max_users;
    1055           3 :         info.info502->path = path;
    1056           3 :         info.info502->sd_buf = sd_buf;
    1057             : 
    1058           3 :         status = dcerpc_srvsvc_NetShareAdd(b, mem_ctx, cli->desthost,
    1059             :                                            502, &info, &parm_error, &result);
    1060           3 :         if (!NT_STATUS_IS_OK(status)) {
    1061           0 :                 result = ntstatus_to_werror(status);
    1062             :         }
    1063             : 
    1064           3 :         return result;
    1065             : }
    1066             : 
    1067           3 : static WERROR cmd_srvsvc_net_share_del(struct rpc_pipe_client *cli,
    1068             :                                        TALLOC_CTX *mem_ctx,
    1069             :                                        int argc, const char **argv)
    1070             : {
    1071             :         const char *share_name;
    1072             :         WERROR result;
    1073             :         NTSTATUS status;
    1074           3 :         struct dcerpc_binding_handle *b = cli->binding_handle;
    1075             : 
    1076           3 :         if (argc < 2) {
    1077           0 :                 printf("Usage: %s share_name\n", argv[0]);
    1078           0 :                 return WERR_OK;
    1079             :         }
    1080             : 
    1081           3 :         share_name = argv[1];
    1082             : 
    1083           3 :         status = dcerpc_srvsvc_NetShareDel(b, mem_ctx, cli->desthost,
    1084             :                                            share_name, 0, &result);
    1085             : 
    1086           3 :         if (!NT_STATUS_IS_OK(status)) {
    1087           0 :                 result = ntstatus_to_werror(status);
    1088             :         }
    1089             : 
    1090           3 :         return result;
    1091             : }
    1092             : 
    1093             : 
    1094             : /* List of commands exported by this module */
    1095             : 
    1096             : struct cmd_set srvsvc_commands[] = {
    1097             : 
    1098             :         {
    1099             :                 .name = "SRVSVC",
    1100             :         },
    1101             : 
    1102             :         {
    1103             :                 .name               = "srvinfo",
    1104             :                 .returntype         = RPC_RTYPE_WERROR,
    1105             :                 .ntfn               = NULL,
    1106             :                 .wfn                = cmd_srvsvc_srv_query_info,
    1107             :                 .table              = &ndr_table_srvsvc,
    1108             :                 .rpc_pipe           = NULL,
    1109             :                 .description        = "Server query info",
    1110             :                 .usage              = "",
    1111             :         },
    1112             :         {
    1113             :                 .name               = "netshareenum",
    1114             :                 .returntype         = RPC_RTYPE_WERROR,
    1115             :                 .ntfn               = NULL,
    1116             :                 .wfn                = cmd_srvsvc_net_share_enum,
    1117             :                 .table              = &ndr_table_srvsvc,
    1118             :                 .rpc_pipe           = NULL,
    1119             :                 .description        = "Enumerate shares",
    1120             :                 .usage              = "",
    1121             :         },
    1122             :         {
    1123             :                 .name               = "netshareenumall",
    1124             :                 .returntype         = RPC_RTYPE_WERROR,
    1125             :                 .ntfn               = NULL,
    1126             :                 .wfn                = cmd_srvsvc_net_share_enum_all,
    1127             :                 .table              = &ndr_table_srvsvc,
    1128             :                 .rpc_pipe           = NULL,
    1129             :                 .description        = "Enumerate all shares",
    1130             :                 .usage              = "",
    1131             :         },
    1132             :         {
    1133             :                 .name               = "netsharegetinfo",
    1134             :                 .returntype         = RPC_RTYPE_WERROR,
    1135             :                 .ntfn               = NULL,
    1136             :                 .wfn                = cmd_srvsvc_net_share_get_info,
    1137             :                 .table              = &ndr_table_srvsvc,
    1138             :                 .rpc_pipe           = NULL,
    1139             :                 .description        = "Get Share Info",
    1140             :                 .usage              = "",
    1141             :         },
    1142             :         {
    1143             :                 .name               = "netsharesetinfo",
    1144             :                 .returntype         = RPC_RTYPE_WERROR,
    1145             :                 .ntfn               = NULL,
    1146             :                 .wfn                = cmd_srvsvc_net_share_set_info,
    1147             :                 .table              = &ndr_table_srvsvc,
    1148             :                 .rpc_pipe           = NULL,
    1149             :                 .description        = "Set Share Info",
    1150             :                 .usage              = "",
    1151             :         },
    1152             :         {
    1153             :                 .name               = "netsharesetdfsflags",
    1154             :                 .returntype         = RPC_RTYPE_WERROR,
    1155             :                 .ntfn               = NULL,
    1156             :                 .wfn                = cmd_srvsvc_net_share_set_dfs_flags,
    1157             :                 .table              = &ndr_table_srvsvc,
    1158             :                 .rpc_pipe           = NULL,
    1159             :                 .description        = "Set DFS flags",
    1160             :                 .usage              = "",
    1161             :         },
    1162             :         {
    1163             :                 .name               = "netfileenum",
    1164             :                 .returntype         = RPC_RTYPE_WERROR,
    1165             :                 .ntfn               = NULL,
    1166             :                 .wfn                = cmd_srvsvc_net_file_enum,
    1167             :                 .table              =  &ndr_table_srvsvc,
    1168             :                 .rpc_pipe           = NULL,
    1169             :                 .description        = "Enumerate open files",
    1170             :                 .usage              = "",
    1171             :         },
    1172             :         {
    1173             :                 .name               = "netremotetod",
    1174             :                 .returntype         = RPC_RTYPE_WERROR,
    1175             :                 .ntfn               = NULL,
    1176             :                 .wfn                = cmd_srvsvc_net_remote_tod,
    1177             :                 .table              = &ndr_table_srvsvc,
    1178             :                 .rpc_pipe           = NULL,
    1179             :                 .description        = "Fetch remote time of day",
    1180             :                 .usage              = "",
    1181             :         },
    1182             :         {
    1183             :                 .name               = "netnamevalidate",
    1184             :                 .returntype         = RPC_RTYPE_WERROR,
    1185             :                 .ntfn               = NULL,
    1186             :                 .wfn                = cmd_srvsvc_net_name_validate,
    1187             :                 .table              = &ndr_table_srvsvc,
    1188             :                 .rpc_pipe           = NULL,
    1189             :                 .description        = "Validate sharename",
    1190             :                 .usage              = "",
    1191             :         },
    1192             :         {
    1193             :                 .name               = "netfilegetsec",
    1194             :                 .returntype         = RPC_RTYPE_WERROR,
    1195             :                 .ntfn               = NULL,
    1196             :                 .wfn                = cmd_srvsvc_net_file_get_sec,
    1197             :                 .table              = &ndr_table_srvsvc,
    1198             :                 .rpc_pipe           = NULL,
    1199             :                 .description        = "Get File security",
    1200             :                 .usage              = "",
    1201             :         },
    1202             :         {
    1203             :                 .name               = "netsessdel",
    1204             :                 .returntype         = RPC_RTYPE_WERROR,
    1205             :                 .ntfn               = NULL,
    1206             :                 .wfn                = cmd_srvsvc_net_sess_del,
    1207             :                 .table              = &ndr_table_srvsvc,
    1208             :                 .rpc_pipe           = NULL,
    1209             :                 .description        = "Delete Session",
    1210             :                 .usage              = "",
    1211             :         },
    1212             :         {
    1213             :                 .name               = "netsessenum",
    1214             :                 .returntype         = RPC_RTYPE_WERROR,
    1215             :                 .ntfn               = NULL,
    1216             :                 .wfn                = cmd_srvsvc_net_sess_enum,
    1217             :                 .table              = &ndr_table_srvsvc,
    1218             :                 .rpc_pipe           = NULL,
    1219             :                 .description        = "Enumerate Sessions",
    1220             :                 .usage              = "",
    1221             :         },
    1222             :         {
    1223             :                 .name               = "netdiskenum",
    1224             :                 .returntype         = RPC_RTYPE_WERROR,
    1225             :                 .ntfn               = NULL,
    1226             :                 .wfn                = cmd_srvsvc_net_disk_enum,
    1227             :                 .table              = &ndr_table_srvsvc,
    1228             :                 .rpc_pipe           = NULL,
    1229             :                 .description        = "Enumerate Disks",
    1230             :                 .usage              = "",
    1231             :         },
    1232             :         {
    1233             :                 .name               = "netconnenum",
    1234             :                 .returntype         = RPC_RTYPE_WERROR,
    1235             :                 .ntfn               = NULL,
    1236             :                 .wfn                = cmd_srvsvc_net_conn_enum,
    1237             :                 .table              = &ndr_table_srvsvc,
    1238             :                 .rpc_pipe           = NULL,
    1239             :                 .description        = "Enumerate Connections",
    1240             :                 .usage              = "",
    1241             :         },
    1242             :         {
    1243             :                 .name               = "netshareadd",
    1244             :                 .returntype         = RPC_RTYPE_WERROR,
    1245             :                 .ntfn               = NULL,
    1246             :                 .wfn                = cmd_srvsvc_net_share_add,
    1247             :                 .table              = &ndr_table_srvsvc,
    1248             :                 .rpc_pipe           = NULL,
    1249             :                 .description        = "Add share",
    1250             :                 .usage              = "",
    1251             :         },
    1252             :         {
    1253             :                 .name               = "netsharedel",
    1254             :                 .returntype         = RPC_RTYPE_WERROR,
    1255             :                 .ntfn               = NULL,
    1256             :                 .wfn                = cmd_srvsvc_net_share_del,
    1257             :                 .table              = &ndr_table_srvsvc,
    1258             :                 .rpc_pipe           = NULL,
    1259             :                 .description        = "Delete share",
    1260             :                 .usage              = "",
    1261             :         },
    1262             : 
    1263             :         {
    1264             :                 .name = NULL,
    1265             :         }
    1266             : };

Generated by: LCOV version 1.14