aboutsummaryrefslogtreecommitdiffhomepage
path: root/oxish-proto/src
diff options
context:
space:
mode:
Diffstat (limited to 'oxish-proto/src')
-rw-r--r--oxish-proto/src/channels.rs16
-rw-r--r--oxish-proto/src/lib.rs3
2 files changed, 13 insertions, 6 deletions
diff --git a/oxish-proto/src/channels.rs b/oxish-proto/src/channels.rs
index 9677ac2..917945d 100644
--- a/oxish-proto/src/channels.rs
+++ b/oxish-proto/src/channels.rs
@@ -244,12 +244,16 @@ impl<'a> TryFrom<IncomingPacket<'a>> for ChannelRequest<'a> {
}
b"[email protected]" => ChannelRequestType::AuthAgentReq,
_ => {
- match str::from_utf8(r#type) {
- Ok(r#type) => warn!(%r#type, "unknown channel request type"),
- Err(_) => warn!(?r#type, "unknown channel request type"),
- }
-
- return Err(ProtoError::InvalidPacket("unknown channel request type"));
+ return Err(match str::from_utf8(r#type) {
+ Ok(r#type) => {
+ warn!(%r#type, "unknown channel request type");
+ ProtoError::InvalidChannelType(r#type.to_owned())
+ }
+ Err(_) => {
+ warn!(?r#type, "unknown channel request type");
+ ProtoError::InvalidPacket("unknown channel request type (invalid UTF-8)")
+ }
+ });
}
};
diff --git a/oxish-proto/src/lib.rs b/oxish-proto/src/lib.rs
index 0ea304e..a67228c 100644
--- a/oxish-proto/src/lib.rs
+++ b/oxish-proto/src/lib.rs
@@ -635,6 +635,9 @@ pub enum ProtoError {
/// current input (`required - available`).
#[error("incomplete message: {0:?}")]
Incomplete(Option<usize>),
+ /// An unknown or unsupported channel type was requested
+ #[error("invalid packet: {0}")]
+ InvalidChannelType(String),
/// A host key file could not be used; the payload describes why
#[error("invalid host key: {0}")]
InvalidHostKey(&'static str),