summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-05-31 21:10:49 +0000
committerJim McDonough <jmcd@samba.org>2002-05-31 21:10:49 +0000
commit4e71eae06eb4a2d67edd3767dc888c5c5de3cfc9 (patch)
tree9ccc7a58eb69feb2c9165259309cec6bceddd80d
parent0f7e6fd0ec1dbe4a5d75a7df2f5ac32e95fd4d9a (diff)
downloadsamba-4e71eae06eb4a2d67edd3767dc888c5c5de3cfc9.tar.gz
samba-4e71eae06eb4a2d67edd3767dc888c5c5de3cfc9.tar.bz2
samba-4e71eae06eb4a2d67edd3767dc888c5c5de3cfc9.zip
Enable all net rpc share subcommands and autoselect transport.
(This used to be commit ebd07c3a295e3f8cd46441caac4dc8e8b178c2cc)
-rw-r--r--source3/utils/net.c3
-rw-r--r--source3/utils/net_help.c4
-rw-r--r--source3/utils/net_rpc.c57
3 files changed, 58 insertions, 6 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c
index e132b8d6e3..9e4c5e52c9 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -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);
}
diff --git a/source3/utils/net_help.c b/source3/utils/net_help.c
index 18a89a9cb7..d87c3abe76 100644
--- a/source3/utils/net_help.c
+++ b/source3/utils/net_help.c
@@ -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);
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index a7414958d1..c9310d4138 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -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}
};