Răsfoiți Sursa

[PATCH] cifs: append \* properly on ASCII servers

For older servers which do not support Unicode

Signed-off-by: Steve French (sfrench@us.ibm.com)
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Steve French 20 ani în urmă
părinte
comite
6857547671
2 a modificat fișierele cu 7 adăugiri și 3 ștergeri
  1. 3 1
      fs/cifs/CHANGES
  2. 4 2
      fs/cifs/cifssmb.c

+ 3 - 1
fs/cifs/CHANGES

@@ -4,7 +4,9 @@ Fix error mapping of the TOO_MANY_LINKS (hardlinks) case.
 Do not oops if root user kills cifs oplock kernel thread or
 Do not oops if root user kills cifs oplock kernel thread or
 kills the cifsd thread (NB: killing the cifs kernel threads is not
 kills the cifsd thread (NB: killing the cifs kernel threads is not
 recommended, unmount and rmmod cifs will kill them when they are
 recommended, unmount and rmmod cifs will kill them when they are
-no longer needed).
+no longer needed).  Fix readdir to ASCII servers (ie older servers
+which do not support Unicode) and also require asterik.
+
 
 
 Version 1.33
 Version 1.33
 ------------
 ------------

+ 4 - 2
fs/cifs/cifssmb.c

@@ -2451,12 +2451,14 @@ findFirstRetry:
 		name_len += 2;
 		name_len += 2;
 	} else {	/* BB add check for overrun of SMB buf BB */
 	} else {	/* BB add check for overrun of SMB buf BB */
 		name_len = strnlen(searchName, PATH_MAX);
 		name_len = strnlen(searchName, PATH_MAX);
-		name_len++;	/* trailing null */
 /* BB fix here and in unicode clause above ie
 /* BB fix here and in unicode clause above ie
 		if(name_len > buffersize-header)
 		if(name_len > buffersize-header)
 			free buffer exit; BB */
 			free buffer exit; BB */
 		strncpy(pSMB->FileName, searchName, name_len);
 		strncpy(pSMB->FileName, searchName, name_len);
-		pSMB->FileName[name_len] = 0; /* just in case */
+		pSMB->FileName[name_len] = '\\';
+		pSMB->FileName[name_len+1] = '*';
+		pSMB->FileName[name_len+2] = 0;
+		name_len += 3;
 	}
 	}
 
 
 	params = 12 + name_len /* includes null */ ;
 	params = 12 + name_len /* includes null */ ;