summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-11-16 00:59:18 +0000
committerJeremy Allison <jra@samba.org>2000-11-16 00:59:18 +0000
commit6f58dd587124c8b85fc62177b26129aaea5819b0 (patch)
tree40c926a6f3e5b5db7e913e13ea6571b97dacf362 /source3/libsmb
parent14355a6434952071e862af3a1e7bcfbbf640a6a3 (diff)
downloadsamba-6f58dd587124c8b85fc62177b26129aaea5819b0.tar.gz
samba-6f58dd587124c8b85fc62177b26129aaea5819b0.tar.bz2
samba-6f58dd587124c8b85fc62177b26129aaea5819b0.zip
Ok - fixed a bug in our levelII oplock code. We need to break a level II on
a byte range lock (write lock only, but Win2k breaks on read lock also so I do the same) - if you think about why, this is obvious. Also fixed our client code to do level II oplocks, if requested, and fixed the code where we would assume the client wanted level II if it advertised itself as being level II capable - it may not want that. Jeremy. (This used to be commit 213cd0b5192307cd4b0026cae94b2f52fb1b0c02)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cliconnect.c2
-rw-r--r--source3/libsmb/clientgen.c11
-rw-r--r--source3/libsmb/clifile.c5
3 files changed, 15 insertions, 3 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 3292b9e1d6..ff81d886b0 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -146,7 +146,7 @@ BOOL cli_session_setup(struct cli_state *cli,
SIVAL(cli->outbuf,smb_vwv5,cli->sesskey);
SSVAL(cli->outbuf,smb_vwv7,passlen);
SSVAL(cli->outbuf,smb_vwv8,ntpasslen);
- SSVAL(cli->outbuf,smb_vwv11,0);
+ SSVAL(cli->outbuf,smb_vwv11,CAP_NT_SMBS|(cli->use_level_II_oplocks ? CAP_LEVEL_II_OPLOCKS : 0));
p = smb_buf(cli->outbuf);
memcpy(p,pword,passlen);
p += SVAL(cli->outbuf,smb_vwv7);
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 8d9fcb61d6..8d9e2f034f 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -121,14 +121,20 @@ static void cli_process_oplock(struct cli_state *cli)
char *oldbuf = cli->outbuf;
pstring buf;
int fnum;
+ unsigned char level;
fnum = SVAL(cli->inbuf,smb_vwv2);
+ level = CVAL(cli->inbuf,smb_vwv3+1);
/* damn, we really need to keep a record of open files so we
can detect a oplock break and a close crossing on the
wire. for now this swallows the errors */
if (fnum == 0) return;
+ /* Ignore level II break to none's. */
+ if (level == OPLOCKLEVEL_NONE)
+ return;
+
cli->outbuf = buf;
memset(buf,'\0',smb_size);
@@ -140,7 +146,10 @@ static void cli_process_oplock(struct cli_state *cli)
SSVAL(buf,smb_vwv0,0xFF);
SSVAL(buf,smb_vwv1,0);
SSVAL(buf,smb_vwv2,fnum);
- SSVAL(buf,smb_vwv3,2); /* oplock break ack */
+ if (cli->use_level_II_oplocks)
+ SSVAL(buf,smb_vwv3,0x102); /* levelII oplock break ack */
+ else
+ SSVAL(buf,smb_vwv3,2); /* exclusive oplock break ack */
SIVAL(buf,smb_vwv4,0); /* timoeut */
SSVAL(buf,smb_vwv6,0); /* unlockcount */
SSVAL(buf,smb_vwv7,0); /* lockcount */
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 63f6f8cc6c..2f183ea135 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -182,7 +182,10 @@ int cli_nt_create(struct cli_state *cli, char *fname)
cli_setup_packet(cli);
SSVAL(cli->outbuf,smb_vwv0,0xFF);
- SIVAL(cli->outbuf,smb_ntcreate_Flags, 0x06);
+ if (cli->use_oplocks)
+ SIVAL(cli->outbuf,smb_ntcreate_Flags, REQUEST_OPLOCK|REQUEST_BATCH_OPLOCK);
+ else
+ SIVAL(cli->outbuf,smb_ntcreate_Flags, 0);
SIVAL(cli->outbuf,smb_ntcreate_RootDirectoryFid, 0x0);
SIVAL(cli->outbuf,smb_ntcreate_DesiredAccess, 0x2019f);
SIVAL(cli->outbuf,smb_ntcreate_FileAttributes, 0x0);