summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/chgpasswd.c13
-rw-r--r--source3/smbd/ipc.c2
-rw-r--r--source3/smbd/password.c7
-rw-r--r--source3/smbd/trans2.c36
4 files changed, 41 insertions, 17 deletions
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 */