From daa890e2c86ba7dded91144e6aa75105c23e0008 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 25 May 2004 00:05:51 +0000 Subject: r865: Regression test for attribute-only opens not causing an oplock break. Samba3 server used to get this wrong. Jeremy. (This used to be commit 4120b3bdf6668909efa0af97b2c63adea22c35da) --- source4/torture/raw/oplock.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source4') diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c index 0eabcc94f7..403d19113d 100644 --- a/source4/torture/raw/oplock.c +++ b/source4/torture/raw/oplock.c @@ -255,9 +255,38 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx) CHECK_VAL(break_info.fnum, fnum2); CHECK_VAL(break_info.level, 2); + cli_close(cli->tree, fnum); + + printf("open with batch oplock\n"); + ZERO_STRUCT(break_info); + cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree); + + io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED | + NTCREATEX_FLAGS_REQUEST_OPLOCK | + NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK; + status = smb_raw_open(cli->tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + fnum = io.ntcreatex.out.fnum; + CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN); + + ZERO_STRUCT(break_info); + printf("second open with attributes only shouldn't cause oplock break\n"); + + io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED | + NTCREATEX_FLAGS_REQUEST_OPLOCK | + NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK; + io.ntcreatex.in.access_mask = SA_RIGHT_FILE_READ_ATTRIBUTES|SA_RIGHT_FILE_WRITE_ATTRIBUTES|STD_RIGHT_SYNCHRONIZE_ACCESS; + status = smb_raw_open(cli->tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + fnum2 = io.ntcreatex.out.fnum; + CHECK_VAL(io.ntcreatex.out.oplock_level, NO_OPLOCK_RETURN); + CHECK_VAL(break_info.count, 0); + CHECK_VAL(break_info.fnum, 0); + CHECK_VAL(break_info.level, 0); done: cli_close(cli->tree, fnum); + cli_close(cli->tree, fnum2); cli_unlink(cli->tree, fname); return ret; } -- cgit