[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Fri May 20 11:27:03 MDT 2011


The branch, master has been updated
       via  95a55e2 Fix bug 8133 - strange behavior for the file (whose filename first character is period ) in SMB2 case.
       via  38c77db Optimization. If the attributes passed to can_rename() include both FILE_ATTRIBUTE_HIDDEN and FILE_ATTRIBUTE_SYSTEM then there's no point in reading the source DOS attribute, as we're not going to deny the rename on attribute match.
      from  df650fa s3:smbd remove unused code

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 95a55e2feabfae3b0874ae9aa2ce716ca0a9ae39
Author: Jeremy Allison <jra at samba.org>
Date:   Thu May 19 16:39:18 2011 -0700

    Fix bug 8133 - strange behavior for the file (whose filename first character is period ) in SMB2 case.
    
    When doing SMB2 renames, we need to match all filetypes (no attributes field in the SMB2 call).
    By default a file starting with a period is returned as FILE_ATTRIBUTE_HIDDEN in Samba.
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Fri May 20 19:26:04 CEST 2011 on sn-devel-104

commit 38c77db9892b5d607a7a05fab563f5f6977794e1
Author: Jeremy Allison <jra at samba.org>
Date:   Thu May 19 16:38:11 2011 -0700

    Optimization. If the attributes passed to can_rename() include both FILE_ATTRIBUTE_HIDDEN and FILE_ATTRIBUTE_SYSTEM then there's no point in reading the source DOS attribute, as we're not going to deny the rename on attribute match.

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/reply.c  |   13 ++++++++-----
 source3/smbd/trans2.c |    5 +++--
 2 files changed, 11 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 99ab4ca..31f596c 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2381,15 +2381,18 @@ void reply_ctemp(struct smb_request *req)
 static NTSTATUS can_rename(connection_struct *conn, files_struct *fsp,
 			uint16 dirtype)
 {
-	uint32 fmode;
-
 	if (!CAN_WRITE(conn)) {
 		return NT_STATUS_MEDIA_WRITE_PROTECTED;
 	}
 
-	fmode = dos_mode(conn, fsp->fsp_name);
-	if ((fmode & ~dirtype) & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) {
-		return NT_STATUS_NO_SUCH_FILE;
+	if ((dirtype & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) !=
+			(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) {
+		/* Only bother to read the DOS attribute if we might deny the
+		   rename on the grounds of attribute missmatch. */
+		uint32_t fmode = dos_mode(conn, fsp->fsp_name);
+		if ((fmode & ~dirtype) & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) {
+			return NT_STATUS_NO_SUCH_FILE;
+		}
 	}
 
 	if (S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index f5b87c7..cc21b32 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -6050,8 +6050,9 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
 		  "SMB_FILE_RENAME_INFORMATION (fnum %d) %s -> %s\n",
 		  fsp->fnum, fsp_str_dbg(fsp),
 		  smb_fname_str_dbg(smb_fname_dst)));
-	status = rename_internals_fsp(conn, fsp, smb_fname_dst, 0,
-				      overwrite);
+	status = rename_internals_fsp(conn, fsp, smb_fname_dst,
+				(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM),
+				overwrite);
 
  out:
 	TALLOC_FREE(smb_fname_dst);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list