1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-25 06:04:04 +03:00

Enable all net rpc share subcommands and autoselect transport.

(This used to be commit ebd07c3a295e3f8cd46441caac4dc8e8b178c2cc)
This commit is contained in:
Jim McDonough 2002-05-31 21:10:49 +00:00
parent 0f7e6fd0ec
commit 4e71eae06e
3 changed files with 58 additions and 6 deletions

View File

@ -316,8 +316,7 @@ static int net_join(int argc, const char **argv)
static int net_share(int argc, const char **argv)
{
/* only share list is implemented in RPC */
if (argc == 0 && net_rpc_check(0))
if (net_rpc_check(0))
return net_rpc_share(argc, argv);
return net_rap_share(argc, argv);
}

View File

@ -99,9 +99,9 @@ int net_help_share(int argc, const char **argv)
"\nnet <method> share [misc. options] [targets] \n"
"\tenumerates all exported resources (network shares) "
"on target server\n"
"\nnet [rap] share ADD <name=serverpath> [misc. options] [targets]"
"\nnet <method> share ADD <name=serverpath> [misc. options] [targets]"
"\n\tAdds a share from a server (makes the export active)\n"
"\nnet [rap] share DELETE <sharename> [misc. options] [targets]\n"
"\nnet <method> share DELETE <sharename> [misc. options] [targets]\n"
"\n\tDeletes a share from a server (makes the export inactive)\n");
net_common_methods_usage(argc, argv);
net_common_flags_usage(argc, argv);

View File

@ -867,6 +867,61 @@ static int rpc_share_usage(int argc, const char **argv)
return net_help_share(argc, argv);
}
static NTSTATUS
rpc_share_add_internals(const DOM_SID *domain_sid, struct cli_state *cli,
TALLOC_CTX *mem_ctx,int argc, const char **argv)
{
WERROR result;
char *sharename=talloc_strdup(mem_ctx, argv[0]);
char *path;
uint32 type=0; /* only allow disk shares to be added */
uint32 num_users=0, perms=0;
char *password=NULL; /* don't allow a share password */
path = strchr(sharename, '=');
if (!path)
return NT_STATUS_UNSUCCESSFUL;
*path++ = '\0';
result = cli_srvsvc_net_share_add(cli, mem_ctx, sharename, type,
opt_comment, perms, opt_maxusers,
num_users, path, password);
return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
}
static int rpc_share_add(int argc, const char **argv)
{
if ((argc < 1) || !strchr(argv[0], '=')) {
DEBUG(1,("Sharename or path not specified on add\n"));
return rpc_share_usage(argc, argv);
}
return run_rpc_command(PIPE_SRVSVC, 0,
rpc_share_add_internals,
argc, argv);
}
static NTSTATUS
rpc_share_del_internals(const DOM_SID *domain_sid, struct cli_state *cli,
TALLOC_CTX *mem_ctx,int argc, const char **argv)
{
WERROR result;
result = cli_srvsvc_net_share_del(cli, mem_ctx, argv[0]);
return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
}
static int rpc_share_delete(int argc, const char **argv)
{
if (argc < 1) {
DEBUG(1,("Sharename not specified on delete\n"));
return rpc_share_usage(argc, argv);
}
return run_rpc_command(PIPE_SRVSVC, 0,
rpc_share_del_internals,
argc, argv);
}
static void display_share_info_1(SRV_SHARE_INFO_1 *info1)
{
fstring netname = "", remark = "";
@ -940,10 +995,8 @@ rpc_share_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
int net_rpc_share(int argc, const char **argv)
{
struct functable func[] = {
#if 0
{"add", rpc_share_add},
{"delete", rpc_share_delete},
#endif
{NULL, NULL}
};