From aef303f83c2bdebbd3bf64d8c3ed4b2621232ccb Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 6 Dec 2009 12:40:44 +0100 Subject: s3: Add rpcclient wkssvc_enumerateusers --- source3/rpcclient/cmd_wkssvc.c | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'source3') diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index e8dc48d4a3..34ad57650c 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -160,6 +160,54 @@ static WERROR cmd_wkssvc_enumeratecomputernames(struct rpc_pipe_client *cli, return werr; } +static WERROR cmd_wkssvc_enumerateusers(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, + const char **argv) +{ + const char *server_name; + NTSTATUS status; + struct wkssvc_NetWkstaEnumUsersInfo info; + WERROR werr; + uint32_t i, num_entries, resume_handle; + + server_name = cli->desthost; + + ZERO_STRUCT(info); + + if (argc >= 2) { + info.level = atoi(argv[1]); + } + + status = rpccli_wkssvc_NetWkstaEnumUsers(cli, mem_ctx, server_name, + &info, 1000, &num_entries, + &resume_handle, &werr); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + + for (i=0; iuser0[i].user_name; + break; + case 1: + user = talloc_asprintf( + talloc_tos(), "%s\\%s", + info.ctr.user1->user1[i].logon_domain, + info.ctr.user1->user1[i].user_name); + break; + } + printf("%s\n", user); + } + + return werr; +} + struct cmd_set wkssvc_commands[] = { { "WKSSVC" }, @@ -167,5 +215,8 @@ struct cmd_set wkssvc_commands[] = { { "wkssvc_getjoininformation", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_getjoininformation, &ndr_table_wkssvc.syntax_id, NULL, "Query WKSSVC Join Information", "" }, { "wkssvc_messagebuffersend", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_messagebuffersend, &ndr_table_wkssvc.syntax_id, NULL, "Send WKSSVC message", "" }, { "wkssvc_enumeratecomputernames", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_enumeratecomputernames, &ndr_table_wkssvc.syntax_id, NULL, "Enumerate WKSSVC computer names", "" }, + { "wkssvc_enumerateusers", RPC_RTYPE_WERROR, NULL, + cmd_wkssvc_enumerateusers, &ndr_table_wkssvc.syntax_id, NULL, + "Enumerate WKSSVC users", "" }, { NULL } }; -- cgit