stat as root
Jeremy Allison
jra at samba.org
Thu Apr 7 18:26:33 GMT 2005
On Thu, Apr 07, 2005 at 07:20:33AM +1000, psz at maths.usyd.edu.au wrote:
> Another bug corrected. Cheers,
>
> Paul Szabo psz at maths.usyd.edu.au http://www.maths.usyd.edu.au/u/psz/
> School of Mathematics and Statistics University of Sydney Australia
>
>
> --- smbd/oplock.c.orig Sat Feb 26 04:59:26 2005
> +++ smbd/oplock.c Thu Apr 7 06:45:13 2005
> @@ -808,6 +808,13 @@
> saved_vuid = current_user.vuid;
> saved_fsp_conn = fsp->conn;
> change_to_root_user();
> +/* PSz 7 Apr 05 */
> +/*
> + * 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).
> + */
Ok - thanks for that. This is the fix I've committed.
Jeremy.
-------------- next part --------------
Index: smbd/oplock.c
===================================================================
--- smbd/oplock.c (revision 6232)
+++ smbd/oplock.c (working copy)
@@ -806,6 +806,12 @@
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();
Index: smbd/vfs.c
===================================================================
--- smbd/vfs.c (revision 6232)
+++ smbd/vfs.c (working copy)
@@ -731,7 +731,9 @@
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));
}
More information about the samba-technical
mailing list