summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/rpcclient/cmd_dfs.c98
1 files changed, 56 insertions, 42 deletions
diff --git a/source3/rpcclient/cmd_dfs.c b/source3/rpcclient/cmd_dfs.c
index 7f3aab3997..b3198fcf07 100644
--- a/source3/rpcclient/cmd_dfs.c
+++ b/source3/rpcclient/cmd_dfs.c
@@ -24,21 +24,21 @@
/* Check DFS is supported by the remote server */
-static NTSTATUS cmd_dfs_version(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- int argc, const char **argv)
+static WERROR cmd_dfs_version(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
+ int argc, const char **argv)
{
enum dfs_ManagerVersion version;
NTSTATUS result;
if (argc != 1) {
printf("Usage: %s\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
result = rpccli_dfs_GetManagerVersion(cli, mem_ctx, &version);
if (!NT_STATUS_IS_OK(result)) {
- return result;
+ return ntstatus_to_werror(result);
}
if (version > 0) {
@@ -47,20 +47,21 @@ static NTSTATUS cmd_dfs_version(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx
printf("dfs is not present\n");
}
- return NT_STATUS_OK;
+ return WERR_OK;
}
-static NTSTATUS cmd_dfs_add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- int argc, const char **argv)
+static WERROR cmd_dfs_add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
+ int argc, const char **argv)
{
NTSTATUS result;
+ WERROR werr;
const char *path, *servername, *sharename, *comment;
uint32 flags = 0;
if (argc != 5) {
printf("Usage: %s path servername sharename comment\n",
argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
path = argv[1];
@@ -68,31 +69,38 @@ static NTSTATUS cmd_dfs_add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
sharename = argv[3];
comment = argv[4];
- result = rpccli_dfs_Add(cli, mem_ctx, path, servername,
- sharename, comment, flags);
+ result = rpccli_dfs_Add(cli, mem_ctx, path, servername,
+ sharename, comment, flags, &werr);
+ if (!NT_STATUS_IS_OK(result)) {
+ return ntstatus_to_werror(result);
+ }
- return result;
+ return werr;
}
-static NTSTATUS cmd_dfs_remove(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- int argc, const char **argv)
+static WERROR cmd_dfs_remove(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
+ int argc, const char **argv)
{
NTSTATUS result;
+ WERROR werr;
const char *path, *servername, *sharename;
if (argc != 4) {
printf("Usage: %s path servername sharename\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
path = argv[1];
servername = argv[2];
sharename = argv[3];
- result = rpccli_dfs_Remove(cli, mem_ctx, path, servername,
- sharename);
+ result = rpccli_dfs_Remove(cli, mem_ctx, path, servername,
+ sharename, &werr);
+ if (!NT_STATUS_IS_OK(result)) {
+ return ntstatus_to_werror(result);
+ }
- return result;
+ return werr;
}
/* Display a DFS_INFO_1 structure */
@@ -176,8 +184,8 @@ static void display_dfs_enumstruct(struct dfs_EnumStruct *ctr)
/* Enumerate dfs shares */
-static NTSTATUS cmd_dfs_enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- int argc, const char **argv)
+static WERROR cmd_dfs_enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
+ int argc, const char **argv)
{
struct dfs_EnumStruct str;
struct dfs_EnumArray1 info1;
@@ -188,11 +196,12 @@ static NTSTATUS cmd_dfs_enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
struct dfs_EnumArray300 info300;
NTSTATUS result;
+ WERROR werr;
uint32 total = 0;
if (argc > 2) {
printf("Usage: %s [info_level]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
str.level = 1;
@@ -212,18 +221,19 @@ static NTSTATUS cmd_dfs_enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
}
result = rpccli_dfs_Enum(cli, mem_ctx, str.level, 0xFFFFFFFF, &str,
- &total);
+ &total, &werr);
- if (NT_STATUS_IS_OK(result))
+ if (NT_STATUS_IS_OK(result)) {
display_dfs_enumstruct(&str);
+ }
- return result;
+ return werr;
}
/* Enumerate dfs shares */
-static NTSTATUS cmd_dfs_enumex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- int argc, const char **argv)
+static WERROR cmd_dfs_enumex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
+ int argc, const char **argv)
{
struct dfs_EnumStruct str;
struct dfs_EnumArray1 info1;
@@ -234,11 +244,12 @@ static NTSTATUS cmd_dfs_enumex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
struct dfs_EnumArray300 info300;
NTSTATUS result;
+ WERROR werr;
uint32 total = 0;
if (argc < 2 || argc > 3) {
printf("Usage: %s dfs_name [info_level]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
if (argc == 3)
@@ -257,19 +268,21 @@ static NTSTATUS cmd_dfs_enumex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
}
result = rpccli_dfs_EnumEx(cli, mem_ctx, argv[1], str.level,
- 0xFFFFFFFF, &str, &total);
+ 0xFFFFFFFF, &str, &total, &werr);
- if (NT_STATUS_IS_OK(result))
+ if (NT_STATUS_IS_OK(result)) {
display_dfs_enumstruct(&str);
+ }
- return result;
+ return werr;
}
-static NTSTATUS cmd_dfs_getinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- int argc, const char **argv)
+static WERROR cmd_dfs_getinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
+ int argc, const char **argv)
{
NTSTATUS result;
+ WERROR werr;
const char *path, *servername, *sharename;
uint32 info_level = 1;
union dfs_Info ctr;
@@ -277,7 +290,7 @@ static NTSTATUS cmd_dfs_getinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx
if (argc < 4 || argc > 5) {
printf("Usage: %s path servername sharename "
"[info_level]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
path = argv[1];
@@ -287,13 +300,14 @@ static NTSTATUS cmd_dfs_getinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx
if (argc == 5)
info_level = atoi(argv[4]);
- result = rpccli_dfs_GetInfo(cli, mem_ctx, path, servername,
- sharename, info_level, &ctr);
+ result = rpccli_dfs_GetInfo(cli, mem_ctx, path, servername,
+ sharename, info_level, &ctr, &werr);
- if (NT_STATUS_IS_OK(result))
+ if (NT_STATUS_IS_OK(result)) {
display_dfs_info(info_level, &ctr);
+ }
- return result;
+ return werr;
}
/* List of commands exported by this module */
@@ -302,12 +316,12 @@ struct cmd_set dfs_commands[] = {
{ "DFS" },
- { "dfsversion", RPC_RTYPE_NTSTATUS, cmd_dfs_version, NULL, PI_NETDFS, NULL, "Query DFS support", "" },
- { "dfsadd", RPC_RTYPE_NTSTATUS, cmd_dfs_add, NULL, PI_NETDFS, NULL, "Add a DFS share", "" },
- { "dfsremove", RPC_RTYPE_NTSTATUS, cmd_dfs_remove, NULL, PI_NETDFS, NULL, "Remove a DFS share", "" },
- { "dfsgetinfo",RPC_RTYPE_NTSTATUS, cmd_dfs_getinfo, NULL, PI_NETDFS, NULL, "Query DFS share info", "" },
- { "dfsenum", RPC_RTYPE_NTSTATUS, cmd_dfs_enum, NULL, PI_NETDFS, NULL, "Enumerate dfs shares", "" },
- { "dfsenumex", RPC_RTYPE_NTSTATUS, cmd_dfs_enumex, NULL, PI_NETDFS, NULL, "Enumerate dfs shares", "" },
+ { "dfsversion", RPC_RTYPE_WERROR, NULL, cmd_dfs_version, PI_NETDFS, NULL, "Query DFS support", "" },
+ { "dfsadd", RPC_RTYPE_WERROR, NULL, cmd_dfs_add, PI_NETDFS, NULL, "Add a DFS share", "" },
+ { "dfsremove", RPC_RTYPE_WERROR, NULL, cmd_dfs_remove, PI_NETDFS, NULL, "Remove a DFS share", "" },
+ { "dfsgetinfo", RPC_RTYPE_WERROR, NULL, cmd_dfs_getinfo, PI_NETDFS, NULL, "Query DFS share info", "" },
+ { "dfsenum", RPC_RTYPE_WERROR, NULL, cmd_dfs_enum, PI_NETDFS, NULL, "Enumerate dfs shares", "" },
+ { "dfsenumex", RPC_RTYPE_WERROR, NULL, cmd_dfs_enumex, PI_NETDFS, NULL, "Enumerate dfs shares", "" },
{ NULL }
};