[SCM] Samba Shared Repository - branch v4-4-test updated

Karolin Seeger kseeger at samba.org
Mon Oct 31 13:59:03 UTC 2016


The branch, v4-4-test has been updated
       via  23aac93 ctdb-packaging: Move CTDB tests to /usr/local/share/ctdb/tests/
       via  79bf745 s3:smbd: only pass UCF_PREP_CREATEFILE to filename_convert() if we may create a new file
       via  a0b5a08 Revert "ctdb-common: Use SCHED_RESET_ON_FORK when setting SCHED_FIFO"
       via  6aec65c s3: vfs: streams_depot. Use conn->connectpath not conn->cwd.
       via  aa23db8 ctdb-conn: add missing variable initialization
      from  d6a814c VERSION: Bump version up to 4.4.8...

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-4-test


- Log -----------------------------------------------------------------
commit 23aac93906d4696af500263ac4c519d5a66382e4
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Oct 11 11:30:37 2016 +1100

    ctdb-packaging: Move CTDB tests to /usr/local/share/ctdb/tests/
    
    In time, other things will end up in /use/local/share/ctdb/.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12104
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit fd8e562069e3c01720be62069b7d58d14c10afd5)
    
    Autobuild-User(v4-4-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-4-test): Mon Oct 31 14:58:04 CET 2016 on sn-devel-144

commit 79bf7452dcf97ab640bb6a7654d3090fa91f9aa0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Oct 13 12:42:59 2016 +0200

    s3:smbd: only pass UCF_PREP_CREATEFILE to filename_convert() if we may create a new file
    
    This fixes a regression introduced by commit
    f98d10af2a05f0261611f4cabdfe274cd9fe91c0
    (smbd: Always use UCF_PREP_CREATEFILE for filename_convert calls to resolve a path for open)
    
    The main problem was that Windows client seem to verify
    the access to user.V2\ntuser.ini is rejected with NT_STATUS_ACCESS_DENIED,
    using the machine credentials.
    
    Passing UCF_PREP_CREATEFILE to filename_convert() triggers a code path
    that implements a dropbox behaviour. A dropbox is a directory with only -wx permissions,
    so get_real_filename fails with EACCESS, it needs to list the directory.
    EACCESS is ignored with UCF_PREP_CREATEFILE.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=10297
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Oct 25 05:33:36 CEST 2016 on sn-devel-144
    
    (cherry picked from commit 759416582c54a16aacbef0e0dfe4649bddff8c5e)

commit a0b5a087e5c13926d5330ac3138f3883a9692cd4
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Mon Oct 24 18:24:54 2016 +1100

    Revert "ctdb-common: Use SCHED_RESET_ON_FORK when setting SCHED_FIFO"
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12392
    
    Feature SCHED_RESET_ON_FORK is completely broken on RHEL6 and RHEL7
    distributions.  So do not rely on SCHED_RESET_ON_FORK for now.
    
    This reverts commit 1be8564e553ce044426dbe7b3987edf514832940.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Tue Oct 25 11:28:28 CEST 2016 on sn-devel-144
    
    (cherry picked from commit 71b69b0169dc6e2843325f1567f64b6acd43e6b8)

commit 6aec65c2333270f497d0ea21bdafc5e2d3676773
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 21 11:04:02 2016 -0700

    s3: vfs: streams_depot. Use conn->connectpath not conn->cwd.
    
    conn->cwd can change over the life of the connection,
    conn->connectpath remains static.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12387
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>
    
    Autobuild-User(master): Uri Simchoni <uri at samba.org>
    Autobuild-Date(master): Mon Oct 24 23:52:48 CEST 2016 on sn-devel-144
    
    (cherry picked from commit 1366385d1c3e9ac0556e954864e60e72f6906942)

commit aa23db80986ab2472afdcb29e8285c5338422453
Author: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Date:   Mon Oct 10 16:26:05 2016 +0200

    ctdb-conn: add missing variable initialization
    
    Avoid potential crash in TALLOC_FREE(hdr).
    
    Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 4194c0797f78293fe48105ce5af70f36a3c233a8)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12372
    ctdb: bad free in ctdbd_migrate()

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

Summary of changes:
 ctdb/common/system_util.c           |  8 +-------
 ctdb/packaging/RPM/ctdb.spec.in     |  4 ++--
 ctdb/wscript                        |  2 +-
 source3/lib/ctdbd_conn.c            |  2 +-
 source3/modules/vfs_streams_depot.c |  3 ++-
 source3/smbd/filename.c             | 23 ++++++++++++++++++++++
 source3/smbd/nttrans.c              |  8 ++++----
 source3/smbd/proto.h                |  1 +
 source3/smbd/reply.c                | 38 +++++++++++++++++++------------------
 source3/smbd/smb2_create.c          | 10 ++++++----
 10 files changed, 61 insertions(+), 38 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/common/system_util.c b/ctdb/common/system_util.c
index e6c4f17..738bf9c 100644
--- a/ctdb/common/system_util.c
+++ b/ctdb/common/system_util.c
@@ -67,14 +67,10 @@ bool set_scheduler(void)
 #else /* no AIX */
 #if HAVE_SCHED_SETSCHEDULER
 	struct sched_param p;
-	int policy = SCHED_FIFO;
 
 	p.sched_priority = 1;
 
-#ifdef SCHED_RESET_ON_FORK
-	policy |= SCHED_RESET_ON_FORK;
-#endif
-	if (sched_setscheduler(0, policy, &p) == -1) {
+	if (sched_setscheduler(0, SCHED_FIFO, &p) == -1) {
 		DEBUG(DEBUG_CRIT,("Unable to set scheduler to SCHED_FIFO (%s)\n",
 			 strerror(errno)));
 		return false;
@@ -107,7 +103,6 @@ void reset_scheduler(void)
 #endif
 #else /* no AIX */
 #if HAVE_SCHED_SETSCHEDULER
-#ifndef SCHED_RESET_ON_FORK
 	struct sched_param p;
 
 	p.sched_priority = 0;
@@ -116,7 +111,6 @@ void reset_scheduler(void)
 	}
 #endif
 #endif
-#endif
 }
 
 void set_nonblocking(int fd)
diff --git a/ctdb/packaging/RPM/ctdb.spec.in b/ctdb/packaging/RPM/ctdb.spec.in
index eed4a10..3df5baf 100644
--- a/ctdb/packaging/RPM/ctdb.spec.in
+++ b/ctdb/packaging/RPM/ctdb.spec.in
@@ -240,8 +240,8 @@ test suite for ctdb
 
 %files tests
 %defattr(-,root,root)
-%dir %{_datadir}/%{name}-tests
-%{_datadir}/%{name}-tests/*
+%dir %{_datadir}/%{name}/tests
+%{_datadir}/%{name}/tests/*
 %dir %{_libexecdir}/%{name}/tests
 %{_libexecdir}/%{name}/tests/*
 %{_bindir}/ctdb_run_tests
diff --git a/ctdb/wscript b/ctdb/wscript
index 4327663..06d954fc 100755
--- a/ctdb/wscript
+++ b/ctdb/wscript
@@ -207,7 +207,7 @@ def configure(conf):
                     conf.env.CTDB_RUNDIR))
 
     conf.env.CTDB_TEST_DATADIR = os.path.join(conf.env.EXEC_PREFIX,
-                                              'share/ctdb-tests')
+                                              'share/ctdb/tests')
     conf.env.CTDB_TEST_LIBEXECDIR = os.path.join(conf.env.LIBEXECDIR, 'ctdb/tests')
 
     # Allow unified compilation and separate compilation of utilities
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 04f6f2f..abdece8 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -919,7 +919,7 @@ int ctdbd_db_attach(struct ctdbd_connection *conn,
 int ctdbd_migrate(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key)
 {
 	struct ctdb_req_call_old req;
-	struct ctdb_req_header *hdr;
+	struct ctdb_req_header *hdr = NULL;
 	struct iovec iov[2];
 	ssize_t nwritten;
 	int ret;
diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c
index 5964852..bb8d5b9 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -128,7 +128,8 @@ static char *stream_dir(vfs_handle_struct *handle,
 	check_valid = lp_parm_bool(SNUM(handle->conn),
 		      "streams_depot", "check_valid", true);
 
-	tmp = talloc_asprintf(talloc_tos(), "%s/.streams", handle->conn->cwd);
+	tmp = talloc_asprintf(talloc_tos(), "%s/.streams",
+		handle->conn->connectpath);
 
 	if (tmp == NULL) {
 		errno = ENOMEM;
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index e89575d..ce40c0a 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -30,6 +30,29 @@
 #include "smbd/smbd.h"
 #include "smbd/globals.h"
 
+uint32_t filename_create_ucf_flags(struct smb_request *req, uint32_t create_disposition)
+{
+	uint32_t ucf_flags = 0;
+
+	if (req != NULL && req->posix_pathnames) {
+		ucf_flags |= UCF_POSIX_PATHNAMES;
+	}
+
+	switch (create_disposition) {
+	case FILE_OPEN:
+	case FILE_OVERWRITE:
+		break;
+	case FILE_SUPERSEDE:
+	case FILE_CREATE:
+	case FILE_OPEN_IF:
+	case FILE_OVERWRITE_IF:
+		ucf_flags |= UCF_PREP_CREATEFILE;
+		break;
+	}
+
+	return ucf_flags;
+}
+
 static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx,
 				  connection_struct *conn,
 				  struct smb_filename *smb_fname);
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 32c54e7..ad169d9 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -461,8 +461,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
 	int oplock_request;
 	uint8_t oplock_granted = NO_OPLOCK_RETURN;
 	struct case_semantics_state *case_state = NULL;
-	uint32_t ucf_flags = UCF_PREP_CREATEFILE |
-			(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
+	uint32_t ucf_flags;
 	TALLOC_CTX *ctx = talloc_tos();
 
 	START_PROFILE(SMBntcreateX);
@@ -536,6 +535,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
 		}
 	}
 
+	ucf_flags = filename_create_ucf_flags(req, create_disposition);
 	status = filename_convert(ctx,
 				conn,
 				req->flags2 & FLAGS2_DFS_PATHNAMES,
@@ -1024,8 +1024,7 @@ static void call_nt_transact_create(connection_struct *conn,
 	int oplock_request;
 	uint8_t oplock_granted;
 	struct case_semantics_state *case_state = NULL;
-	uint32_t ucf_flags = UCF_PREP_CREATEFILE |
-			(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
+	uint32_t ucf_flags;
 	TALLOC_CTX *ctx = talloc_tos();
 
 	DEBUG(5,("call_nt_transact_create\n"));
@@ -1106,6 +1105,7 @@ static void call_nt_transact_create(connection_struct *conn,
 		}
 	}
 
+	ucf_flags = filename_create_ucf_flags(req, create_disposition);
 	status = filename_convert(ctx,
 				conn,
 				req->flags2 & FLAGS2_DFS_PATHNAMES,
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index dcfd829..ca8ea57 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -325,6 +325,7 @@ int fsp_stat(files_struct *fsp);
 
 /* The following definitions come from smbd/filename.c  */
 
+uint32_t filename_create_ucf_flags(struct smb_request *req, uint32_t create_disposition);
 NTSTATUS unix_convert(TALLOC_CTX *ctx,
 		      connection_struct *conn,
 		      const char *orig_path,
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 72fa5a4..6b16458 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2097,8 +2097,7 @@ void reply_open(struct smb_request *req)
 	uint32_t create_options = 0;
 	uint32_t private_flags = 0;
 	NTSTATUS status;
-	uint32_t ucf_flags = UCF_PREP_CREATEFILE |
-			(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
+	uint32_t ucf_flags;
 	TALLOC_CTX *ctx = talloc_tos();
 
 	START_PROFILE(SMBopen);
@@ -2127,6 +2126,8 @@ void reply_open(struct smb_request *req)
 		goto out;
 	}
 
+	ucf_flags = filename_create_ucf_flags(req, create_disposition);
+
 	status = filename_convert(ctx,
 				conn,
 				req->flags2 & FLAGS2_DFS_PATHNAMES,
@@ -2251,8 +2252,7 @@ void reply_open_and_X(struct smb_request *req)
 	uint32_t create_disposition;
 	uint32_t create_options = 0;
 	uint32_t private_flags = 0;
-	uint32_t ucf_flags = UCF_PREP_CREATEFILE |
-			(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
+	uint32_t ucf_flags;
 	TALLOC_CTX *ctx = talloc_tos();
 
 	START_PROFILE(SMBopenX);
@@ -2299,6 +2299,8 @@ void reply_open_and_X(struct smb_request *req)
 		goto out;
 	}
 
+	ucf_flags = filename_create_ucf_flags(req, create_disposition);
+
 	status = filename_convert(ctx,
 				conn,
 				req->flags2 & FLAGS2_DFS_PATHNAMES,
@@ -2511,8 +2513,7 @@ void reply_mknew(struct smb_request *req)
 	uint32_t share_mode = FILE_SHARE_READ|FILE_SHARE_WRITE;
 	uint32_t create_disposition;
 	uint32_t create_options = 0;
-	uint32_t ucf_flags = UCF_PREP_CREATEFILE |
-			(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
+	uint32_t ucf_flags;
 	TALLOC_CTX *ctx = talloc_tos();
 
 	START_PROFILE(SMBcreate);
@@ -2526,6 +2527,14 @@ void reply_mknew(struct smb_request *req)
 	fattr = SVAL(req->vwv+0, 0);
 	oplock_request = CORE_OPLOCK_REQUEST(req->inbuf);
 
+	if (req->cmd == SMBmknew) {
+		/* We should fail if file exists. */
+		create_disposition = FILE_CREATE;
+	} else {
+		/* Create if file doesn't exist, truncate if it does. */
+		create_disposition = FILE_OVERWRITE_IF;
+	}
+
 	/* mtime. */
 	ft.mtime = convert_time_t_to_timespec(srv_make_unix_date3(req->vwv+1));
 
@@ -2536,6 +2545,7 @@ void reply_mknew(struct smb_request *req)
 		goto out;
 	}
 
+	ucf_flags = filename_create_ucf_flags(req, create_disposition);
 	status = filename_convert(ctx,
 				conn,
 				req->flags2 & FLAGS2_DFS_PATHNAMES,
@@ -2560,14 +2570,6 @@ void reply_mknew(struct smb_request *req)
 			 smb_fname_str_dbg(smb_fname)));
 	}
 
-	if(req->cmd == SMBmknew) {
-		/* We should fail if file exists. */
-		create_disposition = FILE_CREATE;
-	} else {
-		/* Create if file doesn't exist, truncate if it does. */
-		create_disposition = FILE_OVERWRITE_IF;
-	}
-
 	status = SMB_VFS_CREATE_FILE(
 		conn,					/* conn */
 		req,					/* req */
@@ -2644,8 +2646,7 @@ void reply_ctemp(struct smb_request *req)
 	char *s;
 	NTSTATUS status;
 	int i;
-	uint32_t ucf_flags = UCF_PREP_CREATEFILE |
-			(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
+	uint32_t ucf_flags;
 	TALLOC_CTX *ctx = talloc_tos();
 
 	START_PROFILE(SMBctemp);
@@ -2682,6 +2683,7 @@ void reply_ctemp(struct smb_request *req)
 			goto out;
 		}
 
+		ucf_flags = filename_create_ucf_flags(req, FILE_CREATE);
 		status = filename_convert(ctx, conn,
 				req->flags2 & FLAGS2_DFS_PATHNAMES,
 				fname,
@@ -6107,8 +6109,7 @@ void reply_mkdir(struct smb_request *req)
 	struct smb_filename *smb_dname = NULL;
 	char *directory = NULL;
 	NTSTATUS status;
-	uint32_t ucf_flags = UCF_PREP_CREATEFILE |
-			(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
+	uint32_t ucf_flags;
 	TALLOC_CTX *ctx = talloc_tos();
 
 	START_PROFILE(SMBmkdir);
@@ -6120,6 +6121,7 @@ void reply_mkdir(struct smb_request *req)
 		goto out;
 	}
 
+	ucf_flags = filename_create_ucf_flags(req, FILE_CREATE);
 	status = filename_convert(ctx, conn,
 				 req->flags2 & FLAGS2_DFS_PATHNAMES,
 				 directory,
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index 17bddc1..46eb839 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -374,12 +374,12 @@ static bool smb2_lease_key_valid(const struct smb2_lease_key *key)
 	return ((key->data[0] != 0) || (key->data[1] != 0));
 }
 
-static NTSTATUS smbd_smb2_create_durable_lease_check(
+static NTSTATUS smbd_smb2_create_durable_lease_check(struct smb_request *smb1req,
 	const char *requested_filename, const struct files_struct *fsp,
 	const struct smb2_lease *lease_ptr)
 {
 	struct smb_filename *smb_fname = NULL;
-	uint32_t ucf_flags = UCF_PREP_CREATEFILE;
+	uint32_t ucf_flags;
 	NTSTATUS status;
 
 	if (lease_ptr == NULL) {
@@ -404,6 +404,7 @@ static NTSTATUS smbd_smb2_create_durable_lease_check(
 		return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 	}
 
+	ucf_flags = filename_create_ucf_flags(smb1req, FILE_OPEN);
 	status = filename_convert(talloc_tos(), fsp->conn, false,
 				  requested_filename, ucf_flags,
 				  NULL, &smb_fname);
@@ -1051,7 +1052,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 				   (unsigned)result->oplock_type, lease_ptr));
 
 			status = smbd_smb2_create_durable_lease_check(
-				fname, result, lease_ptr);
+				smb1req, fname, result, lease_ptr);
 			if (!NT_STATUS_IS_OK(status)) {
 				close_file(smb1req, result, SHUTDOWN_CLOSE);
 				tevent_req_nterror(req, status);
@@ -1072,7 +1073,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 			info = FILE_WAS_OPENED;
 		} else {
 			struct smb_filename *smb_fname = NULL;
-			uint32_t ucf_flags = UCF_PREP_CREATEFILE;
+			uint32_t ucf_flags;
 
 			if (requested_oplock_level == SMB2_OPLOCK_LEVEL_LEASE) {
 				if (lease_ptr == NULL) {
@@ -1096,6 +1097,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 				}
 			}
 
+			ucf_flags = filename_create_ucf_flags(smb1req, in_create_disposition);
 			status = filename_convert(req,
 						  smb1req->conn,
 						  smb1req->flags2 & FLAGS2_DFS_PATHNAMES,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list