summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-12-01 02:15:14 +0000
committerLuke Leighton <lkcl@samba.org>1999-12-01 02:15:14 +0000
commit6ddfc68e0496dc41f8c9a022a0b04a2066b43c9d (patch)
tree2f8a0996fe269f79e86d6336e4520d3278b442ed
parent7e42174792298c8815acd1ebf34c357aff0de7c3 (diff)
downloadsamba-6ddfc68e0496dc41f8c9a022a0b04a2066b43c9d.tar.gz
samba-6ddfc68e0496dc41f8c9a022a0b04a2066b43c9d.tar.bz2
samba-6ddfc68e0496dc41f8c9a022a0b04a2066b43c9d.zip
sys_select added one more argument (read, write selectors).
(This used to be commit e4d92ff9dfc51735e6932748f66a7c20b2c1cb6a)
-rw-r--r--source3/Makefile.in14
-rw-r--r--source3/client/client.c2
-rw-r--r--source3/client/smbmount.c2
-rw-r--r--source3/include/includes.h1
-rw-r--r--source3/include/proto.h194
-rw-r--r--source3/include/smb.h8
-rw-r--r--source3/lib/system.c7
-rw-r--r--source3/lib/util.c2
-rw-r--r--source3/lib/util_array.c71
-rw-r--r--source3/lib/util_sock.c2
-rw-r--r--source3/libsmb/clientgen.c72
-rw-r--r--source3/libsmb/nmblib.c2
-rw-r--r--source3/libsmb/smbencrypt.c102
-rw-r--r--source3/nmbd/nmbd_packets.c2
-rw-r--r--source3/rpc_client/cli_connect.c1
-rw-r--r--source3/rpc_client/cli_use.c33
-rw-r--r--source3/rpcclient/display_srv.c10
-rw-r--r--source3/rpcclient/rpcclient.c4
-rw-r--r--source3/smbd/oplock.c2
-rw-r--r--source3/smbd/process.c2
-rw-r--r--source3/smbd/server.c2
-rw-r--r--source3/utils/smbfilter.c4
22 files changed, 323 insertions, 216 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 8f4bfbc5df..42e7e07e36 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -256,7 +256,15 @@ SMBPASSWD_OBJ = utils/smbpasswd.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
$(UBIQX_OBJ) $(RPC_CLIENT_OBJ) $(RPC_PARSE_OBJ) $(LIB_OBJ)
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_wkssvc.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)
+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) \
$(UBIQX_OBJ) $(LIB_OBJ)
diff --git a/source3/client/client.c b/source3/client/client.c
index e27e169405..180aa493ba 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -1514,7 +1514,7 @@ static void wait_keyboard(void)
timeout.tv_sec = 20;
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))
return;
diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c
index 4b0cd7dff7..3fad6674fb 100644
--- a/source3/client/smbmount.c
+++ b/source3/client/smbmount.c
@@ -609,7 +609,7 @@ static void wait_keyboard(char *buffer)
timeout.tv_sec = 20;
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))
return;
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 4437e8710f..1379494ecb 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -55,6 +55,7 @@
#endif
+#include <sys/un.h>
#include <sys/types.h>
#ifdef TIME_WITH_SYS_TIME
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 2dc9a7279b..3d75d26ae8 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -324,8 +324,8 @@ int smbrun(char *cmd,char *outfile,BOOL shared);
/*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,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 *r_fds, fd_set *w_fds, struct timeval *tval);
int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
int sys_fstat(int fd,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*(item_dup)(const void*), BOOL alloc_anyway);
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);
char* add_chars_to_array(uint32 *len, char ***array, const char *name);
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 *user_domain);
BOOL cli_session_setup(struct cli_state *cli,
- char *user,
+ char *myhostname, char *user,
char *pass, int passlen,
char *ntpass, int ntpasslen,
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 */
-void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24);
-void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24);
-void E_md4hash(uchar *passwd, uchar *p16);
+void SMBencrypt(uchar *pwrd, uchar *c8, uchar *p24);
+void SMBNTencrypt(uchar *pwrd, uchar *c8, uchar *p24);
+void E_md4hash(uchar *pwrd, uchar *p16);
void lm_owf_genW(const UNISTR2 *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_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_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],
const uchar *srv_chal, int srv_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 *domain_n,
uchar kr_buf[16]);
-void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24]);
-BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[16], BOOL unicode);
+void NTLMSSPOWFencrypt(uchar pwrd[8], uchar *ntlmchalresp, uchar p24[24]);
+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);
void create_ntlmssp_resp(struct pwd_info *pwd,
char *domain, char *user_name, char *my_name,
uint32 ntlmssp_cli_flgs,
prs_struct *auth_resp);
-BOOL decode_pw_buffer(const char buffer[516], char *new_passwd,
- int new_passwd_size, uint32 *new_pw_len);
+BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
+ int new_pwrd_size, uint32 *new_pw_len);
BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
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,
BOOL force_close,
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 */
@@ -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[]);
-/*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_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,
char *const sname, uint32 type, char *const comment,
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,
char *const sname);
-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);
-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);
+
+/*The following definitions come from rpcclient/display_svc.c */
+
char *get_svc_start_type_str(uint32 type);
void display_query_svc_cfg(FILE *out_hnd, enum action_type action,
const QUERY_SERVICE_CONFIG *const cfg);
void display_svc_info(FILE *out_hnd, enum action_type action,
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,
- 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);
+
+/*The following definitions come from rpcclient/display_sync.c */
+
void display_sam_sync_ctr(FILE *out_hnd, enum action_type action,
SAM_DELTA_HDR *const delta,
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_CTR *const ctr,
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 */
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 60bf7d715c..ebc0e7ad9e 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -352,6 +352,14 @@ struct sam_disp_info
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 */
/* DOM_SID - security id */
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 5a5f853bda..f9de800bd3 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -60,7 +60,7 @@ static int pollfd(int fd)
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;
int counter=0;
@@ -90,7 +90,7 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
}
#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
struct pollfd pfd[256];
@@ -131,7 +131,8 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
do {
if (tval) memcpy((void *)&t2,(void *)tval,sizeof(t2));
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);
return(selrtn);
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 26f0482162..9bcbe1a9c7 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1148,7 +1148,7 @@ void msleep(int t)
FD_ZERO(&fds);
errno = 0;
- sys_select(0,&fds,&tval);
+ sys_select(0,&fds,NULL, &tval);
GetTimeOfDay(&t2);
tdiff = TvalDiff(&t1,&t2);
diff --git a/source3/lib/util_array.c b/source3/lib/util_array.c
index 62be3f17bd..71cd19e65d 100644
--- a/source3/lib/util_array.c
+++ b/source3/lib/util_array.c
@@ -77,6 +77,69 @@ void* add_item_to_array(uint32 *len, void ***array, void *item)
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(*fn)(void*) = (void(*)(void*))&free;
@@ -175,7 +238,7 @@ static PRINTER_INFO_2 *prt2_dup(const PRINTER_INFO_2* from)
}
else
{
- memset(copy, 0, sizeof(*copy));
+ ZERO_STRUCTP(copy);
}
}
return copy;
@@ -206,7 +269,7 @@ static PRINTER_INFO_1 *prt1_dup(const PRINTER_INFO_1* from)
}
else
{
- memset(copy, 0, sizeof(*copy));
+ ZERO_STRUCTP(copy);
}
}
return copy;
@@ -237,7 +300,7 @@ static JOB_INFO_1 *job1_dup(const JOB_INFO_1* from)
}
else
{
- memset(copy, 0, sizeof(*copy));
+ ZERO_STRUCTP(copy);
}
}
return copy;
@@ -268,7 +331,7 @@ static JOB_INFO_2 *job2_dup(const JOB_INFO_2* from)
}
else
{
- memset(copy, 0, sizeof(*copy));
+ ZERO_STRUCTP(copy);
}
}
return copy;
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 50c295f2bd..fc5c2958e4 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -287,7 +287,7 @@ ssize_t read_with_timeout(int fd,char *buf,size_t mincnt,size_t maxcnt,unsigned
FD_ZERO(&fds);
FD_SET(fd,&fds);
- selrtn = sys_select(fd+1,&fds,&timeout);
+ selrtn = sys_select(fd+1,&fds,NULL, &timeout);
/* Check if error */
if(selrtn == -1) {
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 06fa97df0c..f3bd08895d 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -918,9 +918,11 @@ BOOL cli_session_setup_x(struct cli_state *cli,
}
static BOOL cli_calc_session_pwds(struct cli_state *cli,
+ char *myhostname,
char *pword, char *ntpword,
char *pass, int *passlen,
char *ntpass, int *ntpasslen,
+ char *sess_key,
BOOL ntlmv2)
{
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)
{
- /* passlen != 0, ntpasslen != 0 && server supports encryption */
- if (ntlmv2)
+ if (cli->use_ntlmv2 != False)
{
- /* plain-text password requesting to be encrypted */
- uchar *srv_key = (uchar *)cli->cryptkey;
- uchar nt_owf[16];
- 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);
-
- 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
-
+ DEBUG(10,("cli_establish_connection: NTLMv2\n"));
+ pwd_make_lm_nt_owf2(&(cli->usr.pwd), cli->cryptkey,
+ cli->usr.user_name, myhostname,
+ cli->usr.domain);
}
else
{
- /* plain-text password requesting to be encrypted */
- uchar *key = (uchar *)cli->cryptkey;
- SMBencrypt ((uchar *)pass , key,(uchar *)pword );
- SMBNTencrypt((uchar *)ntpass, key,(uchar *)ntpword);
- *passlen = 24;
- *ntpasslen = 24;
+ DEBUG(10,("cli_establish_connection: NTLMv1\n"));
+ pwd_make_lm_nt_owf(&(cli->usr.pwd), cli->cryptkey);
}
+
+ pwd_get_lm_nt_owf(&(cli->usr.pwd), pass, ntpass,
+ ntpasslen, sess_key);
+
+ *passlen = 24;
}
return True;
}
@@ -1059,7 +1025,7 @@ static BOOL cli_calc_session_pwds(struct cli_state *cli,
send a session setup
****************************************************************************/
BOOL cli_session_setup(struct cli_state *cli,
- char *user,
+ char *myhostname, char *user,
char *pass, int passlen,
char *ntpass, int ntpasslen,
char *user_domain)
@@ -1073,9 +1039,10 @@ BOOL cli_session_setup(struct cli_state *cli,
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,
- ntpass, &ntpasslen, cli->use_ntlmv2) &&
+ ntpass, &ntpasslen, cli->sess_key,
+ cli->use_ntlmv2) &&
cli_session_setup_x(cli, user, pass, passlen, ntpass, ntpasslen,
user_domain);
}
@@ -3238,7 +3205,8 @@ BOOL cli_establish_connection(struct cli_state *cli,
}
/* 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,
ntpasswd, ntpass_len,
cli->usr.domain))
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c
index 9dca4731ad..ba951a809a 100644
--- a/source3/libsmb/nmblib.c
+++ b/source3/libsmb/nmblib.c
@@ -908,7 +908,7 @@ struct packet_struct *receive_packet(int fd,enum packet_type type,int t)
timeout.tv_sec = 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))
return(read_packet(fd,type));
diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c
index ace6cdc300..34e6f43975 100644
--- a/source3/libsmb/smbencrypt.c
+++ b/source3/libsmb/smbencrypt.c
@@ -24,17 +24,15 @@
extern int DEBUGLEVEL;
-#include "byteorder.h"
-
/*
This implements the X/Open SMB password encryption
It takes a password, a 8 byte "crypt key" and puts 24 bytes of
encrypted password into p24 */
-void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24)
+void SMBencrypt(uchar *pwrd, uchar *c8, uchar *p24)
{
uchar p21[21];
- lm_owf_gen(passwd, p21);
+ lm_owf_gen(pwrd, p21);
SMBOWFencrypt(p21, c8, p24);
#ifdef DEBUG_PASSWORD
@@ -45,13 +43,13 @@ void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24)
#endif
}
-void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24)
+void SMBNTencrypt(uchar *pwrd, uchar *c8, uchar *p24)
{
uchar p21[21];
memset(p21,'\0',21);
- nt_owf_gen(passwd, p21);
+ nt_owf_gen(pwrd, p21);
SMBOWFencrypt(p21, c8, p24);
#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.
*/
-void E_md4hash(uchar *passwd, uchar *p16)
+void E_md4hash(uchar *pwrd, uchar *p16)
{
int len;
int16 wpwd[129];
/* Password cannot be longer than 128 characters */
- len = strlen((char *)passwd);
+ len = strlen((char *)pwrd);
if(len > 128)
len = 128;
/* 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 */
/* Calculate length in bytes */
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 */
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)
{
- unistr2_to_ascii( passwd, pwd, sizeof(passwd)-1);
+ unistr2_to_ascii( pwrd, pwd, sizeof(pwrd)-1);
}
/* Mangle the passwords into Lanman format */
- passwd[14] = '\0';
- strupper(passwd);
+ pwrd[14] = '\0';
+ strupper(pwrd);
/* Calculate the SMB (lanman) hash functions of the password */
memset(p16, '\0', 16);
- E_P16((uchar *) passwd, (uchar *)p16);
+ E_P16((uchar *) pwrd, (uchar *)p16);
#ifdef DEBUG_PASSWORD
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);
#endif
/* 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 */
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)
{
- safe_strcpy( passwd, pwd, sizeof(passwd)-1);
+ safe_strcpy( pwrd, pwd, sizeof(pwrd)-1);
}
/* Mangle the passwords into Lanman format */
- passwd[14] = '\0';
- strupper(passwd);
+ pwrd[14] = '\0';
+ strupper(pwrd);
/* Calculate the SMB (lanman) hash functions of the password */
memset(p16, '\0', 16);
- E_P16((uchar *) passwd, (uchar *)p16);
+ E_P16((uchar *) pwrd, (uchar *)p16);
#ifdef DEBUG_PASSWORD
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);
#endif
/* 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 */
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)
{
- copy_unistr2(&passwd, pwd);
+ copy_unistr2(&pwrd, pwd);
}
/* Calculate the MD4 hash (NT compatible) of the password */
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
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);
#endif
/* 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 */
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)
{
- safe_strcpy( passwd, pwd, sizeof(passwd)-1);
+ safe_strcpy( pwrd, pwd, sizeof(pwrd)-1);
}
/* Calculate the MD4 hash (NT compatible) of the password */
memset(nt_p16, '\0', 16);
- E_md4hash((uchar *)passwd, nt_p16);
+ E_md4hash((uchar *)pwrd, nt_p16);
#ifdef DEBUG_PASSWORD
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);
#endif
/* 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 */
@@ -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. */
-void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24])
+void SMBOWFencrypt(uchar pwrd[16], uchar *c8, uchar p24[24])
{
uchar p21[21];
memset(p21,'\0',21);
- memcpy(p21, passwd, 16);
+ memcpy(p21, pwrd, 16);
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. */
-void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24])
+void NTLMSSPOWFencrypt(uchar pwrd[8], uchar *ntlmchalresp, uchar p24[24])
{
uchar p21[21];
memset(p21,'\0',21);
- memcpy(p21, passwd, 8);
+ memcpy(p21, pwrd, 8);
memset(p21 + 8, 0xbd, 8);
E_P24(p21, ntlmchalresp, p24);
@@ -408,13 +406,13 @@ void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24])
#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)
{
- 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;
}
@@ -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);
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
{
- fstrcpy( &data[512 - new_pw_len], passwd);
+ fstrcpy( &data[512 - new_pw_len], pwrd);
}
SIVAL(data, 512, new_pw_len);
#ifdef DEBUG_PASSWORD
- DEBUG(100,("make_oem_passwd_hash\n"));
+ DEBUG(100,("make_oem_pwrd_hash\n"));
dump_data(100, data, 516);
#endif
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
************************************************************/
-BOOL decode_pw_buffer(const char buffer[516], char *new_passwd,
- int new_passwd_size, uint32 *new_pw_len)
+BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
+ int new_pwrd_size, uint32 *new_pw_len)
{
/*
* 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);
#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)));
return False;
}
- memcpy(new_passwd, &buffer[512-(*new_pw_len)], (*new_pw_len));
- new_passwd[(*new_pw_len)] = '\0';
+ memcpy(new_pwrd, &buffer[512-(*new_pw_len)], (*new_pw_len));
+ new_pwrd[(*new_pw_len)] = '\0';
return True;
}
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index c39699f822..66c774a6e9 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -1749,7 +1749,7 @@ BOOL listen_for_packets(BOOL run_election)
BlockSignals(False, 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. */
diff --git a/source3/rpc_client/cli_connect.c b/source3/rpc_client/cli_connect.c
index 0baa279711..d2d23864c3 100644
--- a/source3/rpc_client/cli_connect.c
+++ b/source3/rpc_client/cli_connect.c
@@ -23,7 +23,6 @@
#define NO_SYSLOG
#include "includes.h"
-#include "trans2.h"
struct user_credentials *usr_creds = NULL;
diff --git a/source3/rpc_client/cli_use.c b/source3/rpc_client/cli_use.c
index 2f79d4c2cf..a2559fbaab 100644
--- a/source3/rpc_client/cli_use.c
+++ b/source3/rpc_client/cli_use.c
@@ -287,7 +287,6 @@ BOOL cli_net_use_del(const char* srv_name,
DEBUG(10,("cli_net_use_del: %s. force close: %s\n",
srv_name, BOOLSTR(force_close)));
- dbgflush();
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",
i, clis[i]->num_users));
- dbgflush();
if (force_close || clis[i]->num_users == 0)
{
@@ -336,3 +334,34 @@ BOOL cli_net_use_del(const char* srv_name,
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);
+ }
+}
+
diff --git a/source3/rpcclient/display_srv.c b/source3/rpcclient/display_srv.c
index 9b6cd4b350..f0069c0d53 100644
--- a/source3/rpcclient/display_srv.c
+++ b/source3/rpcclient/display_srv.c
@@ -653,16 +653,16 @@ void display_share_info_2(FILE *out_hnd, enum action_type action,
fstring remark ;
fstring net_name;
fstring path ;
- fstring passwd ;
+ fstring password;
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(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,
info2->perms, info2->max_uses, info2->num_uses,
- path, passwd);
+ path, password);
break;
}
@@ -1149,7 +1149,7 @@ print shares on a host, level 2
void display_share2(FILE *out_hnd, enum action_type action,
char *const sname, uint32 type, char *const comment,
uint32 perms, uint32 max_uses, uint32 num_uses,
- char *const path, char *const passwd)
+ char *const path, char *const password)
{
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",
sname, get_share_type_str(type), comment,
- perms, max_uses, num_uses, path, passwd);
+ perms, max_uses, num_uses, path, password);
break;
}
case ACTION_FOOTER:
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index f5dbe3245b..a8546b7733 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -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[])
{
- char opt;
+ int opt;
BOOL net_use = False;
BOOL net_use_del = 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;
char *cmd_str = NULL;
- char opt;
+ int opt;
extern FILE *dbf;
extern char *optarg;
static pstring servicesf = CONFIGFILE;
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 1455b4d8e5..99fe7a69fa 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -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_usec = (timeout % 1000) * 1000;
- selrtn = sys_select(maxfd+1,fds,&to);
+ selrtn = sys_select(maxfd+1,fds,NULL, &to);
/* Check if error */
if(selrtn == -1) {
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 1a6ec320e1..95222d3f51 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -173,7 +173,7 @@ static BOOL receive_message_or_smb(char *buffer, int buffer_len,
to.tv_sec = timeout / 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 */
if(selrtn == -1) {
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index a0c9ab7c56..5512e6e56b 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -207,7 +207,7 @@ max can be %d\n",
memcpy((char *)&lfds, (char *)&listen_set,
sizeof(listen_set));
- num = sys_select(256,&lfds,NULL);
+ num = sys_select(256,&lfds,NULL, NULL);
if (num == -1 && errno == EINTR)
continue;
diff --git a/source3/utils/smbfilter.c b/source3/utils/smbfilter.c
index 4f6420c767..643a3ed2ce 100644
--- a/source3/utils/smbfilter.c
+++ b/source3/utils/smbfilter.c
@@ -120,7 +120,7 @@ static void filter_child(int c, struct in_addr dest_ip)
if (s != -1) FD_SET(s, &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 (c != -1 && FD_ISSET(c, &fds)) {
@@ -184,7 +184,7 @@ static void start_filter(char *desthost)
FD_ZERO(&fds);
FD_SET(s, &fds);
- num = sys_select(s+1,&fds,NULL);
+ num = sys_select(s+1,&fds,NULL, NULL);
if (num > 0) {
c = accept(s, &addr, &in_addrlen);
if (c != -1) {