[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue May 28 22:23:24 UTC 2019


The branch, master has been updated
       via  73080f255e3 smbd: Adapt brl_pending_overlap to README.Coding
       via  4a93fc686fa smbd: Avoid casts in smbd_smb2_lock_send()
       via  8b478aaf2cf smbd: Avoid casts in do_unlock()
       via  199bb3d72a0 smbd: Avoid casts in smbd_do_unlocking()
       via  2093ebc4aba smbd: Align integer types in smbd_do_unlocking()
       via  115e9ea3af9 smbd: Simplify an if-expression in smbd_do_locking()
       via  a2c2235c1f2 smbtorture: Fix a typo
       via  72ba86dd0c9 smbd: Use tevent_req_simple_recv_ntstatus() in smbd_smb2_lock_recv()
       via  1838a8df596 smbd: Avoid casts in smbd_do_locking()
       via  f283b7a4ee7 smbd: Fix a typo
       via  953f9f7b6d2 smbd: Factor out fsps_lease_update()
       via  9891a44fd7f smbd: Simplify fsp_lease_update()
       via  df3606685b1 smbd: Use "fsp->lease" instead of "lease"
       via  4e56d2280ad smbd: Fix a typo
       via  905698fbe66 dbwrap: Use sizeof, not an integer constant
       via  f11c5887f4f brlock: Remove clustering special case
       via  ff2ed9070db smbd: Fix a typo
       via  32999e14872 lib: Fix CID 1445648 Null pointer dereferences
      from  9053391f86a s3:mdssvc: fix flex compilation error

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


- Log -----------------------------------------------------------------
commit 73080f255e379ed030005031f560c3ed71919b06
Author: Volker Lendecke <vl at samba.org>
Date:   Mon May 27 16:21:12 2019 +0200

    smbd: Adapt brl_pending_overlap to README.Coding
    
    Just reformatting, no behaviour change. This just looked too ugly to me.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue May 28 22:22:28 UTC 2019 on sn-devel-184

commit 4a93fc686fafe4ffbe72271f4093bde6aa607b2a
Author: Volker Lendecke <vl at samba.org>
Date:   Mon May 27 16:15:17 2019 +0200

    smbd: Avoid casts in smbd_smb2_lock_send()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8b478aaf2cf88e8102b334eb5dbe1c44f5d30eb6
Author: Volker Lendecke <vl at samba.org>
Date:   Mon May 27 13:49:34 2019 +0200

    smbd: Avoid casts in do_unlock()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 199bb3d72a0b80597265aaddd53adf97d1b34d30
Author: Volker Lendecke <vl at samba.org>
Date:   Mon May 27 13:45:59 2019 +0200

    smbd: Avoid casts in smbd_do_unlocking()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2093ebc4abafb0024ab5faeffdadb9a6f88d947d
Author: Volker Lendecke <vl at samba.org>
Date:   Mon May 27 13:45:42 2019 +0200

    smbd: Align integer types in smbd_do_unlocking()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 115e9ea3af9eb248f25f2ac6505956226f8dc6cd
Author: Volker Lendecke <vl at samba.org>
Date:   Mon May 27 13:45:10 2019 +0200

    smbd: Simplify an if-expression in smbd_do_locking()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a2c2235c1f26c43dfb6b7ad965974460901dbb9b
Author: Volker Lendecke <vl at samba.org>
Date:   Tue May 28 16:54:34 2019 +0200

    smbtorture: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 72ba86dd0c9c95792c5dcb01fcd5b93d9815e336
Author: Volker Lendecke <vl at samba.org>
Date:   Tue May 28 17:00:30 2019 +0200

    smbd: Use tevent_req_simple_recv_ntstatus() in smbd_smb2_lock_recv()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1838a8df596ae2625c83f5001bf7d5c66ed2bbe7
Author: Volker Lendecke <vl at samba.org>
Date:   Tue May 21 09:17:24 2019 +0200

    smbd: Avoid casts in smbd_do_locking()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f283b7a4ee7c596953121af58cc59e3621b0b654
Author: Volker Lendecke <vl at samba.org>
Date:   Tue May 21 20:37:30 2019 +0200

    smbd: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 953f9f7b6d21c4cb2cea6033af240b0bac1cabeb
Author: Volker Lendecke <vl at samba.org>
Date:   Fri May 24 16:50:30 2019 +0200

    smbd: Factor out fsps_lease_update()
    
    Less lines of code, less .text bytes with -O3
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9891a44fd7fc7f2b3a177d5f220cf21dd48b18b0
Author: Volker Lendecke <vl at samba.org>
Date:   Fri May 24 15:58:09 2019 +0200

    smbd: Simplify fsp_lease_update()
    
    We don't need a share mode lock from a data dependency point of view
    anymore, the leases data moved to leases.tdb. However, from a
    coherency point of view it's probably wise to do this under a share
    mode lock.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit df3606685b1dfe4fd6ab422b4acd2fbb5aa36076
Author: Volker Lendecke <vl at samba.org>
Date:   Fri May 24 15:50:02 2019 +0200

    smbd: Use "fsp->lease" instead of "lease"
    
    See the SMB_ASSERT a few lines above. Why this? It makes the next
    commit more obvious.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4e56d2280ad04ce0b3e54f13ed1ac9f472fd6ad8
Author: Volker Lendecke <vl at samba.org>
Date:   Fri May 24 14:46:19 2019 +0200

    smbd: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 905698fbe667de856a19eb9ff96f5865a6775e55
Author: Volker Lendecke <vl at samba.org>
Date:   Fri May 24 14:37:20 2019 +0200

    dbwrap: Use sizeof, not an integer constant
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f11c5887f4fb4b766f23c82b84b5aedb79eb3f43
Author: Volker Lendecke <vl at samba.org>
Date:   Sun May 26 08:20:47 2019 +0200

    brlock: Remove clustering special case
    
    With e7424897a127 we don't need this special case for clustering
    anymore.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ff2ed9070dbaa919425c222989b3fa4b917b59e2
Author: Volker Lendecke <vl at samba.org>
Date:   Mon May 27 11:48:13 2019 +0200

    smbd: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 32999e148727ff3f0371a78dd80b7c3e6b666391
Author: Volker Lendecke <vl at samba.org>
Date:   Tue May 28 08:49:52 2019 +0200

    lib: Fix CID 1445648 Null pointer dereferences
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 lib/util/sys_popen.c              |  3 ++-
 source3/lib/dbwrap/dbwrap_watch.c |  3 ++-
 source3/locking/brlock.c          | 40 +++++++++++++---------------
 source3/locking/locking.c         |  9 ++++---
 source3/locking/share_mode_lock.c |  4 +--
 source3/smbd/open.c               |  4 +--
 source3/smbd/oplock.c             | 55 ++++++++++++++++++---------------------
 source3/smbd/proto.h              |  4 +--
 source3/smbd/reply.c              | 40 ++++++++++++++--------------
 source3/smbd/smb2_lock.c          | 24 ++++++-----------
 source4/torture/raw/lock.c        |  2 +-
 11 files changed, 88 insertions(+), 100 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/sys_popen.c b/lib/util/sys_popen.c
index 659e99ba736..f62199b42ff 100644
--- a/lib/util/sys_popen.c
+++ b/lib/util/sys_popen.c
@@ -44,13 +44,14 @@ int sys_popenv(char * const argl[])
 	int parent_end, child_end;
 	int pipe_fds[2];
 	popen_list *entry = NULL;
-	const char *command = argl[0];
+	const char *command = NULL;
 	int ret;
 
 	if (argl == NULL) {
 		errno = EINVAL;
 		return -1;
 	}
+	command = argl[0];
 
 	if (!*command) {
 		errno = EINVAL;
diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c
index 45e17958b92..c367efdd130 100644
--- a/source3/lib/dbwrap/dbwrap_watch.c
+++ b/source3/lib/dbwrap/dbwrap_watch.c
@@ -361,7 +361,8 @@ static void dbwrap_watched_wakeup(struct db_record *rec,
 
 	SIVAL(len_buf, 0, db_id_len);
 
-	iov[0] = (struct iovec) { .iov_base = len_buf, .iov_len = 4 };
+	iov[0] = (struct iovec) { .iov_base = len_buf,
+				  .iov_len = sizeof(len_buf) };
 	iov[1] = (struct iovec) { .iov_base = db_id, .iov_len = db_id_len };
 	iov[2] = (struct iovec) { .iov_base = rec->key.dptr,
 				  .iov_len = rec->key.dsize };
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index a24ad68bf3f..5a4bd0d5c06 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -295,13 +295,18 @@ static bool brl_conflict_other(const struct lock_struct *lock,
  Check if an unlock overlaps a pending lock.
 ****************************************************************************/
 
-static bool brl_pending_overlap(const struct lock_struct *lock, const struct lock_struct *pend_lock)
+static bool brl_pending_overlap(const struct lock_struct *lock,
+				const struct lock_struct *pend_lock)
 {
-	if ((lock->start <= pend_lock->start) && (lock->start + lock->size > pend_lock->start))
-		return True;
-	if ((lock->start >= pend_lock->start) && (lock->start < pend_lock->start + pend_lock->size))
-		return True;
-	return False;
+	if ((lock->start <= pend_lock->start) &&
+	    (lock->start + lock->size > pend_lock->start)) {
+		return true;
+	}
+	if ((lock->start >= pend_lock->start) &&
+	    (lock->start < pend_lock->start + pend_lock->size)) {
+		return true;
+	}
+	return false;
 }
 
 /****************************************************************************
@@ -2099,22 +2104,13 @@ struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp)
 	br_lock->modified = false;
 	br_lock->record = NULL;
 
-	if (lp_clustering()) {
-		/*
-		 * In the cluster case we can't cache the brlock struct
-		 * because dbwrap_get_seqnum does not work reliably over
-		 * ctdb. Thus we have to throw away the brlock struct soon.
-		 */
-		talloc_steal(talloc_tos(), br_lock);
-	} else {
-		/*
-		 * Cache the brlock struct, invalidated when the dbwrap_seqnum
-		 * changes. See beginning of this routine.
-		 */
-		TALLOC_FREE(fsp->brlock_rec);
-		fsp->brlock_rec = br_lock;
-		fsp->brlock_seqnum = dbwrap_get_seqnum(brlock_db);
-	}
+	/*
+	 * Cache the brlock struct, invalidated when the dbwrap_seqnum
+	 * changes. See beginning of this routine.
+	 */
+	TALLOC_FREE(fsp->brlock_rec);
+	fsp->brlock_rec = br_lock;
+	fsp->brlock_seqnum = dbwrap_get_seqnum(brlock_db);
 
 	return br_lock;
 }
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 073651fd841..8deb5279fa4 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -316,9 +316,12 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx,
 		return NT_STATUS_OK;
 	}
 
-	DEBUG(10, ("do_unlock: unlock start=%ju len=%ju requested for %s file "
-		   "%s\n", (uintmax_t)offset, (uintmax_t)count,
-		   fsp_fnum_dbg(fsp), fsp_str_dbg(fsp)));
+	DBG_DEBUG("unlock start=%"PRIu64" len=%"PRIu64" requested for %s file "
+		  "%s\n",
+		  offset,
+		  count,
+		  fsp_fnum_dbg(fsp),
+		  fsp_str_dbg(fsp));
 
 	br_lck = brl_get_locks(talloc_tos(), fsp);
 	if (!br_lck) {
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index a20de67b34a..92902af3fe7 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -317,8 +317,8 @@ static struct share_mode_data *parse_share_modes(TALLOC_CTX *mem_ctx,
 	ndr_err = ndr_pull_struct_blob_all(
 		&blob, d, d, (ndr_pull_flags_fn_t)ndr_pull_share_mode_data);
 	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-		DEBUG(1, ("ndr_pull_share_mode_lock failed: %s\n",
-			  ndr_errstr(ndr_err)));
+		DBG_WARNING("ndr_pull_share_mode_data failed: %s\n",
+			    ndr_errstr(ndr_err));
 		goto fail;
 	}
 
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 8e9de5e11b4..7a0db9396f9 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1315,7 +1315,7 @@ static NTSTATUS open_file(files_struct *fsp,
 			 * GPFS can return ETIMEDOUT for pread on
 			 * nonblocking file descriptors when files
 			 * migrated to tape need to be recalled. I
-			 * could imagine this happens elsehwere
+			 * could imagine this happens elsewhere
 			 * too. With blocking file descriptors this
 			 * does not happen.
 			 */
@@ -2108,7 +2108,7 @@ static NTSTATUS try_lease_upgrade(struct files_struct *fsp,
 		}
 	}
 
-	fsp_lease_update(lck, fsp_client_guid(fsp), fsp->lease);
+	fsp_lease_update(fsp);
 
 	return NT_STATUS_OK;
 }
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index b99b9cb4f08..aad85fbb2d1 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -391,7 +391,7 @@ static void lease_timeout_handler(struct tevent_context *ctx,
 		return;
 	}
 
-	fsp_lease_update(lck, fsp_client_guid(fsp), lease);
+	fsp_lease_update(fsp);
 
 	if (lease->lease.lease_epoch != old_epoch) {
 		/*
@@ -426,18 +426,18 @@ static void lease_timeout_handler(struct tevent_context *ctx,
 	TALLOC_FREE(lck);
 }
 
-bool fsp_lease_update(struct share_mode_lock *lck,
-		      const struct GUID *client_guid,
-		      struct fsp_lease *lease)
+bool fsp_lease_update(struct files_struct *fsp)
 {
+	const struct GUID *client_guid = fsp_client_guid(fsp);
+	struct fsp_lease *lease = fsp->lease;
 	uint32_t current_state;
 	bool breaking;
 	uint16_t lease_version, epoch;
 	NTSTATUS status;
 
 	status = leases_db_get(client_guid,
-			       &lease->lease.lease_key,
-			       &lck->data->id,
+			       &fsp->lease->lease.lease_key,
+			       &fsp->file_id,
 			       &current_state,
 			       &breaking,
 			       NULL, /* breaking_to_requested */
@@ -523,17 +523,16 @@ static void downgrade_lease_additional_trigger(struct tevent_context *ev,
 	}
 }
 
-struct downgrade_lease_fsps_state {
-	struct file_id id;
-	struct share_mode_lock *lck;
+struct fsps_lease_update_state {
+	const struct file_id *id;
 	const struct smb2_lease_key *key;
 };
 
-static struct files_struct *downgrade_lease_fsps(struct files_struct *fsp,
-						 void *private_data)
+static struct files_struct *fsps_lease_update_fn(
+	struct files_struct *fsp, void *private_data)
 {
-	struct downgrade_lease_fsps_state *state =
-		(struct downgrade_lease_fsps_state *)private_data;
+	struct fsps_lease_update_state *state =
+		(struct fsps_lease_update_state *)private_data;
 
 	if (fsp->oplock_type != LEASE_OPLOCK) {
 		return NULL;
@@ -541,15 +540,23 @@ static struct files_struct *downgrade_lease_fsps(struct files_struct *fsp,
 	if (!smb2_lease_key_equal(&fsp->lease->lease.lease_key, state->key)) {
 		return NULL;
 	}
-	if (!file_id_equal(&fsp->file_id, &state->id)) {
+	if (!file_id_equal(&fsp->file_id, state->id)) {
 		return NULL;
 	}
 
-	fsp_lease_update(state->lck, fsp_client_guid(fsp), fsp->lease);
+	fsp_lease_update(fsp);
 
 	return NULL;
 }
 
+static void fsps_lease_update(struct smbd_server_connection *sconn,
+			      const struct file_id *id,
+			      const struct smb2_lease_key *key)
+{
+	struct fsps_lease_update_state state = { .id = id, .key = key };
+	files_forall(sconn, fsps_lease_update_fn, &state);
+}
+
 NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
 			 uint32_t num_file_ids,
 			 const struct file_id *ids,
@@ -748,13 +755,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
 	 */
 	lck->data->modified = true;
 
-	{
-		struct downgrade_lease_fsps_state state = {
-			.id = id, .lck = lck, .key = key,
-		};
-
-		files_forall(sconn, downgrade_lease_fsps, &state);
-	}
+	fsps_lease_update(sconn, &id, key);
 
 	TALLOC_FREE(lck);
 	DEBUG(10, ("%s: Downgrading %s to %x => %s\n", __func__,
@@ -771,13 +772,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
 			return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 		}
 
-		{
-			struct downgrade_lease_fsps_state state = {
-				.id = ids[i], .lck = lck, .key = key,
-			};
-
-			files_forall(sconn, downgrade_lease_fsps, &state);
-		}
+		fsps_lease_update(sconn, &ids[i], key);
 
 		DEBUG(10, ("%s: Downgrading %s to %x => %s\n", __func__,
 			file_id_string_tos(&ids[i]), (unsigned)lease_state, nt_errstr(status)));
@@ -1110,7 +1105,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
 		}
 
 		/* Ensure we're in sync with current lease state. */
-		fsp_lease_update(lck, fsp_client_guid(fsp), fsp->lease);
+		fsp_lease_update(fsp);
 
 		TALLOC_FREE(lck);
 	}
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 7d4f7757ec3..7b2a752d2fd 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -733,9 +733,7 @@ NTSTATUS set_file_oplock(files_struct *fsp);
 bool remove_oplock_under_lock(files_struct *fsp, struct share_mode_lock *lck);
 bool remove_oplock(files_struct *fsp);
 bool downgrade_oplock(files_struct *fsp);
-bool fsp_lease_update(struct share_mode_lock *lck,
-		      const struct GUID *client_guid,
-		      struct fsp_lease *lease);
+bool fsp_lease_update(struct files_struct *fsp);
 NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
 			uint32_t num_file_ids,
 			const struct file_id *ids,
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 6dc69f7405c..88823ae31c9 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -4597,7 +4597,7 @@ void reply_writebraw(struct smb_request *req)
 
 		/*
 		 * We are not vulnerable to CVE-2017-12163
-		 * here as we are guarenteed to have numtowrite
+		 * here as we are guaranteed to have numtowrite
 		 * bytes available - we just read from the client.
 		 */
 		nwritten = write_file(req,fsp,buf+4,startpos+nwritten,numtowrite);
@@ -8096,13 +8096,13 @@ NTSTATUS smbd_do_locking(struct smb_request *req,
 	for(i = 0; i < (int)num_locks; i++) {
 		struct smbd_lock_element *e = &locks[i];
 
-		DEBUG(10,("smbd_do_locking: lock start=%.0f, len=%.0f for smblctx "
-			  "%llu, file %s timeout = %d\n",
-			  (double)e->offset,
-			  (double)e->count,
-			  (unsigned long long)e->smblctx,
+		DBG_DEBUG("lock start=%"PRIu64", len=%"PRIu64" for smblctx "
+			  "%"PRIu64", file %s timeout = %"PRIi32"\n",
+			  e->offset,
+			  e->count,
+			  e->smblctx,
 			  fsp_str_dbg(fsp),
-			  (int)timeout));
+			  timeout);
 
 		if (type & LOCKING_ANDX_CANCEL_LOCK) {
 			struct blocking_lock_record *blr = NULL;
@@ -8176,8 +8176,8 @@ NTSTATUS smbd_do_locking(struct smb_request *req,
 			if (br_lck && blocking_lock && ERROR_WAS_LOCK_DENIED(status)) {
 				/* Windows internal resolution for blocking locks seems
 				   to be about 200ms... Don't wait for less than that. JRA. */
-				if (timeout != -1 && timeout < lp_lock_spin_time()) {
-					timeout = lp_lock_spin_time();
+				if (timeout != -1) {
+					timeout = MAX(timeout, lp_lock_spin_time());
 				}
 				defer_lock = true;
 			}
@@ -8261,8 +8261,10 @@ NTSTATUS smbd_do_locking(struct smb_request *req,
 		return status;
 	}
 
-	DEBUG(3, ("smbd_do_locking: %s type=%d num_locks=%d\n",
-		  fsp_fnum_dbg(fsp), (unsigned int)type, num_locks));
+	DBG_NOTICE("%s type=%"PRIu8" num_locks=%"PRIu16"\n",
+		   fsp_fnum_dbg(fsp),
+		   type,
+		   num_locks);
 
 	return NT_STATUS_OK;
 }
@@ -8272,18 +8274,18 @@ NTSTATUS smbd_do_unlocking(struct smb_request *req,
 			   uint16_t num_ulocks,
 			   struct smbd_lock_element *ulocks)
 {
-	int i;
+	uint16_t i;
 
-	for(i = 0; i < (int)num_ulocks; i++) {
+	for(i = 0; i < num_ulocks; i++) {
 		struct smbd_lock_element *e = &ulocks[i];
 		NTSTATUS status;
 
-		DEBUG(10,("%s: unlock start=%.0f, len=%.0f for "
-			  "pid %u, file %s\n", __func__,
-			  (double)e->offset,
-			  (double)e->count,
-			  (unsigned int)e->smblctx,
-			  fsp_str_dbg(fsp)));
+		DBG_DEBUG("unlock start=%"PRIu64", len=%"PRIu64" for "
+			  "pid %"PRIu64", file %s\n",
+			  e->offset,
+			  e->count,
+			  e->smblctx,
+			  fsp_str_dbg(fsp));
 
 		if (e->brltype != UNLOCK_LOCK) {
 			/* this can only happen with SMB2 */
diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c
index a05470e52e4..ae845d44387 100644
--- a/source3/smbd/smb2_lock.c
+++ b/source3/smbd/smb2_lock.c
@@ -335,13 +335,13 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
 			locks[i].brltype = UNLOCK_LOCK;
 		}
 
-		DEBUG(10,("smbd_smb2_lock_send: index %d offset=%llu, count=%llu, "
-			"smblctx = %llu type %d\n",
-			i,
-			(unsigned long long)locks[i].offset,
-			(unsigned long long)locks[i].count,
-			(unsigned long long)locks[i].smblctx,
-			(int)locks[i].brltype ));
+		DBG_DEBUG("index %"PRIu16" offset=%"PRIu64", count=%"PRIu64", "
+			  "smblctx = %"PRIu64" type %d\n",
+			  i,
+			  locks[i].offset,
+			  locks[i].count,
+			  locks[i].smblctx,
+			  (int)locks[i].brltype);
 	}
 
 	state->locks = locks;
@@ -379,15 +379,7 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
 
 static NTSTATUS smbd_smb2_lock_recv(struct tevent_req *req)
 {
-	NTSTATUS status;
-
-	if (tevent_req_is_nterror(req, &status)) {
-		tevent_req_received(req);
-		return status;
-	}
-
-	tevent_req_received(req);
-	return NT_STATUS_OK;
+	return tevent_req_simple_recv_ntstatus(req);
 }
 
 /****************************************************************
diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c
index a8cc153b3d7..92585eea00e 100644
--- a/source4/torture/raw/lock.c
+++ b/source4/torture/raw/lock.c
@@ -571,7 +571,7 @@ static bool test_async(struct torture_context *tctx,
 		       "lock cancel was not immediate (%s)\n", __location__));
 
 	/* MS-CIFS (2.2.4.32.1) states that a cancel is honored if and only
-	 * if the lock vector contains one entry. When given mutliple cancel
+	 * if the lock vector contains one entry. When given multiple cancel
 	 * requests in a single PDU we expect the server to return an
 	 * error. Samba4 handles this correctly. Windows servers seem to
 	 * accept the request but only cancel the first lock.  Samba3


-- 
Samba Shared Repository



More information about the samba-cvs mailing list