summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/include/cli_context.h4
-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
6 files changed, 21 insertions, 9 deletions
diff --git a/source4/include/cli_context.h b/source4/include/cli_context.h
index 6887160987..c12ff5d5fa 100644
--- a/source4/include/cli_context.h
+++ b/source4/include/cli_context.h
@@ -281,6 +281,10 @@ struct cli_request {
expecting a reply from the server. */
uint_t one_way_request:1;
+ /* set this when the request should only increment the signing
+ counter by one */
+ uint_t sign_single_increment:1;
+
/* the mid of this packet - used to match replies */
uint16_t mid;
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;