diff options
author | Luke Leighton <lkcl@samba.org> | 1998-09-25 21:01:52 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-09-25 21:01:52 +0000 |
commit | 66d5d73a5d75e88a77970f7b27687b8354ab2e80 (patch) | |
tree | da1b7278847138fc219398238f7a895a1c7f7a82 /source3/include | |
parent | 1631d3fba7b887a5de23241b39430ffb5e036803 (diff) | |
download | samba-66d5d73a5d75e88a77970f7b27687b8354ab2e80.tar.gz samba-66d5d73a5d75e88a77970f7b27687b8354ab2e80.tar.bz2 samba-66d5d73a5d75e88a77970f7b27687b8354ab2e80.zip |
added rpcclient program
(This used to be commit aa38f39d67fade4dfd7badb7a9b39c833a1dd1ca)
Diffstat (limited to 'source3/include')
-rw-r--r-- | source3/include/nameserv.h | 7 | ||||
-rw-r--r-- | source3/include/ntdomain.h | 7 | ||||
-rw-r--r-- | source3/include/proto.h | 52 | ||||
-rw-r--r-- | source3/include/smb.h | 205 |
4 files changed, 219 insertions, 52 deletions
diff --git a/source3/include/nameserv.h b/source3/include/nameserv.h index e50ad042d9..e3a1d740a7 100644 --- a/source3/include/nameserv.h +++ b/source3/include/nameserv.h @@ -170,13 +170,6 @@ enum logon_state struct subnet_record; -/* A netbios name structure. */ -struct nmb_name { - char name[17]; - char scope[64]; - unsigned int name_type; -}; - struct nmb_data { uint16 nb_flags; /* Netbios flags. */ diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h index ac411fa653..5cdd2849f8 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -81,13 +81,8 @@ typedef struct pipes_struct uint32 hdr_offsets; uint32 frag_len_left; uint32 next_frag_start; -} pipes_struct; -struct acct_info -{ - fstring acct_name; /* account name */ - uint32 smb_userid; /* domain-relative RID */ -}; +} pipes_struct; struct api_struct { diff --git a/source3/include/proto.h b/source3/include/proto.h index fd77c45ee3..d9ea40354f 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -226,6 +226,7 @@ BOOL in_group(gid_t group, int current_gid, int ngroups, GID_T *groups); char *StrCpy(char *dest,char *src); char *StrnCpy(char *dest,char *src,int n); void putip(void *dest,void *src); +char *dns_to_netbios_name(char *dns_name); int name_mangle( char *In, char *Out, char name_type ); BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf); time_t file_modtime(char *fname); @@ -387,14 +388,20 @@ BOOL cli_qfileinfo(struct cli_state *cli, int fnum, BOOL cli_oem_change_password(struct cli_state *cli, char *user, char *new_password, char *old_password); BOOL cli_negprot(struct cli_state *cli); -BOOL cli_session_request(struct cli_state *cli, char *host, int name_type, - char *myname); +BOOL cli_session_request(struct cli_state *cli, + struct nmb_name *calling, struct nmb_name *called); BOOL cli_connect(struct cli_state *cli, char *host, struct in_addr *ip); BOOL cli_initialise(struct cli_state *cli); void cli_shutdown(struct cli_state *cli); void cli_error(struct cli_state *cli, int *eclass, int *num); void cli_sockopt(struct cli_state *cli, char *options); int cli_setpid(struct cli_state *cli, int pid); +BOOL cli_reestablish_connection(struct cli_state *cli); +BOOL cli_establish_connection(struct cli_state *cli, + char *dest_host, struct in_addr *dest_ip, + struct nmb_name *calling, struct nmb_name *called, + char *service, char *service_type, + BOOL do_shutdown, BOOL do_tcon); /*The following definitions come from libsmb/credentials.c */ @@ -440,6 +447,20 @@ void sort_query_replies(char *data, int n, struct in_addr ip); char *get_nt_error_msg(uint32 nt_code); +/*The following definitions come from libsmb/pwd_cache.c */ + +void pwd_init(struct pwd_info *pwd); +void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key); +void pwd_read(struct pwd_info *pwd, char *passwd_report, BOOL do_encrypt); +void pwd_set_nullpwd(struct pwd_info *pwd); +void pwd_set_cleartext(struct pwd_info *pwd, char *clr); +void pwd_get_cleartext(struct pwd_info *pwd, char *clr); +void pwd_set_lm_nt_16(struct pwd_info *pwd, char lm_pwd[16], char nt_pwd[16]); +void pwd_get_lm_nt_16(struct pwd_info *pwd, char lm_pwd[16], char nt_pwd[16]); +void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr); +void pwd_make_lm_nt_owf(struct pwd_info *pwd, char cryptkey[8]); +void pwd_get_lm_nt_owf(struct pwd_info *pwd, char lm_owf[24], char nt_owf[24]); + /*The following definitions come from libsmb/smbdes.c */ void E_P16(unsigned char *p14,unsigned char *p16); @@ -455,6 +476,8 @@ void SamOEMhash( unsigned char *data, unsigned char *key, int val); void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24); void E_md4hash(uchar *passwd, uchar *p16); +void nt_lm_owf_gen(char *pwd, uchar nt_p16[16], uchar p16[16]); +void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24]); void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24); /*The following definitions come from libsmb/smberr.c */ @@ -1162,6 +1185,15 @@ BOOL cli_nt_login_network(struct cli_state *cli, char *domain, char *username, NET_ID_INFO_CTR *ctr, NET_USER_INFO_3 *user_info3); BOOL cli_nt_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr); +/*The following definitions come from rpc_client/cli_lsarpc.c */ + +BOOL do_lsa_open_policy(struct cli_state *cli, + char *server_name, POLICY_HND *hnd); +BOOL do_lsa_query_info_pol(struct cli_state *cli, + POLICY_HND *hnd, uint16 info_class, + fstring domain_name, fstring domain_sid); +BOOL do_lsa_close(struct cli_state *cli, POLICY_HND *hnd); + /*The following definitions come from rpc_client/cli_netlogon.c */ BOOL cli_net_logon_ctrl2(struct cli_state *cli, uint32 status_level); @@ -1184,8 +1216,13 @@ void cli_nt_session_close(struct cli_state *cli); /*The following definitions come from rpc_parse/parse_lsa.c */ void make_lsa_trans_name(LSA_TRANS_NAME *trn, uint32 sid_name_use, char *name, uint32 idx); +void make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, uint32 sec_qos); +void make_q_open_pol(LSA_Q_OPEN_POL *r_q, char *server_name, + uint32 attributes, uint32 sec_qos, + uint32 desired_access); void lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth); void lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth); +void make_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class); void lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth); void lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct *ps, int depth); void make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, @@ -1197,6 +1234,9 @@ void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, in void lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth); void lsa_io_q_lookup_rids(char *desc, LSA_Q_LOOKUP_RIDS *q_r, prs_struct *ps, int depth); void lsa_io_r_lookup_rids(char *desc, LSA_R_LOOKUP_RIDS *r_r, prs_struct *ps, int depth); +void make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd); +void lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth); +void lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth); /*The following definitions come from rpc_parse/parse_misc.c */ @@ -1629,6 +1669,14 @@ uint32 lookup_user_rid(char *user_name, uint32 *rid); BOOL api_wkssvc_rpc(pipes_struct *p, prs_struct *data); +/*The following definitions come from rpcclient/cmd_lsarpc.c */ + +void cmd_lsa_query_info(struct client_info *info); + +/*The following definitions come from rpcclient/rpcclient.c */ + +void rpcclient_init(void); + /*The following definitions come from smbd/blocking.c */ BOOL push_blocking_lock_request( char *inbuf, int length, int lock_timeout, int lock_num); diff --git a/source3/include/smb.h b/source3/include/smb.h index bec14ddd13..59a7a07e76 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -403,42 +403,20 @@ typedef struct cred_info UTIME timestamp; /* credential time-stamp */ } DOM_CRED; -struct cli_state { - int fd; - int cnum; - int pid; - int mid; - int uid; - int protocol; - int sec_mode; - int rap_error; - int privilages; - fstring eff_name; - fstring desthost; - char cryptkey[8]; - uint32 sesskey; - int serverzone; - uint32 servertime; - int readbraw_supported; - int writebraw_supported; - int timeout; - int max_xmit; - char *outbuf; - char *inbuf; - int bufsize; - int initialised; - /* - * Only used in NT domain calls. - */ - uint32 nt_error; /* NT RPC error code. */ - uint16 nt_pipe_fnum; /* Pipe handle. */ - unsigned char sess_key[16]; /* Current session key. */ - DOM_CRED clnt_cred; /* Client credential. */ - fstring mach_acct; /* MYNAME$. */ - fstring srv_name_slash; /* \\remote server. */ - fstring clnt_name_slash; /* \\local client. */ -}; +struct pwd_info +{ + BOOL null_pwd; + BOOL cleartext; + BOOL crypted; + fstring password; + + uchar smb_lm_pwd[16]; + uchar smb_nt_pwd[16]; + + uchar smb_lm_owf[24]; + uchar smb_nt_owf[24]; +}; typedef struct { @@ -1601,6 +1579,161 @@ extern int unix_ERR_code; __FILE__, __LINE__)), smb_panic("assert failed"))) #define SMB_ASSERT_ARRAY(a,n) SMB_ASSERT((sizeof(a)/sizeof((a)[0])) >= (n)) +#include "ntdomain.h" + +/* A netbios name structure. */ +struct nmb_name { + char name[17]; + char scope[64]; + unsigned int name_type; +}; + +struct cli_state { + int fd; + int cnum; + int pid; + int mid; + int uid; + int protocol; + int sec_mode; + int rap_error; + int privilages; + + fstring eff_name; + fstring desthost; + fstring user_name; + fstring domain; + + fstring share; + fstring dev; + struct nmb_name called; + struct nmb_name calling; + fstring full_dest_host_name; + struct in_addr dest_ip; + + struct pwd_info pwd; + char cryptkey[8]; + uint32 sesskey; + int serverzone; + uint32 servertime; + int readbraw_supported; + int writebraw_supported; + int timeout; + int max_xmit; + char *outbuf; + char *inbuf; + int bufsize; + int initialised; + /* + * Only used in NT domain calls. + */ + uint32 nt_error; /* NT RPC error code. */ + uint16 nt_pipe_fnum; /* Pipe handle. */ + unsigned char sess_key[16]; /* Current session key. */ + DOM_CRED clnt_cred; /* Client credential. */ + fstring mach_acct; /* MYNAME$. */ + fstring srv_name_slash; /* \\remote server. */ + fstring clnt_name_slash; /* \\local client. */ +}; + +struct acct_info +{ + fstring acct_name; /* account name */ + uint32 smb_userid; /* domain-relative RID */ +}; + +struct nt_client_info +{ + /************* \PIPE\NETLOGON stuff ******************/ + + fstring mach_acct; + + uint8 sess_key[16]; + DOM_CRED clnt_cred; + DOM_CRED rtn_cred; + + NET_ID_INFO_CTR ctr; + NET_USER_INFO_3 user_info3; + + /************** \PIPE\lsarpc stuff ********************/ + + POLICY_HND lsa_info_pol; + + /* domain member */ + fstring level3_dom; + fstring level3_sid; + + /* domain controller */ + fstring level5_dom; + fstring level5_sid; + + /************** \PIPE\samr stuff ********************/ + + POLICY_HND samr_pol_connect; + POLICY_HND samr_pol_open_domain; + POLICY_HND samr_pol_open_user; + + struct acct_info *sam; + int num_sam_entries; +}; + + +struct tar_client_info +{ + int blocksize; + BOOL inc; + BOOL reset; + BOOL excl; + char type; + int attrib; + char **cliplist; + int clipn; + int tp; + int num_files; + int buf_size; + int bytes_written; + char *buf; + int handle; + int print_mode; + char *file_mode; +}; + +struct client_info +{ + struct in_addr dest_ip; + fstring dest_host; + fstring query_host; + uint8 name_type; + + fstring myhostname; + fstring mach_acct; + + pstring cur_dir; + pstring base_dir; + pstring file_sel; + + fstring service; + fstring share; + fstring svc_type; + + time_t newer_than; + int archive_level; + int dir_total; + int put_total_time_ms; + int put_total_size; + int get_total_time_ms; + int get_total_size; + int print_mode; + BOOL translation; + BOOL recurse_dir; + BOOL prompt; + BOOL lowercase; + BOOL abort_mget; + + struct tar_client_info tar; + struct nt_client_info dom; +}; + /* * Size of new password account encoding string. DO NOT CHANGE. */ @@ -1609,6 +1742,4 @@ extern int unix_ERR_code; #endif /* _SMB_H */ -#include "ntdomain.h" - /* _SMB_H */ |