stat as root

psz at maths.usyd.edu.au psz at maths.usyd.edu.au
Wed Apr 6 21:20:33 GMT 2005


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).
+ */
+	pstrcpy(saved_dir,".");
 	vfs_GetWd(saved_fsp_conn,saved_dir);
 	/* Save the chain fnum. */
 	file_chain_save();
--- smbd/vfs.c.orig	Sat Mar 19 01:56:41 2005
+++ smbd/vfs.c	Thu Apr  7 06:53:07 2005
@@ -730,8 +730,23 @@
 	/*  Get the inode of the current directory, if this doesn't work we're
 		in trouble :-) */
 
+/* PSz  7 Apr 05 */
+/*
+ * Were getting many log lines like
+Apr  7 06:00:28 rome smbd[26083]: [2005/04/07 06:00:32, 0, pid=26083, effective(0, 0), real(0, 0)] smbd/vfs.c:vfs_GetWd(734)  
+Apr  7 06:00:28 rome smbd[26083]:   Very strange, couldn't stat "." path=BiNaRyGiBbErIsH  
+ * Not strange, but known to fail for root: the directory may be
+ * NFS-mounted and exported with root_squash (so has no root access).
+ *
+ * Why is path un-initialized: oplock.c?
+ */
 	if (SMB_VFS_STAT(conn, ".",&st) == -1) {
+if (geteuid()) {
 		DEBUG(0,("Very strange, couldn't stat \".\" path=%s\n", path));
+}
+else {
+		DEBUG(1,("Very strange, couldn't stat \".\" path=%s\n", path));
+}
 		return(SMB_VFS_GETWD(conn,path));
 	}
 


More information about the samba-technical mailing list