libcli/raw: make it possible to not send CAP_LEVEL_II_OPLOCKS
authorStefan Metzmacher <metze@samba.org>
Thu, 6 Mar 2008 14:11:16 +0000 (15:11 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 6 Mar 2008 15:31:25 +0000 (16:31 +0100)
But the keep the default to always send it
when the server supports it too.

metze
(This used to be commit 33caaef2e46557525a8ffb79d6dd0db46a079529)

source4/libcli/raw/rawnegotiate.c
source4/param/loadparm.c
source4/torture/util_smb.c

index ec2ada53ff7fd73e016a16a3d96ff71519232e24..6c16935f214c282a5bbd9c423d9906c7ea91f5c9 100644 (file)
@@ -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);
 }
index d94ab92ac942aae1c31e87a35cbc817cc8a77017..65ce7595fcaec8acc75bdac0e1c923f9bf44ee19 100644 (file)
@@ -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;
 }
index ddf7b85c6360677c583407340516efca18c08765..ba62f3789c1cc3d6611bd7f777d3149f851fddb4 100644 (file)
@@ -478,6 +478,9 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
 
        lp_smbcli_options(tctx->lp_ctx, &options);
 
+       options.use_oplocks = torture_setting_bool(tctx, "use_oplocks", true);
+       options.use_level2_oplocks = torture_setting_bool(tctx, "use_level2_oplocks", true);
+
        status = smbcli_full_connection(mem_ctx, c, hostname, 
                                        lp_smb_ports(tctx->lp_ctx),
                                        sharename, NULL,
@@ -489,9 +492,6 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
                return false;
        }
 
-       (*c)->transport->options.use_oplocks = torture_setting_bool(tctx, "use_oplocks", false);
-       (*c)->transport->options.use_level2_oplocks = torture_setting_bool(tctx, "use_level2_oplocks", false);
-
        return true;
 }