linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* DFS patch series
@ 2008-04-26  0:34 Steve French
  2008-04-26 17:41 ` DFS patch series - fixed Igor Mammedov
  0 siblings, 1 reply; 5+ messages in thread
From: Steve French @ 2008-04-26  0:34 UTC (permalink / raw)
  To: Q (Igor Mammedov), Igor Mammedov; +Cc: Jeremy Allison, linux-fsdevel

I merged the first patch in your remaining cifs dfs series patch
0001-Adds-to-dns_resolver-checking-if-the-server-name-is.patch into
the cifs tree, but isn't this section of the 2nd patch of three ie
0002-fixed-compatibility-issue-with-samba-a-refferal-req.patch
incorrect? It is converting the slashes in the whole path (not in the
UNC prefix) - so escape sequences in real posix directory and file
names will be converted to separators.  This seems wrong.  We should
be converting just the treename part here.

@@ -243,6 +240,12 @@ static char
*build_full_dfs_path_from_dentry(struct dentry *dentry)
                strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len);
                strcat(tmp_path, search_path);
                tmp_path[l_max_len-1] = 0;
+               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
+                       for (i = 0; i < l_max_len; i++) {
+                               if (tmp_path[i] == '\\')
+                                       tmp_path[i] = '/';
+                       }
+
                full_path = tmp_path;
                kfree(search_path);
        } else {


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DFS patch series - fixed
  2008-04-26  0:34 DFS patch series Steve French
@ 2008-04-26 17:41 ` Igor Mammedov
  2008-04-28  3:40   ` Steve French
  0 siblings, 1 reply; 5+ messages in thread
From: Igor Mammedov @ 2008-04-26 17:41 UTC (permalink / raw)
  To: Steve French; +Cc: Q (Igor Mammedov), Jeremy Allison, linux-fsdevel

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

Steve French wrote:
> I merged the first patch in your remaining cifs dfs series patch
> 0001-Adds-to-dns_resolver-checking-if-the-server-name-is.patch into
> the cifs tree, but isn't this section of the 2nd patch of three ie
> 0002-fixed-compatibility-issue-with-samba-a-refferal-req.patch
> incorrect? It is converting the slashes in the whole path (not in the
> UNC prefix) - so escape sequences in real posix directory and file
> names will be converted to separators.  This seems wrong.  We should
> be converting just the treename part here.
> 
> ...

Fixed, now it converts only treeName part of the path:
0003-fixed-compatibility-issue-with-samba-a-refferal-requ.patch

In my test setup it works.

-- 

Best regards,

-------------------------
Igor Mammedov,
niallain "at" gmail.com





[-- Attachment #2: 0003-fixed-compatibility-issue-with-samba-a-refferal-requ.patch --]
[-- Type: text/x-patch, Size: 2343 bytes --]

>From 29f7313c1e594b5c2c9ff0e0672d551c23354c7d Mon Sep 17 00:00:00 2001
From: Igor Mammedov <niallain@gmail.com>
Date: Sat, 26 Apr 2008 21:20:28 +0400
Subject: [PATCH] fixed compatibility issue with samba:a refferal request treeName
 part is canonized to '/' path separator

Signed-off-by: Igor Mammedov <niallain@gmail.com>
---
 fs/cifs/cifs_dfs_ref.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index f53f41f..e0a3a56 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -81,15 +81,11 @@ static char *cifs_get_share_name(const char *node_name)
 	/* find sharename end */
 	pSep++;
 	pSep = memchr(UNC+(pSep-UNC), '\\', len-(pSep-UNC));
-	if (!pSep) {
-		cERROR(1, ("%s:2 cant find share name in node name: %s",
-			__func__, node_name));
-		kfree(UNC);
-		return NULL;
+	if (pSep) {
+		/* trim path up to sharename end
+		 * now we have share name in UNC */
+		*pSep = 0;
 	}
-	/* trim path up to sharename end
-	 *          * now we have share name in UNC */
-	*pSep = 0;
 
 	return UNC;
 }
@@ -176,7 +172,7 @@ static char *compose_mount_options(const char *sb_mountdata,
 		tkn_e = strchr(tkn_e+1, '\\');
 		if (tkn_e) {
 			strcat(mountdata, ",prefixpath=");
-			strcat(mountdata, tkn_e);
+			strcat(mountdata, tkn_e+1);
 		}
 	}
 
@@ -232,7 +228,8 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry)
 		return NULL;
 
 	if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) {
-		/* we should use full path name to correct working with DFS */
+		int i;
+		/* we should use full path name for correct working with DFS */
 		l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) +
 					strnlen(search_path, MAX_PATHCONF) + 1;
 		tmp_path = kmalloc(l_max_len, GFP_KERNEL);
@@ -241,8 +238,14 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry)
 			return NULL;
 		}
 		strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len);
-		strcat(tmp_path, search_path);
 		tmp_path[l_max_len-1] = 0;
+		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
+			for (i = 0; i < l_max_len; i++) {
+				if (tmp_path[i] == '\\')
+					tmp_path[i] = '/';
+			}
+		strncat(tmp_path, search_path, l_max_len - strlen(tmp_path));
+
 		full_path = tmp_path;
 		kfree(search_path);
 	} else {
-- 
1.5.3.7


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: DFS patch series - fixed
  2008-04-26 17:41 ` DFS patch series - fixed Igor Mammedov
@ 2008-04-28  3:40   ` Steve French
  2008-04-28  8:05     ` Igor Mammedov
  0 siblings, 1 reply; 5+ messages in thread
From: Steve French @ 2008-04-28  3:40 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: Q (Igor Mammedov), Jeremy Allison, linux-fsdevel

Is your change to cifs_get_share_name code intentional?  You allow the
\\server\share\path string to not be terminated by a path (ie be
\\server\share)

On Sat, Apr 26, 2008 at 12:41 PM, Igor Mammedov <niallain@gmail.com> wrote:
> Steve French wrote:
>  > I merged the first patch in your remaining cifs dfs series patch
>  > 0001-Adds-to-dns_resolver-checking-if-the-server-name-is.patch into
>  > the cifs tree, but isn't this section of the 2nd patch of three ie
>  > 0002-fixed-compatibility-issue-with-samba-a-refferal-req.patch
>  > incorrect? It is converting the slashes in the whole path (not in the
>  > UNC prefix) - so escape sequences in real posix directory and file
>  > names will be converted to separators.  This seems wrong.  We should
>  > be converting just the treename part here.
>  >
>  > ...
>
>  Fixed, now it converts only treeName part of the path:
>  0003-fixed-compatibility-issue-with-samba-a-refferal-requ.patch
>
>  In my test setup it works.
>
>  --
>
>  Best regards,
>
>  -------------------------
>  Igor Mammedov,
>  niallain "at" gmail.com
>
>
>
>
>



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DFS patch series - fixed
  2008-04-28  3:40   ` Steve French
@ 2008-04-28  8:05     ` Igor Mammedov
  2008-04-28 23:06       ` Steve French
  0 siblings, 1 reply; 5+ messages in thread
From: Igor Mammedov @ 2008-04-28  8:05 UTC (permalink / raw)
  To: Steve French; +Cc: Q (Igor Mammedov), Jeremy Allison, linux-fsdevel

Steve French wrote:
> Is your change to cifs_get_share_name code intentional?  You allow the
> \\server\share\path string to not be terminated by a path (ie be
> \\server\share)

Yes, there was error in previous version, I've stumbled upon it while mounting
referrals without a path part in it. (the function still do what it did but
now it correctly handles ref unc that consists only from treeName) 

cifs_get_share_name should return unc from ref UNC as if it was handled
by mount.cifs helper (i.e. cut off the path part from unc and leave only
a treeName, the path part would be specified as prefixpath option later
in compose_mount_options).
 
> On Sat, Apr 26, 2008 at 12:41 PM, Igor Mammedov <niallain@gmail.com> wrote:
>> Steve French wrote:
>>  > I merged the first patch in your remaining cifs dfs series patch
>>  > 0001-Adds-to-dns_resolver-checking-if-the-server-name-is.patch into
>>  > the cifs tree, but isn't this section of the 2nd patch of three ie
>>  > 0002-fixed-compatibility-issue-with-samba-a-refferal-req.patch
>>  > incorrect? It is converting the slashes in the whole path (not in the
>>  > UNC prefix) - so escape sequences in real posix directory and file
>>  > names will be converted to separators.  This seems wrong.  We should
>>  > be converting just the treename part here.
>>  >
>>  > ...
>>
>>  Fixed, now it converts only treeName part of the path:
>>  0003-fixed-compatibility-issue-with-samba-a-refferal-requ.patch
>>
>>  In my test setup it works.
>>
>>  --
>>
>>  Best regards,
>>
>>  -------------------------
>>  Igor Mammedov,
>>  niallain "at" gmail.com
>>
>>
>>
>>
>>
> 
> 
> 


-- 

Best regards,

-------------------------
Igor Mammedov,
niallain "at" gmail.com





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DFS patch series - fixed
  2008-04-28  8:05     ` Igor Mammedov
@ 2008-04-28 23:06       ` Steve French
  0 siblings, 0 replies; 5+ messages in thread
From: Steve French @ 2008-04-28 23:06 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: Q (Igor Mammedov), Jeremy Allison, linux-fsdevel

merged

On Mon, Apr 28, 2008 at 3:05 AM, Igor Mammedov <niallain@gmail.com> wrote:
> Steve French wrote:
>  > Is your change to cifs_get_share_name code intentional?  You allow the
>  > \\server\share\path string to not be terminated by a path (ie be
>  > \\server\share)
>
>  Yes, there was error in previous version, I've stumbled upon it while mounting
>  referrals without a path part in it. (the function still do what it did but
>  now it correctly handles ref unc that consists only from treeName)
>
>  cifs_get_share_name should return unc from ref UNC as if it was handled
>  by mount.cifs helper (i.e. cut off the path part from unc and leave only
>  a treeName, the path part would be specified as prefixpath option later
>  in compose_mount_options).
>
>
>
>  > On Sat, Apr 26, 2008 at 12:41 PM, Igor Mammedov <niallain@gmail.com> wrote:
>  >> Steve French wrote:
>  >>  > I merged the first patch in your remaining cifs dfs series patch
>  >>  > 0001-Adds-to-dns_resolver-checking-if-the-server-name-is.patch into
>  >>  > the cifs tree, but isn't this section of the 2nd patch of three ie
>  >>  > 0002-fixed-compatibility-issue-with-samba-a-refferal-req.patch
>  >>  > incorrect? It is converting the slashes in the whole path (not in the
>  >>  > UNC prefix) - so escape sequences in real posix directory and file
>  >>  > names will be converted to separators.  This seems wrong.  We should
>  >>  > be converting just the treename part here.
>  >>  >
>  >>  > ...
>  >>
>  >>  Fixed, now it converts only treeName part of the path:
>  >>  0003-fixed-compatibility-issue-with-samba-a-refferal-requ.patch
>  >>
>  >>  In my test setup it works.
>  >>
>  >>  --
>  >>
>  >>  Best regards,
>  >>
>  >>  -------------------------
>  >>  Igor Mammedov,
>  >>  niallain "at" gmail.com
>  >>
>  >>
>  >>
>  >>
>  >>
>  >
>  >
>  >
>
>
>  --
>
>  Best regards,
>
>  -------------------------
>  Igor Mammedov,
>  niallain "at" gmail.com
>
>
>
>
>



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-28 23:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-26  0:34 DFS patch series Steve French
2008-04-26 17:41 ` DFS patch series - fixed Igor Mammedov
2008-04-28  3:40   ` Steve French
2008-04-28  8:05     ` Igor Mammedov
2008-04-28 23:06       ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).