[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha2-1222-gd0b641a

Stefan Metzmacher metze at samba.org
Thu Mar 6 16:24:41 GMT 2008


The branch, v4-0-test has been updated
       via  d0b641a9ee36939468beb427bf6b15892342a33d (commit)
       via  4fb2c9fb1f4e3ee23281ca83f8b91d252cbf53c7 (commit)
       via  2192d6d2bda2afd2ba1ed0cb68bdfe590b9d50af (commit)
       via  0905f3ebd1cb1ac9cefc4272208add9e5a8d7f59 (commit)
       via  7c9b269b0742d435055e21f7e6cc945c21c7e332 (commit)
       via  146f1fe0b67ca0805f0e71358abc57da0c0579a9 (commit)
       via  5563238782e825f64a22b5f9e0a7deb687f50b19 (commit)
       via  cc42cd5f6753ca582677fa6f403f0419eec5ab10 (commit)
       via  33caaef2e46557525a8ffb79d6dd0db46a079529 (commit)
      from  e66be2f519584717abd7fc1f069bf7afe0d7ff60 (commit)

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


- Log -----------------------------------------------------------------
commit d0b641a9ee36939468beb427bf6b15892342a33d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 6 16:27:13 2008 +0100

    RAW-OPLOCK: rename _ack_to_levelII() -> ack_to_given()
    
    Also improve the output.
    
    metze

commit 4fb2c9fb1f4e3ee23281ca83f8b91d252cbf53c7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 6 15:56:03 2008 +0100

    RAW-OPLOCK: add BATCH24 test another case with a connection with no CAP_LEVEL_II_OPLOCKS
    
    metze

commit 2192d6d2bda2afd2ba1ed0cb68bdfe590b9d50af
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 6 15:54:07 2008 +0100

    RAW-OPLOCK: add BATCH23 and test with a connection with no CAP_LEVEL_II_OPLOCKS
    
    metze

commit 0905f3ebd1cb1ac9cefc4272208add9e5a8d7f59
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 6 15:49:31 2008 +0100

    RAW-OPLOCK: remove unused vars
    
    metze

commit 7c9b269b0742d435055e21f7e6cc945c21c7e332
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 6 15:48:31 2008 +0100

    pvfs_open: pass down allow_level_II_oplock to odb_open_file()
    
    metze

commit 146f1fe0b67ca0805f0e71358abc57da0c0579a9
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 6 15:47:27 2008 +0100

    opendb: add allow_level_II_oplock parameter to odb_open_file()
    
    Not all clients support a fallback to level II oplocks.
    
    metze

commit 5563238782e825f64a22b5f9e0a7deb687f50b19
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 6 15:34:37 2008 +0100

    pvfs_open: fix crash/leak in case pvfs_setup_oplock() fails
    
    metze

commit cc42cd5f6753ca582677fa6f403f0419eec5ab10
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 6 15:14:08 2008 +0100

    ntvfs: pass down the client capabilities into the ntvfs layer
    
    Note that we don't use any protocol specific values here.
    
    For now only NTVFS_CLIENT_CAP_LEVEL_II_OPLOCKS is defined
    others should be defined, when we find out that the ntvfs
    layer needs to know about it.
    
    metze

commit 33caaef2e46557525a8ffb79d6dd0db46a079529
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 6 15:11:16 2008 +0100

    libcli/raw: make it possible to not send CAP_LEVEL_II_OPLOCKS
    
    But the keep the default to always send it
    when the server supports it too.
    
    metze

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

Summary of changes:
 source/cluster/ctdb/opendb_ctdb.c       |    1 +
 source/libcli/raw/rawnegotiate.c        |    4 +
 source/librpc/idl/opendb.idl            |    1 +
 source/ntvfs/common/opendb.c            |    4 +-
 source/ntvfs/common/opendb.h            |    1 +
 source/ntvfs/common/opendb_tdb.c        |   32 ++-
 source/ntvfs/ntvfs.h                    |   16 ++
 source/ntvfs/ntvfs_base.c               |    2 +
 source/ntvfs/ntvfs_util.c               |    1 +
 source/ntvfs/posix/pvfs_open.c          |   31 ++-
 source/param/loadparm.c                 |    4 +-
 source/rpc_server/srvsvc/srvsvc_ntvfs.c |    1 +
 source/smb_server/smb/service.c         |    6 +
 source/smb_server/smb2/tcon.c           |    4 +
 source/torture/raw/oplock.c             |  321 +++++++++++++++++++++++++------
 source/torture/util_smb.c               |    6 +-
 16 files changed, 352 insertions(+), 83 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/cluster/ctdb/opendb_ctdb.c b/source/cluster/ctdb/opendb_ctdb.c
index e84f236..fe48f98 100644
--- a/source/cluster/ctdb/opendb_ctdb.c
+++ b/source/cluster/ctdb/opendb_ctdb.c
@@ -284,6 +284,7 @@ static NTSTATUS odb_ctdb_open_file(struct odb_lock *lck,
 				   uint32_t stream_id, uint32_t share_access,
 				   uint32_t access_mask, bool delete_on_close,
 				   uint32_t open_disposition, bool break_to_none,
+				   bool allow_level_II_oplock,
 				   uint32_t oplock_level, uint32_t *oplock_granted)
 
 {
diff --git a/source/libcli/raw/rawnegotiate.c b/source/libcli/raw/rawnegotiate.c
index ec2ada5..6c16935 100644
--- a/source/libcli/raw/rawnegotiate.c
+++ b/source/libcli/raw/rawnegotiate.c
@@ -187,6 +187,10 @@ NTSTATUS smb_raw_negotiate_recv(struct smbcli_request *req)
 		transport->negotiate.capabilities &= ~CAP_STATUS32;
 	}
 
+	if (!transport->options.use_level2_oplocks) {
+		transport->negotiate.capabilities &= ~CAP_LEVEL_II_OPLOCKS;
+	}
+
 failed:
 	return smbcli_request_destroy(req);
 }
diff --git a/source/librpc/idl/opendb.idl b/source/librpc/idl/opendb.idl
index eaa626e..e3bc2d0 100644
--- a/source/librpc/idl/opendb.idl
+++ b/source/librpc/idl/opendb.idl
@@ -23,6 +23,7 @@ interface opendb
 		/* we need a per-entry delete on close, as well as a per-file
 		   one, to cope with strange semantics on open */
 		boolean8 delete_on_close;
+		boolean8 allow_level_II_oplock;
 		uint32 oplock_level;
 	} opendb_entry;
 
diff --git a/source/ntvfs/common/opendb.c b/source/ntvfs/common/opendb.c
index 6c1a9c0..a7e5458 100644
--- a/source/ntvfs/common/opendb.c
+++ b/source/ntvfs/common/opendb.c
@@ -98,11 +98,13 @@ _PUBLIC_ NTSTATUS odb_open_file(struct odb_lock *lck,
 				uint32_t stream_id, uint32_t share_access,
 				uint32_t access_mask, bool delete_on_close,
 				uint32_t open_disposition, bool break_to_none,
+				bool allow_level_II_oplock,
 				uint32_t oplock_level, uint32_t *oplock_granted)
 {
 	return ops->odb_open_file(lck, file_handle, path, stream_id, share_access,
 				  access_mask, delete_on_close, open_disposition,
-				  break_to_none, oplock_level, oplock_granted);
+				  break_to_none, allow_level_II_oplock,
+				  oplock_level, oplock_granted);
 }
 
 
diff --git a/source/ntvfs/common/opendb.h b/source/ntvfs/common/opendb.h
index 69a7f71..1c7f815 100644
--- a/source/ntvfs/common/opendb.h
+++ b/source/ntvfs/common/opendb.h
@@ -30,6 +30,7 @@ struct opendb_ops {
 				  uint32_t stream_id, uint32_t share_access,
 				  uint32_t access_mask, bool delete_on_close,
 				  uint32_t open_disposition, bool break_to_none,
+				  bool allow_level_II_oplock,
 				  uint32_t oplock_level, uint32_t *oplock_granted);
 	NTSTATUS (*odb_open_file_pending)(struct odb_lock *lck, void *private);
 	NTSTATUS (*odb_close_file)(struct odb_lock *lck, void *file_handle,
diff --git a/source/ntvfs/common/opendb_tdb.c b/source/ntvfs/common/opendb_tdb.c
index 47b35f5..0736af3 100644
--- a/source/ntvfs/common/opendb_tdb.c
+++ b/source/ntvfs/common/opendb_tdb.c
@@ -344,7 +344,8 @@ static NTSTATUS odb_tdb_open_can_internal(struct odb_context *odb,
 			   break request and suspending this call
 			   until the break is acknowledged or the file
 			   is closed */
-			if (break_to_none) {
+			if (break_to_none ||
+			    !file->entries[i].allow_level_II_oplock) {
 				oplock_return = OPLOCK_BREAK_TO_NONE;
 			}
 			odb_oplock_break_send(odb, &file->entries[i],
@@ -391,7 +392,8 @@ static NTSTATUS odb_tdb_open_can_internal(struct odb_context *odb,
 			 * send an oplock break to the holder of the
 			 * oplock and tell caller to retry later
 			 */
-			if (break_to_none) {
+			if (break_to_none ||
+			    !file->entries[i].allow_level_II_oplock) {
 				oplock_return = OPLOCK_BREAK_TO_NONE;
 			}
 			odb_oplock_break_send(odb, &file->entries[i],
@@ -418,6 +420,7 @@ static NTSTATUS odb_tdb_open_file(struct odb_lock *lck,
 				  uint32_t stream_id, uint32_t share_access,
 				  uint32_t access_mask, bool delete_on_close,
 				  uint32_t open_disposition, bool break_to_none,
+				  bool allow_level_II_oplock,
 				  uint32_t oplock_level, uint32_t *oplock_granted)
 {
 	struct odb_context *odb = lck->odb;
@@ -447,13 +450,14 @@ static NTSTATUS odb_tdb_open_file(struct odb_lock *lck,
 	NT_STATUS_NOT_OK_RETURN(status);
 
 	/* see if it conflicts */
-	e.server          = odb->ntvfs_ctx->server_id;
-	e.file_handle     = file_handle;
-	e.stream_id       = stream_id;
-	e.share_access    = share_access;
-	e.access_mask     = access_mask;
-	e.delete_on_close = delete_on_close;
-	e.oplock_level    = OPLOCK_NONE;
+	e.server		= odb->ntvfs_ctx->server_id;
+	e.file_handle		= file_handle;
+	e.stream_id		= stream_id;
+	e.share_access		= share_access;
+	e.access_mask		= access_mask;
+	e.delete_on_close	= delete_on_close;
+	e.allow_level_II_oplock	= allow_level_II_oplock;
+	e.oplock_level		= OPLOCK_NONE;
 
 	/*
 	  possibly grant an exclusive, batch or level2 oplock
@@ -466,17 +470,23 @@ static NTSTATUS odb_tdb_open_file(struct odb_lock *lck,
 			if (file.num_entries == 0) {
 				e.oplock_level	= OPLOCK_EXCLUSIVE;
 				*oplock_granted	= EXCLUSIVE_OPLOCK_RETURN;
-			} else {
+			} else if (allow_level_II_oplock) {
 				e.oplock_level	= OPLOCK_LEVEL_II;
 				*oplock_granted	= LEVEL_II_OPLOCK_RETURN;
+			} else {
+				e.oplock_level	= OPLOCK_NONE;
+				*oplock_granted	= NO_OPLOCK_RETURN;
 			}
 		} else if (oplock_level == OPLOCK_BATCH) {
 			if (file.num_entries == 0) {
 				e.oplock_level	= OPLOCK_BATCH;
 				*oplock_granted	= BATCH_OPLOCK_RETURN;
-			} else {
+			} else if (allow_level_II_oplock) {
 				e.oplock_level	= OPLOCK_LEVEL_II;
 				*oplock_granted	= LEVEL_II_OPLOCK_RETURN;
+			} else {
+				e.oplock_level	= OPLOCK_NONE;
+				*oplock_granted	= NO_OPLOCK_RETURN;
 			}
 		} else if (oplock_level == OPLOCK_LEVEL_II) {
 			e.oplock_level	= OPLOCK_LEVEL_II;
diff --git a/source/ntvfs/ntvfs.h b/source/ntvfs/ntvfs.h
index a708dbf..7a2edc7 100644
--- a/source/ntvfs/ntvfs.h
+++ b/source/ntvfs/ntvfs.h
@@ -181,6 +181,14 @@ struct ntvfs_context {
 
 	enum protocol_types protocol;
 
+	/*
+	 * client capabilities
+	 * this field doesn't use protocol specific
+	 * values!
+	 */
+#define NTVFS_CLIENT_CAP_LEVEL_II_OPLOCKS	0x0000000000000001LLU
+	uint64_t client_caps;
+
 	/* 
 	 * linked list of module contexts
 	 */
@@ -257,6 +265,14 @@ struct ntvfs_request {
 	/* the smb pid is needed for locking contexts */
 	uint16_t smbpid;
 
+	/*
+	 * client capabilities
+	 * this field doesn't use protocol specific
+	 * values!
+	 * see NTVFS_CLIENT_CAP_*
+	 */
+	uint64_t client_caps;
+
 	/* some statictics for the management tools */
 	struct {
 		/* the system time when the request arrived */
diff --git a/source/ntvfs/ntvfs_base.c b/source/ntvfs/ntvfs_base.c
index f5a24f2..35becab 100644
--- a/source/ntvfs/ntvfs_base.c
+++ b/source/ntvfs/ntvfs_base.c
@@ -153,6 +153,7 @@ _PUBLIC_ bool ntvfs_interface_differs(const struct ntvfs_critical_sizes *const i
 */
 NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, enum ntvfs_type type,
 			       enum protocol_types protocol,
+			       uint64_t ntvfs_client_caps,
 			       struct event_context *ev, struct messaging_context *msg,
 			       struct loadparm_context *lp_ctx,
 			       struct server_id server_id, struct ntvfs_context **_ctx)
@@ -168,6 +169,7 @@ NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, e
 	ctx = talloc_zero(mem_ctx, struct ntvfs_context);
 	NT_STATUS_HAVE_NO_MEMORY(ctx);
 	ctx->protocol		= protocol;
+	ctx->client_caps	= ntvfs_client_caps;
 	ctx->type		= type;
 	ctx->config		= talloc_steal(ctx, scfg);
 	ctx->event_ctx		= ev;
diff --git a/source/ntvfs/ntvfs_util.c b/source/ntvfs/ntvfs_util.c
index 7432ac2..ebe8008 100644
--- a/source/ntvfs/ntvfs_util.c
+++ b/source/ntvfs/ntvfs_util.c
@@ -42,6 +42,7 @@ _PUBLIC_ struct ntvfs_request *ntvfs_request_create(struct ntvfs_context *ctx, T
 	req->async_states		= NULL;
 	req->session_info		= session_info;
 	req->smbpid			= smbpid;
+	req->client_caps		= ctx->client_caps;
 	req->statistics.request_time	= request_time;
 
 	async = talloc(req, struct ntvfs_async_state);
diff --git a/source/ntvfs/posix/pvfs_open.c b/source/ntvfs/posix/pvfs_open.c
index adf4c1a..47b44b9 100644
--- a/source/ntvfs/posix/pvfs_open.c
+++ b/source/ntvfs/posix/pvfs_open.c
@@ -293,7 +293,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
 		status = odb_open_file(lck, f->handle, name->full_name, name->stream_id,
 				       share_access, access_mask, del_on_close, 
 				       io->generic.in.open_disposition,
-				       false, OPLOCK_NONE, NULL);
+				       false, false, OPLOCK_NONE, NULL);
 
 		if (!NT_STATUS_IS_OK(status)) {
 			talloc_free(lck);
@@ -347,7 +347,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
 		status = odb_open_file(lck, f->handle, name->full_name, name->stream_id,
 				       share_access, access_mask, del_on_close, 
 				       io->generic.in.open_disposition,
-				       false, OPLOCK_NONE, NULL);
+				       false, false, OPLOCK_NONE, NULL);
 
 		if (!NT_STATUS_IS_OK(status)) {
 			goto cleanup_delete;
@@ -544,6 +544,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
 	bool del_on_close;
 	struct pvfs_filename *parent;
 	uint32_t oplock_level = OPLOCK_NONE, oplock_granted;
+	bool allow_level_II_oplock = false;
 
 	if ((io->ntcreatex.in.file_attr & FILE_ATTRIBUTE_READONLY) &&
 	    (create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE)) {
@@ -658,10 +659,15 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
 		oplock_level = OPLOCK_EXCLUSIVE;
 	}
 
+	if (req->client_caps & NTVFS_CLIENT_CAP_LEVEL_II_OPLOCKS) {
+		allow_level_II_oplock = true;
+	}
+
 	status = odb_open_file(lck, f->handle, name->full_name, name->stream_id,
 			       share_access, access_mask, del_on_close, 
 			       io->generic.in.open_disposition,
-			       false, oplock_level, &oplock_granted);
+			       false, allow_level_II_oplock,
+			       oplock_level, &oplock_granted);
 	talloc_free(lck);
 	if (!NT_STATUS_IS_OK(status)) {
 		/* bad news, we must have hit a race - we don't delete the file
@@ -696,21 +702,20 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
 
 	DLIST_ADD(pvfs->files.list, f);
 
+	/* setup a destructor to avoid file descriptor leaks on
+	   abnormal termination */
+	talloc_set_destructor(f, pvfs_fnum_destructor);
+	talloc_set_destructor(f->handle, pvfs_handle_destructor);
+
 	if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
 		oplock_granted = OPLOCK_BATCH;
 	} else if (oplock_granted != OPLOCK_NONE) {
 		status = pvfs_setup_oplock(f, oplock_granted);
 		if (!NT_STATUS_IS_OK(status)) {
-			talloc_free(lck);
 			return status;
 		}
 	}
 
-	/* setup a destructor to avoid file descriptor leaks on
-	   abnormal termination */
-	talloc_set_destructor(f, pvfs_fnum_destructor);
-	talloc_set_destructor(f->handle, pvfs_handle_destructor);
-
 	io->generic.out.oplock_level  = oplock_granted;
 	io->generic.out.file.ntvfs    = f->ntvfs;
 	io->generic.out.create_action = NTCREATEX_ACTION_CREATED;
@@ -1048,6 +1053,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
 	bool del_on_close;
 	bool stream_existed, stream_truncate=false;
 	uint32_t oplock_level = OPLOCK_NONE, oplock_granted;
+	bool allow_level_II_oplock = false;
 
 	/* use the generic mapping code to avoid implementing all the
 	   different open calls. */
@@ -1242,11 +1248,16 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
 		oplock_level = OPLOCK_EXCLUSIVE;
 	}
 
+	if (req->client_caps & NTVFS_CLIENT_CAP_LEVEL_II_OPLOCKS) {
+		allow_level_II_oplock = true;
+	}
+
 	/* see if we are allowed to open at the same time as existing opens */
 	status = odb_open_file(lck, f->handle, name->full_name, name->stream_id,
 			       share_access, access_mask, del_on_close,
 			       io->generic.in.open_disposition,
-			       false, oplock_level, &oplock_granted);
+			       false, allow_level_II_oplock,
+			       oplock_level, &oplock_granted);
 
 	/*
 	 * on a sharing violation we need to retry when the file is closed by
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index d94ab92..65ce759 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -2614,6 +2614,6 @@ void lp_smbcli_options(struct loadparm_context *lp_ctx,
 	options->ntstatus_support = lp_nt_status_support(lp_ctx);
 	options->max_protocol = lp_cli_maxprotocol(lp_ctx);
 	options->unicode = lp_unicode(lp_ctx);
-	options->use_oplocks = false;
-	options->use_level2_oplocks = false;
+	options->use_oplocks = true;
+	options->use_level2_oplocks = true;
 }
diff --git a/source/rpc_server/srvsvc/srvsvc_ntvfs.c b/source/rpc_server/srvsvc/srvsvc_ntvfs.c
index ccd6c4f..43fb24c 100644
--- a/source/rpc_server/srvsvc/srvsvc_ntvfs.c
+++ b/source/rpc_server/srvsvc/srvsvc_ntvfs.c
@@ -98,6 +98,7 @@ NTSTATUS srvsvc_create_ntvfs_context(struct dcesrv_call_state *dce_call,
 	/* init ntvfs function pointers */
 	status = ntvfs_init_connection(c, scfg, type,
 				       PROTOCOL_NT1,
+				       0,/* ntvfs_client_caps */
 				       dce_call->event_ctx,
 				       dce_call->conn->msg_ctx,
 				       dce_call->conn->dce_ctx->lp_ctx,
diff --git a/source/smb_server/smb/service.c b/source/smb_server/smb/service.c
index 35b3653..52471c0 100644
--- a/source/smb_server/smb/service.c
+++ b/source/smb_server/smb/service.c
@@ -36,6 +36,7 @@ static NTSTATUS make_connection_scfg(struct smbsrv_request *req,
 {
 	struct smbsrv_tcon *tcon;
 	NTSTATUS status;
+	uint64_t ntvfs_caps = 0;
 
 	tcon = smbsrv_smb_tcon_new(req->smb_conn, scfg->name);
 	if (!tcon) {
@@ -44,9 +45,14 @@ static NTSTATUS make_connection_scfg(struct smbsrv_request *req,
 	}
 	req->tcon = tcon;
 
+	if (req->smb_conn->negotiate.client_caps & CAP_LEVEL_II_OPLOCKS) {
+		ntvfs_caps |= NTVFS_CLIENT_CAP_LEVEL_II_OPLOCKS;
+	}
+
 	/* init ntvfs function pointers */
 	status = ntvfs_init_connection(tcon, scfg, type,
 				       req->smb_conn->negotiate.protocol,
+				       ntvfs_caps,
 				       req->smb_conn->connection->event.ctx,
 				       req->smb_conn->connection->msg_ctx,
 				       req->smb_conn->lp_ctx,
diff --git a/source/smb_server/smb2/tcon.c b/source/smb_server/smb2/tcon.c
index 7f7d558..040947f 100644
--- a/source/smb_server/smb2/tcon.c
+++ b/source/smb_server/smb2/tcon.c
@@ -245,6 +245,7 @@ static NTSTATUS smb2srv_tcon_backend(struct smb2srv_request *req, union smb_tcon
 	const char *service = io->smb2.in.path;
 	struct share_config *scfg;
 	const char *sharetype;
+	uint64_t ntvfs_caps = 0;
 
 	if (strncmp(service, "\\\\", 2) == 0) {
 		const char *p = strchr(service+2, '\\');
@@ -283,9 +284,12 @@ static NTSTATUS smb2srv_tcon_backend(struct smb2srv_request *req, union smb_tcon
 	}
 	req->tcon = tcon;
 
+	ntvfs_caps = NTVFS_CLIENT_CAP_LEVEL_II_OPLOCKS;
+
 	/* init ntvfs function pointers */
 	status = ntvfs_init_connection(tcon, scfg, type,
 				       req->smb_conn->negotiate.protocol,
+				       ntvfs_caps,
 				       req->smb_conn->connection->event.ctx,
 				       req->smb_conn->connection->msg_ctx,
 				       req->smb_conn->lp_ctx,
diff --git a/source/torture/raw/oplock.c b/source/torture/raw/oplock.c
index 8a7489c..1926b12 100644
--- a/source/torture/raw/oplock.c
+++ b/source/torture/raw/oplock.c
@@ -24,6 +24,9 @@
 #include "libcli/libcli.h"
 #include "torture/util.h"
 #include "lib/events/events.h"
+#include "param/param.h"
+#include "lib/cmdline/popt_common.h"
+#include "libcli/resolve/resolve.h"
 
 #define CHECK_VAL(v, correct) do { \
 	if ((v) != (correct)) { \
@@ -68,16 +71,30 @@ static struct {
 /*
   a handler function for oplock break requests. Ack it as a break to level II if possible
 */
-static bool oplock_handler_ack_to_levelII(struct smbcli_transport *transport, 
-					  uint16_t tid, uint16_t fnum, 
-					  uint8_t level, void *private)
+static bool oplock_handler_ack_to_given(struct smbcli_transport *transport,
+					uint16_t tid, uint16_t fnum,
+					uint8_t level, void *private)
 {
 	struct smbcli_tree *tree = (struct smbcli_tree *)private;
+	const char *name;
+
 	break_info.fnum = fnum;
 	break_info.level = level;
 	break_info.count++;
 
-	printf("Acking to level II in oplock handler\n");
+	switch (level) {
+	case OPLOCK_BREAK_TO_LEVEL_II:
+		name = "level II";
+		break;
+	case OPLOCK_BREAK_TO_NONE:
+		name = "none";
+		break;
+	default:
+		name = "unknown";
+		break_info.failures++;
+	}
+	printf("Acking to %s [0x%02X] in oplock handler\n",
+		name, level);
 
 	return smbcli_oplock_ack(tree, fnum, level);
 }
@@ -153,6 +170,32 @@ static bool oplock_handler_close(struct smbcli_transport *transport, uint16_t ti
 	return true;
 }
 
+static bool open_connection_no_level2_oplocks(struct torture_context *tctx,
+					      struct smbcli_state **c)
+{
+	NTSTATUS status;
+
+	struct smbcli_options options;
+
+	lp_smbcli_options(tctx->lp_ctx, &options);
+
+	options.use_level2_oplocks = false;
+
+	status = smbcli_full_connection(tctx, c,
+					torture_setting_string(tctx, "host", NULL),
+					lp_smb_ports(tctx->lp_ctx),
+					torture_setting_string(tctx, "share", NULL),
+					NULL, cmdline_credentials,
+					lp_resolve_context(tctx->lp_ctx),
+					tctx->ev, &options);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("Failed to open connection - %s\n", nt_errstr(status));
+		return false;
+	}
+
+	return true;
+}
+
 static bool test_raw_oplock_exclusive1(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2)
 {
 	const char *fname = BASEDIR "\\test_exclusive1.dat";
@@ -169,7 +212,7 @@ static bool test_raw_oplock_exclusive1(struct torture_context *tctx, struct smbc
 	/* cleanup */
 	smbcli_unlink(cli1->tree, fname);
 
-	smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_levelII, cli1->tree);
+	smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
 
 	/*
 	  base ntcreatex parms
@@ -234,7 +277,7 @@ static bool test_raw_oplock_exclusive2(struct torture_context *tctx, struct smbc
 	/* cleanup */
 	smbcli_unlink(cli1->tree, fname);
 
-	smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_levelII, cli1->tree);
+	smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
 
 	/*
 	  base ntcreatex parms
@@ -329,7 +372,7 @@ static bool test_raw_oplock_exclusive3(struct torture_context *tctx, struct smbc
 	/* cleanup */
 	smbcli_unlink(cli1->tree, fname);
 
-	smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_levelII, cli1->tree);
+	smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list