mount.cifs: take extra care that mountpoint isn't changed during mount
commitd650c6369212851fc9c780c8f800184f48abc348
authorJeff Layton <jlayton@redhat.com>
Tue, 26 Jan 2010 13:45:58 +0000 (26 08:45 -0500)
committerKarolin Seeger <kseeger@samba.org>
Thu, 6 May 2010 12:13:50 +0000 (6 14:13 +0200)
treea21b62040af613f2133ed5f87bb3d295ef4ffb29
parent565f8e10c9828c4d998f494d6c1a280e9a8927d5
mount.cifs: take extra care that mountpoint isn't changed during mount

It's possible to trick mount.cifs into mounting onto the wrong directory
by replacing the mountpoint with a symlink to a directory. mount.cifs
attempts to check the validity of the mountpoint, but there's still a
possible race between those checks and the mount(2) syscall.

To guard against this, chdir to the mountpoint very early, and only deal
with it as "." from then on out.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
(cherry picked from commit c4a342cec1ced80128f82758c7a2192b23f4017a)
source3/client/mount.cifs.c