summaryrefslogtreecommitdiff
path: root/source4/libcli/smb2
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli/smb2')
-rw-r--r--source4/libcli/smb2/request.c4
-rw-r--r--source4/libcli/smb2/smb2.h4
-rw-r--r--source4/libcli/smb2/transport.c7
3 files changed, 13 insertions, 2 deletions
diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c
index 7482cf1f2c..f3684ed280 100644
--- a/source4/libcli/smb2/request.c
+++ b/source4/libcli/smb2/request.c
@@ -134,10 +134,10 @@ struct smb2_request *smb2_request_init(struct smb2_transport *transport, uint16_
SSVAL(req->out.hdr, SMB2_HDR_EPOCH, 0);
SIVAL(req->out.hdr, SMB2_HDR_STATUS, 0);
SSVAL(req->out.hdr, SMB2_HDR_OPCODE, opcode);
- SSVAL(req->out.hdr, SMB2_HDR_CREDIT, 0);
+ SSVAL(req->out.hdr, SMB2_HDR_CREDIT, transport->credits.ask_num);
SIVAL(req->out.hdr, SMB2_HDR_FLAGS, flags);
SIVAL(req->out.hdr, SMB2_HDR_NEXT_COMMAND, 0);
- SBVAL(req->out.hdr, SMB2_HDR_MESSAGE_ID, req->seqnum);
+ SBVAL(req->out.hdr, SMB2_HDR_MESSAGE_ID, req->seqnum);
SIVAL(req->out.hdr, SMB2_HDR_PID, 0);
SIVAL(req->out.hdr, SMB2_HDR_TID, 0);
SBVAL(req->out.hdr, SMB2_HDR_SESSION_ID, 0);
diff --git a/source4/libcli/smb2/smb2.h b/source4/libcli/smb2/smb2.h
index 39d6aaacba..eb231984df 100644
--- a/source4/libcli/smb2/smb2.h
+++ b/source4/libcli/smb2/smb2.h
@@ -86,6 +86,10 @@ struct smb2_transport {
struct smb2_request_buffer buffer;
} compound;
+ struct {
+ uint16_t ask_num;
+ } credits;
+
/* a list of requests that are pending for receive on this
connection */
struct smb2_request *pending_recv;
diff --git a/source4/libcli/smb2/transport.c b/source4/libcli/smb2/transport.c
index 49b72a4545..60522370b7 100644
--- a/source4/libcli/smb2/transport.c
+++ b/source4/libcli/smb2/transport.c
@@ -84,6 +84,7 @@ struct smb2_transport *smb2_transport_init(struct smbcli_socket *sock,
transport->socket = talloc_steal(transport, sock);
transport->options = *options;
+ transport->credits.ask_num = 1;
/* setup the stream -> packet parser */
transport->packet = packet_init(transport);
@@ -545,6 +546,12 @@ void smb2_transport_compound_set_related(struct smb2_transport *transport,
transport->compound.related = related;
}
+void smb2_transport_credits_ask_num(struct smb2_transport *transport,
+ uint16_t ask_num)
+{
+ transport->credits.ask_num = ask_num;
+}
+
static void idle_handler(struct tevent_context *ev,
struct tevent_timer *te, struct timeval t, void *private_data)
{