diff options
author | Luke Leighton <lkcl@samba.org> | 1999-11-03 22:14:38 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-11-03 22:14:38 +0000 |
commit | 83f2465f0f1432bc0aba76b83f3a781fb7c3a071 (patch) | |
tree | a5231957175fb327010ca2a3b17052065690fe70 /source3 | |
parent | dc963d7939c9f4f5f7850f9c92385c5484df51bb (diff) | |
download | samba-83f2465f0f1432bc0aba76b83f3a781fb7c3a071.tar.gz samba-83f2465f0f1432bc0aba76b83f3a781fb7c3a071.tar.bz2 samba-83f2465f0f1432bc0aba76b83f3a781fb7c3a071.zip |
created msrpc_srv_enum_tprt() function by massaging cmd_srv_enum_tprt().
(This used to be commit 3f9455c535607090103a371ff96051a5ce32e461)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 21 | ||||
-rw-r--r-- | source3/include/rpc_srvsvc.h | 2 | ||||
-rw-r--r-- | source3/rpc_client/cli_srvsvc.c | 2 | ||||
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 2 | ||||
-rw-r--r-- | source3/rpc_parse/parse_srv.c | 11 | ||||
-rw-r--r-- | source3/rpcclient/cmd_srvsvc.c | 103 |
6 files changed, 79 insertions, 62 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 3b318b437d..449a7be805 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -2028,7 +2028,7 @@ BOOL samr_query_dispinfo(struct cli_state *cli, uint16 fnum, /*The following definitions come from rpc_client/cli_srvsvc.c */ BOOL do_srv_net_srv_tprt_enum(struct cli_state *cli, uint16 fnum, - char *server_name, + const char *server_name, uint32 switch_value, SRV_TPRT_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd); @@ -2222,7 +2222,7 @@ BOOL make_buffer5(BUFFER5 *str, char *buf, int len); BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth); BOOL make_buffer2(BUFFER2 *str, const char *buf, int len); BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth); -BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf); +BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf); BOOL make_string2(STRING2 *str, char *buf, int len); BOOL smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth); BOOL make_unistr2(UNISTR2 *str, const char *buf, int len); @@ -2989,7 +2989,7 @@ BOOL make_srv_share_info2(SH_INFO_2 *sh2, uint32 perms, uint32 max_uses, uint32 num_uses, char *path, char *pass); BOOL make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, - char *srv_name, + const char *srv_name, uint32 share_level, SRV_SHARE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd); @@ -3003,7 +3003,7 @@ BOOL make_srv_sess_info1(SESS_INFO_1 *ss1, uint32 num_opens, uint32 open_time, uint32 idle_time, uint32 user_flags); BOOL make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, - char *srv_name, char *qual_name, + const char *srv_name, const char *qual_name, char *user_name, uint32 sess_level, SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, @@ -3017,7 +3017,7 @@ BOOL make_srv_conn_info1(CONN_INFO_1 *ss1, uint32 num_opens, uint32 num_users, uint32 open_time, char *usr_name, char *net_name); BOOL make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, - char *srv_name, char *qual_name, + const char *srv_name, const char *qual_name, uint32 conn_level, SRV_CONN_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd); @@ -3034,7 +3034,7 @@ BOOL make_srv_tprt_info0(TPRT_INFO_0 *tp0, void free_srv_tprt_info_0(SRV_TPRT_INFO_0 *tp0); void free_srv_tprt_ctr(SRV_TPRT_INFO_CTR *ctr); BOOL make_srv_q_net_tprt_enum(SRV_Q_NET_TPRT_ENUM *q_n, - char *srv_name, + const char *srv_name, uint32 tprt_level, SRV_TPRT_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd); @@ -3045,7 +3045,8 @@ BOOL make_srv_file_info3(FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks, char *path_name, char *user_name); BOOL make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - char *srv_name, char *qual_name, uint32 file_id, + const char *srv_name, const char *qual_name, + uint32 file_id, uint32 file_level, SRV_FILE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd); @@ -3352,6 +3353,12 @@ 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); +BOOL msrpc_srv_enum_tprt(struct cli_state *cli, + const char* dest_srv, + uint32 info_level, + SRV_TPRT_INFO_CTR *ctr, + uint32 pref_sz, + ENUM_HND *hnd); void cmd_srv_enum_tprt(struct client_info *info); void cmd_srv_enum_conn(struct client_info *info); void cmd_srv_enum_shares(struct client_info *info); diff --git a/source3/include/rpc_srvsvc.h b/source3/include/rpc_srvsvc.h index 0472f6c546..25be11d199 100644 --- a/source3/include/rpc_srvsvc.h +++ b/source3/include/rpc_srvsvc.h @@ -294,7 +294,7 @@ typedef struct srv_tprt_info_ctr_info uint32 ptr_tprt_ctr; /* pointer to tprt info union */ union { - SRV_TPRT_INFO_0 info0; /* tprtection info level 0 */ + SRV_TPRT_INFO_0 info0; /* transport info level 0 */ } tprt; diff --git a/source3/rpc_client/cli_srvsvc.c b/source3/rpc_client/cli_srvsvc.c index 0ade6799e9..39f8910f63 100644 --- a/source3/rpc_client/cli_srvsvc.c +++ b/source3/rpc_client/cli_srvsvc.c @@ -35,7 +35,7 @@ extern int DEBUGLEVEL; do a server net tprt enum ****************************************************************************/ BOOL do_srv_net_srv_tprt_enum(struct cli_state *cli, uint16 fnum, - char *server_name, + const char *server_name, uint32 switch_value, SRV_TPRT_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 925adeca12..03cec1128c 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -728,7 +728,7 @@ BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, i /******************************************************************* creates a UNISTR2 structure: sets up the buffer, too ********************************************************************/ -BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) +BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) { if (buf != NULL) { diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index c0530f8987..8ad275229e 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -328,7 +328,7 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struc reads or writes a structure. ********************************************************************/ BOOL make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, - char *srv_name, + const char *srv_name, uint32 share_level, SRV_SHARE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -691,7 +691,7 @@ static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct reads or writes a structure. ********************************************************************/ BOOL make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, - char *srv_name, char *qual_name, + const char *srv_name, const char *qual_name, char *user_name, uint32 sess_level, SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, @@ -1022,7 +1022,7 @@ static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct reads or writes a structure. ********************************************************************/ BOOL make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, - char *srv_name, char *qual_name, + const char *srv_name, const char *qual_name, uint32 conn_level, SRV_CONN_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -1330,7 +1330,7 @@ void free_srv_tprt_ctr(SRV_TPRT_INFO_CTR *ctr) reads or writes a structure. ********************************************************************/ BOOL make_srv_q_net_tprt_enum(SRV_Q_NET_TPRT_ENUM *q_n, - char *srv_name, + const char *srv_name, uint32 tprt_level, SRV_TPRT_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -1567,7 +1567,8 @@ static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct reads or writes a structure. ********************************************************************/ BOOL make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - char *srv_name, char *qual_name, uint32 file_id, + const char *srv_name, const char *qual_name, + uint32 file_id, uint32 file_level, SRV_FILE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c index b856d2ff5c..59ad1ede87 100644 --- a/source3/rpcclient/cmd_srvsvc.c +++ b/source3/rpcclient/cmd_srvsvc.c @@ -45,7 +45,7 @@ BOOL net_srv_get_info(struct client_info *info, uint32 info_level, SRV_INFO_CTR *ctr) { - uint16 nt_pipe_fnum; + uint16 fnum; fstring dest_srv; BOOL res = True; @@ -58,14 +58,14 @@ BOOL net_srv_get_info(struct client_info *info, dest_srv, (int)info_level)); /* open LSARPC session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False; + 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, nt_pipe_fnum, + 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, nt_pipe_fnum); + cli_nt_session_close(smb_cli, fnum); return res; } @@ -105,16 +105,43 @@ void cmd_srv_query_info(struct client_info *info) /**************************************************************************** server enum transports ****************************************************************************/ +BOOL msrpc_srv_enum_tprt(struct cli_state *cli, + const char* dest_srv, + uint32 info_level, + SRV_TPRT_INFO_CTR *ctr, + uint32 pref_sz, + ENUM_HND *hnd) +{ + uint16 fnum; + + BOOL res = True; + BOOL res1 = True; + + /* 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, + info_level, ctr, pref_sz, hnd) : False; + + /* close the session */ + cli_nt_session_close(smb_cli, fnum); + + return res1; +} + +/**************************************************************************** +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; + uint32 pref_sz = 0xffffffff; bzero(&ctr, sizeof(ctr)); @@ -132,36 +159,18 @@ void cmd_srv_enum_tprt(struct client_info *info) 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) + if (msrpc_srv_enum_tprt(smb_cli, dest_srv, + info_level, &ctr, pref_sz, &hnd)) { 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")); - } - free_srv_tprt_ctr(&ctr); } @@ -170,7 +179,7 @@ server enum connections ****************************************************************************/ void cmd_srv_enum_conn(struct client_info *info) { - uint16 nt_pipe_fnum; + uint16 fnum; fstring dest_srv; fstring qual_srv; fstring tmp; @@ -201,13 +210,13 @@ void cmd_srv_enum_conn(struct client_info *info) 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, &nt_pipe_fnum) : False; + 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, nt_pipe_fnum, + res = res ? do_srv_net_srv_conn_enum(smb_cli, fnum, dest_srv, qual_srv, info_level, &ctr, 0xffffffff, &hnd) : False; @@ -219,7 +228,7 @@ void cmd_srv_enum_conn(struct client_info *info) } /* close the session */ - cli_nt_session_close(smb_cli, nt_pipe_fnum); + cli_nt_session_close(smb_cli, fnum); if (res) { @@ -236,7 +245,7 @@ server enum shares ****************************************************************************/ void cmd_srv_enum_shares(struct client_info *info) { - uint16 nt_pipe_fnum; + uint16 fnum; fstring dest_srv; fstring tmp; SRV_SHARE_INFO_CTR ctr; @@ -262,13 +271,13 @@ void cmd_srv_enum_shares(struct client_info *info) 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, &nt_pipe_fnum) : False; + 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, nt_pipe_fnum, + res = res ? do_srv_net_srv_share_enum(smb_cli, fnum, dest_srv, info_level, &ctr, 0xffffffff, &hnd) : False; @@ -280,7 +289,7 @@ void cmd_srv_enum_shares(struct client_info *info) } /* close the session */ - cli_nt_session_close(smb_cli, nt_pipe_fnum); + cli_nt_session_close(smb_cli, fnum); if (res) { @@ -297,7 +306,7 @@ server enum sessions ****************************************************************************/ void cmd_srv_enum_sess(struct client_info *info) { - uint16 nt_pipe_fnum; + uint16 fnum; fstring dest_srv; fstring tmp; SRV_SESS_INFO_CTR ctr; @@ -323,13 +332,13 @@ void cmd_srv_enum_sess(struct client_info *info) 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, &nt_pipe_fnum) : False; + 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, nt_pipe_fnum, + res = res ? do_srv_net_srv_sess_enum(smb_cli, fnum, dest_srv, NULL, NULL, info_level, &ctr, 0x1000, &hnd) : False; if (res) @@ -340,7 +349,7 @@ void cmd_srv_enum_sess(struct client_info *info) } /* close the session */ - cli_nt_session_close(smb_cli, nt_pipe_fnum); + cli_nt_session_close(smb_cli, fnum); if (res) { @@ -357,7 +366,7 @@ server enum files ****************************************************************************/ void cmd_srv_enum_files(struct client_info *info) { - uint16 nt_pipe_fnum; + uint16 fnum; fstring dest_srv; fstring tmp; SRV_FILE_INFO_CTR ctr; @@ -383,13 +392,13 @@ void cmd_srv_enum_files(struct client_info *info) 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, &nt_pipe_fnum) : False; + 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, nt_pipe_fnum, + res = res ? do_srv_net_srv_file_enum(smb_cli, fnum, dest_srv, NULL, 0, info_level, &ctr, 0x1000, &hnd) : False; if (res) @@ -400,7 +409,7 @@ void cmd_srv_enum_files(struct client_info *info) } /* close the session */ - cli_nt_session_close(smb_cli, nt_pipe_fnum); + cli_nt_session_close(smb_cli, fnum); if (res) { @@ -417,7 +426,7 @@ display remote time ****************************************************************************/ void cmd_time(struct client_info *info) { - uint16 nt_pipe_fnum; + uint16 fnum; fstring dest_srv; TIME_OF_DAY_INFO tod; BOOL res = True; @@ -429,10 +438,10 @@ void cmd_time(struct client_info *info) DEBUG(4,("cmd_time: server:%s\n", dest_srv)); /* open srvsvc session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False; + 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, nt_pipe_fnum, + res = res ? do_srv_net_remote_tod(smb_cli, fnum, dest_srv, &tod) : False; if (res) @@ -442,7 +451,7 @@ void cmd_time(struct client_info *info) } /* Close the session */ - cli_nt_session_close(smb_cli, nt_pipe_fnum); + cli_nt_session_close(smb_cli, fnum); if (res) { |