diff options
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_wkssvc.c | 82 |
1 files changed, 81 insertions, 1 deletions
diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index f3ff8113e9..d136cd0d45 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -32,6 +32,15 @@ static WERROR cmd_wkssvc_wkstagetinfo(struct rpc_pipe_client *cli, union wkssvc_NetWkstaInfo info; const char *server_name; + if (argc > 2) { + printf("usage: %s <level>\n", argv[0]); + return WERR_OK; + } + + if (argc > 1) { + level = atoi(argv[1]); + } + server_name = cli->cli->desthost; status = rpccli_wkssvc_NetWkstaGetInfo(cli, mem_ctx, @@ -46,9 +55,80 @@ static WERROR cmd_wkssvc_wkstagetinfo(struct rpc_pipe_client *cli, return werr; } +static WERROR cmd_wkssvc_getjoininformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, + const char **argv) +{ + const char *server_name; + const char *name_buffer; + enum wkssvc_NetJoinStatus name_type; + NTSTATUS status; + WERROR werr; + + server_name = cli->cli->desthost; + name_buffer = ""; + + status = rpccli_wkssvc_NetrGetJoinInformation(cli, mem_ctx, + server_name, + &name_buffer, + &name_type, + &werr); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + + if (W_ERROR_IS_OK(werr)) { + printf("%s (%d)\n", name_buffer, name_type); + } + + return werr; +} + +static WERROR cmd_wkssvc_messagebuffersend(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, + const char **argv) +{ + const char *server_name = cli->cli->desthost; + const char *message_name = cli->cli->desthost; + const char *message_sender_name = cli->cli->desthost; + smb_ucs2_t *message_buffer = NULL; + size_t message_size = 0; + const char *message = "my message"; + NTSTATUS status; + WERROR werr; + + if (argc > 1) { + message = argv[1]; + } + + message_size = push_ucs2_talloc(mem_ctx, + &message_buffer, + message); + if (message_size == -1) { + return WERR_NOMEM; + } + + status = rpccli_wkssvc_NetrMessageBufferSend(cli, mem_ctx, + server_name, + message_name, + message_sender_name, + (uint8_t *)message_buffer, + message_size, + &werr); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + + return werr; +} + struct cmd_set wkssvc_commands[] = { { "WKSSVC" }, - { "wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, PI_WKSSVC, NULL, "Query WKSSVC Workstation Information", "" }, + { "wkssvc_wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, PI_WKSSVC, NULL, "Query WKSSVC Workstation Information", "" }, + { "wkssvc_getjoininformation", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_getjoininformation, PI_WKSSVC, NULL, "Query WKSSVC Join Information", "" }, + { "wkssvc_messagebuffersend", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_messagebuffersend, PI_WKSSVC, NULL, "Send WKSSVC message", "" }, { NULL } }; |