[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Sep 5 14:21:02 MDT 2012


The branch, master has been updated
       via  e00ac55 Free protect_ids in secret_store_domain_sid() as the caller of fetch_secrets() must free the result in order to not leak memory. Signed-off-by: Jeremy Allison <jra at samba.org>
       via  43d619b Add "backup_intent" bool to files_struct.
       via  d7fb237 Remove an unncessary FTRUNCATE call in the open path. We can rely on O_TRUC.
      from  5e492f8 s4 dns: Allow configuring signed updates

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


- Log -----------------------------------------------------------------
commit e00ac55994ad7d067f7f628ae4157f0d23f819c4
Author: Michele Baldessari <michele at acksyn.org>
Date:   Wed Sep 5 10:56:06 2012 -0700

    Free protect_ids in secret_store_domain_sid() as the caller of fetch_secrets() must free the result in order to not leak memory.
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Sep  5 22:20:45 CEST 2012 on sn-devel-104

commit 43d619b2bb4f5fd02fc3d694cb7328fc69c71b5e
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Sep 5 10:46:51 2012 -0700

    Add "backup_intent" bool to files_struct.
    
    Not used right now but I need this in the VFS to implement open for
    backup/restore later and don't want to break the ABI once 4.0.0
    ships.

commit d7fb237810f10c7a7d44cf425163152811eba64c
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Sep 5 10:46:16 2012 -0700

    Remove an unncessary FTRUNCATE call in the open path. We can rely on O_TRUC.
    
    Suggested by Volker.

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

Summary of changes:
 source3/include/vfs.h                    |    3 +++
 source3/passdb/machine_account_secrets.c |    2 ++
 source3/smbd/open.c                      |   30 +-----------------------------
 3 files changed, 6 insertions(+), 29 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index f2cfd24..45895e7 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -141,6 +141,7 @@
 /* Leave at 29 - not yet released. Remove l{list,get,set,remove}xattr - abartlet */
 /* Leave at 29 - not yet released. move to plain off_t - abartlet */
 /* Leave at 29 - not yet released. Remove sys_acl functions other than set and get - abartlet */
+/* Leave at 29 - not yet released. Added backup_intent bool to files_struct - JRA */
 #define SMB_VFS_INTERFACE_VERSION 29
 
 /*
@@ -226,6 +227,8 @@ typedef struct files_struct {
 	bool delete_on_close;
 	bool posix_open;
 	bool is_sparse;
+	bool backup_intent; /* Handle was successfully opened with backup intent
+				and opener has privilege to do so. */
 	struct smb_filename *fsp_name;
 	uint32_t name_hash;		/* Jenkins hash of full pathname. */
 	uint64_t mid;			/* Mid of the operation that created us. */
diff --git a/source3/passdb/machine_account_secrets.c b/source3/passdb/machine_account_secrets.c
index 300455a..70d7106 100644
--- a/source3/passdb/machine_account_secrets.c
+++ b/source3/passdb/machine_account_secrets.c
@@ -101,9 +101,11 @@ bool secrets_store_domain_sid(const char *domain, const struct dom_sid  *sid)
 		if (strncmp(protect_ids, "TRUE", 4)) {
 			DEBUG(0, ("Refusing to store a Domain SID, "
 				  "it has been marked as protected!\n"));
+			SAFE_FREE(protect_ids);
 			return false;
 		}
 	}
+	SAFE_FREE(protect_ids);
 #endif
 
 	ret = secrets_store(domain_sid_keystr(domain), sid, sizeof(struct dom_sid ));
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 6378521..9c4ba36 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -710,13 +710,6 @@ static NTSTATUS open_file(files_struct *fsp,
 		const char *wild;
 		int ret;
 
-		/*
-		 * We can't actually truncate here as the file may be locked.
-		 * open_file_ntcreate will take care of the truncate later. JRA.
-		 */
-
-		local_flags &= ~O_TRUNC;
-
 #if defined(O_NONBLOCK) && defined(S_ISFIFO)
 		/*
 		 * We would block on opening a FIFO with no one else on the
@@ -725,6 +718,7 @@ static NTSTATUS open_file(files_struct *fsp,
 		 */
 
 		if (file_existed && S_ISFIFO(smb_fname->st.st_ex_mode)) {
+			local_flags &= ~O_TRUNC; /* Can't truncate a FIFO. */
 			local_flags |= O_NONBLOCK;
 		}
 #endif
@@ -2382,10 +2376,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 		 (unsigned int)unx_mode, (unsigned int)access_mask,
 		 (unsigned int)open_access_mask));
 
-	/*
-	 * open_file strips any O_TRUNC flags itself.
-	 */
-
 	fsp_open = open_file(fsp, conn, req, parent_dir,
 			     flags|flags2, unx_mode, access_mask,
 			     open_access_mask, &new_file_created);
@@ -2575,24 +2565,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 	 */
 
 	/*
-	 * If requested, truncate the file.
-	 */
-
-	if (!new_file_created && (flags2&O_TRUNC)) {
-		/*
-		 * We are modifying the file after open - update the stat
-		 * struct..
-		 */
-		if ((SMB_VFS_FTRUNCATE(fsp, 0) == -1) ||
-		    (SMB_VFS_FSTAT(fsp, &smb_fname->st)==-1)) {
-			status = map_nt_error_from_unix(errno);
-			TALLOC_FREE(lck);
-			fd_close(fsp);
-			return status;
-		}
-	}
-
-	/*
 	 * According to Samba4, SEC_FILE_READ_ATTRIBUTE is always granted,
 	 * but we don't have to store this - just ignore it on access check.
 	 */


-- 
Samba Shared Repository


More information about the samba-cvs mailing list