if (argc == 0) {
f = stdin;
} else {
- f = fopen(argv[0], "r");
+ if (strequal(argv[0], "-")) {
+ f = stdin;
+ } else {
+ f = fopen(argv[0], "r");
+ }
+ argv++;
+ argc--;
}
if (f == NULL) {
b = pipe_hnd->binding_handle;
+ if (argc != 0) {
+ /* Show results only for shares listed on the command line. */
+ while (*argv) {
+ const char *netname = *argv++;
+ d_printf("%s\n", netname);
+ show_userlist(pipe_hnd, cli, mem_ctx, netname,
+ num_tokens, tokens);
+ }
+ goto done;
+ }
+
/* Issue the NetShareEnum RPC call and retrieve the response */
nt_status = dcerpc_srvsvc_NetShareEnumAll(b,
talloc_tos(),
"\tenumerates all exported resources (network shares) "
"on target server\n\n"
"net [<method>] share ADD <name=serverpath> [misc. options] [targets]"
- "\n\tadds a share from a server (makes the export active)\n\n"
- "net [<method>] share DELETE <sharename> [misc. options] [targets]"
- "\n\tdeletes a share from a server (makes the export inactive)\n\n"
- "net [<method>] share ALLOWEDUSERS [<filename>] "
- "[misc. options] [targets]"
- "\n\tshows a list of all shares together with all users allowed to"
- "\n\taccess them. This needs the output of 'net usersidlist' on"
- "\n\tstdin or in <filename>.\n\n"
+ "\n\tadds a share from a server (makes the export active)\n\n"
+ "net [<method>] share DELETE <sharename> [misc. options] [targets]"
+ "\n\tdeletes a share from a server (makes the export inactive)\n\n"
+ "net [<method>] share ALLOWEDUSERS [misc. options] [<filename>|- "
+ " [targets]]"
+ "\n\tshows a list of shares (either from [targets] or by default all"
+ "\n\tshares) together with all users allowed to access them. This"
+ "\n\tneeds the output of 'net usersidlist' on stdin or in <filename>."
+ "\n\n"
"net [<method>] share MIGRATE FILES <sharename> [misc. options] [targets]"
"\n\tMigrates files from remote to local server\n\n"
"net [<method>] share MIGRATE SHARES <sharename> [misc. options] [targets]"