Reanimate rpcclient wkssvc command.
authorGünther Deschner <gd@samba.org>
Mon, 3 Dec 2007 11:42:17 +0000 (12:42 +0100)
committerGünther Deschner <gd@samba.org>
Mon, 3 Dec 2007 12:08:20 +0000 (13:08 +0100)
Guenther
(This used to be commit 1d615e3ac397106f47c51ace36c01a8f6e1d5d13)

source3/Makefile.in
source3/rpcclient/cmd_wkssvc.c
source3/rpcclient/rpcclient.c

index 4eea8f18150609ed701bf1291aa51f8d3c4810b6..532290ce2106375b42cf850c51282e1ab599cc1a 100644 (file)
@@ -637,6 +637,7 @@ RPCCLIENT_OBJ1 = rpcclient/rpcclient.o rpcclient/cmd_lsarpc.o \
                 rpcclient/cmd_dfs.o \
                 rpcclient/cmd_ds.o rpcclient/cmd_echo.o \
                 rpcclient/cmd_shutdown.o rpcclient/cmd_test.o \
+                rpcclient/cmd_wkssvc.o \
                 $(DISPLAY_SEC_OBJ) $(DISPLAY_DSDCINFO_OBJ)
 
 RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \
index de5b29880a60221972df8b63bc5d09ff2b47f8ce..4f4c364ea262cf233a7ae4f23a8a4ca89ad1a607 100644 (file)
@@ -1,85 +1,52 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
-   NT Domain Authentication SMB / MSRPC client
-   Copyright (C) Andrew Tridgell 1994-1997
-   Copyright (C) Luke Kenneth Casson Leighton 1996-1997
-   
+   RPC pipe client
+
+   Copyright (C) Günther Deschner 2007
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-THIS IS NO LONGER USED - NEEDS REMOVAL.
-
 #include "includes.h"
+#include "rpcclient.h"
 
-#define DEBUG_TESTING
-
-extern struct cli_state *smb_cli;
-
-extern FILE* out_hnd;
-
-
-/****************************************************************************
-workstation get info query
-****************************************************************************/
-void cmd_wks_query_info(struct client_info *info)
+static WERROR cmd_wkssvc_wkstagetinfo(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     int argc,
+                                     const char **argv)
 {
-       fstring dest_wks;
-       fstring tmp;
-       WKS_INFO_100 ctr;
-       uint32 info_level = 100;
-
-       bool res = True;
-
-       memset((char *)&ctr, '\0', sizeof(ctr));
-
-       fstrcpy(dest_wks, "\\\\");
-       fstrcat(dest_wks, info->dest_host);
-       strupper_m(dest_wks);
-
-       if (next_token_nr(NULL, tmp, NULL, sizeof(tmp)))
-       {
-               info_level = (uint32)strtol(tmp, (char**)NULL, 10);
+       NTSTATUS status;
+       uint32_t level = 100;
+       union wkssvc_NetWkstaInfo info;
+       const char *server_name;
+
+       server_name = cli->cli->desthost;
+
+       status = rpccli_wkssvc_NetWkstaGetInfo(cli, mem_ctx,
+                                              server_name,
+                                              level,
+                                              &info);
+       if (!NT_STATUS_IS_OK(status)) {
+               return ntstatus_to_werror(status);
        }
 
-       DEBUG(4,("cmd_wks_query_info: server:%s info level: %d\n",
-                               dest_wks, info_level));
-
-       DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd));
-
-       /* open LSARPC session. */
-       res = res ? cli_nt_session_open(smb_cli, PI_WKSSVC) : False;
-
-       /* send info level: receive requested info.  hopefully. */
-       res = res ? do_wks_query_info(smb_cli, 
-                               dest_wks, info_level, &ctr) : False;
-
-       /* close the session */
-       cli_nt_session_close(smb_cli);
-
-       if (res)
-       {
-               DEBUG(5,("cmd_wks_query_info: query succeeded\n"));
+       return WERR_OK;
+}
 
-#if 0
-               display_wks_info_100(out_hnd, ACTION_HEADER   , &ctr);
-               display_wks_info_100(out_hnd, ACTION_ENUMERATE, &ctr);
-               display_wks_info_100(out_hnd, ACTION_FOOTER   , &ctr);
-#endif
+struct cmd_set wkssvc_commands[] = {
 
-       }
-       else
-       {
-               DEBUG(5,("cmd_wks_query_info: query failed\n"));
-       }
-}
+       { "WKSSVC" },
+       { "wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, PI_WKSSVC, NULL, "Query WKSSVC Workstation Information", "" },
+       { NULL }
+};
index d24a97c89e47fc17f0570ae141bd2a9ba979bb80..ea7db88224ea27bcdf6db1178f3e7f97bf1bca8f 100644 (file)
@@ -502,6 +502,7 @@ extern struct cmd_set ds_commands[];
 extern struct cmd_set echo_commands[];
 extern struct cmd_set shutdown_commands[];
 extern struct cmd_set test_commands[];
+extern struct cmd_set wkssvc_commands[];
 
 static struct cmd_set *rpcclient_command_list[] = {
        rpcclient_commands,
@@ -515,6 +516,7 @@ static struct cmd_set *rpcclient_command_list[] = {
        echo_commands,
        shutdown_commands,
        test_commands,
+       wkssvc_commands,
        NULL
 };