From 4cda1d2b4faaf9a3abeb338e909a52f8b51fd89d Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 30 Oct 1999 22:34:38 +0000 Subject: NetServerTransportEnum parsing, client-side and rpcclient "srvtransports" added. (This used to be commit 37f4aac06fec3fbb34ed40d1010829b2e1f28558) --- source3/include/proto.h | 29 +++++++++++++ source3/include/rpc_srvsvc.h | 100 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 119 insertions(+), 10 deletions(-) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index 1602e1d056..ad4c637aa0 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -610,6 +610,7 @@ char *skip_unibuf(char *srcbuf, int len); char *uni_strncpy(char *destbuf, const char *srcbuf, int len); uint32 buffer2_to_uint32(const BUFFER2 *str); void buffer2_to_multistr(char *dest, const BUFFER2 *str, size_t maxlen); +void buffer4_to_str(char *dest, const BUFFER4 *str, size_t maxlen); /*The following definitions come from libsmb/clientgen.c */ @@ -2003,6 +2004,11 @@ 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, + 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, uint32 switch_value, SRV_CONN_INFO_CTR *ctr, @@ -2174,6 +2180,7 @@ BOOL make_buffer3_str(BUFFER3 *str, const char *buf, int len); BOOL make_buffer3_hex(BUFFER3 *str, char *buf); BOOL make_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len); BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth); +BOOL make_buffer4_str(BUFFER4 *str, const char *buf, int len); BOOL smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth); BOOL init_buffer5(BUFFER5 **str); BOOL clear_buffer5(BUFFER5 **str); @@ -2983,6 +2990,21 @@ BOOL make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, ENUM_HND *hnd); BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth); BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth); +BOOL make_srv_tprt_info0_str(TPRT_INFO_0_STR *tp0, + char *trans_name, + char *trans_addr, uint32 trans_addr_len, + char *addr_name); +BOOL make_srv_tprt_info0(TPRT_INFO_0 *tp0, + uint32 num_vcs, uint32 trans_addr_len, + char *trans_name, char *trans_addr, + char *addr_name); +BOOL make_srv_q_net_tprt_enum(SRV_Q_NET_TPRT_ENUM *q_n, + char *srv_name, + uint32 tprt_level, SRV_TPRT_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd); +BOOL srv_io_q_net_tprt_enum(char *desc, SRV_Q_NET_TPRT_ENUM *q_n, prs_struct *ps, int depth); +BOOL srv_io_r_net_tprt_enum(char *desc, SRV_R_NET_TPRT_ENUM *r_n, prs_struct *ps, int depth); BOOL make_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name); BOOL make_srv_file_info3(FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks, @@ -3272,6 +3294,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); +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); void cmd_srv_enum_sess(struct client_info *info); @@ -3307,6 +3330,12 @@ void display_srv_conn_info_1_ctr(FILE *out_hnd, enum action_type action, SRV_CONN_INFO_1 *ctr); void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action, SRV_CONN_INFO_CTR *ctr); +void display_tprt_info_0(FILE *out_hnd, enum action_type action, + TPRT_INFO_0 *info0, TPRT_INFO_0_STR *str0); +void display_srv_tprt_info_0_ctr(FILE *out_hnd, enum action_type action, + SRV_TPRT_INFO_0 *ctr); +void display_srv_tprt_info_ctr(FILE *out_hnd, enum action_type action, + SRV_TPRT_INFO_CTR *ctr); void display_share_info_1(FILE *out_hnd, enum action_type action, SH_INFO_1 *info1, SH_INFO_1_STR *str1); void display_share_info_2(FILE *out_hnd, enum action_type action, diff --git a/source3/include/rpc_srvsvc.h b/source3/include/rpc_srvsvc.h index 4ed7761fb2..b875f2a2d6 100644 --- a/source3/include/rpc_srvsvc.h +++ b/source3/include/rpc_srvsvc.h @@ -30,6 +30,7 @@ #define SRV_NETFILEENUM 0x09 #define SRV_NETSESSENUM 0x0c #define SRV_NETSHAREENUM 0x0f +#define SRV_NETTRANSPORTENUM 0x1a #define SRV_NET_SRV_GET_INFO 0x15 #define SRV_NET_SRV_SET_INFO 0x16 #define SRV_NET_REMOTE_TOD 0x1c @@ -103,11 +104,11 @@ typedef struct srv_sess_info_ctr_info uint32 switch_value; /* switch value */ uint32 ptr_sess_ctr; /* pointer to sess info union */ union - { + { SRV_SESS_INFO_0 info0; /* session info level 0 */ SRV_SESS_INFO_1 info1; /* session info level 1 */ - } sess; + } sess; } SRV_SESS_INFO_CTR; @@ -209,11 +210,11 @@ typedef struct srv_conn_info_ctr_info uint32 switch_value; /* switch value */ uint32 ptr_conn_ctr; /* pointer to conn info union */ union - { + { SRV_CONN_INFO_0 info0; /* connection info level 0 */ SRV_CONN_INFO_1 info1; /* connection info level 1 */ - } conn; + } conn; } SRV_CONN_INFO_CTR; @@ -250,6 +251,85 @@ typedef struct r_net_conn_enum_info } SRV_R_NET_CONN_ENUM; +/* oops - this is going to take up a *massive* amount of stack. */ +/* the UNISTR2s already have 1024 uint16 chars in them... */ +#define MAX_TPRT_ENTRIES 32 + +/* TPRT_INFO_0 (pointers to level 0 transport info strings) */ +typedef struct ptr_tprt_info0 +{ + uint32 num_vcs; /* number of clients using transport */ + uint32 ptr_trans_name; /* pointer to transport name. */ + uint32 ptr_trans_addr; /* pointer to transport address */ + uint32 trans_addr_len; /* length of transport address */ + uint32 ptr_addr_name; /* pointer to network address name. */ + +} TPRT_INFO_0; + +/* TPRT_INFO_0_STR (level 0 transport info strings) */ +typedef struct str_tprt_info0 +{ + UNISTR2 uni_trans_name; /* unicode string of transport */ + BUFFER4 buf_trans_addr; /* buffer for transport address */ + UNISTR2 uni_addr_name; /* unicode string of network address */ + +} TPRT_INFO_0_STR; + +/* SRV_TPRT_INFO_0 */ +typedef struct srv_tprt_info_0_info +{ + uint32 num_entries_read; /* EntriesRead */ + uint32 ptr_tprt_info; /* Buffer */ + uint32 num_entries_read2; /* EntriesRead */ + + TPRT_INFO_0 info_0 [MAX_TPRT_ENTRIES]; /* transport entry pointers */ + TPRT_INFO_0_STR info_0_str[MAX_TPRT_ENTRIES]; /* transport entry strings */ + +} SRV_TPRT_INFO_0; + +/* SRV_TPRT_INFO_CTR */ +typedef struct srv_tprt_info_ctr_info +{ + uint32 switch_value; /* switch value */ + uint32 ptr_tprt_ctr; /* pointer to tprt info union */ + union + { + SRV_TPRT_INFO_0 info0; /* tprtection info level 0 */ + + } tprt; + +} SRV_TPRT_INFO_CTR; + + +/* SRV_Q_NET_TPRT_ENUM */ +typedef struct q_net_tprt_enum_info +{ + uint32 ptr_srv_name; /* pointer (to server name) */ + UNISTR2 uni_srv_name; /* server name "\\server" */ + + uint32 tprt_level; /* transport level */ + + SRV_TPRT_INFO_CTR *ctr; + + uint32 preferred_len; /* preferred maximum length (0xffff ffff) */ + ENUM_HND enum_hnd; + +} SRV_Q_NET_TPRT_ENUM; + +/* SRV_R_NET_TPRT_ENUM */ +typedef struct r_net_tprt_enum_info +{ + uint32 tprt_level; /* share level */ + + SRV_TPRT_INFO_CTR *ctr; + + uint32 total_entries; /* total number of entries */ + ENUM_HND enum_hnd; + + uint32 status; /* return status */ + +} SRV_R_NET_TPRT_ENUM; + /* oops - this is going to take up a *massive* amount of stack. */ /* the UNISTR2s already have 1024 uint16 chars in them... */ #define MAX_SHARE_ENTRIES 128 @@ -325,11 +405,11 @@ typedef struct srv_share_info_1_info uint32 switch_value; /* switch value */ uint32 ptr_share_ctr; /* pointer to share info union */ union - { + { SRV_SHARE_INFO_1 info1; /* share info level 1 */ SRV_SHARE_INFO_2 info2; /* share info level 2 */ - } share; + } share; } SRV_SHARE_INFO_CTR; @@ -405,10 +485,10 @@ typedef struct srv_file_info_3_info uint32 switch_value; /* switch value */ uint32 ptr_file_ctr; /* pointer to file info union */ union - { + { SRV_FILE_INFO_3 info3; /* file info with 0 entries */ - } file; + } file; } SRV_FILE_INFO_CTR; @@ -493,11 +573,11 @@ typedef struct srv_info_ctr_info uint32 switch_value; /* switch value */ uint32 ptr_srv_ctr; /* pointer to server info */ union - { + { SRV_INFO_102 sv102; /* server info level 102 */ SRV_INFO_101 sv101; /* server info level 101 */ - } srv; + } srv; } SRV_INFO_CTR; -- cgit