diff options
author | Jeremy Allison <jra@samba.org> | 1998-10-21 16:58:34 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-10-21 16:58:34 +0000 |
commit | 6e3af45afe237790f1d7cd94ab2b22e1ca772157 (patch) | |
tree | c0870e0739564cff7c19e2a900d3c701e1ebb33a /source3 | |
parent | ac9be4ddca99c5efae518a985b97fb1fb6374289 (diff) | |
download | samba-6e3af45afe237790f1d7cd94ab2b22e1ca772157.tar.gz samba-6e3af45afe237790f1d7cd94ab2b22e1ca772157.tar.bz2 samba-6e3af45afe237790f1d7cd94ab2b22e1ca772157.zip |
Fixed mainly signed/unsigned issues found by SGI cc in -fullwarn mode.
smbd/chgpasswd.c: Fixed (my) stupid bug where I was returning stack based variables. Doh !
smbd/trans2.c: Allows SETFILEINFO as well as QFILEINFO on directory handles.
Jeremy.
(This used to be commit 0b44d27d0b5cc3948a6c2d78370ccddf1a84cd80)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 12 | ||||
-rw-r--r-- | source3/rpc_client/cli_pipe.c | 4 | ||||
-rw-r--r-- | source3/rpc_client/cli_samr.c | 4 | ||||
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 6 | ||||
-rw-r--r-- | source3/rpc_server/srv_util.c | 2 | ||||
-rw-r--r-- | source3/rpcclient/cmd_netlogon.c | 2 | ||||
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 4 | ||||
-rw-r--r-- | source3/smbd/chgpasswd.c | 13 | ||||
-rw-r--r-- | source3/smbd/ipc.c | 2 | ||||
-rw-r--r-- | source3/smbd/password.c | 7 | ||||
-rw-r--r-- | source3/smbd/trans2.c | 36 |
11 files changed, 58 insertions, 34 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 206c1b309a..83848e45e7 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1277,8 +1277,8 @@ BOOL get_samr_query_userinfo(struct cli_state *cli, uint32 user_rid, SAM_USER_INFO_21 *usr); BOOL do_samr_chgpasswd_user(struct cli_state *cli, char *srv_name, char *user_name, - char nt_newpass[516], char nt_oldhash[16], - char lm_newpass[516], char lm_oldhash[16]); + char nt_newpass[516], uchar nt_oldhash[16], + char lm_newpass[516], uchar lm_oldhash[16]); BOOL do_samr_unknown_38(struct cli_state *cli, char *srv_name); BOOL do_samr_unknown_8(struct cli_state *cli, POLICY_HND *domain_pol, uint16 switch_value); @@ -1750,12 +1750,12 @@ void make_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u); void samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, int depth); void make_enc_passwd(SAMR_ENC_PASSWD *pwd, char pass[512]); void samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int depth); -void make_enc_hash(SAMR_ENC_HASH *hsh, char hash[16]); +void make_enc_hash(SAMR_ENC_HASH *hsh, uchar hash[16]); void samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth); void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, char *dest_host, char *user_name, - char nt_newpass[516], char nt_oldhash[16], - char lm_newpass[516], char lm_oldhash[16]); + char nt_newpass[516], uchar nt_oldhash[16], + char lm_newpass[516], uchar lm_oldhash[16]); void samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct *ps, int depth); void make_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER *r_u, uint32 status); void samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct *ps, int depth); @@ -2210,7 +2210,7 @@ BOOL smb_password_check(char *password, unsigned char *part_passwd, unsigned cha BOOL smb_password_ok(struct smb_passwd *smb_pass, uchar chal[8], uchar lm_pass[24], uchar nt_pass[24]); BOOL pass_check_smb(char *user, char *domain, - uchar *chal, char *lm_pwd, char *nt_pwd, + uchar *chal, uchar *lm_pwd, uchar *nt_pwd, struct passwd *pwd); BOOL password_ok(char *user, char *password, int pwlen, struct passwd *pwd); BOOL user_ok(char *user,int snum); diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index e412bad2a7..15025ceef3 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -104,7 +104,7 @@ static BOOL rpc_read(struct cli_state *cli, DEBUG(5,("rpc_read: offset end: 0x%x. data left to read:0x%x\n", rdata->data->offset.end, data_to_read)); - return rdata->data->data != NULL; + return True; } /**************************************************************************** @@ -229,7 +229,6 @@ static BOOL rpc_api_pipe(struct cli_state *cli, uint16 cmd, prs_struct *rparam, prs_struct *rdata) { int len; - int alloc_hint = 0; uint16 setup[2]; /* only need 2 uint16 setup parameters */ uint32 err; @@ -303,7 +302,6 @@ static BOOL rpc_api_pipe(struct cli_state *cli, uint16 cmd, { RPC_HDR_RESP rhdr_resp; smb_io_rpc_hdr_resp("rpc_hdr_resp", &rhdr_resp, rdata, 0); - alloc_hint = rhdr_resp.alloc_hint; } DEBUG(5,("rpc_api_pipe: len left: %d smbtrans read: %d\n", diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index fae96b561c..294317acc2 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -102,8 +102,8 @@ do a SAMR change user password command ****************************************************************************/ BOOL do_samr_chgpasswd_user(struct cli_state *cli, char *srv_name, char *user_name, - char nt_newpass[516], char nt_oldhash[16], - char lm_newpass[516], char lm_oldhash[16]) + char nt_newpass[516], uchar nt_oldhash[16], + char lm_newpass[516], uchar lm_oldhash[16]) { prs_struct data; prs_struct rdata; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 58f726b6e4..40041e67c5 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2682,7 +2682,7 @@ void samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int de /******************************************************************* makes a SAMR_ENC_HASH structure. ********************************************************************/ -void make_enc_hash(SAMR_ENC_HASH *hsh, char hash[16]) +void make_enc_hash(SAMR_ENC_HASH *hsh, uchar hash[16]) { if (hsh == NULL) return; @@ -2711,8 +2711,8 @@ makes a SAMR_R_UNKNOWN_38 structure. ********************************************************************/ void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, char *dest_host, char *user_name, - char nt_newpass[516], char nt_oldhash[16], - char lm_newpass[516], char lm_oldhash[16]) + char nt_newpass[516], uchar nt_oldhash[16], + char lm_newpass[516], uchar lm_oldhash[16]) { int len_dest_host = strlen(dest_host); int len_user_name = strlen(user_name); diff --git a/source3/rpc_server/srv_util.c b/source3/rpc_server/srv_util.c index fde654bcc4..3269ab4e61 100644 --- a/source3/rpc_server/srv_util.c +++ b/source3/rpc_server/srv_util.c @@ -339,7 +339,7 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p) become_root(True); p->ntlmssp_validated = pass_check_smb(p->user_name, p->domain, (uchar*)p->ntlmssp_chal.challenge, - (char*)lm_owf, (char*)nt_owf, NULL); + lm_owf, nt_owf, NULL); smb_pass = getsmbpwnam(p->user_name); unbecome_root(True); diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index d5ca2b2b1d..8e65e9a7b5 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -51,11 +51,13 @@ void cmd_netlogon_login_test(struct client_info *info) char *nt_password; unsigned char trust_passwd[16]; +#if 0 /* machine account passwords */ pstring new_mach_pwd; /* initialisation */ new_mach_pwd[0] = 0; +#endif if (!next_token(NULL, nt_user_name, NULL, sizeof(nt_user_name))) { diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index fa4c631899..f14c84d6b9 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -99,8 +99,8 @@ void cmd_sam_ntchange_pwd(struct client_info *info) /* establish a connection. */ res = res ? do_samr_chgpasswd_user(smb_cli, srv_name, smb_cli->user_name, - nt_newpass, (char*)nt_hshhash, - lm_newpass, (char*)lm_hshhash) : False; + nt_newpass, nt_hshhash, + lm_newpass, lm_hshhash) : False; /* close the session */ cli_nt_session_close(smb_cli); diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c index 91062268f9..59022c80a8 100644 --- a/source3/smbd/chgpasswd.c +++ b/source3/smbd/chgpasswd.c @@ -455,9 +455,9 @@ BOOL chgpasswd(char *name,char *oldpass,char *newpass, BOOL as_root) BOOL check_lanman_password(char *user, uchar *pass1, uchar *pass2, struct smb_passwd **psmbpw) { + static uchar null_pw[16]; uchar unenc_new_pw[16]; uchar unenc_old_pw[16]; - uchar null_pw[16]; struct smb_passwd *smbpw; *psmbpw = NULL; @@ -482,7 +482,7 @@ BOOL check_lanman_password(char *user, uchar *pass1, { uchar no_pw[14]; memset(no_pw, '\0', 14); - E_P16((uchar *)no_pw, (uchar *)null_pw); + E_P16(no_pw, null_pw); smbpw->smb_passwd = null_pw; } else if (smbpw->smb_passwd == NULL) { DEBUG(0,("check_lanman_password: no lanman password !\n")); @@ -514,8 +514,8 @@ BOOL check_lanman_password(char *user, uchar *pass1, BOOL change_lanman_password(struct smb_passwd *smbpw, uchar *pass1, uchar *pass2) { + static uchar null_pw[16]; uchar unenc_new_pw[16]; - uchar null_pw[16]; BOOL ret; if (smbpw == NULL) @@ -534,7 +534,7 @@ BOOL change_lanman_password(struct smb_passwd *smbpw, uchar *pass1, uchar *pass2 { uchar no_pw[14]; memset(no_pw, '\0', 14); - E_P16((uchar *)no_pw, (uchar *)null_pw); + E_P16(no_pw, null_pw); smbpw->smb_passwd = null_pw; } else if (smbpw->smb_passwd == NULL) { DEBUG(0,("change_lanman_password: no lanman password !\n")); @@ -605,15 +605,16 @@ BOOL check_oem_password(char *user, struct smb_passwd **psmbpw, char *new_passwd, int new_passwd_size) { + static uchar null_pw[16]; + static uchar null_ntpw[16]; struct smb_passwd *smbpw = NULL; int new_pw_len; uchar new_ntp16[16]; uchar unenc_old_ntpw[16]; uchar new_p16[16]; uchar unenc_old_pw[16]; - uchar null_pw[16]; - uchar null_ntpw[16]; char no_pw[2]; + BOOL nt_pass_set = (ntdata != NULL && nthash != NULL); become_root(False); diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 4e4eeb40ca..112a79b5ca 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -1732,7 +1732,7 @@ static BOOL api_SamOEMChangePassword(connection_struct *conn,uint16 vuid, char * */ (void)Get_Pwnam( user, True); - if (pass_oem_change(user, (uchar*) data, (uchar*)(&data[516]), NULL, NULL)) + if (pass_oem_change(user, (uchar*) data, (uchar *)&data[516], NULL, NULL)) { SSVAL(*rparam,0,NERR_Success); } diff --git a/source3/smbd/password.c b/source3/smbd/password.c index eac8c9cd65..95560df66b 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -458,8 +458,9 @@ check if a username/password is OK assuming the password is a 24 byte SMB hash return True if the password is correct, False otherwise ****************************************************************************/ + BOOL pass_check_smb(char *user, char *domain, - uchar *chal, char *lm_pwd, char *nt_pwd, + uchar *chal, uchar *lm_pwd, uchar *nt_pwd, struct passwd *pwd) { struct passwd *pass; @@ -513,7 +514,7 @@ BOOL pass_check_smb(char *user, char *domain, return(True); } - if (smb_password_ok(smb_pass, chal, (uchar *)lm_pwd, (uchar *)nt_pwd)) + if (smb_password_ok(smb_pass, chal, lm_pwd, nt_pwd)) { return(True); } @@ -541,7 +542,7 @@ BOOL password_ok(char *user, char *password, int pwlen, struct passwd *pwd) } return pass_check_smb(user, global_myworkgroup, - challenge, password, password, pwd); + challenge, (uchar *)password, (uchar *)password, pwd); } return pass_check(user, password, pwlen, pwd, diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 35bd10fb13..5b057410ca 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1500,15 +1500,37 @@ static int call_trans2setfilepathinfo(connection_struct *conn, files_struct *fsp = file_fsp(params,0); info_level = SVAL(params,2); - CHECK_FSP(fsp,conn); - CHECK_ERROR(fsp); + if(fsp && fsp->open && fsp->is_directory) { + /* + * This is actually a SETFILEINFO on a directory + * handle (returned from an NT SMB). NT5.0 seems + * to do this call. JRA. + */ + fname = fsp->fsp_name; + unix_convert(fname,conn,0,&bad_path,&st); + if (!check_name(fname,conn) || (!VALID_STAT(st) && dos_stat(fname,&st))) { + DEBUG(3,("fileinfo of %s failed (%s)\n",fname,strerror(errno))); + if((errno == ENOENT) && bad_path) + { + unix_ERR_class = ERRDOS; + unix_ERR_code = ERRbadpath; + } + return(UNIXERROR(ERRDOS,ERRbadpath)); + } + } else { + /* + * Original code - this is an open file. + */ + CHECK_FSP(fsp,conn); + CHECK_ERROR(fsp); - fname = fsp->fsp_name; - fd = fsp->fd_ptr->fd; + fname = fsp->fsp_name; + fd = fsp->fd_ptr->fd; - if(sys_fstat(fd,&st)!=0) { - DEBUG(3,("fstat of %s failed (%s)\n", fname, strerror(errno))); - return(UNIXERROR(ERRDOS,ERRbadpath)); + if (sys_fstat(fd,&st) != 0) { + DEBUG(3,("fstat of fnum %d failed (%s)\n",fsp->fnum, strerror(errno))); + return(UNIXERROR(ERRDOS,ERRbadfid)); + } } } else { /* set path info */ |