diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 130fe5048c0..905115bcaa4 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -1605,6 +1605,7 @@ static void smbd_smb2_request_pending_timer(struct tevent_context *ev, uint8_t *body = NULL; uint8_t *dyn = NULL; uint32_t flags = 0; + uint32_t in_flags = 0; uint64_t session_id = 0; uint64_t message_id = 0; uint64_t nonce_high = 0; @@ -1622,6 +1623,16 @@ static void smbd_smb2_request_pending_timer(struct tevent_context *ev, message_id = BVAL(outhdr, SMB2_HDR_MESSAGE_ID); session_id = BVAL(outhdr, SMB2_HDR_SESSION_ID); + /* + * We need to check inhdr flags here + * as we have already removed the SMB2_HDR_FLAG_CHAINED + * for the separate outhdr reply. + */ + in_flags = IVAL(inhdr, SMB2_HDR_FLAGS); + if (in_flags & SMB2_HDR_FLAG_CHAINED) { + session_id = req->last_session_id; + } + async_id = message_id; /* keep it simple for now... */ SIVAL(outhdr, SMB2_HDR_FLAGS, flags | SMB2_HDR_FLAG_ASYNC);