Commit f85d7dfa authored by Steve French's avatar Steve French Committed by Steve French

[CIFS] Fix endianness bug in new cifs_readdir2 in calculating dir entry name...

[CIFS] Fix endianness bug in new cifs_readdir2 in calculating dir entry name length. Fix "badness in" message on rmmod cifs caused by rename of 
/proc/fs/cifs/NewReaddirEnabled config switch (pointed out by Shaggy).   

Fix improper clearing of UNIX_BASIC_INFO cifs struct. 
Pointed out by Stefan Rompf.

Signed-off-by: David Kleikamp (shaggy@austin.ibm.com)
Signed-off-by: Steve French (sfrench@us.ibm.com)
parent a726658d
......@@ -2,7 +2,8 @@ Version 1.26
------------
Add setfacl support to allow setting of ACLs remotely to Samba 3.10 and later
and other POSIX CIFS compliant servers. Fix error mapping for getfacl
to EOPNOTSUPP when server does not support posix acls on the wire.
to EOPNOTSUPP when server does not support posix acls on the wire. Fix
improperly zeroed buffer in CIFS Unix extensions set times call.
Version 1.25
------------
......
......@@ -403,7 +403,7 @@ cifs_proc_clean(void)
remove_proc_entry("ExtendedSecurity",proc_fs_cifs);
remove_proc_entry("PacketSigningEnabled",proc_fs_cifs);
remove_proc_entry("LinuxExtensionsEnabled",proc_fs_cifs);
remove_proc_entry("NewReaddirEnabled",proc_fs_cifs);
remove_proc_entry("ReenableOldCifsReaddirCode",proc_fs_cifs);
remove_proc_entry("LookupCacheEnabled",proc_fs_cifs);
remove_proc_entry("cifs", proc_root_fs);
}
......
......@@ -3636,6 +3636,7 @@ CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon,
data_offset =
(FILE_UNIX_BASIC_INFO *) ((char *) &pSMB->hdr.Protocol +
offset);
memset(data_offset, 0, count);
pSMB->DataOffset = cpu_to_le16(offset);
pSMB->ParameterOffset = cpu_to_le16(param_offset);
pSMB->SetupCount = 1;
......
......@@ -151,7 +151,7 @@ static char * nxt_dir_entry(char * old_entry, char * end_of_smb)
char * new_entry;
FILE_DIRECTORY_INFO * pDirInfo = (FILE_DIRECTORY_INFO *)old_entry;
new_entry = old_entry + pDirInfo->NextEntryOffset;
new_entry = old_entry + le32_to_cpu(pDirInfo->NextEntryOffset);
cFYI(1,("new entry %p old entry %p",new_entry,old_entry));
/* validate that new_entry is not past end of SMB */
if(new_entry >= end_of_smb) {
......@@ -184,22 +184,22 @@ static int cifs_entry_is_dot(char * current_entry, struct cifsFileInfo * cfile)
FILE_DIRECTORY_INFO * pFindData =
(FILE_DIRECTORY_INFO *)current_entry;
filename = &pFindData->FileName[0];
len = pFindData->FileNameLength;
len = le32_to_cpu(pFindData->FileNameLength);
} else if(cfile->srch_inf.info_level == 0x102) {
FILE_FULL_DIRECTORY_INFO * pFindData =
(FILE_FULL_DIRECTORY_INFO *)current_entry;
filename = &pFindData->FileName[0];
len = pFindData->FileNameLength;
len = le32_to_cpu(pFindData->FileNameLength);
} else if(cfile->srch_inf.info_level == 0x105) {
SEARCH_ID_FULL_DIR_INFO * pFindData =
(SEARCH_ID_FULL_DIR_INFO *)current_entry;
filename = &pFindData->FileName[0];
len = pFindData->FileNameLength;
len = le32_to_cpu(pFindData->FileNameLength);
} else if(cfile->srch_inf.info_level == 0x104) {
FILE_BOTH_DIRECTORY_INFO * pFindData =
(FILE_BOTH_DIRECTORY_INFO *)current_entry;
filename = &pFindData->FileName[0];
len = pFindData->FileNameLength;
len = le32_to_cpu(pFindData->FileNameLength);
} else {
cFYI(1,("Unknown findfirst level %d",cfile->srch_inf.info_level));
}
......@@ -360,23 +360,23 @@ static int cifs_get_name_from_search_buf(struct qstr * pqst,char * current_entry
FILE_DIRECTORY_INFO * pFindData =
(FILE_DIRECTORY_INFO *)current_entry;
filename = &pFindData->FileName[0];
len = pFindData->FileNameLength;
len = le32_to_cpu(pFindData->FileNameLength);
} else if(level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) {
FILE_FULL_DIRECTORY_INFO * pFindData =
(FILE_FULL_DIRECTORY_INFO *)current_entry;
filename = &pFindData->FileName[0];
len = pFindData->FileNameLength;
len = le32_to_cpu(pFindData->FileNameLength);
} else if(level == SMB_FIND_FILE_ID_FULL_DIR_INFO) {
SEARCH_ID_FULL_DIR_INFO * pFindData =
(SEARCH_ID_FULL_DIR_INFO *)current_entry;
filename = &pFindData->FileName[0];
len = pFindData->FileNameLength;
len = le32_to_cpu(pFindData->FileNameLength);
*pinum = pFindData->UniqueId;
} else if(level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) {
FILE_BOTH_DIRECTORY_INFO * pFindData =
(FILE_BOTH_DIRECTORY_INFO *)current_entry;
filename = &pFindData->FileName[0];
len = pFindData->FileNameLength;
len = le32_to_cpu(pFindData->FileNameLength);
} else {
cFYI(1,("Unknown findfirst level %d",level));
return -EINVAL;
......@@ -488,25 +488,25 @@ int cifs_save_resume_key(const char * current_entry,struct cifsFileInfo * cifsFi
FILE_DIRECTORY_INFO * pFindData =
(FILE_DIRECTORY_INFO *)current_entry;
filename = &pFindData->FileName[0];
len = pFindData->FileNameLength;
len = le32_to_cpu(pFindData->FileNameLength);
cifsFile->srch_inf.resume_key = pFindData->FileIndex;
} else if(level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) {
FILE_FULL_DIRECTORY_INFO * pFindData =
(FILE_FULL_DIRECTORY_INFO *)current_entry;
filename = &pFindData->FileName[0];
len = pFindData->FileNameLength;
len = le32_to_cpu(pFindData->FileNameLength);
cifsFile->srch_inf.resume_key = pFindData->FileIndex;
} else if(level == SMB_FIND_FILE_ID_FULL_DIR_INFO) {
SEARCH_ID_FULL_DIR_INFO * pFindData =
(SEARCH_ID_FULL_DIR_INFO *)current_entry;
filename = &pFindData->FileName[0];
len = pFindData->FileNameLength;
len = le32_to_cpu(pFindData->FileNameLength);
cifsFile->srch_inf.resume_key = pFindData->FileIndex;
} else if(level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) {
FILE_BOTH_DIRECTORY_INFO * pFindData =
(FILE_BOTH_DIRECTORY_INFO *)current_entry;
filename = &pFindData->FileName[0];
len = pFindData->FileNameLength;
len = le32_to_cpu(pFindData->FileNameLength);
cifsFile->srch_inf.resume_key = pFindData->FileIndex;
} else {
cFYI(1,("Unknown findfirst level %d",level));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment