mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
Reanimate rpcclient wkssvc command.
Guenther
(This used to be commit 1d615e3ac3
)
This commit is contained in:
parent
e9e182feda
commit
9cc7b8e2a0
@ -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) \
|
||||
|
@ -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;
|
||||
NTSTATUS status;
|
||||
uint32_t level = 100;
|
||||
union wkssvc_NetWkstaInfo info;
|
||||
const char *server_name;
|
||||
|
||||
bool res = True;
|
||||
server_name = cli->cli->desthost;
|
||||
|
||||
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);
|
||||
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"));
|
||||
|
||||
#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
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG(5,("cmd_wks_query_info: query failed\n"));
|
||||
}
|
||||
return WERR_OK;
|
||||
}
|
||||
|
||||
struct cmd_set wkssvc_commands[] = {
|
||||
|
||||
{ "WKSSVC" },
|
||||
{ "wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, PI_WKSSVC, NULL, "Query WKSSVC Workstation Information", "" },
|
||||
{ NULL }
|
||||
};
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user