2 Unix SMB/CIFS implementation.
5 Copyright (C) Andrew Tridgell 1992-1999
6 Copyright (C) Luke Kenneth Casson Leighton 1996 - 1999
7 Copyright (C) Tim Potter 2000,2002
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.
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.
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/>.
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"
30 /* Display server query info */
32 static char *get_server_type_str(uint32_t type
)
34 static fstring typestr
;
37 if (type
== SV_TYPE_ALL
) {
38 fstrcpy(typestr
, "All");
44 for (i
= 0; i
< 32; i
++) {
45 if (type
& ((uint32_t)1 << i
)) {
47 case SV_TYPE_WORKSTATION
:
48 fstrcat(typestr
, "Wk ");
51 fstrcat(typestr
, "Sv ");
53 case SV_TYPE_SQLSERVER
:
54 fstrcat(typestr
, "Sql ");
56 case SV_TYPE_DOMAIN_CTRL
:
57 fstrcat(typestr
, "PDC ");
59 case SV_TYPE_DOMAIN_BAKCTRL
:
60 fstrcat(typestr
, "BDC ");
62 case SV_TYPE_TIME_SOURCE
:
63 fstrcat(typestr
, "Tim ");
66 fstrcat(typestr
, "AFP ");
69 fstrcat(typestr
, "Nov ");
71 case SV_TYPE_DOMAIN_MEMBER
:
72 fstrcat(typestr
, "Dom ");
74 case SV_TYPE_PRINTQ_SERVER
:
75 fstrcat(typestr
, "PrQ ");
77 case SV_TYPE_DIALIN_SERVER
:
78 fstrcat(typestr
, "Din ");
80 case SV_TYPE_SERVER_UNIX
:
81 fstrcat(typestr
, "Unx ");
84 fstrcat(typestr
, "NT ");
87 fstrcat(typestr
, "Wfw ");
89 case SV_TYPE_SERVER_MFPN
:
90 fstrcat(typestr
, "Mfp ");
92 case SV_TYPE_SERVER_NT
:
93 fstrcat(typestr
, "SNT ");
95 case SV_TYPE_POTENTIAL_BROWSER
:
96 fstrcat(typestr
, "PtB ");
98 case SV_TYPE_BACKUP_BROWSER
:
99 fstrcat(typestr
, "BMB ");
101 case SV_TYPE_MASTER_BROWSER
:
102 fstrcat(typestr
, "LMB ");
104 case SV_TYPE_DOMAIN_MASTER
:
105 fstrcat(typestr
, "DMB ");
107 case SV_TYPE_SERVER_OSF
:
108 fstrcat(typestr
, "OSF ");
110 case SV_TYPE_SERVER_VMS
:
111 fstrcat(typestr
, "VMS ");
113 case SV_TYPE_WIN95_PLUS
:
114 fstrcat(typestr
, "W95 ");
116 case SV_TYPE_ALTERNATE_XPORT
:
117 fstrcat(typestr
, "Xpt ");
119 case SV_TYPE_LOCAL_LIST_ONLY
:
120 fstrcat(typestr
, "Dom ");
122 case SV_TYPE_DOMAIN_ENUM
:
123 fstrcat(typestr
, "Loc ");
129 i
= strlen(typestr
) - 1;
131 if (typestr
[i
] == ' ')
137 static void display_server(const char *sname
, uint32_t type
, const char *comment
)
139 printf("\t%-15.15s%-20s %s\n", sname
, get_server_type_str(type
),
143 static void display_srv_info_101(struct srvsvc_NetSrvInfo101
*r
)
145 display_server(r
->server_name
, r
->server_type
, r
->comment
);
147 printf("\tplatform_id :\t%d\n", r
->platform_id
);
148 printf("\tos version :\t%d.%d\n",
149 r
->version_major
, r
->version_minor
);
150 printf("\tserver type :\t0x%x\n", r
->server_type
);
153 static void display_srv_info_102(struct srvsvc_NetSrvInfo102
*r
)
155 display_server(r
->server_name
, r
->server_type
, r
->comment
);
157 printf("\tplatform_id :\t%d\n", r
->platform_id
);
158 printf("\tos version :\t%d.%d\n",
159 r
->version_major
, r
->version_minor
);
160 printf("\tserver type :\t0x%x\n", r
->server_type
);
162 printf("\tusers :\t%x\n", r
->users
);
163 printf("\tdisc, hidden :\t%x, %x\n", r
->disc
, r
->hidden
);
164 printf("\tannounce, delta :\t%d, %d\n", r
->announce
,
166 printf("\tlicenses :\t%d\n", r
->licenses
);
167 printf("\tuser path :\t%s\n", r
->userpath
);
170 /* Server query info */
171 static WERROR
cmd_srvsvc_srv_query_info(struct rpc_pipe_client
*cli
,
173 int argc
, const char **argv
)
175 uint32_t info_level
= 101;
176 union srvsvc_NetSrvInfo info
;
179 const char *server_unc
= cli
->srv_name_slash
;
180 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
183 printf("Usage: %s [infolevel] [server_unc]\n", argv
[0]);
188 info_level
= atoi(argv
[1]);
192 server_unc
= argv
[2];
195 status
= dcerpc_srvsvc_NetSrvGetInfo(b
, mem_ctx
,
200 if (!NT_STATUS_IS_OK(status
)) {
201 return ntstatus_to_werror(status
);
204 if (!W_ERROR_IS_OK(result
)) {
208 /* Display results */
210 switch (info_level
) {
212 display_srv_info_101(info
.info101
);
215 display_srv_info_102(info
.info102
);
218 printf("unsupported info level %d\n", info_level
);
226 static void display_share_info_1(struct srvsvc_NetShareInfo1
*r
)
228 printf("netname: %s\n", r
->name
);
229 printf("\tremark:\t%s\n", r
->comment
);
232 static void display_share_info_2(struct srvsvc_NetShareInfo2
*r
)
234 printf("netname: %s\n", r
->name
);
235 printf("\tremark:\t%s\n", r
->comment
);
236 printf("\tpath:\t%s\n", r
->path
);
237 printf("\tpassword:\t%s\n", r
->password
);
240 static void display_share_info_502(struct srvsvc_NetShareInfo502
*r
)
242 printf("netname: %s\n", r
->name
);
243 printf("\tremark:\t%s\n", r
->comment
);
244 printf("\tpath:\t%s\n", r
->path
);
245 printf("\tpassword:\t%s\n", r
->password
);
247 printf("\ttype:\t0x%x\n", r
->type
);
248 printf("\tperms:\t%d\n", r
->permissions
);
249 printf("\tmax_uses:\t%d\n", r
->max_users
);
250 printf("\tnum_uses:\t%d\n", r
->current_users
);
253 display_sec_desc(r
->sd_buf
.sd
);
257 static void display_share_info_1005(struct srvsvc_NetShareInfo1005
*r
)
259 printf("flags: 0x%x\n", r
->dfs_flags
);
260 printf("csc caching: %u\n",
261 (r
->dfs_flags
& SHARE_1005_CSC_POLICY_MASK
) >>
262 SHARE_1005_CSC_POLICY_SHIFT
);
265 static WERROR
cmd_srvsvc_net_share_enum_int(struct rpc_pipe_client
*cli
,
267 int argc
, const char **argv
,
270 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
;
284 uint32_t totalentries
= 0;
286 uint32_t resume_handle
= 0;
287 uint32_t *resume_handle_p
= NULL
;
288 uint32_t preferred_len
= 0xffffffff, i
;
289 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
292 printf("Usage: %s [infolevel] [resume_handle]\n", argv
[0]);
297 info_level
= atoi(argv
[1]);
301 resume_handle
= atoi(argv
[2]);
302 resume_handle_p
= &resume_handle
;
305 ZERO_STRUCT(info_ctr
);
307 info_ctr
.level
= info_level
;
309 switch (info_level
) {
312 info_ctr
.ctr
.ctr0
= &ctr0
;
316 info_ctr
.ctr
.ctr1
= &ctr1
;
320 info_ctr
.ctr
.ctr2
= &ctr2
;
324 info_ctr
.ctr
.ctr501
= &ctr501
;
328 info_ctr
.ctr
.ctr502
= &ctr502
;
331 ZERO_STRUCT(ctr1004
);
332 info_ctr
.ctr
.ctr1004
= &ctr1004
;
335 ZERO_STRUCT(ctr1005
);
336 info_ctr
.ctr
.ctr1005
= &ctr1005
;
339 ZERO_STRUCT(ctr1006
);
340 info_ctr
.ctr
.ctr1006
= &ctr1006
;
343 ZERO_STRUCT(ctr1007
);
344 info_ctr
.ctr
.ctr1007
= &ctr1007
;
347 ZERO_STRUCT(ctr1501
);
348 info_ctr
.ctr
.ctr1501
= &ctr1501
;
353 case NDR_SRVSVC_NETSHAREENUM
:
354 status
= dcerpc_srvsvc_NetShareEnum(b
, mem_ctx
,
362 case NDR_SRVSVC_NETSHAREENUMALL
:
363 status
= dcerpc_srvsvc_NetShareEnumAll(b
, mem_ctx
,
372 return WERR_INVALID_PARAMETER
;
375 if (!NT_STATUS_IS_OK(status
)) {
376 result
= ntstatus_to_werror(status
);
379 if (!W_ERROR_IS_OK(result
)) {
383 /* Display results */
385 switch (info_level
) {
387 count
= info_ctr
.ctr
.ctr1
->count
;
388 for (i
= 0; i
< count
; i
++)
389 display_share_info_1(&info_ctr
.ctr
.ctr1
->array
[i
]);
392 count
= info_ctr
.ctr
.ctr2
->count
;
393 for (i
= 0; i
< count
; i
++)
394 display_share_info_2(&info_ctr
.ctr
.ctr2
->array
[i
]);
397 count
= info_ctr
.ctr
.ctr502
->count
;
398 for (i
= 0; i
< count
; i
++)
399 display_share_info_502(&info_ctr
.ctr
.ctr502
->array
[i
]);
402 printf("unsupported info level %d\n", info_level
);
410 static WERROR
cmd_srvsvc_net_share_enum(struct rpc_pipe_client
*cli
,
412 int argc
, const char **argv
)
414 return cmd_srvsvc_net_share_enum_int(cli
, mem_ctx
,
416 NDR_SRVSVC_NETSHAREENUM
);
419 static WERROR
cmd_srvsvc_net_share_enum_all(struct rpc_pipe_client
*cli
,
421 int argc
, const char **argv
)
423 return cmd_srvsvc_net_share_enum_int(cli
, mem_ctx
,
425 NDR_SRVSVC_NETSHAREENUMALL
);
428 static WERROR
cmd_srvsvc_net_share_get_info(struct rpc_pipe_client
*cli
,
430 int argc
, const char **argv
)
432 uint32_t info_level
= 502;
433 union srvsvc_NetShareInfo info
;
436 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
438 if (argc
< 2 || argc
> 3) {
439 printf("Usage: %s sharename [infolevel 1|2|502|1005]\n",
445 info_level
= atoi(argv
[2]);
447 status
= dcerpc_srvsvc_NetShareGetInfo(b
, mem_ctx
,
454 if (!NT_STATUS_IS_OK(status
)) {
455 result
= ntstatus_to_werror(status
);
458 if (!W_ERROR_IS_OK(result
)) {
462 /* Display results */
464 switch (info_level
) {
466 display_share_info_1(info
.info1
);
469 display_share_info_2(info
.info2
);
472 display_share_info_502(info
.info502
);
475 display_share_info_1005(info
.info1005
);
478 printf("unsupported info level %d\n", info_level
);
486 static WERROR
cmd_srvsvc_net_share_set_info(struct rpc_pipe_client
*cli
,
488 int argc
, const char **argv
)
490 uint32_t info_level
= 502;
491 union srvsvc_NetShareInfo info_get
;
494 uint32_t parm_err
= 0;
495 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
498 printf("Usage: %s [sharename] [comment]\n", argv
[0]);
502 /* retrieve share info */
503 status
= dcerpc_srvsvc_NetShareGetInfo(b
, mem_ctx
,
510 if (!NT_STATUS_IS_OK(status
)) {
511 result
= ntstatus_to_werror(status
);
514 if (!W_ERROR_IS_OK(result
)) {
518 info_get
.info502
->comment
= argv
[2];
521 status
= dcerpc_srvsvc_NetShareSetInfo(b
, mem_ctx
,
529 if (!NT_STATUS_IS_OK(status
)) {
530 result
= ntstatus_to_werror(status
);
533 if (!W_ERROR_IS_OK(result
)) {
537 /* re-retrieve share info and display */
538 status
= dcerpc_srvsvc_NetShareGetInfo(b
, mem_ctx
,
544 if (!NT_STATUS_IS_OK(status
)) {
545 result
= ntstatus_to_werror(status
);
548 if (!W_ERROR_IS_OK(result
)) {
552 display_share_info_502(info_get
.info502
);
558 static WERROR
cmd_srvsvc_net_share_set_dfs_flags(struct rpc_pipe_client
*cli
,
560 int argc
, const char **argv
)
562 struct srvsvc_NetShareInfo1005 info1005
= { 0 };
563 union srvsvc_NetShareInfo info
= { .info1005
= &info1005
};
566 uint32_t parm_err
= 0;
567 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
570 printf("Usage: %s [sharename] [dfsflags]\n", argv
[0]);
575 info
.info1005
->dfs_flags
= strtol(argv
[2], NULL
, 0);
579 status
= dcerpc_srvsvc_NetShareSetInfo(b
, mem_ctx
,
587 if (!NT_STATUS_IS_OK(status
)) {
588 return ntstatus_to_werror(status
);
590 if (!W_ERROR_IS_OK(result
)) {
594 /* re-retrieve share info and display */
595 status
= dcerpc_srvsvc_NetShareGetInfo(b
, mem_ctx
,
601 if (!NT_STATUS_IS_OK(status
)) {
602 return ntstatus_to_werror(status
);
604 if (!W_ERROR_IS_OK(result
)) {
608 display_share_info_1005(info
.info1005
);
613 static WERROR
cmd_srvsvc_net_remote_tod(struct rpc_pipe_client
*cli
,
615 int argc
, const char **argv
)
617 struct srvsvc_NetRemoteTODInfo
*tod
= NULL
;
620 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
623 printf("Usage: %s\n", argv
[0]);
627 status
= dcerpc_srvsvc_NetRemoteTOD(b
, mem_ctx
,
631 if (!NT_STATUS_IS_OK(status
)) {
632 result
= ntstatus_to_werror(status
);
636 if (!W_ERROR_IS_OK(result
))
643 static WERROR
cmd_srvsvc_net_file_enum(struct rpc_pipe_client
*cli
,
645 int argc
, const char **argv
)
647 struct srvsvc_NetFileCtr3 ctr3
= { 0 };
648 struct srvsvc_NetFileInfoCtr info_ctr
= {
656 uint32_t preferred_len
= 0xffff;
657 uint32_t total_entries
= 0;
658 uint32_t resume_handle
= 0;
659 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
662 printf("Usage: %s [infolevel]\n", argv
[0]);
667 info_ctr
.level
= atoi(argv
[1]);
670 status
= dcerpc_srvsvc_NetFileEnum(b
, mem_ctx
,
679 if (!NT_STATUS_IS_OK(status
)) {
680 result
= ntstatus_to_werror(status
);
684 if (!W_ERROR_IS_OK(result
)) {
688 if (info_ctr
.level
== 3) {
689 struct srvsvc_NetFileCtr3
*ret
= info_ctr
.ctr
.ctr3
;
692 for (i
=0; i
<ret
->count
; i
++) {
693 printf("%s\n", ret
->array
[i
].path
);
700 static WERROR
cmd_srvsvc_net_name_validate(struct rpc_pipe_client
*cli
,
702 int argc
, const char **argv
)
706 uint32_t name_type
= 9;
708 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
710 if (argc
< 2 || argc
> 3) {
711 printf("Usage: %s [sharename] [type]\n", argv
[0]);
716 name_type
= atoi(argv
[2]);
719 status
= dcerpc_srvsvc_NetNameValidate(b
, mem_ctx
,
725 if (!NT_STATUS_IS_OK(status
)) {
726 result
= ntstatus_to_werror(status
);
730 if (!W_ERROR_IS_OK(result
))
737 static WERROR
cmd_srvsvc_net_file_get_sec(struct rpc_pipe_client
*cli
,
739 int argc
, const char **argv
)
743 struct sec_desc_buf
*sd_buf
= NULL
;
744 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
746 if (argc
< 2 || argc
> 4) {
747 printf("Usage: %s [sharename] [file]\n", argv
[0]);
751 status
= dcerpc_srvsvc_NetGetFileSecurity(b
, mem_ctx
,
758 if (!NT_STATUS_IS_OK(status
)) {
759 result
= ntstatus_to_werror(status
);
763 if (!W_ERROR_IS_OK(result
)) {
767 display_sec_desc(sd_buf
->sd
);
773 static WERROR
cmd_srvsvc_net_sess_del(struct rpc_pipe_client
*cli
,
775 int argc
, const char **argv
)
779 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
781 if (argc
< 2 || argc
> 4) {
782 printf("Usage: %s [client] [user]\n", argv
[0]);
786 status
= dcerpc_srvsvc_NetSessDel(b
, mem_ctx
,
791 if (!NT_STATUS_IS_OK(status
)) {
792 result
= ntstatus_to_werror(status
);
796 if (!W_ERROR_IS_OK(result
)) {
804 static WERROR
cmd_srvsvc_net_sess_enum(struct rpc_pipe_client
*cli
,
806 int argc
, const char **argv
)
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 uint32_t total_entries
= 0;
817 uint32_t resume_handle
= 0;
818 uint32_t *resume_handle_p
= NULL
;
820 const char *client
= NULL
;
821 const char *user
= NULL
;
822 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
825 printf("Usage: %s [client] [user] [level] [resume_handle]\n", argv
[0]);
838 level
= atoi(argv
[3]);
842 resume_handle
= atoi(argv
[4]);
843 resume_handle_p
= &resume_handle
;
846 ZERO_STRUCT(info_ctr
);
848 info_ctr
.level
= level
;
850 d_printf("trying level: %d\n", level
);
855 info_ctr
.ctr
.ctr0
= &ctr0
;
859 info_ctr
.ctr
.ctr1
= &ctr1
;
863 info_ctr
.ctr
.ctr2
= &ctr2
;
867 info_ctr
.ctr
.ctr10
= &ctr10
;
871 info_ctr
.ctr
.ctr502
= &ctr502
;
875 status
= dcerpc_srvsvc_NetSessEnum(b
, mem_ctx
,
885 if (!NT_STATUS_IS_OK(status
)) {
886 result
= ntstatus_to_werror(status
);
890 if (!W_ERROR_IS_OK(result
)) {
894 d_printf("Received %d entries.\n", total_entries
);
900 static WERROR
cmd_srvsvc_net_disk_enum(struct rpc_pipe_client
*cli
,
902 int argc
, const char **argv
)
904 struct srvsvc_NetDiskInfo info
;
907 uint32_t total_entries
= 0;
908 uint32_t resume_handle
= 0;
910 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
913 printf("Usage: %s [level] [resume_handle]\n", argv
[0]);
918 level
= atoi(argv
[1]);
922 resume_handle
= atoi(argv
[2]);
927 status
= dcerpc_srvsvc_NetDiskEnum(b
, mem_ctx
,
935 if (!NT_STATUS_IS_OK(status
)) {
936 result
= ntstatus_to_werror(status
);
940 if (!W_ERROR_IS_OK(result
)) {
948 static WERROR
cmd_srvsvc_net_conn_enum(struct rpc_pipe_client
*cli
,
950 int argc
, const char **argv
)
952 struct srvsvc_NetConnInfoCtr info_ctr
;
953 struct srvsvc_NetConnCtr0 ctr0
;
954 struct srvsvc_NetConnCtr1 ctr1
;
957 uint32_t total_entries
= 0;
958 uint32_t resume_handle
= 0;
959 uint32_t *resume_handle_p
= NULL
;
961 const char *path
= "IPC$";
962 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
965 printf("Usage: %s [level] [path] [resume_handle]\n", argv
[0]);
970 level
= atoi(argv
[1]);
978 resume_handle
= atoi(argv
[3]);
979 resume_handle_p
= &resume_handle
;
982 ZERO_STRUCT(info_ctr
);
984 info_ctr
.level
= level
;
989 info_ctr
.ctr
.ctr0
= &ctr0
;
993 info_ctr
.ctr
.ctr1
= &ctr1
;
996 return WERR_INVALID_PARAMETER
;
999 status
= dcerpc_srvsvc_NetConnEnum(b
, mem_ctx
,
1008 if (!NT_STATUS_IS_OK(status
)) {
1009 result
= ntstatus_to_werror(status
);
1013 if (!W_ERROR_IS_OK(result
)) {
1021 static WERROR
cmd_srvsvc_net_share_add(struct rpc_pipe_client
*cli
,
1022 TALLOC_CTX
*mem_ctx
,
1023 int argc
, const char **argv
)
1025 struct srvsvc_NetShareInfo502 info502
= { 0 };
1026 union srvsvc_NetShareInfo info
= { .info502
= &info502
};
1029 uint32_t max_users
= -1, parm_error
;
1030 struct sec_desc_buf sd_buf
= { 0 };
1031 const char *path
, *share_name
, *comment
= NULL
;
1032 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1034 if (argc
< 3 || argc
> 5) {
1035 printf("Usage: %s path share_name [max_users] [comment]\n",
1041 share_name
= argv
[2];
1044 max_users
= atoi(argv
[3]);
1051 info
.info502
->name
= share_name
;
1052 info
.info502
->type
= STYPE_DISKTREE
;
1053 info
.info502
->comment
= comment
;
1054 info
.info502
->max_users
= max_users
;
1055 info
.info502
->path
= path
;
1056 info
.info502
->sd_buf
= sd_buf
;
1058 status
= dcerpc_srvsvc_NetShareAdd(b
, mem_ctx
, cli
->desthost
,
1059 502, &info
, &parm_error
, &result
);
1060 if (!NT_STATUS_IS_OK(status
)) {
1061 result
= ntstatus_to_werror(status
);
1067 static WERROR
cmd_srvsvc_net_share_del(struct rpc_pipe_client
*cli
,
1068 TALLOC_CTX
*mem_ctx
,
1069 int argc
, const char **argv
)
1071 const char *share_name
;
1074 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1077 printf("Usage: %s share_name\n", argv
[0]);
1081 share_name
= argv
[1];
1083 status
= dcerpc_srvsvc_NetShareDel(b
, mem_ctx
, cli
->desthost
,
1084 share_name
, 0, &result
);
1086 if (!NT_STATUS_IS_OK(status
)) {
1087 result
= ntstatus_to_werror(status
);
1094 /* List of commands exported by this module */
1096 struct cmd_set srvsvc_commands
[] = {
1104 .returntype
= RPC_RTYPE_WERROR
,
1106 .wfn
= cmd_srvsvc_srv_query_info
,
1107 .table
= &ndr_table_srvsvc
,
1109 .description
= "Server query info",
1113 .name
= "netshareenum",
1114 .returntype
= RPC_RTYPE_WERROR
,
1116 .wfn
= cmd_srvsvc_net_share_enum
,
1117 .table
= &ndr_table_srvsvc
,
1119 .description
= "Enumerate shares",
1123 .name
= "netshareenumall",
1124 .returntype
= RPC_RTYPE_WERROR
,
1126 .wfn
= cmd_srvsvc_net_share_enum_all
,
1127 .table
= &ndr_table_srvsvc
,
1129 .description
= "Enumerate all shares",
1133 .name
= "netsharegetinfo",
1134 .returntype
= RPC_RTYPE_WERROR
,
1136 .wfn
= cmd_srvsvc_net_share_get_info
,
1137 .table
= &ndr_table_srvsvc
,
1139 .description
= "Get Share Info",
1143 .name
= "netsharesetinfo",
1144 .returntype
= RPC_RTYPE_WERROR
,
1146 .wfn
= cmd_srvsvc_net_share_set_info
,
1147 .table
= &ndr_table_srvsvc
,
1149 .description
= "Set Share Info",
1153 .name
= "netsharesetdfsflags",
1154 .returntype
= RPC_RTYPE_WERROR
,
1156 .wfn
= cmd_srvsvc_net_share_set_dfs_flags
,
1157 .table
= &ndr_table_srvsvc
,
1159 .description
= "Set DFS flags",
1163 .name
= "netfileenum",
1164 .returntype
= RPC_RTYPE_WERROR
,
1166 .wfn
= cmd_srvsvc_net_file_enum
,
1167 .table
= &ndr_table_srvsvc
,
1169 .description
= "Enumerate open files",
1173 .name
= "netremotetod",
1174 .returntype
= RPC_RTYPE_WERROR
,
1176 .wfn
= cmd_srvsvc_net_remote_tod
,
1177 .table
= &ndr_table_srvsvc
,
1179 .description
= "Fetch remote time of day",
1183 .name
= "netnamevalidate",
1184 .returntype
= RPC_RTYPE_WERROR
,
1186 .wfn
= cmd_srvsvc_net_name_validate
,
1187 .table
= &ndr_table_srvsvc
,
1189 .description
= "Validate sharename",
1193 .name
= "netfilegetsec",
1194 .returntype
= RPC_RTYPE_WERROR
,
1196 .wfn
= cmd_srvsvc_net_file_get_sec
,
1197 .table
= &ndr_table_srvsvc
,
1199 .description
= "Get File security",
1203 .name
= "netsessdel",
1204 .returntype
= RPC_RTYPE_WERROR
,
1206 .wfn
= cmd_srvsvc_net_sess_del
,
1207 .table
= &ndr_table_srvsvc
,
1209 .description
= "Delete Session",
1213 .name
= "netsessenum",
1214 .returntype
= RPC_RTYPE_WERROR
,
1216 .wfn
= cmd_srvsvc_net_sess_enum
,
1217 .table
= &ndr_table_srvsvc
,
1219 .description
= "Enumerate Sessions",
1223 .name
= "netdiskenum",
1224 .returntype
= RPC_RTYPE_WERROR
,
1226 .wfn
= cmd_srvsvc_net_disk_enum
,
1227 .table
= &ndr_table_srvsvc
,
1229 .description
= "Enumerate Disks",
1233 .name
= "netconnenum",
1234 .returntype
= RPC_RTYPE_WERROR
,
1236 .wfn
= cmd_srvsvc_net_conn_enum
,
1237 .table
= &ndr_table_srvsvc
,
1239 .description
= "Enumerate Connections",
1243 .name
= "netshareadd",
1244 .returntype
= RPC_RTYPE_WERROR
,
1246 .wfn
= cmd_srvsvc_net_share_add
,
1247 .table
= &ndr_table_srvsvc
,
1249 .description
= "Add share",
1253 .name
= "netsharedel",
1254 .returntype
= RPC_RTYPE_WERROR
,
1256 .wfn
= cmd_srvsvc_net_share_del
,
1257 .table
= &ndr_table_srvsvc
,
1259 .description
= "Delete share",