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>