s4-drs: additional delete test cases
[Samba/eduardoll.git] / source3 / rpcclient / cmd_srvsvc.c
blob866b68111d81380a454debb4c3cf504b06ebfad4
1 /*
2 Unix SMB/CIFS implementation.
3 RPC pipe client
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/>.
23 #include "includes.h"
24 #include "rpcclient.h"
25 #include "../librpc/gen_ndr/cli_srvsvc.h"
27 /* Display server query info */
29 static char *get_server_type_str(uint32 type)
31 static fstring typestr;
32 int i;
34 if (type == SV_TYPE_ALL) {
35 fstrcpy(typestr, "All");
36 return typestr;
39 typestr[0] = 0;
41 for (i = 0; i < 32; i++) {
42 if (type & (1 << i)) {
43 switch (1 << i) {
44 case SV_TYPE_WORKSTATION:
45 fstrcat(typestr, "Wk ");
46 break;
47 case SV_TYPE_SERVER:
48 fstrcat(typestr, "Sv ");
49 break;
50 case SV_TYPE_SQLSERVER:
51 fstrcat(typestr, "Sql ");
52 break;
53 case SV_TYPE_DOMAIN_CTRL:
54 fstrcat(typestr, "PDC ");
55 break;
56 case SV_TYPE_DOMAIN_BAKCTRL:
57 fstrcat(typestr, "BDC ");
58 break;
59 case SV_TYPE_TIME_SOURCE:
60 fstrcat(typestr, "Tim ");
61 break;
62 case SV_TYPE_AFP:
63 fstrcat(typestr, "AFP ");
64 break;
65 case SV_TYPE_NOVELL:
66 fstrcat(typestr, "Nov ");
67 break;
68 case SV_TYPE_DOMAIN_MEMBER:
69 fstrcat(typestr, "Dom ");
70 break;
71 case SV_TYPE_PRINTQ_SERVER:
72 fstrcat(typestr, "PrQ ");
73 break;
74 case SV_TYPE_DIALIN_SERVER:
75 fstrcat(typestr, "Din ");
76 break;
77 case SV_TYPE_SERVER_UNIX:
78 fstrcat(typestr, "Unx ");
79 break;
80 case SV_TYPE_NT:
81 fstrcat(typestr, "NT ");
82 break;
83 case SV_TYPE_WFW:
84 fstrcat(typestr, "Wfw ");
85 break;
86 case SV_TYPE_SERVER_MFPN:
87 fstrcat(typestr, "Mfp ");
88 break;
89 case SV_TYPE_SERVER_NT:
90 fstrcat(typestr, "SNT ");
91 break;
92 case SV_TYPE_POTENTIAL_BROWSER:
93 fstrcat(typestr, "PtB ");
94 break;
95 case SV_TYPE_BACKUP_BROWSER:
96 fstrcat(typestr, "BMB ");
97 break;
98 case SV_TYPE_MASTER_BROWSER:
99 fstrcat(typestr, "LMB ");
100 break;
101 case SV_TYPE_DOMAIN_MASTER:
102 fstrcat(typestr, "DMB ");
103 break;
104 case SV_TYPE_SERVER_OSF:
105 fstrcat(typestr, "OSF ");
106 break;
107 case SV_TYPE_SERVER_VMS:
108 fstrcat(typestr, "VMS ");
109 break;
110 case SV_TYPE_WIN95_PLUS:
111 fstrcat(typestr, "W95 ");
112 break;
113 case SV_TYPE_ALTERNATE_XPORT:
114 fstrcat(typestr, "Xpt ");
115 break;
116 case SV_TYPE_LOCAL_LIST_ONLY:
117 fstrcat(typestr, "Dom ");
118 break;
119 case SV_TYPE_DOMAIN_ENUM:
120 fstrcat(typestr, "Loc ");
121 break;
126 i = strlen(typestr) - 1;
128 if (typestr[i] == ' ')
129 typestr[i] = 0;
131 return typestr;
134 static void display_server(const char *sname, uint32 type, const char *comment)
136 printf("\t%-15.15s%-20s %s\n", sname, get_server_type_str(type),
137 comment);
140 static void display_srv_info_101(struct srvsvc_NetSrvInfo101 *r)
142 display_server(r->server_name, r->server_type, r->comment);
144 printf("\tplatform_id :\t%d\n", r->platform_id);
145 printf("\tos version :\t%d.%d\n",
146 r->version_major, r->version_minor);
147 printf("\tserver type :\t0x%x\n", r->server_type);
150 static void display_srv_info_102(struct srvsvc_NetSrvInfo102 *r)
152 display_server(r->server_name, r->server_type, r->comment);
154 printf("\tplatform_id :\t%d\n", r->platform_id);
155 printf("\tos version :\t%d.%d\n",
156 r->version_major, r->version_minor);
157 printf("\tserver type :\t0x%x\n", r->server_type);
159 printf("\tusers :\t%x\n", r->users);
160 printf("\tdisc, hidden :\t%x, %x\n", r->disc, r->hidden);
161 printf("\tannounce, delta :\t%d, %d\n", r->announce,
162 r->anndelta);
163 printf("\tlicenses :\t%d\n", r->licenses);
164 printf("\tuser path :\t%s\n", r->userpath);
167 /* Server query info */
168 static WERROR cmd_srvsvc_srv_query_info(struct rpc_pipe_client *cli,
169 TALLOC_CTX *mem_ctx,
170 int argc, const char **argv)
172 uint32 info_level = 101;
173 union srvsvc_NetSrvInfo info;
174 WERROR result;
175 NTSTATUS status;
177 if (argc > 2) {
178 printf("Usage: %s [infolevel]\n", argv[0]);
179 return WERR_OK;
182 if (argc == 2)
183 info_level = atoi(argv[1]);
185 status = rpccli_srvsvc_NetSrvGetInfo(cli, mem_ctx,
186 cli->srv_name_slash,
187 info_level,
188 &info,
189 &result);
190 if (!NT_STATUS_IS_OK(status)) {
191 return ntstatus_to_werror(status);
194 if (!W_ERROR_IS_OK(result)) {
195 goto done;
198 /* Display results */
200 switch (info_level) {
201 case 101:
202 display_srv_info_101(info.info101);
203 break;
204 case 102:
205 display_srv_info_102(info.info102);
206 break;
207 default:
208 printf("unsupported info level %d\n", info_level);
209 break;
212 done:
213 return result;
216 static void display_share_info_1(struct srvsvc_NetShareInfo1 *r)
218 printf("netname: %s\n", r->name);
219 printf("\tremark:\t%s\n", r->comment);
222 static void display_share_info_2(struct srvsvc_NetShareInfo2 *r)
224 printf("netname: %s\n", r->name);
225 printf("\tremark:\t%s\n", r->comment);
226 printf("\tpath:\t%s\n", r->path);
227 printf("\tpassword:\t%s\n", r->password);
230 static void display_share_info_502(struct srvsvc_NetShareInfo502 *r)
232 printf("netname: %s\n", r->name);
233 printf("\tremark:\t%s\n", r->comment);
234 printf("\tpath:\t%s\n", r->path);
235 printf("\tpassword:\t%s\n", r->password);
237 printf("\ttype:\t0x%x\n", r->type);
238 printf("\tperms:\t%d\n", r->permissions);
239 printf("\tmax_uses:\t%d\n", r->max_users);
240 printf("\tnum_uses:\t%d\n", r->current_users);
242 if (r->sd_buf.sd)
243 display_sec_desc(r->sd_buf.sd);
247 static WERROR cmd_srvsvc_net_share_enum_int(struct rpc_pipe_client *cli,
248 TALLOC_CTX *mem_ctx,
249 int argc, const char **argv,
250 uint32_t opcode)
252 uint32 info_level = 2;
253 struct srvsvc_NetShareInfoCtr info_ctr;
254 struct srvsvc_NetShareCtr0 ctr0;
255 struct srvsvc_NetShareCtr1 ctr1;
256 struct srvsvc_NetShareCtr2 ctr2;
257 struct srvsvc_NetShareCtr501 ctr501;
258 struct srvsvc_NetShareCtr502 ctr502;
259 struct srvsvc_NetShareCtr1004 ctr1004;
260 struct srvsvc_NetShareCtr1005 ctr1005;
261 struct srvsvc_NetShareCtr1006 ctr1006;
262 struct srvsvc_NetShareCtr1007 ctr1007;
263 struct srvsvc_NetShareCtr1501 ctr1501;
264 WERROR result;
265 NTSTATUS status;
266 uint32_t totalentries = 0;
267 uint32_t resume_handle = 0;
268 uint32_t *resume_handle_p = NULL;
269 uint32 preferred_len = 0xffffffff, i;
271 if (argc > 3) {
272 printf("Usage: %s [infolevel] [resume_handle]\n", argv[0]);
273 return WERR_OK;
276 if (argc >= 2) {
277 info_level = atoi(argv[1]);
280 if (argc == 3) {
281 resume_handle = atoi(argv[2]);
282 resume_handle_p = &resume_handle;
285 ZERO_STRUCT(info_ctr);
287 info_ctr.level = info_level;
289 switch (info_level) {
290 case 0:
291 ZERO_STRUCT(ctr0);
292 info_ctr.ctr.ctr0 = &ctr0;
293 break;
294 case 1:
295 ZERO_STRUCT(ctr1);
296 info_ctr.ctr.ctr1 = &ctr1;
297 break;
298 case 2:
299 ZERO_STRUCT(ctr2);
300 info_ctr.ctr.ctr2 = &ctr2;
301 break;
302 case 501:
303 ZERO_STRUCT(ctr501);
304 info_ctr.ctr.ctr501 = &ctr501;
305 break;
306 case 502:
307 ZERO_STRUCT(ctr502);
308 info_ctr.ctr.ctr502 = &ctr502;
309 break;
310 case 1004:
311 ZERO_STRUCT(ctr1004);
312 info_ctr.ctr.ctr1004 = &ctr1004;
313 break;
314 case 1005:
315 ZERO_STRUCT(ctr1005);
316 info_ctr.ctr.ctr1005 = &ctr1005;
317 break;
318 case 1006:
319 ZERO_STRUCT(ctr1006);
320 info_ctr.ctr.ctr1006 = &ctr1006;
321 break;
322 case 1007:
323 ZERO_STRUCT(ctr1007);
324 info_ctr.ctr.ctr1007 = &ctr1007;
325 break;
326 case 1501:
327 ZERO_STRUCT(ctr1501);
328 info_ctr.ctr.ctr1501 = &ctr1501;
329 break;
332 switch (opcode) {
333 case NDR_SRVSVC_NETSHAREENUM:
334 status = rpccli_srvsvc_NetShareEnum(cli, mem_ctx,
335 cli->desthost,
336 &info_ctr,
337 preferred_len,
338 &totalentries,
339 resume_handle_p,
340 &result);
341 break;
342 case NDR_SRVSVC_NETSHAREENUMALL:
343 status = rpccli_srvsvc_NetShareEnumAll(cli, mem_ctx,
344 cli->desthost,
345 &info_ctr,
346 preferred_len,
347 &totalentries,
348 resume_handle_p,
349 &result);
350 break;
351 default:
352 return WERR_INVALID_PARAM;
355 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
356 goto done;
359 /* Display results */
361 switch (info_level) {
362 case 1:
363 for (i = 0; i < totalentries; i++)
364 display_share_info_1(&info_ctr.ctr.ctr1->array[i]);
365 break;
366 case 2:
367 for (i = 0; i < totalentries; i++)
368 display_share_info_2(&info_ctr.ctr.ctr2->array[i]);
369 break;
370 case 502:
371 for (i = 0; i < totalentries; i++)
372 display_share_info_502(&info_ctr.ctr.ctr502->array[i]);
373 break;
374 default:
375 printf("unsupported info level %d\n", info_level);
376 break;
379 done:
380 return result;
383 static WERROR cmd_srvsvc_net_share_enum(struct rpc_pipe_client *cli,
384 TALLOC_CTX *mem_ctx,
385 int argc, const char **argv)
387 return cmd_srvsvc_net_share_enum_int(cli, mem_ctx,
388 argc, argv,
389 NDR_SRVSVC_NETSHAREENUM);
392 static WERROR cmd_srvsvc_net_share_enum_all(struct rpc_pipe_client *cli,
393 TALLOC_CTX *mem_ctx,
394 int argc, const char **argv)
396 return cmd_srvsvc_net_share_enum_int(cli, mem_ctx,
397 argc, argv,
398 NDR_SRVSVC_NETSHAREENUMALL);
401 static WERROR cmd_srvsvc_net_share_get_info(struct rpc_pipe_client *cli,
402 TALLOC_CTX *mem_ctx,
403 int argc, const char **argv)
405 uint32 info_level = 502;
406 union srvsvc_NetShareInfo info;
407 WERROR result;
408 NTSTATUS status;
410 if (argc < 2 || argc > 3) {
411 printf("Usage: %s [sharename] [infolevel]\n", argv[0]);
412 return WERR_OK;
415 if (argc == 3)
416 info_level = atoi(argv[2]);
418 status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx,
419 cli->desthost,
420 argv[1],
421 info_level,
422 &info,
423 &result);
425 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
426 goto done;
429 /* Display results */
431 switch (info_level) {
432 case 1:
433 display_share_info_1(info.info1);
434 break;
435 case 2:
436 display_share_info_2(info.info2);
437 break;
438 case 502:
439 display_share_info_502(info.info502);
440 break;
441 default:
442 printf("unsupported info level %d\n", info_level);
443 break;
446 done:
447 return result;
450 static WERROR cmd_srvsvc_net_share_set_info(struct rpc_pipe_client *cli,
451 TALLOC_CTX *mem_ctx,
452 int argc, const char **argv)
454 uint32 info_level = 502;
455 union srvsvc_NetShareInfo info_get;
456 WERROR result;
457 NTSTATUS status;
458 uint32_t parm_err = 0;
460 if (argc > 3) {
461 printf("Usage: %s [sharename] [comment]\n", argv[0]);
462 return WERR_OK;
465 /* retrieve share info */
466 status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx,
467 cli->desthost,
468 argv[1],
469 info_level,
470 &info_get,
471 &result);
473 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
474 goto done;
477 info_get.info502->comment = argv[2];
479 /* set share info */
480 status = rpccli_srvsvc_NetShareSetInfo(cli, mem_ctx,
481 cli->desthost,
482 argv[1],
483 info_level,
484 &info_get,
485 &parm_err,
486 &result);
488 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
489 goto done;
492 /* re-retrieve share info and display */
493 status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx,
494 cli->desthost,
495 argv[1],
496 info_level,
497 &info_get,
498 &result);
500 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
501 goto done;
504 display_share_info_502(info_get.info502);
506 done:
507 return result;
510 static WERROR cmd_srvsvc_net_remote_tod(struct rpc_pipe_client *cli,
511 TALLOC_CTX *mem_ctx,
512 int argc, const char **argv)
514 struct srvsvc_NetRemoteTODInfo *tod = NULL;
515 WERROR result;
516 NTSTATUS status;
518 if (argc > 1) {
519 printf("Usage: %s\n", argv[0]);
520 return WERR_OK;
523 status = rpccli_srvsvc_NetRemoteTOD(cli, mem_ctx,
524 cli->srv_name_slash,
525 &tod,
526 &result);
527 if (!NT_STATUS_IS_OK(status)) {
528 result = ntstatus_to_werror(status);
529 goto done;
532 if (!W_ERROR_IS_OK(result))
533 goto done;
535 done:
536 return result;
539 static WERROR cmd_srvsvc_net_file_enum(struct rpc_pipe_client *cli,
540 TALLOC_CTX *mem_ctx,
541 int argc, const char **argv)
543 uint32 info_level = 3;
544 struct srvsvc_NetFileInfoCtr info_ctr;
545 struct srvsvc_NetFileCtr3 ctr3;
546 WERROR result;
547 NTSTATUS status;
548 uint32 preferred_len = 0xffff;
549 uint32_t total_entries = 0;
550 uint32_t resume_handle = 0;
552 if (argc > 2) {
553 printf("Usage: %s [infolevel]\n", argv[0]);
554 return WERR_OK;
557 if (argc == 2)
558 info_level = atoi(argv[1]);
560 ZERO_STRUCT(info_ctr);
561 ZERO_STRUCT(ctr3);
563 info_ctr.level = info_level;
564 info_ctr.ctr.ctr3 = &ctr3;
566 status = rpccli_srvsvc_NetFileEnum(cli, mem_ctx,
567 cli->desthost,
568 NULL,
569 NULL,
570 &info_ctr,
571 preferred_len,
572 &total_entries,
573 &resume_handle,
574 &result);
576 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result))
577 goto done;
579 done:
580 return result;
583 static WERROR cmd_srvsvc_net_name_validate(struct rpc_pipe_client *cli,
584 TALLOC_CTX *mem_ctx,
585 int argc, const char **argv)
587 WERROR result;
588 NTSTATUS status;
589 uint32_t name_type = 9;
590 uint32_t flags = 0;
592 if (argc < 2 || argc > 3) {
593 printf("Usage: %s [sharename] [type]\n", argv[0]);
594 return WERR_OK;
597 if (argc == 3) {
598 name_type = atoi(argv[2]);
601 status = rpccli_srvsvc_NetNameValidate(cli, mem_ctx,
602 cli->desthost,
603 argv[1],
604 name_type,
605 flags,
606 &result);
608 if (!W_ERROR_IS_OK(result))
609 goto done;
611 done:
612 return result;
615 static WERROR cmd_srvsvc_net_file_get_sec(struct rpc_pipe_client *cli,
616 TALLOC_CTX *mem_ctx,
617 int argc, const char **argv)
619 WERROR result;
620 NTSTATUS status;
621 struct sec_desc_buf *sd_buf = NULL;
623 if (argc < 2 || argc > 4) {
624 printf("Usage: %s [sharename] [file]\n", argv[0]);
625 return WERR_OK;
628 status = rpccli_srvsvc_NetGetFileSecurity(cli, mem_ctx,
629 cli->desthost,
630 argv[1],
631 argv[2],
632 SECINFO_DACL,
633 &sd_buf,
634 &result);
636 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
637 goto done;
640 display_sec_desc(sd_buf->sd);
642 done:
643 return result;
646 static WERROR cmd_srvsvc_net_sess_del(struct rpc_pipe_client *cli,
647 TALLOC_CTX *mem_ctx,
648 int argc, const char **argv)
650 WERROR result;
651 NTSTATUS status;
653 if (argc < 2 || argc > 4) {
654 printf("Usage: %s [client] [user]\n", argv[0]);
655 return WERR_OK;
658 status = rpccli_srvsvc_NetSessDel(cli, mem_ctx,
659 cli->desthost,
660 argv[1],
661 argv[2],
662 &result);
664 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
665 goto done;
668 done:
669 return result;
672 static WERROR cmd_srvsvc_net_sess_enum(struct rpc_pipe_client *cli,
673 TALLOC_CTX *mem_ctx,
674 int argc, const char **argv)
676 WERROR result;
677 NTSTATUS status;
678 struct srvsvc_NetSessInfoCtr info_ctr;
679 struct srvsvc_NetSessCtr0 ctr0;
680 struct srvsvc_NetSessCtr1 ctr1;
681 struct srvsvc_NetSessCtr2 ctr2;
682 struct srvsvc_NetSessCtr10 ctr10;
683 struct srvsvc_NetSessCtr502 ctr502;
684 uint32_t total_entries = 0;
685 uint32_t resume_handle = 0;
686 uint32_t *resume_handle_p = NULL;
687 uint32_t level = 1;
688 const char *client = NULL;
689 const char *user = NULL;
691 if (argc > 6) {
692 printf("Usage: %s [client] [user] [level] [resume_handle]\n", argv[0]);
693 return WERR_OK;
696 if (argc >= 2) {
697 client = argv[1];
700 if (argc >= 3) {
701 user = argv[2];
704 if (argc >= 4) {
705 level = atoi(argv[3]);
708 if (argc >= 5) {
709 resume_handle = atoi(argv[4]);
710 resume_handle_p = &resume_handle;
713 ZERO_STRUCT(info_ctr);
715 info_ctr.level = level;
717 d_printf("trying level: %d\n", level);
719 switch (level) {
720 case 0:
721 ZERO_STRUCT(ctr0);
722 info_ctr.ctr.ctr0 = &ctr0;
723 break;
724 case 1:
725 ZERO_STRUCT(ctr1);
726 info_ctr.ctr.ctr1 = &ctr1;
727 break;
728 case 2:
729 ZERO_STRUCT(ctr2);
730 info_ctr.ctr.ctr2 = &ctr2;
731 break;
732 case 10:
733 ZERO_STRUCT(ctr10);
734 info_ctr.ctr.ctr10 = &ctr10;
735 break;
736 case 502:
737 ZERO_STRUCT(ctr502);
738 info_ctr.ctr.ctr502 = &ctr502;
739 break;
742 status = rpccli_srvsvc_NetSessEnum(cli, mem_ctx,
743 cli->desthost,
744 client,
745 user,
746 &info_ctr,
747 0xffffffff,
748 &total_entries,
749 resume_handle_p,
750 &result);
752 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
753 goto done;
756 done:
757 return result;
760 static WERROR cmd_srvsvc_net_disk_enum(struct rpc_pipe_client *cli,
761 TALLOC_CTX *mem_ctx,
762 int argc, const char **argv)
764 struct srvsvc_NetDiskInfo info;
765 WERROR result;
766 NTSTATUS status;
767 uint32_t total_entries = 0;
768 uint32_t resume_handle = 0;
769 uint32_t level = 0;
771 if (argc > 4) {
772 printf("Usage: %s [level] [resume_handle]\n", argv[0]);
773 return WERR_OK;
776 if (argc >= 2) {
777 level = atoi(argv[1]);
780 if (argc >= 3) {
781 resume_handle = atoi(argv[2]);
784 ZERO_STRUCT(info);
786 status = rpccli_srvsvc_NetDiskEnum(cli, mem_ctx,
787 cli->desthost,
788 level,
789 &info,
790 0xffffffff,
791 &total_entries,
792 &resume_handle,
793 &result);
795 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
796 goto done;
799 done:
800 return result;
803 static WERROR cmd_srvsvc_net_conn_enum(struct rpc_pipe_client *cli,
804 TALLOC_CTX *mem_ctx,
805 int argc, const char **argv)
807 struct srvsvc_NetConnInfoCtr info_ctr;
808 struct srvsvc_NetConnCtr0 ctr0;
809 struct srvsvc_NetConnCtr1 ctr1;
810 WERROR result;
811 NTSTATUS status;
812 uint32_t total_entries = 0;
813 uint32_t resume_handle = 0;
814 uint32_t *resume_handle_p = NULL;
815 uint32_t level = 1;
816 const char *path = "IPC$";
818 if (argc > 4) {
819 printf("Usage: %s [level] [path] [resume_handle]\n", argv[0]);
820 return WERR_OK;
823 if (argc >= 2) {
824 level = atoi(argv[1]);
827 if (argc >= 3) {
828 path = argv[2];
831 if (argc >= 4) {
832 resume_handle = atoi(argv[3]);
833 resume_handle_p = &resume_handle;
836 ZERO_STRUCT(info_ctr);
838 info_ctr.level = level;
840 switch (level) {
841 case 0:
842 ZERO_STRUCT(ctr0);
843 info_ctr.ctr.ctr0 = &ctr0;
844 break;
845 case 1:
846 ZERO_STRUCT(ctr1);
847 info_ctr.ctr.ctr1 = &ctr1;
848 break;
849 default:
850 return WERR_INVALID_PARAM;
853 status = rpccli_srvsvc_NetConnEnum(cli, mem_ctx,
854 cli->desthost,
855 path,
856 &info_ctr,
857 0xffffffff,
858 &total_entries,
859 resume_handle_p,
860 &result);
862 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
863 goto done;
866 done:
867 return result;
871 /* List of commands exported by this module */
873 struct cmd_set srvsvc_commands[] = {
875 { "SRVSVC" },
877 { "srvinfo", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_srv_query_info, &ndr_table_srvsvc.syntax_id, NULL, "Server query info", "" },
878 { "netshareenum",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_enum, &ndr_table_srvsvc.syntax_id, NULL, "Enumerate shares", "" },
879 { "netshareenumall",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_enum_all, &ndr_table_srvsvc.syntax_id, NULL, "Enumerate all shares", "" },
880 { "netsharegetinfo",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_get_info, &ndr_table_srvsvc.syntax_id, NULL, "Get Share Info", "" },
881 { "netsharesetinfo",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_set_info, &ndr_table_srvsvc.syntax_id, NULL, "Set Share Info", "" },
882 { "netfileenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_file_enum, &ndr_table_srvsvc.syntax_id, NULL, "Enumerate open files", "" },
883 { "netremotetod",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_remote_tod, &ndr_table_srvsvc.syntax_id, NULL, "Fetch remote time of day", "" },
884 { "netnamevalidate", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_name_validate, &ndr_table_srvsvc.syntax_id, NULL, "Validate sharename", "" },
885 { "netfilegetsec", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_file_get_sec, &ndr_table_srvsvc.syntax_id, NULL, "Get File security", "" },
886 { "netsessdel", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_sess_del, &ndr_table_srvsvc.syntax_id, NULL, "Delete Session", "" },
887 { "netsessenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_sess_enum, &ndr_table_srvsvc.syntax_id, NULL, "Enumerate Sessions", "" },
888 { "netdiskenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_disk_enum, &ndr_table_srvsvc.syntax_id, NULL, "Enumerate Disks", "" },
889 { "netconnenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_conn_enum, &ndr_table_srvsvc.syntax_id, NULL, "Enumerate Connections", "" },
891 { NULL }