diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 26 | ||||
-rw-r--r-- | source3/rpc_client/cli_srvsvc.c | 157 | ||||
-rw-r--r-- | source3/rpcclient/cmd_srvsvc.c | 92 |
3 files changed, 125 insertions, 150 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 28bc1bfa5f..24b50d9bcc 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -2081,35 +2081,30 @@ BOOL spoolss_closeprinter(struct cli_state *cli, uint16 fnum, PRINTER_HND *hnd); /*The following definitions come from rpc_client/cli_srvsvc.c */ -BOOL do_srv_net_srv_tprt_enum(struct cli_state *cli, uint16 fnum, - const char *server_name, +BOOL do_srv_net_srv_tprt_enum( + const char *srv_name, uint32 switch_value, SRV_TPRT_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd); -BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, uint16 fnum, - char *server_name, char *qual_name, +BOOL do_srv_net_srv_conn_enum( char *srv_name, char *qual_name, uint32 switch_value, SRV_CONN_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd); -BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, uint16 fnum, - char *server_name, char *qual_name, char *user_name, +BOOL do_srv_net_srv_sess_enum( char *srv_name, char *qual_name, char *user_name, uint32 switch_value, SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd); -BOOL do_srv_net_srv_share_enum(struct cli_state *cli, uint16 fnum, - char *server_name, +BOOL do_srv_net_srv_share_enum( char *srv_name, uint32 switch_value, SRV_SHARE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd); -BOOL do_srv_net_srv_file_enum(struct cli_state *cli, uint16 fnum, - char *server_name, char *qual_name, uint32 file_id, +BOOL do_srv_net_srv_file_enum( char *srv_name, char *qual_name, uint32 file_id, uint32 switch_value, SRV_FILE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd); -BOOL do_srv_net_srv_get_info(struct cli_state *cli, uint16 fnum, - char *server_name, uint32 switch_value, SRV_INFO_CTR *ctr); -BOOL do_srv_net_remote_tod(struct cli_state *cli, uint16 fnum, - char *server_name, TIME_OF_DAY_INFO *tod); +BOOL do_srv_net_srv_get_info( char *srv_name, uint32 switch_value, + SRV_INFO_CTR *ctr); +BOOL do_srv_net_remote_tod( char *srv_name, TIME_OF_DAY_INFO *tod); /*The following definitions come from rpc_client/cli_svcctl.c */ @@ -3661,8 +3656,7 @@ BOOL net_srv_get_info(struct client_info *info, uint32 info_level, SRV_INFO_CTR *ctr); void cmd_srv_query_info(struct client_info *info, int argc, char *argv[]); -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)); diff --git a/source3/rpc_client/cli_srvsvc.c b/source3/rpc_client/cli_srvsvc.c index 39f8910f63..6d301d014e 100644 --- a/source3/rpc_client/cli_srvsvc.c +++ b/source3/rpc_client/cli_srvsvc.c @@ -34,8 +34,8 @@ extern int DEBUGLEVEL; /**************************************************************************** do a server net tprt enum ****************************************************************************/ -BOOL do_srv_net_srv_tprt_enum(struct cli_state *cli, uint16 fnum, - const char *server_name, +BOOL do_srv_net_srv_tprt_enum( + const char *srv_name, uint32 switch_value, SRV_TPRT_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -43,17 +43,23 @@ BOOL do_srv_net_srv_tprt_enum(struct cli_state *cli, uint16 fnum, prs_struct data; prs_struct rdata; SRV_Q_NET_TPRT_ENUM q_o; - BOOL valid_enum = False; + BOOL valid_enum = False; + struct cli_connection *con = NULL; - if (server_name == NULL || ctr == NULL || preferred_len == 0) return False; + if (ctr == NULL || preferred_len == 0) return False; + + if (!cli_connection_init(srv_name, PIPE_SRVSVC, &con)) + { + return False; + } prs_init(&data , 1024, 4, SAFETY_MARGIN, False); prs_init(&rdata, 0 , 4, SAFETY_MARGIN, True ); /* create and send a MSRPC command with api SRV_NETTPRTENUM */ - DEBUG(4,("SRV Net Server Transport Enum(%s), level %d, enum:%8x\n", - server_name, switch_value, get_enum_hnd(hnd))); + DEBUG(4,("SRV Net Server Transport Enum, level %d, enum:%8x\n", + switch_value, get_enum_hnd(hnd))); ctr->switch_value = switch_value; ctr->ptr_tprt_ctr = 1; @@ -61,7 +67,7 @@ BOOL do_srv_net_srv_tprt_enum(struct cli_state *cli, uint16 fnum, ctr->tprt.info0.ptr_tprt_info = 1; /* store the parameters */ - make_srv_q_net_tprt_enum(&q_o, server_name, + make_srv_q_net_tprt_enum(&q_o, srv_name, switch_value, ctr, preferred_len, hnd); @@ -70,7 +76,7 @@ BOOL do_srv_net_srv_tprt_enum(struct cli_state *cli, uint16 fnum, srv_io_q_net_tprt_enum("", &q_o, &data, 0); /* send the data on \PIPE\ */ - if (rpc_api_pipe_req(cli, fnum, SRV_NETTRANSPORTENUM, &data, &rdata)) + if (rpc_con_pipe_req(con, SRV_NETTRANSPORTENUM, &data, &rdata)) { SRV_R_NET_TPRT_ENUM r_o; BOOL p; @@ -105,14 +111,15 @@ BOOL do_srv_net_srv_tprt_enum(struct cli_state *cli, uint16 fnum, prs_mem_free(&data ); prs_mem_free(&rdata ); + cli_connection_unlink(con); + return valid_enum; } /**************************************************************************** do a server net conn enum ****************************************************************************/ -BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, uint16 fnum, - char *server_name, char *qual_name, +BOOL do_srv_net_srv_conn_enum( char *srv_name, char *qual_name, uint32 switch_value, SRV_CONN_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -120,17 +127,23 @@ BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, uint16 fnum, prs_struct data; prs_struct rdata; SRV_Q_NET_CONN_ENUM q_o; - BOOL valid_enum = False; + BOOL valid_enum = False; + struct cli_connection *con = NULL; - if (server_name == NULL || ctr == NULL || preferred_len == 0) return False; + if (ctr == NULL || preferred_len == 0) return False; + + if (!cli_connection_init(srv_name, PIPE_SRVSVC, &con)) + { + return False; + } prs_init(&data , 1024, 4, SAFETY_MARGIN, False); prs_init(&rdata, 0 , 4, SAFETY_MARGIN, True ); /* create and send a MSRPC command with api SRV_NETCONNENUM */ - DEBUG(4,("SRV Net Server Connection Enum(%s, %s), level %d, enum:%8x\n", - server_name, qual_name, switch_value, get_enum_hnd(hnd))); + DEBUG(4,("SRV Net Server Connection Enum %s), level %d, enum:%8x\n", + qual_name, switch_value, get_enum_hnd(hnd))); ctr->switch_value = switch_value; ctr->ptr_conn_ctr = 1; @@ -138,7 +151,7 @@ BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, uint16 fnum, ctr->conn.info0.ptr_conn_info = 1; /* store the parameters */ - make_srv_q_net_conn_enum(&q_o, server_name, qual_name, + make_srv_q_net_conn_enum(&q_o, srv_name, qual_name, switch_value, ctr, preferred_len, hnd); @@ -147,7 +160,7 @@ BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, uint16 fnum, srv_io_q_net_conn_enum("", &q_o, &data, 0); /* send the data on \PIPE\ */ - if (rpc_api_pipe_req(cli, fnum, SRV_NETCONNENUM, &data, &rdata)) + if (rpc_con_pipe_req(con, SRV_NETCONNENUM, &data, &rdata)) { SRV_R_NET_CONN_ENUM r_o; BOOL p; @@ -182,14 +195,15 @@ BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, uint16 fnum, prs_mem_free(&data ); prs_mem_free(&rdata ); + cli_connection_unlink(con); + return valid_enum; } /**************************************************************************** do a server net sess enum ****************************************************************************/ -BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, uint16 fnum, - char *server_name, char *qual_name, char *user_name, +BOOL do_srv_net_srv_sess_enum( char *srv_name, char *qual_name, char *user_name, uint32 switch_value, SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -197,17 +211,23 @@ BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, uint16 fnum, prs_struct data; prs_struct rdata; SRV_Q_NET_SESS_ENUM q_o; - BOOL valid_enum = False; + BOOL valid_enum = False; + struct cli_connection *con = NULL; - if (server_name == NULL || ctr == NULL || preferred_len == 0) return False; + if (ctr == NULL || preferred_len == 0) return False; + + if (!cli_connection_init(srv_name, PIPE_SRVSVC, &con)) + { + return False; + } prs_init(&data , 1024, 4, SAFETY_MARGIN, False); prs_init(&rdata, 0 , 4, SAFETY_MARGIN, True ); /* create and send a MSRPC command with api SRV_NETSESSENUM */ - DEBUG(4,("SRV Net Session Enum (%s), level %d, enum:%8x\n", - server_name, switch_value, get_enum_hnd(hnd))); + DEBUG(4,("SRV Net Session Enum, level %d, enum:%8x\n", + switch_value, get_enum_hnd(hnd))); ctr->switch_value = switch_value; ctr->ptr_sess_ctr = 1; @@ -215,7 +235,7 @@ BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, uint16 fnum, ctr->sess.info0.ptr_sess_info = 1; /* store the parameters */ - make_srv_q_net_sess_enum(&q_o, server_name, qual_name, user_name, + make_srv_q_net_sess_enum(&q_o, srv_name, qual_name, user_name, switch_value, ctr, preferred_len, hnd); @@ -224,7 +244,7 @@ BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, uint16 fnum, srv_io_q_net_sess_enum("", &q_o, &data, 0); /* send the data on \PIPE\ */ - if (rpc_api_pipe_req(cli, fnum, SRV_NETSESSENUM, &data, &rdata)) + if (rpc_con_pipe_req(con, SRV_NETSESSENUM, &data, &rdata)) { SRV_R_NET_SESS_ENUM r_o; BOOL p; @@ -259,14 +279,15 @@ BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, uint16 fnum, prs_mem_free(&data ); prs_mem_free(&rdata ); + cli_connection_unlink(con); + return valid_enum; } /**************************************************************************** do a server net share enum ****************************************************************************/ -BOOL do_srv_net_srv_share_enum(struct cli_state *cli, uint16 fnum, - char *server_name, +BOOL do_srv_net_srv_share_enum( char *srv_name, uint32 switch_value, SRV_SHARE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -274,17 +295,23 @@ BOOL do_srv_net_srv_share_enum(struct cli_state *cli, uint16 fnum, prs_struct data; prs_struct rdata; SRV_Q_NET_SHARE_ENUM q_o; - BOOL valid_enum = False; + BOOL valid_enum = False; + struct cli_connection *con = NULL; - if (server_name == NULL || ctr == NULL || preferred_len == 0) return False; + if (ctr == NULL || preferred_len == 0) return False; + + if (!cli_connection_init(srv_name, PIPE_SRVSVC, &con)) + { + return False; + } prs_init(&data , 1024, 4, SAFETY_MARGIN, False); prs_init(&rdata, 0 , 4, SAFETY_MARGIN, True ); /* create and send a MSRPC command with api SRV_NETSHAREENUM */ - DEBUG(4,("SRV Get Share Info (%s), level %d, enum:%8x\n", - server_name, switch_value, get_enum_hnd(hnd))); + DEBUG(4,("SRV Get Share Info, level %d, enum:%8x\n", + switch_value, get_enum_hnd(hnd))); q_o.share_level = switch_value; @@ -294,7 +321,7 @@ BOOL do_srv_net_srv_share_enum(struct cli_state *cli, uint16 fnum, ctr->share.info1.ptr_share_info = 1; /* store the parameters */ - make_srv_q_net_share_enum(&q_o, server_name, + make_srv_q_net_share_enum(&q_o, srv_name, switch_value, ctr, preferred_len, hnd); @@ -303,7 +330,7 @@ BOOL do_srv_net_srv_share_enum(struct cli_state *cli, uint16 fnum, srv_io_q_net_share_enum("", &q_o, &data, 0); /* send the data on \PIPE\ */ - if (rpc_api_pipe_req(cli, fnum, SRV_NETSHAREENUM, &data, &rdata)) + if (rpc_con_pipe_req(con, SRV_NETSHAREENUM, &data, &rdata)) { SRV_R_NET_SHARE_ENUM r_o; BOOL p; @@ -338,14 +365,15 @@ BOOL do_srv_net_srv_share_enum(struct cli_state *cli, uint16 fnum, prs_mem_free(&data ); prs_mem_free(&rdata ); + cli_connection_unlink(con); + return valid_enum; } /**************************************************************************** do a server net file enum ****************************************************************************/ -BOOL do_srv_net_srv_file_enum(struct cli_state *cli, uint16 fnum, - char *server_name, char *qual_name, uint32 file_id, +BOOL do_srv_net_srv_file_enum( char *srv_name, char *qual_name, uint32 file_id, uint32 switch_value, SRV_FILE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -353,17 +381,23 @@ BOOL do_srv_net_srv_file_enum(struct cli_state *cli, uint16 fnum, prs_struct data; prs_struct rdata; SRV_Q_NET_FILE_ENUM q_o; - BOOL valid_enum = False; + BOOL valid_enum = False; + struct cli_connection *con = NULL; + + if (ctr == NULL || preferred_len == 0) return False; - if (server_name == NULL || ctr == NULL || preferred_len == 0) return False; + if (!cli_connection_init(srv_name, PIPE_SRVSVC, &con)) + { + return False; + } prs_init(&data , 1024, 4, SAFETY_MARGIN, False); prs_init(&rdata, 0 , 4, SAFETY_MARGIN, True ); /* create and send a MSRPC command with api SRV_NETFILEENUM */ - DEBUG(4,("SRV Get File Info (%s), level %d, enum:%8x\n", - server_name, switch_value, get_enum_hnd(hnd))); + DEBUG(4,("SRV Get File Info level %d, enum:%8x\n", + switch_value, get_enum_hnd(hnd))); q_o.file_level = switch_value; @@ -373,7 +407,7 @@ BOOL do_srv_net_srv_file_enum(struct cli_state *cli, uint16 fnum, ctr->file.info3.ptr_file_info = 1; /* store the parameters */ - make_srv_q_net_file_enum(&q_o, server_name, qual_name, file_id, + make_srv_q_net_file_enum(&q_o, srv_name, qual_name, file_id, switch_value, ctr, preferred_len, hnd); @@ -382,7 +416,7 @@ BOOL do_srv_net_srv_file_enum(struct cli_state *cli, uint16 fnum, srv_io_q_net_file_enum("", &q_o, &data, 0); /* send the data on \PIPE\ */ - if (rpc_api_pipe_req(cli, fnum, SRV_NETFILEENUM, &data, &rdata)) + if (rpc_con_pipe_req(con, SRV_NETFILEENUM, &data, &rdata)) { SRV_R_NET_FILE_ENUM r_o; BOOL p; @@ -417,37 +451,45 @@ BOOL do_srv_net_srv_file_enum(struct cli_state *cli, uint16 fnum, prs_mem_free(&data ); prs_mem_free(&rdata ); + cli_connection_unlink(con); + return valid_enum; } /**************************************************************************** do a server get info ****************************************************************************/ -BOOL do_srv_net_srv_get_info(struct cli_state *cli, uint16 fnum, - char *server_name, uint32 switch_value, SRV_INFO_CTR *ctr) +BOOL do_srv_net_srv_get_info( char *srv_name, uint32 switch_value, + SRV_INFO_CTR *ctr) { prs_struct data; prs_struct rdata; SRV_Q_NET_SRV_GET_INFO q_o; - BOOL valid_info = False; + BOOL valid_info = False; + struct cli_connection *con = NULL; + + if (switch_value == 0 || ctr == NULL) return False; - if (server_name == NULL || switch_value == 0 || ctr == NULL) return False; + if (!cli_connection_init(srv_name, PIPE_SRVSVC, &con)) + { + return False; + } prs_init(&data , 1024, 4, SAFETY_MARGIN, False); prs_init(&rdata, 0 , 4, SAFETY_MARGIN, True ); /* create and send a MSRPC command with api SRV_NET_SRV_GET_INFO */ - DEBUG(4,("SRV Get Server Info (%s), level %d\n", server_name, switch_value)); + DEBUG(4,("SRV Get Server Info level %d\n", switch_value)); /* store the parameters */ - make_srv_q_net_srv_get_info(&q_o, server_name, switch_value); + make_srv_q_net_srv_get_info(&q_o, srv_name, switch_value); /* turn parameters into data stream */ srv_io_q_net_srv_get_info("", &q_o, &data, 0); /* send the data on \PIPE\ */ - if (rpc_api_pipe_req(cli, fnum, SRV_NET_SRV_GET_INFO, &data, &rdata)) + if (rpc_con_pipe_req(con, SRV_NET_SRV_GET_INFO, &data, &rdata)) { SRV_R_NET_SRV_GET_INFO r_o; BOOL p; @@ -483,37 +525,44 @@ BOOL do_srv_net_srv_get_info(struct cli_state *cli, uint16 fnum, prs_mem_free(&data ); prs_mem_free(&rdata ); + cli_connection_unlink(con); + return valid_info; } /**************************************************************************** get server time ****************************************************************************/ -BOOL do_srv_net_remote_tod(struct cli_state *cli, uint16 fnum, - char *server_name, TIME_OF_DAY_INFO *tod) +BOOL do_srv_net_remote_tod( char *srv_name, TIME_OF_DAY_INFO *tod) { prs_struct data; prs_struct rdata; SRV_Q_NET_REMOTE_TOD q_t; BOOL valid_info = False; + struct cli_connection *con = NULL; - if (server_name == NULL || tod == NULL) return False; + if (tod == NULL) return False; + + if (!cli_connection_init(srv_name, PIPE_SRVSVC, &con)) + { + return False; + } prs_init(&data , 1024, 4, SAFETY_MARGIN, False); prs_init(&rdata, 0 , 4, SAFETY_MARGIN, True ); /* create and send a MSRPC command with api SRV_NET_REMOTE_TOD */ - DEBUG(4,("SRV Remote TOD (%s)\n", server_name)); + DEBUG(4,("SRV Remote TOD (%s)\n", srv_name)); /* store the parameters */ - make_srv_q_net_remote_tod(&q_t, server_name); + make_srv_q_net_remote_tod(&q_t, srv_name); /* turn parameters into data stream */ srv_io_q_net_remote_tod("", &q_t, &data, 0); /* send the data on \PIPE\ */ - if (rpc_api_pipe_req(cli, fnum, SRV_NET_REMOTE_TOD, &data, &rdata)) + if (rpc_con_pipe_req(con, SRV_NET_REMOTE_TOD, &data, &rdata)) { SRV_R_NET_REMOTE_TOD r_t; BOOL p; @@ -540,5 +589,7 @@ BOOL do_srv_net_remote_tod(struct cli_state *cli, uint16 fnum, prs_mem_free(&data ); prs_mem_free(&rdata ); + cli_connection_unlink(con); + return valid_info; } 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")); |