summaryrefslogtreecommitdiffstats
path: root/source/libsmb/clientgen.c
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
commit213cd0b5192307cd4b0026cae94b2f52fb1b0c02 (patch)
treeb23420f37b2748b7a05f74fc33717f4cea9dcc4c /source/libsmb/clientgen.c
parentb2b59b93ff1c5bdc43b099e2db1ee86fe8514152 (diff)
downloadsamba-213cd0b5192307cd4b0026cae94b2f52fb1b0c02.tar.gz
samba-213cd0b5192307cd4b0026cae94b2f52fb1b0c02.tar.xz
samba-213cd0b5192307cd4b0026cae94b2f52fb1b0c02.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.
Diffstat (limited to 'source/libsmb/clientgen.c')
-rw-r--r--source/libsmb/clientgen.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c
index 8d9fcb61d6e..8d9e2f034f2 100644
--- a/source/libsmb/clientgen.c
+++ b/source/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 */