Add native dynamic port forwarding
This commit is contained in:
+11
-5
@@ -1308,11 +1308,17 @@ fn stream_open_allowed(
|
||||
open: &StreamOpen,
|
||||
) -> Result<()> {
|
||||
anyhow::ensure!(config.allow_tcp_forwarding, "TCP forwarding disabled");
|
||||
let allowed = client.allowed_forwardings.iter().any(|forward| {
|
||||
forward.kind == ForwardingKind::Local
|
||||
&& forward.target_host.as_deref() == Some(open.target_host.as_str())
|
||||
&& forward.target_port == Some(open.target_port)
|
||||
});
|
||||
let allowed = client
|
||||
.allowed_forwardings
|
||||
.iter()
|
||||
.any(|forward| match forward.kind {
|
||||
ForwardingKind::Local => {
|
||||
forward.target_host.as_deref() == Some(open.target_host.as_str())
|
||||
&& forward.target_port == Some(open.target_port)
|
||||
}
|
||||
ForwardingKind::Dynamic => true,
|
||||
ForwardingKind::Remote => false,
|
||||
});
|
||||
anyhow::ensure!(
|
||||
allowed,
|
||||
"stream target {}:{} was not requested during auth",
|
||||
|
||||
Reference in New Issue
Block a user