mirror of
https://github.com/netbirdio/IronRDP.git
synced 2026-05-22 18:43:12 -07:00
feat(blocking): teach single_sequence_step() to keep unmatched PDUs
The caller can gather the unmatching/unexpected PDUs as necessary. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
committed by
Benoît Cortier
parent
e54fa5f4c8
commit
f8c0c0ed47
@@ -1,5 +1,6 @@
|
||||
use std::io::{Read, Write};
|
||||
|
||||
use bytes::Bytes;
|
||||
use ironrdp_connector::credssp::{CredsspProcessGenerator, CredsspSequence, KerberosConfig};
|
||||
use ironrdp_connector::sspi::credssp::ClientState;
|
||||
use ironrdp_connector::sspi::generator::GeneratorState;
|
||||
@@ -25,7 +26,7 @@ where
|
||||
info!("Begin connection procedure");
|
||||
|
||||
while !connector.should_perform_security_upgrade() {
|
||||
single_sequence_step(framed, connector, &mut buf)?;
|
||||
single_sequence_step(framed, connector, &mut buf, None)?;
|
||||
}
|
||||
|
||||
Ok(ShouldUpgrade)
|
||||
@@ -78,7 +79,7 @@ where
|
||||
debug!("Remaining of connection sequence");
|
||||
|
||||
let result = loop {
|
||||
single_sequence_step(framed, &mut connector, &mut buf)?;
|
||||
single_sequence_step(framed, &mut connector, &mut buf, None)?;
|
||||
|
||||
if let ClientConnectorState::Connected { result } = connector.state {
|
||||
break result;
|
||||
@@ -188,6 +189,7 @@ pub fn single_sequence_step<S>(
|
||||
framed: &mut Framed<S>,
|
||||
connector: &mut ClientConnector,
|
||||
buf: &mut WriteBuf,
|
||||
unmatched: Option<&mut Vec<Bytes>>,
|
||||
) -> ConnectorResult<()>
|
||||
where
|
||||
S: Read + Write,
|
||||
@@ -202,7 +204,7 @@ where
|
||||
);
|
||||
|
||||
let pdu = framed
|
||||
.read_by_hint(next_pdu_hint, None)
|
||||
.read_by_hint(next_pdu_hint, unmatched)
|
||||
.map_err(|e| ironrdp_connector::custom_err!("read frame by hint", e))?;
|
||||
|
||||
trace!(length = pdu.len(), "PDU received");
|
||||
|
||||
Reference in New Issue
Block a user