summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-12-19 11:08:27 +0100
committerGünther Deschner <gd@samba.org>2007-12-19 11:15:05 +0100
commit5eca35e0ca0537908f8e5068d36b0a5d744d937e (patch)
tree6e3282ac70d42fe0b17762f540f6fe486becc3de /source3/rpcclient
parent7326612cfd035c5bf15965ab9a297617110a8d2c (diff)
downloadsamba-5eca35e0ca0537908f8e5068d36b0a5d744d937e.tar.gz
samba-5eca35e0ca0537908f8e5068d36b0a5d744d937e.tar.bz2
samba-5eca35e0ca0537908f8e5068d36b0a5d744d937e.zip
Add cmd_wkssvc_enumeratecomputernames to rpcclient.
Guenther (This used to be commit 289151393a43c7f0c2baafdd79d1163fc80aad6a)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_wkssvc.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c
index d136cd0d45..68f408cf48 100644
--- a/source3/rpcclient/cmd_wkssvc.c
+++ b/source3/rpcclient/cmd_wkssvc.c
@@ -124,11 +124,48 @@ static WERROR cmd_wkssvc_messagebuffersend(struct rpc_pipe_client *cli,
return werr;
}
+static WERROR cmd_wkssvc_enumeratecomputernames(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ int argc,
+ const char **argv)
+{
+ const char *server_name;
+ enum wkssvc_ComputerNameType name_type = NetAllComputerNames;
+ NTSTATUS status;
+ struct wkssvc_ComputerNamesCtr *ctr = NULL;
+ WERROR werr;
+
+ server_name = cli->cli->desthost;
+
+ if (argc >= 2) {
+ name_type = atoi(argv[1]);
+ }
+
+ status = rpccli_wkssvc_NetrEnumerateComputerNames(cli, mem_ctx,
+ server_name,
+ name_type, 0,
+ &ctr,
+ &werr);
+ if (!NT_STATUS_IS_OK(status)) {
+ return ntstatus_to_werror(status);
+ }
+
+ if (W_ERROR_IS_OK(werr)) {
+ int i=0;
+ for (i = 0; i < ctr->count; i++) {
+ printf("name: %d %s\n", i, ctr->computer_name->string);
+ }
+ }
+
+ return werr;
+}
+
struct cmd_set wkssvc_commands[] = {
{ "WKSSVC" },
{ "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", "" },
+ { "wkssvc_enumeratecomputernames", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_enumeratecomputernames, PI_WKSSVC, NULL, "Enumerate WKSSVC computer names", "" },
{ NULL }
};