summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_lsarpc.c4
-rw-r--r--source3/rpcclient/cmd_srvsvc.c61
-rw-r--r--source3/rpcclient/display.c111
-rw-r--r--source3/rpcclient/rpcclient.c6
4 files changed, 180 insertions, 2 deletions
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index f68b323385..104d739747 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -343,12 +343,12 @@ void cmd_lsa_query_secret(struct client_info *info)
/* lookup domain controller; receive a policy handle */
res = res ? lsa_open_policy(smb_cli, nt_pipe_fnum,
srv_name,
- &info->dom.lsa_info_pol, False) : False;
+ &info->dom.lsa_info_pol, True) : False;
/* lookup domain controller; receive a policy handle */
res1 = res ? lsa_open_secret(smb_cli, nt_pipe_fnum,
&info->dom.lsa_info_pol,
- secret_name, 0xf003f, &hnd_secret) : False;
+ secret_name, 0x02000000, &hnd_secret) : False;
res2 = res1 ? lsa_query_secret(smb_cli, nt_pipe_fnum,
&hnd_secret, &enc_secret, &last_update) : False;
diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c
index 547b39b2b8..d6f4f33653 100644
--- a/source3/rpcclient/cmd_srvsvc.c
+++ b/source3/rpcclient/cmd_srvsvc.c
@@ -103,6 +103,67 @@ void cmd_srv_query_info(struct client_info *info)
}
/****************************************************************************
+server enum transports
+****************************************************************************/
+void cmd_srv_enum_tprt(struct client_info *info)
+{
+ uint16 nt_pipe_fnum;
+ fstring dest_srv;
+ fstring tmp;
+ SRV_TPRT_INFO_CTR ctr;
+ ENUM_HND hnd;
+ uint32 info_level = 0;
+
+ BOOL res = True;
+
+ bzero(&ctr, sizeof(ctr));
+
+ fstrcpy(dest_srv, "\\\\");
+ fstrcat(dest_srv, info->dest_host);
+ strupper(dest_srv);
+
+ if (next_token(NULL, tmp, NULL, sizeof(tmp)-1))
+ {
+ info_level = (uint32)strtol(tmp, (char**)NULL, 10);
+ }
+
+ DEBUG(4,("cmd_srv_enum_tprt: server:%s info level: %d\n",
+ dest_srv, (int)info_level));
+
+ DEBUG(5, ("cmd_srv_enum_tprt: smb_cli->fd:%d\n", smb_cli->fd));
+
+ /* open srvsvc session. */
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False;
+
+ hnd.ptr_hnd = 1;
+ hnd.handle = 0;
+
+ /* enumerate transports on server */
+ res = res ? do_srv_net_srv_tprt_enum(smb_cli, nt_pipe_fnum,
+ dest_srv,
+ info_level, &ctr, 0xffffffff, &hnd) : False;
+
+ if (res)
+ {
+ display_srv_tprt_info_ctr(out_hnd, ACTION_HEADER , &ctr);
+ display_srv_tprt_info_ctr(out_hnd, ACTION_ENUMERATE, &ctr);
+ display_srv_tprt_info_ctr(out_hnd, ACTION_FOOTER , &ctr);
+ }
+
+ /* close the session */
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
+
+ if (res)
+ {
+ DEBUG(5,("cmd_srv_enum_tprt: query succeeded\n"));
+ }
+ else
+ {
+ DEBUG(5,("cmd_srv_enum_tprt: query failed\n"));
+ }
+}
+
+/****************************************************************************
server enum connections
****************************************************************************/
void cmd_srv_enum_conn(struct client_info *info)
diff --git a/source3/rpcclient/display.c b/source3/rpcclient/display.c
index 4595cdecc7..e3b35cedc9 100644
--- a/source3/rpcclient/display.c
+++ b/source3/rpcclient/display.c
@@ -479,6 +479,117 @@ void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action,
/****************************************************************************
+transport info level 0 display function
+****************************************************************************/
+void display_tprt_info_0(FILE *out_hnd, enum action_type action,
+ TPRT_INFO_0 *info0, TPRT_INFO_0_STR *str0)
+{
+ if (info0 == NULL || str0 == NULL)
+ {
+ return;
+ }
+
+ switch (action)
+ {
+ case ACTION_HEADER:
+ {
+ fprintf(out_hnd, "Connection Info Level 0:\n");
+
+ break;
+ }
+ case ACTION_ENUMERATE:
+ {
+ fstring trans_name;
+ fstring trans_addr;
+ fstring addr_name;
+
+ unistr2_to_ascii(trans_name, &str0->uni_trans_name, sizeof(trans_name)-1);
+ buffer4_to_str(trans_addr, &str0->buf_trans_addr, sizeof(trans_addr)-1);
+ unistr2_to_ascii(addr_name, &str0->uni_addr_name, sizeof(addr_name)-1);
+
+ fprintf(out_hnd, "\tnum_vcs :\t%d\n", info0->num_vcs);
+ fprintf(out_hnd, "\ttransport name:\t%s\n", trans_name);
+ fprintf(out_hnd, "\ttransport addr:\t%s\n", trans_addr);
+ fprintf(out_hnd, "\taddress name:\t%s\n", addr_name);
+
+ break;
+ }
+ case ACTION_FOOTER:
+ {
+ fprintf(out_hnd, "\n");
+ break;
+ }
+ }
+
+}
+
+/****************************************************************************
+transport info level 0 container display function
+****************************************************************************/
+void display_srv_tprt_info_0_ctr(FILE *out_hnd, enum action_type action,
+ SRV_TPRT_INFO_0 *ctr)
+{
+ if (ctr == NULL)
+ {
+ fprintf(out_hnd, "display_srv_tprt_info_0_ctr: unavailable due to an internal error\n");
+ return;
+ }
+
+ switch (action)
+ {
+ case ACTION_HEADER:
+ {
+ break;
+ }
+ case ACTION_ENUMERATE:
+ {
+ int i;
+
+ for (i = 0; i < ctr->num_entries_read; i++)
+ {
+ display_tprt_info_0(out_hnd, ACTION_HEADER , &(ctr->info_0[i]), &(ctr->info_0_str[i]));
+ display_tprt_info_0(out_hnd, ACTION_ENUMERATE, &(ctr->info_0[i]), &(ctr->info_0_str[i]));
+ display_tprt_info_0(out_hnd, ACTION_FOOTER , &(ctr->info_0[i]), &(ctr->info_0_str[i]));
+ }
+ break;
+ }
+ case ACTION_FOOTER:
+ {
+ break;
+ }
+ }
+}
+
+/****************************************************************************
+transport info container display function
+****************************************************************************/
+void display_srv_tprt_info_ctr(FILE *out_hnd, enum action_type action,
+ SRV_TPRT_INFO_CTR *ctr)
+{
+ if (ctr == NULL || ctr->ptr_tprt_ctr == 0)
+ {
+ fprintf(out_hnd, "display_srv_tprt_info_ctr: unavailable due to an internal error\n");
+ return;
+ }
+
+ switch (ctr->switch_value)
+ {
+ case 0:
+ {
+ display_srv_tprt_info_0_ctr(out_hnd, action,
+ &(ctr->tprt.info0));
+ break;
+ }
+ default:
+ {
+ fprintf(out_hnd, "display_srv_tprt_info_ctr: Unknown Info Level\n");
+ break;
+ }
+ }
+}
+
+
+/****************************************************************************
share info level 1 display function
****************************************************************************/
void display_share_info_1(FILE *out_hnd, enum action_type action,
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 9068b0af5a..b8f159df75 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -243,6 +243,12 @@ commands[] =
{COMPL_NONE, COMPL_NONE}
},
{
+ "srvtransports",
+ cmd_srv_enum_tprt,
+ "List transports on a server",
+ {COMPL_NONE, COMPL_NONE}
+ },
+ {
"srvconnections",
cmd_srv_enum_conn,
"List connections on a server",