mount.cifs: fix several problems when mounting subdirectories of shares
authorJeff Layton <jlayton@redhat.com>
Tue, 13 Nov 2007 14:04:33 +0000 (09:04 -0500)
committerSimo Sorce <idra@samba.org>
Mon, 17 Dec 2007 14:33:54 +0000 (09:33 -0500)
commite8f569735e2c0523efa175ca44dd919f838ae49e
treefc532827b02514c199836f18ad4ccd7b12e9e9d6
parent452e964995afe5a43040c8bdcadc9c45a1e1d007
mount.cifs: fix several problems when mounting subdirectories of shares

This is essentially the same patch as I posted yesterday. The only
difference is that I added the replace_char helper function and now
have the code call it instead of doing the conversion internally.

Thoughts?

-------[snip]-------

CIFS has a few problems when mounting subdirectories of shares:

a) mount.cifs assumes that the prefixpath will always begin with a
forward slash. If it begins with a backslash, then it fails to parse out
the prefixpath and leaves it appended to the sharename. This causes the
mount to fail.

b) if the prefixpath uses '/' as a delimiter, it doesn't convert that to
a "native" prefixpath ('\\' delimiter). The kernel will blindly stuff
this prefix into the beginning of a path when it builds one from a dentry,
and this confuses windows servers (samba doesn't seem to care).

c) When you mount a subdir of a share, mount.cifs munges the device string
so that you can't tell what the prefixpath is. So if I mount:

//server/share/p1/p2/p3

..then /proc/mounts and mtab will show only:

//server/share

d) If the client has to retry the mount with an uppercase sharename, it
doesn't also uppercase the prefixpath (not sure if that's a real issue,
but it seems inconsistent).

The following patch fixes all of these problems. It separates the
"share_name" from the "device_name", and passes the share_name as the
unc= string, and the device_name as the first arg to mount(), and to
setmntent().

It also changes mount.cifs to use '\\' exclusively as a delimiter for
the unc= and prefixpath= options, and to use '/' exclusively as a
delimiter in the device string (seemingly necessary since the kernel
doesn't deal well with backslashes in the device string).

Signed-off-by: Jeff Layton <jlayton@redhat.com>
source/client/mount.cifs.c [changed mode: 0755->0644]