From: Jeremy Allison Date: Fri, 8 Apr 2005 19:21:41 +0000 (+0000) Subject: r6252: Re-order position of become_root() to allow directory to be X-Git-Tag: samba-misc-tags/initial-v3-0-unstable~4966 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9fa32282ebe78c3ecd433e8ece600881774560b7;p=thirdparty%2Fsamba.git r6252: Re-order position of become_root() to allow directory to be read first. Jeremy. --- diff --git a/source/smbd/oplock.c b/source/smbd/oplock.c index e6af12cd814..9b8df98fd56 100644 --- a/source/smbd/oplock.c +++ b/source/smbd/oplock.c @@ -805,7 +805,6 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, unsigned long file_id, saved_user_conn = current_user.conn; 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 @@ -816,6 +815,10 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, unsigned long file_id, /* Save the chain fnum. */ file_chain_save(); + pstrcpy(file_name, fsp->fsp_name); + + change_to_root_user(); + /* * From Charles Hoch . If the break processing * code closes the file (as it often does), then the fsp pointer here @@ -823,8 +826,6 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, unsigned long file_id, * around the loop. */ - pstrcpy(file_name, fsp->fsp_name); - while((fsp = initial_break_processing(dev, inode, file_id)) && OPEN_FSP(fsp) && EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) { if(receive_smb(smbd_server_fd(),inbuf, timeout) == False) {