summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-27 22:19:51 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-27 22:19:51 +0000
commit4a6761a58d5718c386c7ab4fa89c34fa08dca53b (patch)
tree30cd6637233af8576d692c33bc50a45d1c08a682 /source3/rpcclient
parentb9b04afc354edc56c9dad8a861b4e4c8854e3d8e (diff)
downloadsamba-4a6761a58d5718c386c7ab4fa89c34fa08dca53b.tar.gz
samba-4a6761a58d5718c386c7ab4fa89c34fa08dca53b.tar.bz2
samba-4a6761a58d5718c386c7ab4fa89c34fa08dca53b.zip
using "abstracted" cli_connection, got \PIPE\srvsvc commands up and running
again. (This used to be commit 6b67d6164dbfda3ba690d86597ae560b7e5c7584)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_srvsvc.c92
1 files changed, 11 insertions, 81 deletions
diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c
index ee67cc7421..74368dea89 100644
--- a/source3/rpcclient/cmd_srvsvc.c
+++ b/source3/rpcclient/cmd_srvsvc.c
@@ -33,8 +33,6 @@ extern int DEBUGLEVEL;
#define DEBUG_TESTING
-extern struct cli_state *smb_cli;
-
extern FILE* out_hnd;
@@ -45,7 +43,6 @@ BOOL net_srv_get_info(struct client_info *info,
uint32 info_level,
SRV_INFO_CTR *ctr)
{
- uint16 fnum;
fstring dest_srv;
BOOL res = True;
@@ -57,15 +54,8 @@ BOOL net_srv_get_info(struct client_info *info,
DEBUG(4,("net_srv_get_info: server:%s info level: %d\n",
dest_srv, (int)info_level));
- /* open LSARPC session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &fnum) : False;
-
/* send info level: receive requested info. hopefully. */
- res = res ? do_srv_net_srv_get_info(smb_cli, fnum,
- dest_srv, info_level, ctr) : False;
-
- /* close the session */
- cli_nt_session_close(smb_cli, fnum);
+ res = res ? do_srv_net_srv_get_info(dest_srv, info_level, ctr) : False;
return res;
}
@@ -85,8 +75,6 @@ void cmd_srv_query_info(struct client_info *info, int argc, char *argv[])
info_level = (uint32)strtol(argv[1], (char**)NULL, 10);
}
- DEBUG(5, ("cmd_srv_query_info: smb_cli->fd:%d\n", smb_cli->fd));
-
if (net_srv_get_info(info, info_level, &ctr))
{
DEBUG(5,("cmd_srv_query_info: query succeeded\n"));
@@ -104,14 +92,11 @@ void cmd_srv_query_info(struct client_info *info, int argc, char *argv[])
/****************************************************************************
server enum transports
****************************************************************************/
-BOOL msrpc_srv_enum_tprt(struct cli_state *cli,
- const char* dest_srv,
+BOOL msrpc_srv_enum_tprt( const char* dest_srv,
uint32 info_level,
SRV_TPRT_INFO_CTR *ctr,
TPRT_INFO_FN(tprt_fn))
{
- uint16 fnum;
-
BOOL res = True;
BOOL res1 = True;
@@ -120,17 +105,10 @@ BOOL msrpc_srv_enum_tprt(struct cli_state *cli,
hnd.ptr_hnd = 1;
hnd.handle = 0;
- /* open srvsvc session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &fnum) : False;
-
/* enumerate transports on server */
- res1 = res ? do_srv_net_srv_tprt_enum(smb_cli, fnum,
- dest_srv,
+ res1 = res ? do_srv_net_srv_tprt_enum(dest_srv,
info_level, ctr, 0xffffffff, &hnd) : False;
- /* close the session */
- cli_nt_session_close(smb_cli, fnum);
-
tprt_fn(ctr);
free_srv_tprt_ctr(ctr);
@@ -168,10 +146,8 @@ void cmd_srv_enum_tprt(struct client_info *info, int argc, char *argv[])
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));
-
/* enumerate transports on server */
- msrpc_srv_enum_tprt(smb_cli, dest_srv,
+ msrpc_srv_enum_tprt(dest_srv,
info_level, &ctr,
srv_display_tprt_ctr);
}
@@ -181,7 +157,6 @@ server enum connections
****************************************************************************/
void cmd_srv_enum_conn(struct client_info *info, int argc, char *argv[])
{
- uint16 fnum;
fstring dest_srv;
fstring qual_srv;
SRV_CONN_INFO_CTR ctr;
@@ -208,17 +183,11 @@ void cmd_srv_enum_conn(struct client_info *info, int argc, char *argv[])
DEBUG(4,("cmd_srv_enum_conn: server:%s info level: %d\n",
dest_srv, (int)info_level));
- DEBUG(5, ("cmd_srv_enum_conn: smb_cli->fd:%d\n", smb_cli->fd));
-
- /* open srvsvc session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &fnum) : False;
-
hnd.ptr_hnd = 1;
hnd.handle = 0;
/* enumerate connections on server */
- res = res ? do_srv_net_srv_conn_enum(smb_cli, fnum,
- dest_srv, qual_srv,
+ res = res ? do_srv_net_srv_conn_enum(dest_srv, qual_srv,
info_level, &ctr, 0xffffffff, &hnd) : False;
if (res)
@@ -228,9 +197,6 @@ void cmd_srv_enum_conn(struct client_info *info, int argc, char *argv[])
display_srv_conn_info_ctr(out_hnd, ACTION_FOOTER , &ctr);
}
- /* close the session */
- cli_nt_session_close(smb_cli, fnum);
-
if (res)
{
DEBUG(5,("cmd_srv_enum_conn: query succeeded\n"));
@@ -246,7 +212,6 @@ server enum shares
****************************************************************************/
void cmd_srv_enum_shares(struct client_info *info, int argc, char *argv[])
{
- uint16 fnum;
fstring dest_srv;
SRV_SHARE_INFO_CTR ctr;
ENUM_HND hnd;
@@ -268,17 +233,11 @@ void cmd_srv_enum_shares(struct client_info *info, int argc, char *argv[])
DEBUG(4,("cmd_srv_enum_shares: server:%s info level: %d\n",
dest_srv, (int)info_level));
- DEBUG(5, ("cmd_srv_enum_shares: smb_cli->fd:%d\n", smb_cli->fd));
-
- /* open srvsvc session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &fnum) : False;
-
hnd.ptr_hnd = 0;
hnd.handle = 0;
/* enumerate shares_files on server */
- res = res ? do_srv_net_srv_share_enum(smb_cli, fnum,
- dest_srv,
+ res = res ? do_srv_net_srv_share_enum(dest_srv,
info_level, &ctr, 0xffffffff, &hnd) : False;
if (res)
@@ -288,9 +247,6 @@ void cmd_srv_enum_shares(struct client_info *info, int argc, char *argv[])
display_srv_share_info_ctr(out_hnd, ACTION_FOOTER , &ctr);
}
- /* close the session */
- cli_nt_session_close(smb_cli, fnum);
-
if (res)
{
DEBUG(5,("cmd_srv_enum_shares: query succeeded\n"));
@@ -306,7 +262,6 @@ server enum sessions
****************************************************************************/
void cmd_srv_enum_sess(struct client_info *info, int argc, char *argv[])
{
- uint16 fnum;
fstring dest_srv;
SRV_SESS_INFO_CTR ctr;
ENUM_HND hnd;
@@ -328,17 +283,12 @@ void cmd_srv_enum_sess(struct client_info *info, int argc, char *argv[])
DEBUG(4,("cmd_srv_enum_sess: server:%s info level: %d\n",
dest_srv, (int)info_level));
- DEBUG(5, ("cmd_srv_enum_sess: smb_cli->fd:%d\n", smb_cli->fd));
-
- /* open srvsvc session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &fnum) : False;
-
hnd.ptr_hnd = 1;
hnd.handle = 0;
/* enumerate sessions on server */
- res = res ? do_srv_net_srv_sess_enum(smb_cli, fnum,
- dest_srv, NULL, NULL, info_level, &ctr, 0x1000, &hnd) : False;
+ res = res ? do_srv_net_srv_sess_enum(dest_srv, NULL, NULL,
+ info_level, &ctr, 0x1000, &hnd) : False;
if (res)
{
@@ -347,9 +297,6 @@ void cmd_srv_enum_sess(struct client_info *info, int argc, char *argv[])
display_srv_sess_info_ctr(out_hnd, ACTION_FOOTER , &ctr);
}
- /* close the session */
- cli_nt_session_close(smb_cli, fnum);
-
if (res)
{
DEBUG(5,("cmd_srv_enum_sess: query succeeded\n"));
@@ -365,7 +312,6 @@ server enum files
****************************************************************************/
void cmd_srv_enum_files(struct client_info *info, int argc, char *argv[])
{
- uint16 fnum;
fstring dest_srv;
SRV_FILE_INFO_CTR ctr;
ENUM_HND hnd;
@@ -387,17 +333,12 @@ void cmd_srv_enum_files(struct client_info *info, int argc, char *argv[])
DEBUG(4,("cmd_srv_enum_files: server:%s info level: %d\n",
dest_srv, (int)info_level));
- DEBUG(5, ("cmd_srv_enum_files: smb_cli->fd:%d\n", smb_cli->fd));
-
- /* open srvsvc session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &fnum) : False;
-
hnd.ptr_hnd = 1;
hnd.handle = 0;
/* enumerate files on server */
- res = res ? do_srv_net_srv_file_enum(smb_cli, fnum,
- dest_srv, NULL, 0, info_level, &ctr, 0x1000, &hnd) : False;
+ res = res ? do_srv_net_srv_file_enum(dest_srv, NULL, 0,
+ info_level, &ctr, 0x1000, &hnd) : False;
if (res)
{
@@ -406,9 +347,6 @@ void cmd_srv_enum_files(struct client_info *info, int argc, char *argv[])
display_srv_file_info_ctr(out_hnd, ACTION_FOOTER , &ctr);
}
- /* close the session */
- cli_nt_session_close(smb_cli, fnum);
-
if (res)
{
DEBUG(5,("cmd_srv_enum_files: query succeeded\n"));
@@ -424,7 +362,6 @@ display remote time
****************************************************************************/
void cmd_time(struct client_info *info, int argc, char *argv[])
{
- uint16 fnum;
fstring dest_srv;
TIME_OF_DAY_INFO tod;
BOOL res = True;
@@ -435,12 +372,8 @@ void cmd_time(struct client_info *info, int argc, char *argv[])
DEBUG(4,("cmd_time: server:%s\n", dest_srv));
- /* open srvsvc session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &fnum) : False;
-
/* enumerate files on server */
- res = res ? do_srv_net_remote_tod(smb_cli, fnum,
- dest_srv, &tod) : False;
+ res = res ? do_srv_net_remote_tod(dest_srv, &tod) : False;
if (res)
{
@@ -448,9 +381,6 @@ void cmd_time(struct client_info *info, int argc, char *argv[])
http_timestring(tod.elapsedt));
}
- /* Close the session */
- cli_nt_session_close(smb_cli, fnum);
-
if (res)
{
DEBUG(5,("cmd_srv_enum_files: query succeeded\n"));