[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha2-1041-gc475353

Stefan Metzmacher metze at samba.org
Tue Feb 26 13:24:57 GMT 2008


The branch, v4-0-test has been updated
       via  c475353e34154eb13e35cc8b6cf553e3986f8677 (commit)
       via  27e39063a0b759c7bced1cc9d7a6cb9192820c70 (commit)
       via  066ba3c7cfff12cb0b5298fc45eabb5fc097d056 (commit)
       via  6c34c7bc6801e470e5ec50aa93d0a07f7ad59314 (commit)
       via  10c42e3d4ab71a71dfe620b40841dfe98f458c1a (commit)
      from  8a26a6e8f11aca5119b15e304213548ad608dc5b (commit)

http://gitweb.samba.org/?samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit c475353e34154eb13e35cc8b6cf553e3986f8677
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Feb 26 12:52:46 2008 +0100

    opendb_tdb: with break_to_none attribute only opens also break oplocks
    
    metze

commit 27e39063a0b759c7bced1cc9d7a6cb9192820c70
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Feb 26 10:26:33 2008 +0100

    pvfs_open: pass down an access mask to pvfs_can_update_file_size()
    
    You just need SEC_FILE_WRITE_ATTRIBUTE to change
    the filesize...
    
    metze

commit 066ba3c7cfff12cb0b5298fc45eabb5fc097d056
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Feb 26 10:29:07 2008 +0100

    pvfs_qfileinfo: down discard the return value of pvfs_can_stat()
    
    The odb_can_open() code returns DELETE_PENDING if
    a delete is really pending.
    
    metze

commit 6c34c7bc6801e470e5ec50aa93d0a07f7ad59314
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Feb 26 10:28:07 2008 +0100

    pvfs_open: pass down an access mask in pvfs_can_stat()
    
    metze

commit 10c42e3d4ab71a71dfe620b40841dfe98f458c1a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Feb 26 10:21:39 2008 +0100

    pvfs_open: pass NTCREATEX_DISP_OPEN to odb_can_open()
    
    As 0 is NTCREATEX_DISP_SUPERSEDE and that's not what we want here.
    
    metze

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

Summary of changes:
 source/ntvfs/common/opendb_tdb.c    |   11 +++++++++--
 source/ntvfs/posix/pvfs_open.c      |   26 ++++++++++++++++++--------
 source/ntvfs/posix/pvfs_qfileinfo.c |    2 +-
 3 files changed, 28 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/ntvfs/common/opendb_tdb.c b/source/ntvfs/common/opendb_tdb.c
index 73c04b7..fe5a0a8 100644
--- a/source/ntvfs/common/opendb_tdb.c
+++ b/source/ntvfs/common/opendb_tdb.c
@@ -288,7 +288,8 @@ static NTSTATUS odb_oplock_break_send(struct odb_context *odb,
 }
 
 static bool access_attributes_only(uint32_t access_mask,
-				   uint32_t open_disposition)
+				   uint32_t open_disposition,
+				   bool break_to_none)
 {
 	switch (open_disposition) {
 	case NTCREATEX_DISP_SUPERSEDE:
@@ -298,6 +299,11 @@ static bool access_attributes_only(uint32_t access_mask,
 	default:
 		break;
 	}
+
+	if (break_to_none) {
+		return false;
+	}
+
 #define CHECK_MASK(m,g) ((m) && (((m) & ~(g))==0) && (((m) & (g)) != 0))
 	return CHECK_MASK(access_mask,
 			  SEC_STD_SYNCHRONIZE |
@@ -326,7 +332,8 @@ static NTSTATUS odb_tdb_open_can_internal(struct odb_context *odb,
 			 * but we'll not grant the oplock below
 			 */
 			attrs_only = access_attributes_only(access_mask,
-							    open_disposition);
+							    open_disposition,
+							    break_to_none);
 			if (attrs_only) {
 				break;
 			}
diff --git a/source/ntvfs/posix/pvfs_open.c b/source/ntvfs/posix/pvfs_open.c
index 12b70c0..a01352f 100644
--- a/source/ntvfs/posix/pvfs_open.c
+++ b/source/ntvfs/posix/pvfs_open.c
@@ -1530,7 +1530,7 @@ NTSTATUS pvfs_can_delete(struct pvfs_state *pvfs,
 
 	status = odb_can_open(lck, name->stream_id,
 			      share_access, access_mask, delete_on_close,
-			      0, false);
+			      NTCREATEX_DISP_OPEN, false);
 
 	if (NT_STATUS_IS_OK(status)) {
 		status = pvfs_access_check_simple(pvfs, req, name, access_mask);
@@ -1594,7 +1594,7 @@ NTSTATUS pvfs_can_rename(struct pvfs_state *pvfs,
 
 	status = odb_can_open(lck, name->stream_id,
 			      share_access, access_mask, delete_on_close,
-			      0, false);
+			      NTCREATEX_DISP_OPEN, false);
 
 	/*
 	 * if it's a sharing violation or we got no oplock
@@ -1648,15 +1648,25 @@ NTSTATUS pvfs_can_update_file_size(struct pvfs_state *pvfs,
 		return NT_STATUS_INTERNAL_DB_CORRUPTION;
 	}
 
-	/* TODO: this may needs some more flags */
-	share_access	= NTCREATEX_SHARE_ACCESS_WRITE;
-	access_mask	= 0;
+	share_access	= NTCREATEX_SHARE_ACCESS_READ |
+			  NTCREATEX_SHARE_ACCESS_WRITE |
+			  NTCREATEX_SHARE_ACCESS_DELETE;
+	/*
+	 * I would have thought that we would need to pass
+	 * SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA here too
+	 *
+	 * But you only need SEC_FILE_WRITE_ATTRIBUTE permissions
+	 * to set the filesize.
+	 *
+	 * --metze
+	 */
+	access_mask	= SEC_FILE_WRITE_ATTRIBUTE;
 	delete_on_close	= false;
 	break_to_none	= true;
 
 	status = odb_can_open(lck, name->stream_id,
 			      share_access, access_mask, delete_on_close,
-			      0, break_to_none);
+			      NTCREATEX_DISP_OPEN, break_to_none);
 
 	/*
 	 * if it's a sharing violation or we got no oplock
@@ -1710,12 +1720,12 @@ NTSTATUS pvfs_can_stat(struct pvfs_state *pvfs,
 
 	share_access	= NTCREATEX_SHARE_ACCESS_READ |
 			  NTCREATEX_SHARE_ACCESS_WRITE;
-	access_mask	= 0;
+	access_mask	= SEC_FILE_READ_ATTRIBUTE;
 	delete_on_close	= false;
 
 	status = odb_can_open(lck, name->stream_id,
 			      share_access, access_mask, delete_on_close,
-			      0, false);
+			      NTCREATEX_DISP_OPEN, false);
 
 	if (!NT_STATUS_IS_OK(status)) {
 		talloc_free(lck);
diff --git a/source/ntvfs/posix/pvfs_qfileinfo.c b/source/ntvfs/posix/pvfs_qfileinfo.c
index 2f01c08..8d23d70 100644
--- a/source/ntvfs/posix/pvfs_qfileinfo.c
+++ b/source/ntvfs/posix/pvfs_qfileinfo.c
@@ -330,7 +330,7 @@ NTSTATUS pvfs_qpathinfo(struct ntvfs_module_context *ntvfs,
 
 	status = pvfs_can_stat(pvfs, req, name);
 	if (!NT_STATUS_IS_OK(status)) {
-		return NT_STATUS_DELETE_PENDING;
+		return status;
 	}
 
 	status = pvfs_access_check_simple(pvfs, req, name, 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list