mirror of
https://github.com/samba-team/samba.git
synced 2025-12-14 20:23:54 +03:00
sys_select added one more argument (read, write selectors).
This commit is contained in:
@@ -256,7 +256,15 @@ SMBPASSWD_OBJ = utils/smbpasswd.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
|
|||||||
$(UBIQX_OBJ) $(RPC_CLIENT_OBJ) $(RPC_PARSE_OBJ) $(LIB_OBJ)
|
$(UBIQX_OBJ) $(RPC_CLIENT_OBJ) $(RPC_PARSE_OBJ) $(LIB_OBJ)
|
||||||
|
|
||||||
RPCCLIENT_OBJ = rpcclient/rpcclient.o \
|
RPCCLIENT_OBJ = rpcclient/rpcclient.o \
|
||||||
rpcclient/display.o \
|
rpcclient/display_at.o \
|
||||||
|
rpcclient/display_event.o \
|
||||||
|
rpcclient/display_reg.o \
|
||||||
|
rpcclient/display_sam.o \
|
||||||
|
rpcclient/display_sec.o \
|
||||||
|
rpcclient/display_spool.o \
|
||||||
|
rpcclient/display_srv.o \
|
||||||
|
rpcclient/display_svc.o \
|
||||||
|
rpcclient/display_sync.o \
|
||||||
rpcclient/cmd_lsarpc.o \
|
rpcclient/cmd_lsarpc.o \
|
||||||
rpcclient/cmd_wkssvc.o \
|
rpcclient/cmd_wkssvc.o \
|
||||||
rpcclient/cmd_brs.o \
|
rpcclient/cmd_brs.o \
|
||||||
@@ -294,6 +302,10 @@ NMBLOOKUP_OBJ = utils/nmblookup.o $(PARAM_OBJ) $(UBIQX_OBJ) \
|
|||||||
|
|
||||||
DEBUG2HTML_OBJ = utils/debug2html.o $(PARAM_OBJ) $(LIB_OBJ)
|
DEBUG2HTML_OBJ = utils/debug2html.o $(PARAM_OBJ) $(LIB_OBJ)
|
||||||
|
|
||||||
|
SMB_AGENT_OBJ = smb-agent.o $(PARAM_OBJ) $(LIB_OBJ)
|
||||||
|
|
||||||
|
SMB_CLIENT_OBJ = smb-client.o $(PARAM_OBJ) $(LIB_OBJ)
|
||||||
|
|
||||||
SMBTORTURE_OBJ = utils/torture.o $(LIBSMB_OBJ) $(PARAM_OBJ) \
|
SMBTORTURE_OBJ = utils/torture.o $(LIBSMB_OBJ) $(PARAM_OBJ) \
|
||||||
$(UBIQX_OBJ) $(LIB_OBJ)
|
$(UBIQX_OBJ) $(LIB_OBJ)
|
||||||
|
|
||||||
|
|||||||
@@ -1514,7 +1514,7 @@ static void wait_keyboard(void)
|
|||||||
|
|
||||||
timeout.tv_sec = 20;
|
timeout.tv_sec = 20;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
sys_select(MAX(cli->fd,fileno(stdin))+1,&fds,&timeout);
|
sys_select(MAX(cli->fd,fileno(stdin))+1,&fds,NULL, &timeout);
|
||||||
|
|
||||||
if (FD_ISSET(fileno(stdin),&fds))
|
if (FD_ISSET(fileno(stdin),&fds))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -609,7 +609,7 @@ static void wait_keyboard(char *buffer)
|
|||||||
|
|
||||||
timeout.tv_sec = 20;
|
timeout.tv_sec = 20;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
selrtn = sys_select(MAX(Client,fileno(stdin))+1,&fds,&timeout);
|
selrtn = sys_select(MAX(Client,fileno(stdin))+1,&fds,NULL, &timeout);
|
||||||
|
|
||||||
if (FD_ISSET(fileno(stdin),&fds))
|
if (FD_ISSET(fileno(stdin),&fds))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <sys/un.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#ifdef TIME_WITH_SYS_TIME
|
#ifdef TIME_WITH_SYS_TIME
|
||||||
|
|||||||
@@ -324,8 +324,8 @@ int smbrun(char *cmd,char *outfile,BOOL shared);
|
|||||||
|
|
||||||
/*The following definitions come from lib/system.c */
|
/*The following definitions come from lib/system.c */
|
||||||
|
|
||||||
int sys_select(int maxfd, fd_set *fds,struct timeval *tval);
|
int sys_select(int maxfd, fd_set *fds, fd_set *w_fds, struct timeval *tval);
|
||||||
int sys_select(int maxfd, fd_set *fds,struct timeval *tval);
|
int sys_select(int maxfd, fd_set *r_fds, fd_set *w_fds, struct timeval *tval);
|
||||||
int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
|
int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
|
||||||
int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
|
int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
|
||||||
int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf);
|
int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf);
|
||||||
@@ -489,6 +489,9 @@ void free_void_array(uint32 num_entries, void **entries,
|
|||||||
void* add_copy_to_array(uint32 *len, void ***array, const void *item,
|
void* add_copy_to_array(uint32 *len, void ***array, const void *item,
|
||||||
void*(item_dup)(const void*), BOOL alloc_anyway);
|
void*(item_dup)(const void*), BOOL alloc_anyway);
|
||||||
void* add_item_to_array(uint32 *len, void ***array, void *item);
|
void* add_item_to_array(uint32 *len, void ***array, void *item);
|
||||||
|
void free_use_array(uint32 num_entries, struct use_info **entries);
|
||||||
|
struct use_info* add_use_to_array(uint32 *len, struct use_info ***array,
|
||||||
|
const struct use_info *name);
|
||||||
void free_char_array(uint32 num_entries, char **entries);
|
void free_char_array(uint32 num_entries, char **entries);
|
||||||
char* add_chars_to_array(uint32 *len, char ***array, const char *name);
|
char* add_chars_to_array(uint32 *len, char ***array, const char *name);
|
||||||
void free_uint32_array(uint32 num_entries, uint32 **entries);
|
void free_uint32_array(uint32 num_entries, uint32 **entries);
|
||||||
@@ -701,7 +704,7 @@ BOOL cli_session_setup_x(struct cli_state *cli,
|
|||||||
char *ntpass, int ntpasslen,
|
char *ntpass, int ntpasslen,
|
||||||
char *user_domain);
|
char *user_domain);
|
||||||
BOOL cli_session_setup(struct cli_state *cli,
|
BOOL cli_session_setup(struct cli_state *cli,
|
||||||
char *user,
|
char *myhostname, char *user,
|
||||||
char *pass, int passlen,
|
char *pass, int passlen,
|
||||||
char *ntpass, int ntpasslen,
|
char *ntpass, int ntpasslen,
|
||||||
char *user_domain);
|
char *user_domain);
|
||||||
@@ -866,16 +869,16 @@ void sam_pwd_hash(uint32 rid, const uchar *in, uchar *out, int forw);
|
|||||||
|
|
||||||
/*The following definitions come from libsmb/smbencrypt.c */
|
/*The following definitions come from libsmb/smbencrypt.c */
|
||||||
|
|
||||||
void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24);
|
void SMBencrypt(uchar *pwrd, uchar *c8, uchar *p24);
|
||||||
void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24);
|
void SMBNTencrypt(uchar *pwrd, uchar *c8, uchar *p24);
|
||||||
void E_md4hash(uchar *passwd, uchar *p16);
|
void E_md4hash(uchar *pwrd, uchar *p16);
|
||||||
void lm_owf_genW(const UNISTR2 *pwd, uchar p16[16]);
|
void lm_owf_genW(const UNISTR2 *pwd, uchar p16[16]);
|
||||||
void lm_owf_gen(const char *pwd, uchar p16[16]);
|
void lm_owf_gen(const char *pwd, uchar p16[16]);
|
||||||
void nt_owf_genW(const UNISTR2 *pwd, uchar nt_p16[16]);
|
void nt_owf_genW(const UNISTR2 *pwd, uchar nt_p16[16]);
|
||||||
void nt_owf_gen(const char *pwd, uchar nt_p16[16]);
|
void nt_owf_gen(const char *pwd, uchar nt_p16[16]);
|
||||||
void nt_lm_owf_genW(const UNISTR2 *pwd, uchar nt_p16[16], uchar lm_p16[16]);
|
void nt_lm_owf_genW(const UNISTR2 *pwd, uchar nt_p16[16], uchar lm_p16[16]);
|
||||||
void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16]);
|
void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16]);
|
||||||
void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24]);
|
void SMBOWFencrypt(uchar pwrd[16], uchar *c8, uchar p24[24]);
|
||||||
void SMBOWFencrypt_ntv2(const uchar kr[16],
|
void SMBOWFencrypt_ntv2(const uchar kr[16],
|
||||||
const uchar *srv_chal, int srv_chal_len,
|
const uchar *srv_chal, int srv_chal_len,
|
||||||
const uchar *cli_chal, int cli_chal_len,
|
const uchar *cli_chal, int cli_chal_len,
|
||||||
@@ -893,15 +896,15 @@ void ntv2_owf_gen(const uchar owf[16],
|
|||||||
const char *user_n,
|
const char *user_n,
|
||||||
const char *domain_n,
|
const char *domain_n,
|
||||||
uchar kr_buf[16]);
|
uchar kr_buf[16]);
|
||||||
void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24]);
|
void NTLMSSPOWFencrypt(uchar pwrd[8], uchar *ntlmchalresp, uchar p24[24]);
|
||||||
BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[16], BOOL unicode);
|
BOOL make_oem_passwd_hash(char data[516], const char *pwrd, uchar old_pw_hash[16], BOOL unicode);
|
||||||
BOOL nt_decrypt_string2(STRING2 *out, const STRING2 *in, const uchar *key);
|
BOOL nt_decrypt_string2(STRING2 *out, const STRING2 *in, const uchar *key);
|
||||||
void create_ntlmssp_resp(struct pwd_info *pwd,
|
void create_ntlmssp_resp(struct pwd_info *pwd,
|
||||||
char *domain, char *user_name, char *my_name,
|
char *domain, char *user_name, char *my_name,
|
||||||
uint32 ntlmssp_cli_flgs,
|
uint32 ntlmssp_cli_flgs,
|
||||||
prs_struct *auth_resp);
|
prs_struct *auth_resp);
|
||||||
BOOL decode_pw_buffer(const char buffer[516], char *new_passwd,
|
BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
|
||||||
int new_passwd_size, uint32 *new_pw_len);
|
int new_pwrd_size, uint32 *new_pw_len);
|
||||||
BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
|
BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
|
||||||
int new_pw_len, BOOL nt_pass_set);
|
int new_pw_len, BOOL nt_pass_set);
|
||||||
|
|
||||||
@@ -2173,6 +2176,7 @@ BOOL cli_net_use_del(const char* srv_name,
|
|||||||
const struct user_credentials *usr_creds,
|
const struct user_credentials *usr_creds,
|
||||||
BOOL force_close,
|
BOOL force_close,
|
||||||
BOOL *connection_closed);
|
BOOL *connection_closed);
|
||||||
|
void cli_net_use_enum(uint32 *num_cons, struct use_info ***use);
|
||||||
|
|
||||||
/*The following definitions come from rpc_client/cli_wkssvc.c */
|
/*The following definitions come from rpc_client/cli_wkssvc.c */
|
||||||
|
|
||||||
@@ -3728,7 +3732,95 @@ void cmd_svc_set(struct client_info *info, int argc, char *argv[]);
|
|||||||
|
|
||||||
void cmd_wks_query_info(struct client_info *info, int argc, char *argv[]);
|
void cmd_wks_query_info(struct client_info *info, int argc, char *argv[]);
|
||||||
|
|
||||||
/*The following definitions come from rpcclient/display.c */
|
/*The following definitions come from rpcclient/display_at.c */
|
||||||
|
|
||||||
|
void display_at_enum_info(FILE *out_hnd, enum action_type action,
|
||||||
|
uint32 num_jobs, const AT_ENUM_INFO *const jobs,
|
||||||
|
char *const *const commands);
|
||||||
|
void display_at_job_info(FILE *out_hnd, enum action_type action,
|
||||||
|
AT_JOB_INFO *const job, fstring command);
|
||||||
|
|
||||||
|
/*The following definitions come from rpcclient/display_event.c */
|
||||||
|
|
||||||
|
void display_eventlog_eventrecord(FILE *out_hnd, enum action_type action, EVENTLOGRECORD *const ev);
|
||||||
|
|
||||||
|
/*The following definitions come from rpcclient/display_reg.c */
|
||||||
|
|
||||||
|
char *get_reg_val_type_str(uint32 type);
|
||||||
|
void display_reg_value_info(FILE *out_hnd, enum action_type action,
|
||||||
|
const char *val_name,
|
||||||
|
uint32 val_type, const BUFFER2 *value);
|
||||||
|
void display_reg_key_info(FILE *out_hnd, enum action_type action,
|
||||||
|
const char *key_name, time_t key_mod_time);
|
||||||
|
|
||||||
|
/*The following definitions come from rpcclient/display_sam.c */
|
||||||
|
|
||||||
|
void display_alias_members(FILE *out_hnd, enum action_type action,
|
||||||
|
uint32 num_mem, char *const *const sid_mem,
|
||||||
|
uint8 *const type);
|
||||||
|
void display_alias_rid_info(FILE *out_hnd, enum action_type action,
|
||||||
|
DOM_SID *const sid,
|
||||||
|
uint32 num_rids, uint32 *const rid);
|
||||||
|
void display_group_members(FILE *out_hnd, enum action_type action,
|
||||||
|
uint32 num_mem, char *const *const name, uint32 *const type);
|
||||||
|
void display_group_info1(FILE *out_hnd, enum action_type action, GROUP_INFO1 *const info1);
|
||||||
|
void display_group_info4(FILE *out_hnd, enum action_type action, GROUP_INFO4 *const info4);
|
||||||
|
void display_group_info_ctr(FILE *out_hnd, enum action_type action,
|
||||||
|
GROUP_INFO_CTR *const ctr);
|
||||||
|
void display_group_rid_info(FILE *out_hnd, enum action_type action,
|
||||||
|
uint32 num_gids, DOM_GID *const gid);
|
||||||
|
void display_alias_name_info(FILE *out_hnd, enum action_type action,
|
||||||
|
uint32 num_aliases, fstring *const alias_name, const uint32 *const num_als_usrs);
|
||||||
|
void display_alias_info3(FILE *out_hnd, enum action_type action, ALIAS_INFO3 *const info3);
|
||||||
|
void display_alias_info_ctr(FILE *out_hnd, enum action_type action,
|
||||||
|
ALIAS_INFO_CTR *const ctr);
|
||||||
|
void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_INFO_21 *const usr);
|
||||||
|
void display_sam_unk_info_2(FILE *out_hnd, enum action_type action,
|
||||||
|
SAM_UNK_INFO_2 *const info2);
|
||||||
|
void display_sam_unk_ctr(FILE *out_hnd, enum action_type action,
|
||||||
|
uint32 switch_value, SAM_UNK_CTR *const ctr);
|
||||||
|
void display_sam_info_1(FILE *out_hnd, enum action_type action,
|
||||||
|
SAM_ENTRY1 *const e1, SAM_STR1 *const s1);
|
||||||
|
void display_sam_info_1_ctr(FILE *out_hnd, enum action_type action,
|
||||||
|
uint32 count, SAM_DISPINFO_1 *const ctr);
|
||||||
|
void display_sam_disp_info_ctr(FILE *out_hnd, enum action_type action,
|
||||||
|
uint16 level, uint32 count,
|
||||||
|
SAM_DISPINFO_CTR *const ctr);
|
||||||
|
|
||||||
|
/*The following definitions come from rpcclient/display_sec.c */
|
||||||
|
|
||||||
|
char *get_sec_mask_str(uint32 type);
|
||||||
|
void display_sec_access(FILE *out_hnd, enum action_type action, SEC_ACCESS *const info);
|
||||||
|
void display_sec_ace(FILE *out_hnd, enum action_type action, SEC_ACE *const ace);
|
||||||
|
void display_sec_acl(FILE *out_hnd, enum action_type action, SEC_ACL *const sec_acl);
|
||||||
|
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_print_info_0(FILE *out_hnd, enum action_type action,
|
||||||
|
PRINTER_INFO_0 *const i0);
|
||||||
|
void display_print_info_1(FILE *out_hnd, enum action_type action,
|
||||||
|
PRINTER_INFO_1 *const i1);
|
||||||
|
void display_printer_info_0_ctr(FILE *out_hnd, enum action_type action,
|
||||||
|
uint32 count, PRINTER_INFO_0 *const *const ctr);
|
||||||
|
void display_printer_info_1_ctr(FILE *out_hnd, enum action_type action,
|
||||||
|
uint32 count, PRINTER_INFO_1 *const *const ctr);
|
||||||
|
void display_printer_info_ctr(FILE *out_hnd, enum action_type action,
|
||||||
|
uint32 level, uint32 count,
|
||||||
|
void *const *const ctr);
|
||||||
|
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);
|
||||||
|
|
||||||
|
/*The following definitions come from rpcclient/display_srv.c */
|
||||||
|
|
||||||
char *get_sid_name_use_str(uint8 sid_name_use);
|
char *get_sid_name_use_str(uint8 sid_name_use);
|
||||||
char *get_file_mode_str(uint32 share_mode);
|
char *get_file_mode_str(uint32 share_mode);
|
||||||
@@ -3788,51 +3880,20 @@ void display_share(FILE *out_hnd, enum action_type action,
|
|||||||
void display_share2(FILE *out_hnd, enum action_type action,
|
void display_share2(FILE *out_hnd, enum action_type action,
|
||||||
char *const sname, uint32 type, char *const comment,
|
char *const sname, uint32 type, char *const comment,
|
||||||
uint32 perms, uint32 max_uses, uint32 num_uses,
|
uint32 perms, uint32 max_uses, uint32 num_uses,
|
||||||
char *const path, char *const passwd);
|
char *const path, char *const password);
|
||||||
void display_name(FILE *out_hnd, enum action_type action,
|
void display_name(FILE *out_hnd, enum action_type action,
|
||||||
char *const sname);
|
char *const sname);
|
||||||
void display_alias_members(FILE *out_hnd, enum action_type action,
|
|
||||||
uint32 num_mem, char *const *const sid_mem,
|
/*The following definitions come from rpcclient/display_svc.c */
|
||||||
uint8 *const type);
|
|
||||||
void display_alias_rid_info(FILE *out_hnd, enum action_type action,
|
|
||||||
DOM_SID *const sid,
|
|
||||||
uint32 num_rids, uint32 *const rid);
|
|
||||||
void display_group_members(FILE *out_hnd, enum action_type action,
|
|
||||||
uint32 num_mem, char *const *const name, uint32 *const type);
|
|
||||||
void display_group_info1(FILE *out_hnd, enum action_type action, GROUP_INFO1 *const info1);
|
|
||||||
void display_group_info4(FILE *out_hnd, enum action_type action, GROUP_INFO4 *const info4);
|
|
||||||
void display_group_info_ctr(FILE *out_hnd, enum action_type action,
|
|
||||||
GROUP_INFO_CTR *const ctr);
|
|
||||||
void display_group_rid_info(FILE *out_hnd, enum action_type action,
|
|
||||||
uint32 num_gids, DOM_GID *const gid);
|
|
||||||
void display_alias_name_info(FILE *out_hnd, enum action_type action,
|
|
||||||
uint32 num_aliases, fstring *const alias_name, const uint32 *const num_als_usrs);
|
|
||||||
void display_alias_info3(FILE *out_hnd, enum action_type action, ALIAS_INFO3 *const info3);
|
|
||||||
void display_alias_info_ctr(FILE *out_hnd, enum action_type action,
|
|
||||||
ALIAS_INFO_CTR *const ctr);
|
|
||||||
void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_INFO_21 *const usr);
|
|
||||||
char *get_sec_mask_str(uint32 type);
|
|
||||||
void display_sec_access(FILE *out_hnd, enum action_type action, SEC_ACCESS *const info);
|
|
||||||
void display_sec_ace(FILE *out_hnd, enum action_type action, SEC_ACE *const ace);
|
|
||||||
void display_sec_acl(FILE *out_hnd, enum action_type action, SEC_ACL *const sec_acl);
|
|
||||||
void display_sec_desc(FILE *out_hnd, enum action_type action, SEC_DESC *const sec);
|
|
||||||
char *get_reg_val_type_str(uint32 type);
|
|
||||||
void display_reg_value_info(FILE *out_hnd, enum action_type action,
|
|
||||||
const char *val_name,
|
|
||||||
uint32 val_type, const BUFFER2 *value);
|
|
||||||
void display_reg_key_info(FILE *out_hnd, enum action_type action,
|
|
||||||
const char *key_name, time_t key_mod_time);
|
|
||||||
char *get_svc_start_type_str(uint32 type);
|
char *get_svc_start_type_str(uint32 type);
|
||||||
void display_query_svc_cfg(FILE *out_hnd, enum action_type action,
|
void display_query_svc_cfg(FILE *out_hnd, enum action_type action,
|
||||||
const QUERY_SERVICE_CONFIG *const cfg);
|
const QUERY_SERVICE_CONFIG *const cfg);
|
||||||
void display_svc_info(FILE *out_hnd, enum action_type action,
|
void display_svc_info(FILE *out_hnd, enum action_type action,
|
||||||
const ENUM_SRVC_STATUS *const svc);
|
const ENUM_SRVC_STATUS *const svc);
|
||||||
void display_at_enum_info(FILE *out_hnd, enum action_type action,
|
|
||||||
uint32 num_jobs, const AT_ENUM_INFO *const jobs,
|
/*The following definitions come from rpcclient/display_sync.c */
|
||||||
char *const *const commands);
|
|
||||||
void display_at_job_info(FILE *out_hnd, enum action_type action,
|
|
||||||
AT_JOB_INFO *const job, fstring command);
|
|
||||||
void display_eventlog_eventrecord(FILE *out_hnd, enum action_type action, EVENTLOGRECORD *const ev);
|
|
||||||
void display_sam_sync_ctr(FILE *out_hnd, enum action_type action,
|
void display_sam_sync_ctr(FILE *out_hnd, enum action_type action,
|
||||||
SAM_DELTA_HDR *const delta,
|
SAM_DELTA_HDR *const delta,
|
||||||
SAM_DELTA_CTR *const ctr);
|
SAM_DELTA_CTR *const ctr);
|
||||||
@@ -3840,39 +3901,6 @@ void display_sam_sync(FILE *out_hnd, enum action_type action,
|
|||||||
SAM_DELTA_HDR *const deltas,
|
SAM_DELTA_HDR *const deltas,
|
||||||
SAM_DELTA_CTR *const ctr,
|
SAM_DELTA_CTR *const ctr,
|
||||||
uint32 num);
|
uint32 num);
|
||||||
void display_sam_unk_info_2(FILE *out_hnd, enum action_type action,
|
|
||||||
SAM_UNK_INFO_2 *const info2);
|
|
||||||
void display_sam_unk_ctr(FILE *out_hnd, enum action_type action,
|
|
||||||
uint32 switch_value, SAM_UNK_CTR *const ctr);
|
|
||||||
void display_sam_info_1(FILE *out_hnd, enum action_type action,
|
|
||||||
SAM_ENTRY1 *const e1, SAM_STR1 *const s1);
|
|
||||||
void display_sam_info_1_ctr(FILE *out_hnd, enum action_type action,
|
|
||||||
uint32 count, SAM_DISPINFO_1 *const ctr);
|
|
||||||
void display_sam_disp_info_ctr(FILE *out_hnd, enum action_type action,
|
|
||||||
uint16 level, uint32 count,
|
|
||||||
SAM_DISPINFO_CTR *const ctr);
|
|
||||||
void display_print_info_0(FILE *out_hnd, enum action_type action,
|
|
||||||
PRINTER_INFO_0 *const i0);
|
|
||||||
void display_print_info_1(FILE *out_hnd, enum action_type action,
|
|
||||||
PRINTER_INFO_1 *const i1);
|
|
||||||
void display_printer_info_0_ctr(FILE *out_hnd, enum action_type action,
|
|
||||||
uint32 count, PRINTER_INFO_0 *const *const ctr);
|
|
||||||
void display_printer_info_1_ctr(FILE *out_hnd, enum action_type action,
|
|
||||||
uint32 count, PRINTER_INFO_1 *const *const ctr);
|
|
||||||
void display_printer_info_ctr(FILE *out_hnd, enum action_type action,
|
|
||||||
uint32 level, uint32 count,
|
|
||||||
void *const *const ctr);
|
|
||||||
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);
|
|
||||||
|
|
||||||
/*The following definitions come from rpcclient/rpcclient.c */
|
/*The following definitions come from rpcclient/rpcclient.c */
|
||||||
|
|
||||||
|
|||||||
@@ -352,6 +352,14 @@ struct sam_disp_info
|
|||||||
char *full_name; /* user's full name string */
|
char *full_name; /* user's full name string */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct use_info
|
||||||
|
{
|
||||||
|
BOOL connected;
|
||||||
|
char *srv_name;
|
||||||
|
char *user_name;
|
||||||
|
char *domain;
|
||||||
|
};
|
||||||
|
|
||||||
#define MAXSUBAUTHS 15 /* max sub authorities in a SID */
|
#define MAXSUBAUTHS 15 /* max sub authorities in a SID */
|
||||||
|
|
||||||
/* DOM_SID - security id */
|
/* DOM_SID - security id */
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ static int pollfd(int fd)
|
|||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
|
int sys_select(int maxfd, fd_set *fds, fd_set *w_fds, struct timeval *tval)
|
||||||
{
|
{
|
||||||
fd_set fds2;
|
fd_set fds2;
|
||||||
int counter=0;
|
int counter=0;
|
||||||
@@ -90,7 +90,7 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else /* !NO_SELECT */
|
#else /* !NO_SELECT */
|
||||||
int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
|
int sys_select(int maxfd, fd_set *r_fds, fd_set *w_fds, struct timeval *tval)
|
||||||
{
|
{
|
||||||
#ifdef USE_POLL
|
#ifdef USE_POLL
|
||||||
struct pollfd pfd[256];
|
struct pollfd pfd[256];
|
||||||
@@ -131,7 +131,8 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
|
|||||||
do {
|
do {
|
||||||
if (tval) memcpy((void *)&t2,(void *)tval,sizeof(t2));
|
if (tval) memcpy((void *)&t2,(void *)tval,sizeof(t2));
|
||||||
errno = 0;
|
errno = 0;
|
||||||
selrtn = select(maxfd,SELECT_CAST fds,NULL,NULL,tval?&t2:NULL);
|
selrtn = select(maxfd,SELECT_CAST r_fds,SELECT_CAST w_fds,
|
||||||
|
NULL,tval?&t2:NULL);
|
||||||
} while (selrtn<0 && errno == EINTR);
|
} while (selrtn<0 && errno == EINTR);
|
||||||
|
|
||||||
return(selrtn);
|
return(selrtn);
|
||||||
|
|||||||
@@ -1148,7 +1148,7 @@ void msleep(int t)
|
|||||||
|
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
errno = 0;
|
errno = 0;
|
||||||
sys_select(0,&fds,&tval);
|
sys_select(0,&fds,NULL, &tval);
|
||||||
|
|
||||||
GetTimeOfDay(&t2);
|
GetTimeOfDay(&t2);
|
||||||
tdiff = TvalDiff(&t1,&t2);
|
tdiff = TvalDiff(&t1,&t2);
|
||||||
|
|||||||
@@ -77,6 +77,69 @@ void* add_item_to_array(uint32 *len, void ***array, void *item)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void use_info_free(struct use_info *item)
|
||||||
|
{
|
||||||
|
if (item != NULL)
|
||||||
|
{
|
||||||
|
if (item->srv_name != NULL)
|
||||||
|
{
|
||||||
|
free(item->srv_name);
|
||||||
|
}
|
||||||
|
if (item->user_name != NULL)
|
||||||
|
{
|
||||||
|
free(item->user_name);
|
||||||
|
}
|
||||||
|
if (item->domain != NULL)
|
||||||
|
{
|
||||||
|
free(item->domain);
|
||||||
|
}
|
||||||
|
free(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct use_info *use_info_dup(const struct use_info *from)
|
||||||
|
{
|
||||||
|
if (from != NULL)
|
||||||
|
{
|
||||||
|
struct use_info *copy = (struct use_info *)
|
||||||
|
malloc(sizeof(struct use_info));
|
||||||
|
if (copy != NULL)
|
||||||
|
{
|
||||||
|
ZERO_STRUCTP(copy);
|
||||||
|
copy->connected = from->connected;
|
||||||
|
if (from->srv_name != NULL)
|
||||||
|
{
|
||||||
|
copy->srv_name = strdup(from->srv_name );
|
||||||
|
}
|
||||||
|
if (from->user_name != NULL)
|
||||||
|
{
|
||||||
|
copy->user_name = strdup(from->user_name);
|
||||||
|
}
|
||||||
|
if (from->domain != NULL)
|
||||||
|
{
|
||||||
|
copy->domain = strdup(from->domain );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void free_use_array(uint32 num_entries, struct use_info **entries)
|
||||||
|
{
|
||||||
|
void(*fn)(void*) = (void(*)(void*))&use_info_free;
|
||||||
|
free_void_array(num_entries, (void**)entries, *fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct use_info* add_use_to_array(uint32 *len, struct use_info ***array,
|
||||||
|
const struct use_info *name)
|
||||||
|
{
|
||||||
|
void*(*fn)(const void*) = (void*(*)(const void*))&use_info_dup;
|
||||||
|
return (struct use_info*)add_copy_to_array(len,
|
||||||
|
(void***)array, (const void*)name, *fn, False);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void free_char_array(uint32 num_entries, char **entries)
|
void free_char_array(uint32 num_entries, char **entries)
|
||||||
{
|
{
|
||||||
void(*fn)(void*) = (void(*)(void*))&free;
|
void(*fn)(void*) = (void(*)(void*))&free;
|
||||||
@@ -175,7 +238,7 @@ static PRINTER_INFO_2 *prt2_dup(const PRINTER_INFO_2* from)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memset(copy, 0, sizeof(*copy));
|
ZERO_STRUCTP(copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return copy;
|
return copy;
|
||||||
@@ -206,7 +269,7 @@ static PRINTER_INFO_1 *prt1_dup(const PRINTER_INFO_1* from)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memset(copy, 0, sizeof(*copy));
|
ZERO_STRUCTP(copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return copy;
|
return copy;
|
||||||
@@ -237,7 +300,7 @@ static JOB_INFO_1 *job1_dup(const JOB_INFO_1* from)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memset(copy, 0, sizeof(*copy));
|
ZERO_STRUCTP(copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return copy;
|
return copy;
|
||||||
@@ -268,7 +331,7 @@ static JOB_INFO_2 *job2_dup(const JOB_INFO_2* from)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memset(copy, 0, sizeof(*copy));
|
ZERO_STRUCTP(copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return copy;
|
return copy;
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ ssize_t read_with_timeout(int fd,char *buf,size_t mincnt,size_t maxcnt,unsigned
|
|||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
FD_SET(fd,&fds);
|
FD_SET(fd,&fds);
|
||||||
|
|
||||||
selrtn = sys_select(fd+1,&fds,&timeout);
|
selrtn = sys_select(fd+1,&fds,NULL, &timeout);
|
||||||
|
|
||||||
/* Check if error */
|
/* Check if error */
|
||||||
if(selrtn == -1) {
|
if(selrtn == -1) {
|
||||||
|
|||||||
@@ -918,9 +918,11 @@ BOOL cli_session_setup_x(struct cli_state *cli,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static BOOL cli_calc_session_pwds(struct cli_state *cli,
|
static BOOL cli_calc_session_pwds(struct cli_state *cli,
|
||||||
|
char *myhostname,
|
||||||
char *pword, char *ntpword,
|
char *pword, char *ntpword,
|
||||||
char *pass, int *passlen,
|
char *pass, int *passlen,
|
||||||
char *ntpass, int *ntpasslen,
|
char *ntpass, int *ntpasslen,
|
||||||
|
char *sess_key,
|
||||||
BOOL ntlmv2)
|
BOOL ntlmv2)
|
||||||
{
|
{
|
||||||
BOOL ntpass_ok = ntpass != NULL && ntpasslen != NULL;
|
BOOL ntpass_ok = ntpass != NULL && ntpasslen != NULL;
|
||||||
@@ -998,59 +1000,23 @@ static BOOL cli_calc_session_pwds(struct cli_state *cli,
|
|||||||
}
|
}
|
||||||
else if (ntpasslen != NULL)
|
else if (ntpasslen != NULL)
|
||||||
{
|
{
|
||||||
/* passlen != 0, ntpasslen != 0 && server supports encryption */
|
if (cli->use_ntlmv2 != False)
|
||||||
if (ntlmv2)
|
|
||||||
{
|
{
|
||||||
/* plain-text password requesting to be encrypted */
|
DEBUG(10,("cli_establish_connection: NTLMv2\n"));
|
||||||
uchar *srv_key = (uchar *)cli->cryptkey;
|
pwd_make_lm_nt_owf2(&(cli->usr.pwd), cli->cryptkey,
|
||||||
uchar nt_owf[16];
|
cli->usr.user_name, myhostname,
|
||||||
uchar kr[16];
|
|
||||||
HMACMD5Context ctx;
|
|
||||||
|
|
||||||
SMBgenclientchals(cli->lm_cli_chal,
|
|
||||||
cli->nt_cli_chal,
|
|
||||||
&cli->nt_cli_chal_len,
|
|
||||||
cli->calling.name,
|
|
||||||
cli->usr.domain);
|
cli->usr.domain);
|
||||||
|
|
||||||
nt_owf_gen(pword, nt_owf);
|
|
||||||
ntv2_owf_gen(nt_owf, cli->usr.user_name, cli->usr.domain, kr);
|
|
||||||
|
|
||||||
/* lm # */
|
|
||||||
memcpy(pword, cli->lm_cli_chal, 8);
|
|
||||||
SMBOWFencrypt_ntv2(kr,
|
|
||||||
srv_key, 8,
|
|
||||||
cli->lm_cli_chal, 8,
|
|
||||||
&pword[8]);
|
|
||||||
*passlen = 24;
|
|
||||||
|
|
||||||
/* nt # */
|
|
||||||
memcpy(ntpword, cli->lm_cli_chal, cli->nt_cli_chal_len);
|
|
||||||
SMBOWFencrypt_ntv2(kr,
|
|
||||||
srv_key, 8,
|
|
||||||
cli->nt_cli_chal, cli->nt_cli_chal_len,
|
|
||||||
&ntpword[cli->nt_cli_chal_len]);
|
|
||||||
*ntpasslen = cli->nt_cli_chal_len + 16;
|
|
||||||
|
|
||||||
hmac_md5_init_limK_to_64(kr, 16, &ctx);
|
|
||||||
hmac_md5_update(cli->nt_cli_chal, cli->nt_cli_chal_len,
|
|
||||||
&ctx);
|
|
||||||
hmac_md5_final(cli->sess_key, &ctx);
|
|
||||||
#if DEBUG_PASSWORD
|
|
||||||
DEBUG(100,("session key:\n"));
|
|
||||||
dump_data(100, cli->sess_key, sizeof(cli->sess_key));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* plain-text password requesting to be encrypted */
|
DEBUG(10,("cli_establish_connection: NTLMv1\n"));
|
||||||
uchar *key = (uchar *)cli->cryptkey;
|
pwd_make_lm_nt_owf(&(cli->usr.pwd), cli->cryptkey);
|
||||||
SMBencrypt ((uchar *)pass , key,(uchar *)pword );
|
|
||||||
SMBNTencrypt((uchar *)ntpass, key,(uchar *)ntpword);
|
|
||||||
*passlen = 24;
|
|
||||||
*ntpasslen = 24;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pwd_get_lm_nt_owf(&(cli->usr.pwd), pass, ntpass,
|
||||||
|
ntpasslen, sess_key);
|
||||||
|
|
||||||
|
*passlen = 24;
|
||||||
}
|
}
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
@@ -1059,7 +1025,7 @@ static BOOL cli_calc_session_pwds(struct cli_state *cli,
|
|||||||
send a session setup
|
send a session setup
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL cli_session_setup(struct cli_state *cli,
|
BOOL cli_session_setup(struct cli_state *cli,
|
||||||
char *user,
|
char *myhostname, char *user,
|
||||||
char *pass, int passlen,
|
char *pass, int passlen,
|
||||||
char *ntpass, int ntpasslen,
|
char *ntpass, int ntpasslen,
|
||||||
char *user_domain)
|
char *user_domain)
|
||||||
@@ -1073,9 +1039,10 @@ BOOL cli_session_setup(struct cli_state *cli,
|
|||||||
|
|
||||||
fstrcpy(cli->usr.user_name, user);
|
fstrcpy(cli->usr.user_name, user);
|
||||||
|
|
||||||
return cli_calc_session_pwds(cli, pword, ntpword,
|
return cli_calc_session_pwds(cli, myhostname, pword, ntpword,
|
||||||
pass, &passlen,
|
pass, &passlen,
|
||||||
ntpass, &ntpasslen, cli->use_ntlmv2) &&
|
ntpass, &ntpasslen, cli->sess_key,
|
||||||
|
cli->use_ntlmv2) &&
|
||||||
cli_session_setup_x(cli, user, pass, passlen, ntpass, ntpasslen,
|
cli_session_setup_x(cli, user, pass, passlen, ntpass, ntpasslen,
|
||||||
user_domain);
|
user_domain);
|
||||||
}
|
}
|
||||||
@@ -3238,7 +3205,8 @@ BOOL cli_establish_connection(struct cli_state *cli,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* attempt clear-text session */
|
/* attempt clear-text session */
|
||||||
if (!cli_session_setup(cli, cli->usr.user_name,
|
if (!cli_session_setup(cli, calling->name,
|
||||||
|
cli->usr.user_name,
|
||||||
passwd, pass_len,
|
passwd, pass_len,
|
||||||
ntpasswd, ntpass_len,
|
ntpasswd, ntpass_len,
|
||||||
cli->usr.domain))
|
cli->usr.domain))
|
||||||
|
|||||||
@@ -908,7 +908,7 @@ struct packet_struct *receive_packet(int fd,enum packet_type type,int t)
|
|||||||
timeout.tv_sec = t/1000;
|
timeout.tv_sec = t/1000;
|
||||||
timeout.tv_usec = 1000*(t%1000);
|
timeout.tv_usec = 1000*(t%1000);
|
||||||
|
|
||||||
sys_select(fd+1,&fds,&timeout);
|
sys_select(fd+1,&fds,NULL, &timeout);
|
||||||
|
|
||||||
if (FD_ISSET(fd,&fds))
|
if (FD_ISSET(fd,&fds))
|
||||||
return(read_packet(fd,type));
|
return(read_packet(fd,type));
|
||||||
|
|||||||
@@ -24,17 +24,15 @@
|
|||||||
|
|
||||||
extern int DEBUGLEVEL;
|
extern int DEBUGLEVEL;
|
||||||
|
|
||||||
#include "byteorder.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This implements the X/Open SMB password encryption
|
This implements the X/Open SMB password encryption
|
||||||
It takes a password, a 8 byte "crypt key" and puts 24 bytes of
|
It takes a password, a 8 byte "crypt key" and puts 24 bytes of
|
||||||
encrypted password into p24 */
|
encrypted password into p24 */
|
||||||
void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24)
|
void SMBencrypt(uchar *pwrd, uchar *c8, uchar *p24)
|
||||||
{
|
{
|
||||||
uchar p21[21];
|
uchar p21[21];
|
||||||
|
|
||||||
lm_owf_gen(passwd, p21);
|
lm_owf_gen(pwrd, p21);
|
||||||
SMBOWFencrypt(p21, c8, p24);
|
SMBOWFencrypt(p21, c8, p24);
|
||||||
|
|
||||||
#ifdef DEBUG_PASSWORD
|
#ifdef DEBUG_PASSWORD
|
||||||
@@ -45,13 +43,13 @@ void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24)
|
void SMBNTencrypt(uchar *pwrd, uchar *c8, uchar *p24)
|
||||||
{
|
{
|
||||||
uchar p21[21];
|
uchar p21[21];
|
||||||
|
|
||||||
memset(p21,'\0',21);
|
memset(p21,'\0',21);
|
||||||
|
|
||||||
nt_owf_gen(passwd, p21);
|
nt_owf_gen(pwrd, p21);
|
||||||
SMBOWFencrypt(p21, c8, p24);
|
SMBOWFencrypt(p21, c8, p24);
|
||||||
|
|
||||||
#ifdef DEBUG_PASSWORD
|
#ifdef DEBUG_PASSWORD
|
||||||
@@ -114,17 +112,17 @@ static int _my_mbstowcs(int16 *dst, const uchar *src, int len)
|
|||||||
* Creates the MD4 Hash of the users password in NT UNICODE.
|
* Creates the MD4 Hash of the users password in NT UNICODE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void E_md4hash(uchar *passwd, uchar *p16)
|
void E_md4hash(uchar *pwrd, uchar *p16)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int16 wpwd[129];
|
int16 wpwd[129];
|
||||||
|
|
||||||
/* Password cannot be longer than 128 characters */
|
/* Password cannot be longer than 128 characters */
|
||||||
len = strlen((char *)passwd);
|
len = strlen((char *)pwrd);
|
||||||
if(len > 128)
|
if(len > 128)
|
||||||
len = 128;
|
len = 128;
|
||||||
/* Password must be converted to NT unicode */
|
/* Password must be converted to NT unicode */
|
||||||
_my_mbstowcs(wpwd, passwd, len);
|
_my_mbstowcs(wpwd, pwrd, len);
|
||||||
wpwd[len] = 0; /* Ensure string is null terminated */
|
wpwd[len] = 0; /* Ensure string is null terminated */
|
||||||
/* Calculate length in bytes */
|
/* Calculate length in bytes */
|
||||||
len = _my_wcslen(wpwd) * sizeof(int16);
|
len = _my_wcslen(wpwd) * sizeof(int16);
|
||||||
@@ -135,107 +133,107 @@ void E_md4hash(uchar *passwd, uchar *p16)
|
|||||||
/* Does the LM owf of a user's password */
|
/* Does the LM owf of a user's password */
|
||||||
void lm_owf_genW(const UNISTR2 *pwd, uchar p16[16])
|
void lm_owf_genW(const UNISTR2 *pwd, uchar p16[16])
|
||||||
{
|
{
|
||||||
char passwd[15];
|
char pwrd[15];
|
||||||
|
|
||||||
memset(passwd,'\0',15);
|
memset(pwrd,'\0',15);
|
||||||
if (pwd != NULL)
|
if (pwd != NULL)
|
||||||
{
|
{
|
||||||
unistr2_to_ascii( passwd, pwd, sizeof(passwd)-1);
|
unistr2_to_ascii( pwrd, pwd, sizeof(pwrd)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mangle the passwords into Lanman format */
|
/* Mangle the passwords into Lanman format */
|
||||||
passwd[14] = '\0';
|
pwrd[14] = '\0';
|
||||||
strupper(passwd);
|
strupper(pwrd);
|
||||||
|
|
||||||
/* Calculate the SMB (lanman) hash functions of the password */
|
/* Calculate the SMB (lanman) hash functions of the password */
|
||||||
|
|
||||||
memset(p16, '\0', 16);
|
memset(p16, '\0', 16);
|
||||||
E_P16((uchar *) passwd, (uchar *)p16);
|
E_P16((uchar *) pwrd, (uchar *)p16);
|
||||||
|
|
||||||
#ifdef DEBUG_PASSWORD
|
#ifdef DEBUG_PASSWORD
|
||||||
DEBUG(100,("nt_lm_owf_gen: pwd, lm#\n"));
|
DEBUG(100,("nt_lm_owf_gen: pwd, lm#\n"));
|
||||||
dump_data(120, passwd, strlen(passwd));
|
dump_data(120, pwrd, strlen(pwrd));
|
||||||
dump_data(100, p16, 16);
|
dump_data(100, p16, 16);
|
||||||
#endif
|
#endif
|
||||||
/* clear out local copy of user's password (just being paranoid). */
|
/* clear out local copy of user's password (just being paranoid). */
|
||||||
bzero(passwd, sizeof(passwd));
|
bzero(pwrd, sizeof(pwrd));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Does the LM owf of a user's password */
|
/* Does the LM owf of a user's password */
|
||||||
void lm_owf_gen(const char *pwd, uchar p16[16])
|
void lm_owf_gen(const char *pwd, uchar p16[16])
|
||||||
{
|
{
|
||||||
char passwd[15];
|
char pwrd[15];
|
||||||
|
|
||||||
memset(passwd,'\0',15);
|
memset(pwrd,'\0',15);
|
||||||
if (pwd != NULL)
|
if (pwd != NULL)
|
||||||
{
|
{
|
||||||
safe_strcpy( passwd, pwd, sizeof(passwd)-1);
|
safe_strcpy( pwrd, pwd, sizeof(pwrd)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mangle the passwords into Lanman format */
|
/* Mangle the passwords into Lanman format */
|
||||||
passwd[14] = '\0';
|
pwrd[14] = '\0';
|
||||||
strupper(passwd);
|
strupper(pwrd);
|
||||||
|
|
||||||
/* Calculate the SMB (lanman) hash functions of the password */
|
/* Calculate the SMB (lanman) hash functions of the password */
|
||||||
|
|
||||||
memset(p16, '\0', 16);
|
memset(p16, '\0', 16);
|
||||||
E_P16((uchar *) passwd, (uchar *)p16);
|
E_P16((uchar *) pwrd, (uchar *)p16);
|
||||||
|
|
||||||
#ifdef DEBUG_PASSWORD
|
#ifdef DEBUG_PASSWORD
|
||||||
DEBUG(100,("nt_lm_owf_gen: pwd, lm#\n"));
|
DEBUG(100,("nt_lm_owf_gen: pwd, lm#\n"));
|
||||||
dump_data(120, passwd, strlen(passwd));
|
dump_data(120, pwrd, strlen(pwrd));
|
||||||
dump_data(100, p16, 16);
|
dump_data(100, p16, 16);
|
||||||
#endif
|
#endif
|
||||||
/* clear out local copy of user's password (just being paranoid). */
|
/* clear out local copy of user's password (just being paranoid). */
|
||||||
bzero(passwd, sizeof(passwd));
|
bzero(pwrd, sizeof(pwrd));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Does both the NT and LM owfs of a user's password */
|
/* Does both the NT and LM owfs of a user's password */
|
||||||
void nt_owf_genW(const UNISTR2 *pwd, uchar nt_p16[16])
|
void nt_owf_genW(const UNISTR2 *pwd, uchar nt_p16[16])
|
||||||
{
|
{
|
||||||
UNISTR2 passwd;
|
UNISTR2 pwrd;
|
||||||
|
|
||||||
memset(&passwd,'\0',sizeof(passwd));
|
memset(&pwrd,'\0',sizeof(pwrd));
|
||||||
if (pwd != NULL)
|
if (pwd != NULL)
|
||||||
{
|
{
|
||||||
copy_unistr2(&passwd, pwd);
|
copy_unistr2(&pwrd, pwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the MD4 hash (NT compatible) of the password */
|
/* Calculate the MD4 hash (NT compatible) of the password */
|
||||||
memset(nt_p16, '\0', 16);
|
memset(nt_p16, '\0', 16);
|
||||||
mdfour(nt_p16, (unsigned char *)passwd.buffer, passwd.uni_str_len * 2);
|
mdfour(nt_p16, (unsigned char *)pwrd.buffer, pwrd.uni_str_len * 2);
|
||||||
|
|
||||||
#ifdef DEBUG_PASSWORD
|
#ifdef DEBUG_PASSWORD
|
||||||
DEBUG(100,("nt_owf_gen: pwd, nt#\n"));
|
DEBUG(100,("nt_owf_gen: pwd, nt#\n"));
|
||||||
dump_data(120, (const char*)passwd.buffer, passwd.uni_str_len * 2);
|
dump_data(120, (const char*)pwrd.buffer, pwrd.uni_str_len * 2);
|
||||||
dump_data(100, nt_p16, 16);
|
dump_data(100, nt_p16, 16);
|
||||||
#endif
|
#endif
|
||||||
/* clear out local copy of user's password (just being paranoid). */
|
/* clear out local copy of user's password (just being paranoid). */
|
||||||
memset(&passwd, 0, sizeof(passwd));
|
memset(&pwrd, 0, sizeof(pwrd));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Does both the NT and LM owfs of a user's password */
|
/* Does both the NT and LM owfs of a user's password */
|
||||||
void nt_owf_gen(const char *pwd, uchar nt_p16[16])
|
void nt_owf_gen(const char *pwd, uchar nt_p16[16])
|
||||||
{
|
{
|
||||||
char passwd[130];
|
char pwrd[130];
|
||||||
|
|
||||||
memset(passwd,'\0',130);
|
memset(pwrd,'\0',130);
|
||||||
if (pwd != NULL)
|
if (pwd != NULL)
|
||||||
{
|
{
|
||||||
safe_strcpy( passwd, pwd, sizeof(passwd)-1);
|
safe_strcpy( pwrd, pwd, sizeof(pwrd)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the MD4 hash (NT compatible) of the password */
|
/* Calculate the MD4 hash (NT compatible) of the password */
|
||||||
memset(nt_p16, '\0', 16);
|
memset(nt_p16, '\0', 16);
|
||||||
E_md4hash((uchar *)passwd, nt_p16);
|
E_md4hash((uchar *)pwrd, nt_p16);
|
||||||
|
|
||||||
#ifdef DEBUG_PASSWORD
|
#ifdef DEBUG_PASSWORD
|
||||||
DEBUG(100,("nt_owf_gen: pwd, nt#\n"));
|
DEBUG(100,("nt_owf_gen: pwd, nt#\n"));
|
||||||
dump_data(120, passwd, strlen(passwd));
|
dump_data(120, pwrd, strlen(pwrd));
|
||||||
dump_data(100, nt_p16, 16);
|
dump_data(100, nt_p16, 16);
|
||||||
#endif
|
#endif
|
||||||
/* clear out local copy of user's password (just being paranoid). */
|
/* clear out local copy of user's password (just being paranoid). */
|
||||||
bzero(passwd, sizeof(passwd));
|
bzero(pwrd, sizeof(pwrd));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Does both the NT and LM owfs of a user's UNICODE password */
|
/* Does both the NT and LM owfs of a user's UNICODE password */
|
||||||
@@ -253,13 +251,13 @@ void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Does the des encryption from the NT or LM MD4 hash. */
|
/* Does the des encryption from the NT or LM MD4 hash. */
|
||||||
void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24])
|
void SMBOWFencrypt(uchar pwrd[16], uchar *c8, uchar p24[24])
|
||||||
{
|
{
|
||||||
uchar p21[21];
|
uchar p21[21];
|
||||||
|
|
||||||
memset(p21,'\0',21);
|
memset(p21,'\0',21);
|
||||||
|
|
||||||
memcpy(p21, passwd, 16);
|
memcpy(p21, pwrd, 16);
|
||||||
E_P24(p21, c8, p24);
|
E_P24(p21, c8, p24);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,12 +389,12 @@ void ntv2_owf_gen(const uchar owf[16],
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Does the des encryption from the FIRST 8 BYTES of the NT or LM MD4 hash. */
|
/* Does the des encryption from the FIRST 8 BYTES of the NT or LM MD4 hash. */
|
||||||
void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24])
|
void NTLMSSPOWFencrypt(uchar pwrd[8], uchar *ntlmchalresp, uchar p24[24])
|
||||||
{
|
{
|
||||||
uchar p21[21];
|
uchar p21[21];
|
||||||
|
|
||||||
memset(p21,'\0',21);
|
memset(p21,'\0',21);
|
||||||
memcpy(p21, passwd, 8);
|
memcpy(p21, pwrd, 8);
|
||||||
memset(p21 + 8, 0xbd, 8);
|
memset(p21 + 8, 0xbd, 8);
|
||||||
|
|
||||||
E_P24(p21, ntlmchalresp, p24);
|
E_P24(p21, ntlmchalresp, p24);
|
||||||
@@ -408,13 +406,13 @@ void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24])
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[16], BOOL unicode)
|
BOOL make_oem_passwd_hash(char data[516], const char *pwrd, uchar old_pw_hash[16], BOOL unicode)
|
||||||
{
|
{
|
||||||
int new_pw_len = strlen(passwd) * (unicode ? 2 : 1);
|
int new_pw_len = strlen(pwrd) * (unicode ? 2 : 1);
|
||||||
|
|
||||||
if (new_pw_len > 512)
|
if (new_pw_len > 512)
|
||||||
{
|
{
|
||||||
DEBUG(0,("make_oem_passwd_hash: new password is too long.\n"));
|
DEBUG(0,("make_oem_pwrd_hash: new password is too long.\n"));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,16 +425,16 @@ BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[
|
|||||||
generate_random_buffer((unsigned char *)data, 516, False);
|
generate_random_buffer((unsigned char *)data, 516, False);
|
||||||
if (unicode)
|
if (unicode)
|
||||||
{
|
{
|
||||||
ascii_to_unibuf(&data[512 - new_pw_len], passwd, new_pw_len);
|
ascii_to_unibuf(&data[512 - new_pw_len], pwrd, new_pw_len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fstrcpy( &data[512 - new_pw_len], passwd);
|
fstrcpy( &data[512 - new_pw_len], pwrd);
|
||||||
}
|
}
|
||||||
SIVAL(data, 512, new_pw_len);
|
SIVAL(data, 512, new_pw_len);
|
||||||
|
|
||||||
#ifdef DEBUG_PASSWORD
|
#ifdef DEBUG_PASSWORD
|
||||||
DEBUG(100,("make_oem_passwd_hash\n"));
|
DEBUG(100,("make_oem_pwrd_hash\n"));
|
||||||
dump_data(100, data, 516);
|
dump_data(100, data, 516);
|
||||||
#endif
|
#endif
|
||||||
SamOEMhash( (unsigned char *)data, (unsigned char *)old_pw_hash, True);
|
SamOEMhash( (unsigned char *)data, (unsigned char *)old_pw_hash, True);
|
||||||
@@ -518,8 +516,8 @@ void create_ntlmssp_resp(struct pwd_info *pwd,
|
|||||||
/***********************************************************
|
/***********************************************************
|
||||||
decode a password buffer
|
decode a password buffer
|
||||||
************************************************************/
|
************************************************************/
|
||||||
BOOL decode_pw_buffer(const char buffer[516], char *new_passwd,
|
BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
|
||||||
int new_passwd_size, uint32 *new_pw_len)
|
int new_pwrd_size, uint32 *new_pw_len)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The length of the new password is in the last 4 bytes of
|
* The length of the new password is in the last 4 bytes of
|
||||||
@@ -532,14 +530,14 @@ BOOL decode_pw_buffer(const char buffer[516], char *new_passwd,
|
|||||||
dump_data(100, buffer, 516);
|
dump_data(100, buffer, 516);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((*new_pw_len) < 0 || (*new_pw_len) > new_passwd_size - 1)
|
if ((*new_pw_len) < 0 || (*new_pw_len) > new_pwrd_size - 1)
|
||||||
{
|
{
|
||||||
DEBUG(0,("check_oem_password: incorrect password length (%d).\n", (*new_pw_len)));
|
DEBUG(0,("check_oem_password: incorrect password length (%d).\n", (*new_pw_len)));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(new_passwd, &buffer[512-(*new_pw_len)], (*new_pw_len));
|
memcpy(new_pwrd, &buffer[512-(*new_pw_len)], (*new_pw_len));
|
||||||
new_passwd[(*new_pw_len)] = '\0';
|
new_pwrd[(*new_pw_len)] = '\0';
|
||||||
|
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1749,7 +1749,7 @@ BOOL listen_for_packets(BOOL run_election)
|
|||||||
BlockSignals(False, SIGUSR2);
|
BlockSignals(False, SIGUSR2);
|
||||||
#endif /* SIGUSR2 */
|
#endif /* SIGUSR2 */
|
||||||
|
|
||||||
selrtn = sys_select(256,&fds,&timeout);
|
selrtn = sys_select(256,&fds,NULL, &timeout);
|
||||||
|
|
||||||
/* We can only take signals when we are in the select - block them again here. */
|
/* We can only take signals when we are in the select - block them again here. */
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#define NO_SYSLOG
|
#define NO_SYSLOG
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#include "trans2.h"
|
|
||||||
|
|
||||||
struct user_credentials *usr_creds = NULL;
|
struct user_credentials *usr_creds = NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -287,7 +287,6 @@ BOOL cli_net_use_del(const char* srv_name,
|
|||||||
|
|
||||||
DEBUG(10,("cli_net_use_del: %s. force close: %s\n",
|
DEBUG(10,("cli_net_use_del: %s. force close: %s\n",
|
||||||
srv_name, BOOLSTR(force_close)));
|
srv_name, BOOLSTR(force_close)));
|
||||||
dbgflush();
|
|
||||||
|
|
||||||
if (strnequal("\\\\", sv_name, 2))
|
if (strnequal("\\\\", sv_name, 2))
|
||||||
{
|
{
|
||||||
@@ -321,7 +320,6 @@ BOOL cli_net_use_del(const char* srv_name,
|
|||||||
|
|
||||||
DEBUG(10,("idx: %i num_users now: %d\n",
|
DEBUG(10,("idx: %i num_users now: %d\n",
|
||||||
i, clis[i]->num_users));
|
i, clis[i]->num_users));
|
||||||
dbgflush();
|
|
||||||
|
|
||||||
if (force_close || clis[i]->num_users == 0)
|
if (force_close || clis[i]->num_users == 0)
|
||||||
{
|
{
|
||||||
@@ -336,3 +334,34 @@ BOOL cli_net_use_del(const char* srv_name,
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
enumerate client states
|
||||||
|
****************************************************************************/
|
||||||
|
void cli_net_use_enum(uint32 *num_cons, struct use_info ***use)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
*num_cons = 0;
|
||||||
|
*use = NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < num_clis; i++)
|
||||||
|
{
|
||||||
|
struct use_info item;
|
||||||
|
|
||||||
|
ZERO_STRUCT(item);
|
||||||
|
|
||||||
|
if (clis[i] == NULL) continue;
|
||||||
|
|
||||||
|
item.connected = clis[i]->cli != NULL ? True : False;
|
||||||
|
|
||||||
|
if (item.connected)
|
||||||
|
{
|
||||||
|
item.srv_name = clis[i]->cli->desthost;
|
||||||
|
item.user_name = clis[i]->cli->usr.user_name;
|
||||||
|
item.domain = clis[i]->cli->usr.domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_use_to_array(num_cons, use, &item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -653,16 +653,16 @@ void display_share_info_2(FILE *out_hnd, enum action_type action,
|
|||||||
fstring remark ;
|
fstring remark ;
|
||||||
fstring net_name;
|
fstring net_name;
|
||||||
fstring path ;
|
fstring path ;
|
||||||
fstring passwd ;
|
fstring password;
|
||||||
|
|
||||||
unistr2_to_ascii(net_name, &str2->uni_netname, sizeof(net_name)-1);
|
unistr2_to_ascii(net_name, &str2->uni_netname, sizeof(net_name)-1);
|
||||||
unistr2_to_ascii(remark, &str2->uni_remark, sizeof(remark)-1);
|
unistr2_to_ascii(remark, &str2->uni_remark, sizeof(remark)-1);
|
||||||
unistr2_to_ascii(path, &str2->uni_path, sizeof(path)-1);
|
unistr2_to_ascii(path, &str2->uni_path, sizeof(path)-1);
|
||||||
unistr2_to_ascii(passwd, &str2->uni_passwd, sizeof(passwd)-1);
|
unistr2_to_ascii(password, &str2->uni_passwd, sizeof(password)-1);
|
||||||
|
|
||||||
display_share2(out_hnd, action, net_name, info2->type, remark,
|
display_share2(out_hnd, action, net_name, info2->type, remark,
|
||||||
info2->perms, info2->max_uses, info2->num_uses,
|
info2->perms, info2->max_uses, info2->num_uses,
|
||||||
path, passwd);
|
path, password);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1149,7 +1149,7 @@ print shares on a host, level 2
|
|||||||
void display_share2(FILE *out_hnd, enum action_type action,
|
void display_share2(FILE *out_hnd, enum action_type action,
|
||||||
char *const sname, uint32 type, char *const comment,
|
char *const sname, uint32 type, char *const comment,
|
||||||
uint32 perms, uint32 max_uses, uint32 num_uses,
|
uint32 perms, uint32 max_uses, uint32 num_uses,
|
||||||
char *const path, char *const passwd)
|
char *const path, char *const password)
|
||||||
{
|
{
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
@@ -1161,7 +1161,7 @@ void display_share2(FILE *out_hnd, enum action_type action,
|
|||||||
{
|
{
|
||||||
report(out_hnd, "\t%-15.15s%-10.10s%s %x %x %x %s %s\n",
|
report(out_hnd, "\t%-15.15s%-10.10s%s %x %x %x %s %s\n",
|
||||||
sname, get_share_type_str(type), comment,
|
sname, get_share_type_str(type), comment,
|
||||||
perms, max_uses, num_uses, path, passwd);
|
perms, max_uses, num_uses, path, password);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_FOOTER:
|
case ACTION_FOOTER:
|
||||||
|
|||||||
@@ -1351,7 +1351,7 @@ static char *complete_cmd_null(char *text, int state)
|
|||||||
|
|
||||||
static void cmd_net(struct client_info *info, int argc, char *argv[])
|
static void cmd_net(struct client_info *info, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char opt;
|
int opt;
|
||||||
BOOL net_use = False;
|
BOOL net_use = False;
|
||||||
BOOL net_use_del = False;
|
BOOL net_use_del = False;
|
||||||
BOOL net_use_add = False;
|
BOOL net_use_add = False;
|
||||||
@@ -1451,7 +1451,7 @@ static void cmd_set(struct client_info *info, int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
BOOL interactive = True;
|
BOOL interactive = True;
|
||||||
char *cmd_str = NULL;
|
char *cmd_str = NULL;
|
||||||
char opt;
|
int opt;
|
||||||
extern FILE *dbf;
|
extern FILE *dbf;
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
static pstring servicesf = CONFIGFILE;
|
static pstring servicesf = CONFIGFILE;
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ BOOL receive_local_message(fd_set *fds, char *buffer, int buffer_len, int timeou
|
|||||||
to.tv_sec = timeout / 1000;
|
to.tv_sec = timeout / 1000;
|
||||||
to.tv_usec = (timeout % 1000) * 1000;
|
to.tv_usec = (timeout % 1000) * 1000;
|
||||||
|
|
||||||
selrtn = sys_select(maxfd+1,fds,&to);
|
selrtn = sys_select(maxfd+1,fds,NULL, &to);
|
||||||
|
|
||||||
/* Check if error */
|
/* Check if error */
|
||||||
if(selrtn == -1) {
|
if(selrtn == -1) {
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ static BOOL receive_message_or_smb(char *buffer, int buffer_len,
|
|||||||
to.tv_sec = timeout / 1000;
|
to.tv_sec = timeout / 1000;
|
||||||
to.tv_usec = (timeout % 1000) * 1000;
|
to.tv_usec = (timeout % 1000) * 1000;
|
||||||
|
|
||||||
selrtn = sys_select(MAX(maxfd,Client)+1,&fds,timeout>0?&to:NULL);
|
selrtn = sys_select(MAX(maxfd,Client)+1,&fds,NULL, timeout>0?&to:NULL);
|
||||||
|
|
||||||
/* Check if error */
|
/* Check if error */
|
||||||
if(selrtn == -1) {
|
if(selrtn == -1) {
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ max can be %d\n",
|
|||||||
memcpy((char *)&lfds, (char *)&listen_set,
|
memcpy((char *)&lfds, (char *)&listen_set,
|
||||||
sizeof(listen_set));
|
sizeof(listen_set));
|
||||||
|
|
||||||
num = sys_select(256,&lfds,NULL);
|
num = sys_select(256,&lfds,NULL, NULL);
|
||||||
|
|
||||||
if (num == -1 && errno == EINTR)
|
if (num == -1 && errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ static void filter_child(int c, struct in_addr dest_ip)
|
|||||||
if (s != -1) FD_SET(s, &fds);
|
if (s != -1) FD_SET(s, &fds);
|
||||||
if (c != -1) FD_SET(c, &fds);
|
if (c != -1) FD_SET(c, &fds);
|
||||||
|
|
||||||
num = sys_select(MAX(s+1, c+1),&fds,NULL);
|
num = sys_select(MAX(s+1, c+1),&fds,NULL, NULL);
|
||||||
if (num <= 0) continue;
|
if (num <= 0) continue;
|
||||||
|
|
||||||
if (c != -1 && FD_ISSET(c, &fds)) {
|
if (c != -1 && FD_ISSET(c, &fds)) {
|
||||||
@@ -184,7 +184,7 @@ static void start_filter(char *desthost)
|
|||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
FD_SET(s, &fds);
|
FD_SET(s, &fds);
|
||||||
|
|
||||||
num = sys_select(s+1,&fds,NULL);
|
num = sys_select(s+1,&fds,NULL, NULL);
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
c = accept(s, &addr, &in_addrlen);
|
c = accept(s, &addr, &in_addrlen);
|
||||||
if (c != -1) {
|
if (c != -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user