summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-08-03 06:52:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:57:45 -0500
commit53781e9d37b9adb1cf2d5be2a6ae6c1f5ace26c9 (patch)
tree5e5f8946adf47c56ad3bddf74a118926f78765b7 /source4/libcli
parent44194cc66378682a39f3694977101bf8f2a7a6f6 (diff)
downloadsamba-53781e9d37b9adb1cf2d5be2a6ae6c1f5ace26c9.tar.gz
samba-53781e9d37b9adb1cf2d5be2a6ae6c1f5ace26c9.tar.bz2
samba-53781e9d37b9adb1cf2d5be2a6ae6c1f5ace26c9.zip
r1633: fixed a couple of async oplock handling errors
(This used to be commit d7e2f39b90122088e94d4a8e8c7ffa7c91d7d664)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/raw/clioplock.c5
-rw-r--r--source4/libcli/raw/clitransport.c14
-rw-r--r--source4/libcli/raw/rawnotify.c3
-rw-r--r--source4/libcli/raw/rawrequest.c2
-rw-r--r--source4/libcli/raw/smb_signing.c2
5 files changed, 17 insertions, 9 deletions
diff --git a/source4/libcli/raw/clioplock.c b/source4/libcli/raw/clioplock.c
index 0cd6adb41f..29e44fc940 100644
--- a/source4/libcli/raw/clioplock.c
+++ b/source4/libcli/raw/clioplock.c
@@ -39,8 +39,11 @@ BOOL cli_oplock_ack(struct cli_tree *tree, uint16_t fnum, uint16_t ack_level)
SSVAL(req->out.vwv,VWV(6),0);
SSVAL(req->out.vwv,VWV(7),0);
+ /* this request does not expect a reply, so tell the signing
+ subsystem not to allocate an id for a reply */
+ req->one_way_request = 1;
+
ret = cli_request_send(req);
- cli_request_destroy(req);
return ret;
}
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c
index abdcc0d392..d2d78d0789 100644
--- a/source4/libcli/raw/clitransport.c
+++ b/source4/libcli/raw/clitransport.c
@@ -250,9 +250,14 @@ static void cli_transport_process_send(struct cli_transport *transport)
req->out.buffer += ret;
req->out.size -= ret;
if (req->out.size == 0) {
- req->state = CLI_REQUEST_RECV;
DLIST_REMOVE(transport->pending_send, req);
- DLIST_ADD(transport->pending_recv, req);
+ if (req->one_way_request) {
+ req->state = CLI_REQUEST_DONE;
+ cli_request_destroy(req);
+ } else {
+ req->state = CLI_REQUEST_RECV;
+ DLIST_ADD(transport->pending_recv, req);
+ }
}
}
@@ -275,13 +280,14 @@ static void cli_transport_finish_recv(struct cli_transport *transport)
buffer = transport->recv_buffer.buffer;
len = transport->recv_buffer.req_size;
+ ZERO_STRUCT(transport->recv_buffer);
+
hdr = buffer+NBT_HDR_SIZE;
vwv = hdr + HDR_VWV;
/* see if it could be an oplock break request */
if (handle_oplock_break(transport, len, hdr, vwv)) {
talloc_free(transport->mem_ctx, buffer);
- ZERO_STRUCT(transport->recv_buffer);
return;
}
@@ -377,7 +383,6 @@ async:
/* if this request has an async handler then call that to
notify that the reply has been received. This might destroy
the request so it must happen last */
- ZERO_STRUCT(transport->recv_buffer);
DLIST_REMOVE(transport->pending_recv, req);
req->state = CLI_REQUEST_DONE;
if (req->async.fn) {
@@ -390,7 +395,6 @@ error:
DLIST_REMOVE(transport->pending_recv, req);
req->state = CLI_REQUEST_ERROR;
}
- ZERO_STRUCT(transport->recv_buffer);
}
/*
diff --git a/source4/libcli/raw/rawnotify.c b/source4/libcli/raw/rawnotify.c
index b8efa2fcd6..a9215fee10 100644
--- a/source4/libcli/raw/rawnotify.c
+++ b/source4/libcli/raw/rawnotify.c
@@ -108,9 +108,10 @@ NTSTATUS smb_raw_ntcancel(struct cli_request *oldreq)
/* this request does not expect a reply, so tell the signing
subsystem not to allocate an id for a reply */
+ req->sign_single_increment = 1;
req->one_way_request = 1;
cli_request_send(req);
- return cli_request_destroy(req);
+ return NT_STATUS_OK;
}
diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c
index 9c53c4b18c..38b8f71f57 100644
--- a/source4/libcli/raw/rawrequest.c
+++ b/source4/libcli/raw/rawrequest.c
@@ -324,7 +324,7 @@ BOOL handle_oplock_break(struct cli_transport *transport, uint_t len, const char
{
/* we must be very fussy about what we consider an oplock break to avoid
matching readbraw replies */
- if (len != MIN_SMB_SIZE + VWV(8) ||
+ if (len != MIN_SMB_SIZE + VWV(8) + NBT_HDR_SIZE ||
(CVAL(hdr, HDR_FLG) & FLAG_REPLY) ||
CVAL(hdr,HDR_COM) != SMBlockingX ||
SVAL(hdr, HDR_MID) != 0xFFFF ||
diff --git a/source4/libcli/raw/smb_signing.c b/source4/libcli/raw/smb_signing.c
index 80615f2d72..9c02fe50ec 100644
--- a/source4/libcli/raw/smb_signing.c
+++ b/source4/libcli/raw/smb_signing.c
@@ -220,7 +220,7 @@ static void cli_request_simple_sign_outgoing_message(struct cli_request *req)
/* some requests (eg. NTcancel) are one way, and the sequence number
should be increased by 1 not 2 */
- if (req->one_way_request) {
+ if (req->sign_single_increment) {
data->next_seq_num += 1;
} else {
data->next_seq_num += 2;