[SCM] Samba Shared Repository - branch v3-6-test updated

Jeremy Allison jra at samba.org
Wed Jan 26 16:16:03 MST 2011


The branch, v3-6-test has been updated
       via  f22ff13 Looking into printer driver issues, I ran across some peculiarities in copy_file(): - Firstly, if the source file is zero bytes, NT_STATUS_DISK_FULL is   returned. - Secondly, the conditional lseek is confusing. It fires when   OPENX_FILE_EXISTS_OPEN is set and I can't see why the lseek is   necessary in this case. - Finally, the lseek error path also results in NT_STATUS_DISK_FULL.
      from  e396ae0 s3-utils: Fixed a resource leak in net_afs.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit f22ff13a6c46bb716049ff2250b29c670e555052
Author: David Disseldorp <ddiss at suse.de>
Date:   Wed Jan 26 14:32:01 2011 -0800

    Looking into printer driver issues, I ran across some peculiarities in
    copy_file():
    - Firstly, if the source file is zero bytes, NT_STATUS_DISK_FULL is
      returned.
    - Secondly, the conditional lseek is confusing. It fires when
      OPENX_FILE_EXISTS_OPEN is set and I can't see why the lseek is
      necessary in this case.
    - Finally, the lseek error path also results in NT_STATUS_DISK_FULL.
    
    Proposed fix for first and third point below.
    (cherry picked from commit aa3bba8d778862c82e48a7c6f7bd51f5c78c7d90)

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

Summary of changes:
 source3/smbd/reply.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 4d3be85..f7265e0 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -6789,20 +6789,23 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
 		goto out;
 	}
 
-	if ((ofun&3) == 1) {
-		if(SMB_VFS_LSEEK(fsp2,0,SEEK_END) == -1) {
-			DEBUG(0,("copy_file: error - vfs lseek returned error %s\n", strerror(errno) ));
-			/*
-			 * Stop the copy from occurring.
-			 */
-			ret = -1;
-			smb_fname_src->st.st_ex_size = 0;
+	if (ofun & OPENX_FILE_EXISTS_OPEN) {
+		ret = SMB_VFS_LSEEK(fsp2, 0, SEEK_END);
+		if (ret == -1) {
+			DEBUG(0, ("error - vfs lseek returned error %s\n",
+				strerror(errno)));
+			status = map_nt_error_from_unix(errno);
+			close_file(NULL, fsp1, ERROR_CLOSE);
+			close_file(NULL, fsp2, ERROR_CLOSE);
+			goto out;
 		}
 	}
 
 	/* Do the actual copy. */
 	if (smb_fname_src->st.st_ex_size) {
 		ret = vfs_transfer_file(fsp1, fsp2, smb_fname_src->st.st_ex_size);
+	} else {
+		ret = 0;
 	}
 
 	close_file(NULL, fsp1, NORMAL_CLOSE);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list