Author: jra Date: 2007-08-06 18:54:26 +0000 (Mon, 06 Aug 2007) New Revision: 24253
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24253 Log: From Jan Martin <[EMAIL PROTECTED]>. ---------------------------------------------------------- In rare cases, Samba 3.0.25b shows directory contents at the wrong position in the file tree when displaying a subdirectory of a DFS link. The problem occurs whenever Windows XP asks for a DFS referral for a subdirectory of a DFS link with a trailing backslash. Windows does not do this very often, but we saw it several times per day on our central DFS server. smbd/msdfs.c, dfs_path_lookup() does the following with the requested path: - in line 390, the local copy 'localpath' is 'unix_convert'ed; the trailing backslash is removed inside unix_convert - in lines 417-20, 'dfspath' (another copy of the requested path) is mangled another way without removing trailing backslashes That's why the following loop (lines 435-461) that is meant to synchronously cut off the last path component from both strings until it comes to a DFS link, does not handle both strings the same. When the original path ended with a backslash, 'canon_dfspath' has always one component more than 'localpath', so that *consumedcntp gets too big in line 446. This value is reported to the client. ---------------------------------------------------------- Bug #4860. Jeremy. Modified: branches/SAMBA_3_0_25/source/smbd/msdfs.c branches/SAMBA_3_2/source/smbd/msdfs.c branches/SAMBA_3_2_0/source/smbd/msdfs.c Changeset: Modified: branches/SAMBA_3_0_25/source/smbd/msdfs.c =================================================================== --- branches/SAMBA_3_0_25/source/smbd/msdfs.c 2007-08-06 14:03:11 UTC (rev 24252) +++ branches/SAMBA_3_0_25/source/smbd/msdfs.c 2007-08-06 18:54:26 UTC (rev 24253) @@ -421,6 +421,14 @@ } /* + * localpath comes out of unix_convert, so it has + * no trailing backslash. Make sure that canon_dfspath hasn't either. + * Fix for bug #4860 from Jan Martin <[EMAIL PROTECTED]>. + */ + + trim_char(canon_dfspath,0,'/'); + + /* * Redirect if any component in the path is a link. * We do this by walking backwards through the * local path, chopping off the last component Modified: branches/SAMBA_3_2/source/smbd/msdfs.c =================================================================== --- branches/SAMBA_3_2/source/smbd/msdfs.c 2007-08-06 14:03:11 UTC (rev 24252) +++ branches/SAMBA_3_2/source/smbd/msdfs.c 2007-08-06 18:54:26 UTC (rev 24253) @@ -422,6 +422,14 @@ } /* + * localpath comes out of unix_convert, so it has + * no trailing backslash. Make sure that canon_dfspath hasn't either. + * Fix for bug #4860 from Jan Martin <[EMAIL PROTECTED]>. + */ + + trim_char(canon_dfspath,0,'/'); + + /* * Redirect if any component in the path is a link. * We do this by walking backwards through the * local path, chopping off the last component Modified: branches/SAMBA_3_2_0/source/smbd/msdfs.c =================================================================== --- branches/SAMBA_3_2_0/source/smbd/msdfs.c 2007-08-06 14:03:11 UTC (rev 24252) +++ branches/SAMBA_3_2_0/source/smbd/msdfs.c 2007-08-06 18:54:26 UTC (rev 24253) @@ -422,6 +422,14 @@ } /* + * localpath comes out of unix_convert, so it has + * no trailing backslash. Make sure that canon_dfspath hasn't either. + * Fix for bug #4860 from Jan Martin <[EMAIL PROTECTED]>. + */ + + trim_char(canon_dfspath,0,'/'); + + /* * Redirect if any component in the path is a link. * We do this by walking backwards through the * local path, chopping off the last component
