From d2b40a7de259377d937492acedd39988ddd108a4 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 7 Jul 2000 06:20:46 +0000 Subject: More rpcclient merge issues: * fixes some readline bugs from the merge * first attempt at commands (spoolenum almost works) * no changes to existing functions in HEAD; only additions of new functions. I'll weed out what I can as I go. --jerry (This used to be commit 61d2aad5dc2b212b11c981f1eca47efa627e9fc8) --- source3/include/ntdomain.h | 12 +++++ source3/include/proto.h | 90 ++++++++++++++++++++++++++++++++++++++ source3/include/rpc_client_proto.h | 27 ++++++++++++ 3 files changed, 129 insertions(+) (limited to 'source3/include') diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h index 08c8163cda..ebd24c9dd6 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -37,6 +37,18 @@ * A bunch of stuff that was put into smb.h * in the NTDOM branch - it didn't belong there. */ + +#define CHECK_STRUCT(data) \ +{ \ + if ((data)->struct_start != 0xfefefefe || \ + (data)->struct_end != 0xdcdcdcdc) \ + { \ + DEBUG(0,("uninitialised structure (%s, %d)\n", \ + FUNCTION_MACRO, __LINE__)); \ + sleep(30); \ + } \ +} + typedef struct _prs_struct { diff --git a/source3/include/proto.h b/source3/include/proto.h index 1b23ba1fbc..8fcad544f4 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -43,6 +43,16 @@ void charset_initialise(void); void codepage_initialise(int client_codepage); void add_char_string(char *s); +/*The following definitions come from lib/cmd_interp.c */ + +void free_cmd_set_array(uint32 num_entries, struct command_set **entries); +struct command_set *add_cmd_set_to_array(uint32 *len, + struct command_set ***array, + const struct command_set *cmd); +void add_command_set(const struct command_set *cmds); +void cmd_set_no_autoconnect(void); +int command_main(int argc, char *argv[]); + /*The following definitions come from lib/crc32.c */ uint32 crc32_calc_buffer( char *buffer, uint32 count); @@ -146,6 +156,8 @@ BOOL receive_msrpc(int fd, prs_struct *data, unsigned int timeout); BOOL msrpc_send(int fd, prs_struct *ps); BOOL msrpc_receive(int fd, prs_struct *ps); void ncalrpc_l_shutdown(struct msrpc_local *msrpc); +struct msrpc_local *ncalrpc_l_initialise(struct msrpc_local *msrpc, + const vuser_key * key); BOOL msrpc_connect(struct msrpc_state *msrpc, const char *pipe_name); void msrpc_init_creds(struct msrpc_state *msrpc, const struct user_creds *usr); void msrpc_close_socket(struct msrpc_state *msrpc); @@ -158,6 +170,8 @@ struct msrpc_state *msrpc_initialise(struct msrpc_state *msrpc, uint32 pid); void msrpc_shutdown(struct msrpc_state *msrpc); BOOL msrpc_establish_connection(struct msrpc_state *msrpc, const char *pipe_name); +BOOL ncalrpc_l_establish_connection(struct msrpc_local *msrpc, + const char *pipe_name); /*The following definitions come from lib/msrpc_use.c */ @@ -514,6 +528,8 @@ char *skip_unibuf(char *src, size_t len); char *dos_unistrn2(uint16 *src, int len); char *dos_unistr2(uint16 *src); char *dos_unistr2_to_str(UNISTR2 *str); +void ascii_to_unistr(uint16 *dest, const char *src, int maxlen); +void unistr_to_ascii(char *dest, const uint16 *src, int len); void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen); uint32 buffer2_to_uint32(BUFFER2 *str); char *dos_buffer2_to_str(BUFFER2 *str); @@ -1712,6 +1728,16 @@ BOOL profile_setup(BOOL rdonly); void init_connections(void); void free_connections(void); void cli_connection_free(struct cli_connection *con); +void cli_connection_unlink(struct cli_connection *con); +BOOL cli_connection_init(const char *srv_name, const char *pipe_name, + struct cli_connection **con); +BOOL cli_connection_init_auth(const char *srv_name, const char *pipe_name, + struct cli_connection **con, + cli_auth_fns * auth, void *auth_creds); +struct cli_auth_fns *cli_conn_get_authfns(struct cli_connection *con); +void *cli_conn_get_auth_creds(struct cli_connection *con); +BOOL rpc_con_pipe_req(struct cli_connection *con, uint8 op_num, + prs_struct * data, prs_struct * rdata); /*The following definitions come from rpc_client/cli_login.c */ @@ -1759,6 +1785,7 @@ BOOL change_trust_account_password( char *domain, char *remote_machine_list); BOOL rpc_api_pipe_req(struct cli_state *cli, uint8 op_num, prs_struct *data, prs_struct *rdata); +BOOL rpc_pipe_bind(struct cli_state *cli, char *pipe_name, char *my_name); void cli_nt_set_ntlmssp_flgs(struct cli_state *cli, uint32 ntlmssp_flgs); BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name); void cli_nt_session_close(struct cli_state *cli); @@ -1847,6 +1874,12 @@ BOOL do_samr_query_userinfo(struct cli_state *cli, BOOL do_samr_close(struct cli_state *cli, POLICY_HND *hnd); #endif +/*The following definitions come from rpc_client/cli_spoolss.c */ + +uint32 spoolss_enum_printers(uint32 flags, fstring srv_name, uint32 level, + NEW_BUFFER *buffer, uint32 offered, + uint32 *needed, uint32 *returned); + /*The following definitions come from rpc_client/cli_srvsvc.c */ BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, @@ -1890,14 +1923,28 @@ BOOL do_wks_query_info(struct cli_state *cli, char *server_name, uint32 switch_value, WKS_INFO_100 *wks100); +/*The following definitions come from rpc_client/msrpc_spoolss.c */ + +BOOL msrpc_spoolss_enum_printers(char* srv_name, uint32 flags, uint32 level, PRINTER_INFO_CTR ctr); + /*The following definitions come from rpc_client/ncacn_np_use.c */ BOOL ncacn_np_use_del(const char *srv_name, const char *pipe_name, const vuser_key * key, BOOL force_close, BOOL *connection_closed); +struct ncacn_np *ncacn_np_initialise(struct ncacn_np *msrpc, + const vuser_key * key); +struct ncacn_np *ncacn_np_use_add(const char *pipe_name, + const vuser_key * key, + const char *srv_name, + const struct ntuser_creds *ntc, + BOOL reuse, BOOL *is_new_connection); /*The following definitions come from rpc_client/ncalrpc_l_use.c */ +struct msrpc_local *ncalrpc_l_use_add(const char *pipe_name, + const vuser_key * key, + BOOL reuse, BOOL *is_new); BOOL ncalrpc_l_use_del(const char *pipe_name, const vuser_key * key, BOOL force_close, BOOL *connection_closed); @@ -1925,6 +1972,7 @@ BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth); void copy_unix_creds(CREDS_UNIX *to, const CREDS_UNIX *from); void copy_nt_sec_creds(CREDS_NT_SEC *to, const CREDS_NT_SEC *from); void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from); +void create_ntc_from_cli_state (CREDS_NT *to, const struct cli_state *cli_from); void copy_nt_creds(struct ntuser_creds *to, const struct ntuser_creds *from); void copy_user_creds(struct user_creds *to, @@ -2202,6 +2250,9 @@ BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset); BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 ptr_uint32, uint32 data_size); +void prs_free_data(prs_struct *buf); +BOOL prs_realloc_data(prs_struct *buf, size_t new_size); +char *prs_data(const prs_struct *buf, uint32 offset); int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps); int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps); @@ -3037,6 +3088,45 @@ uint32 lookup_user_rid(char *user_name, uint32 *rid); BOOL api_wkssvc_rpc(pipes_struct *p); #endif +/*The following definitions come from rpcclient/cmd_spoolss.c */ + +uint32 cmd_spoolss_enum_printers(struct client_info *info, int argc, char *argv[]); + +/*The following definitions come from rpcclient/display_sec.c */ + +void display_sec_desc(FILE *out_hnd, enum action_type action, SEC_DESC *const sec); + +/*The following definitions come from rpcclient/display_spool.c */ + +void display_printer_info_ctr(FILE *out_hnd, enum action_type action, uint32 level, + uint32 count, PRINTER_INFO_CTR ctr); +void display_printer_enumdata(FILE *out_hnd, enum action_type action, uint32 idx, + uint32 valuelen, uint16 *value, uint32 rvaluelen, + uint32 type, + uint32 datalen, uint8 *data, uint32 rdatalen); +void display_job_info_2(FILE *out_hnd, enum action_type action, + JOB_INFO_2 *const i2); +void display_job_info_1(FILE *out_hnd, enum action_type action, + JOB_INFO_1 *const i1); +void display_job_info_2_ctr(FILE *out_hnd, enum action_type action, + uint32 count, JOB_INFO_2 *const *const ctr); +void display_job_info_1_ctr(FILE *out_hnd, enum action_type action, + uint32 count, JOB_INFO_1 *const *const ctr); +void display_job_info_ctr(FILE *out_hnd, enum action_type action, + uint32 level, uint32 count, + void *const *const ctr); +void display_printer_driver_ctr(FILE *out_hnd, enum action_type action, uint32 level, + uint32 count, PRINTER_DRIVER_CTR ctr); +void display_printerdriverdir_info_ctr(FILE *out_hnd, enum action_type action, uint32 level, + DRIVER_DIRECTORY_CTR ctr); + +/*The following definitions come from rpcclient/rpcclient.c */ + + +/*The following definitions come from rpcclient/spoolss_cmds.c */ + +void add_spl_commands(void); + /*The following definitions come from smbd/blocking.c */ #if OLD_NTDOMAIN diff --git a/source3/include/rpc_client_proto.h b/source3/include/rpc_client_proto.h index 7682057439..e3ef439804 100644 --- a/source3/include/rpc_client_proto.h +++ b/source3/include/rpc_client_proto.h @@ -8,6 +8,16 @@ void init_connections(void); void free_connections(void); void cli_connection_free(struct cli_connection *con); +void cli_connection_unlink(struct cli_connection *con); +BOOL cli_connection_init(const char *srv_name, const char *pipe_name, + struct cli_connection **con); +BOOL cli_connection_init_auth(const char *srv_name, const char *pipe_name, + struct cli_connection **con, + cli_auth_fns * auth, void *auth_creds); +struct cli_auth_fns *cli_conn_get_authfns(struct cli_connection *con); +void *cli_conn_get_auth_creds(struct cli_connection *con); +BOOL rpc_con_pipe_req(struct cli_connection *con, uint8 op_num, + prs_struct * data, prs_struct * rdata); /*The following definitions come from rpc_client/cli_login.c */ @@ -55,6 +65,7 @@ BOOL change_trust_account_password( char *domain, char *remote_machine_list); BOOL rpc_api_pipe_req(struct cli_state *cli, uint8 op_num, prs_struct *data, prs_struct *rdata); +BOOL rpc_pipe_bind(struct cli_state *cli, char *pipe_name, char *my_name); void cli_nt_set_ntlmssp_flgs(struct cli_state *cli, uint32 ntlmssp_flgs); BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name); void cli_nt_session_close(struct cli_state *cli); @@ -143,6 +154,12 @@ BOOL do_samr_query_userinfo(struct cli_state *cli, BOOL do_samr_close(struct cli_state *cli, POLICY_HND *hnd); #endif +/*The following definitions come from rpc_client/cli_spoolss.c */ + +uint32 spoolss_enum_printers(uint32 flags, fstring srv_name, uint32 level, + NEW_BUFFER *buffer, uint32 offered, + uint32 *needed, uint32 *returned); + /*The following definitions come from rpc_client/cli_srvsvc.c */ BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, @@ -191,9 +208,19 @@ BOOL do_wks_query_info(struct cli_state *cli, BOOL ncacn_np_use_del(const char *srv_name, const char *pipe_name, const vuser_key * key, BOOL force_close, BOOL *connection_closed); +struct ncacn_np *ncacn_np_initialise(struct ncacn_np *msrpc, + const vuser_key * key); +struct ncacn_np *ncacn_np_use_add(const char *pipe_name, + const vuser_key * key, + const char *srv_name, + const struct ntuser_creds *ntc, + BOOL reuse, BOOL *is_new_connection); /*The following definitions come from rpc_client/ncalrpc_l_use.c */ +struct msrpc_local *ncalrpc_l_use_add(const char *pipe_name, + const vuser_key * key, + BOOL reuse, BOOL *is_new); BOOL ncalrpc_l_use_del(const char *pipe_name, const vuser_key * key, BOOL force_close, BOOL *connection_closed); -- cgit