summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-04-07 18:27:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:31 -0500
commitd761233aba3e8ed9abb0b7da81de86b3bf15667f (patch)
treef6d53b736d784f99eeafdae9d08db0ce0208367a /source3
parent466a825ce7a3c9a40a694608523f47e580c78415 (diff)
downloadsamba-d761233aba3e8ed9abb0b7da81de86b3bf15667f.tar.gz
samba-d761233aba3e8ed9abb0b7da81de86b3bf15667f.tar.bz2
samba-d761233aba3e8ed9abb0b7da81de86b3bf15667f.zip
r6234: Fix for possible root squash nfs bugs from psz@maths.usyd.edu.au
Jeremy. (This used to be commit dbf021a2e04e74dd7f072c927a34043fd8c3ae30)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/oplock.c6
-rw-r--r--source3/smbd/vfs.c4
2 files changed, 9 insertions, 1 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 858092407f..e6af12cd81 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -806,6 +806,12 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, unsigned long file_id,
saved_vuid = current_user.vuid;
saved_fsp_conn = fsp->conn;
change_to_root_user();
+ /*
+ * Initialize saved_dir to something sensible: vfs_GetWd may not work well
+ * for root: the directory may be NFS-mounted and exported with root_squash
+ * (so has no root access).
+ */
+ pstrcpy(saved_dir,saved_fsp_conn->connectpath);
vfs_GetWd(saved_fsp_conn,saved_dir);
/* Save the chain fnum. */
file_chain_save();
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 34671b8efc..28441c91ab 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -731,7 +731,9 @@ char *vfs_GetWd(connection_struct *conn, char *path)
in trouble :-) */
if (SMB_VFS_STAT(conn, ".",&st) == -1) {
- DEBUG(0,("Very strange, couldn't stat \".\" path=%s\n", path));
+ /* Known to fail for root: the directory may be
+ * NFS-mounted and exported with root_squash (so has no root access). */
+ DEBUG(1,("vfs_GetWd: couldn't stat \".\" path=%s error %s (NFS problem ?)\n", path, strerror(errno) ));
return(SMB_VFS_GETWD(conn,path));
}