mirror of
https://github.com/Noratrieb/cluelessh.git
synced 2026-01-14 16:35:06 +01:00
bootstrap SFTP subsystem
This commit is contained in:
parent
8de8204bc7
commit
a9e2edc572
15 changed files with 205 additions and 17 deletions
|
|
@ -105,6 +105,11 @@ pub enum ChannelRequest {
|
|||
|
||||
command: Vec<u8>,
|
||||
},
|
||||
Subsystem {
|
||||
want_reply: bool,
|
||||
|
||||
name: String,
|
||||
},
|
||||
Env {
|
||||
want_reply: bool,
|
||||
|
||||
|
|
@ -471,6 +476,19 @@ impl ChannelsState {
|
|||
command: command.to_owned(),
|
||||
}
|
||||
}
|
||||
"subsystem" => {
|
||||
if !self.is_server {
|
||||
return Err(peer_error!("server tried to set environment var"));
|
||||
}
|
||||
|
||||
let name = p.utf8_string()?;
|
||||
|
||||
info!(channel = %our_channel, %name, "Starting subsystem");
|
||||
ChannelRequest::Subsystem {
|
||||
want_reply,
|
||||
name: name.to_owned(),
|
||||
}
|
||||
}
|
||||
"env" => {
|
||||
if !self.is_server {
|
||||
return Err(peer_error!("server tried to set environment var"));
|
||||
|
|
@ -632,6 +650,7 @@ impl ChannelsState {
|
|||
Packet::new_msg_channel_request_shell(peer, b"shell", want_reply)
|
||||
}
|
||||
ChannelRequest::Exec { .. } => todo!("exec"),
|
||||
ChannelRequest::Subsystem { .. } => todo!("subsystem"),
|
||||
ChannelRequest::Env { .. } => todo!("env"),
|
||||
ChannelRequest::ExitStatus { status } => {
|
||||
Packet::new_msg_channel_request_exit_status(
|
||||
|
|
@ -787,6 +806,7 @@ impl ChannelOperation {
|
|||
ChannelRequest::PtyReq { .. } => "pty-req",
|
||||
ChannelRequest::Shell { .. } => "shell",
|
||||
ChannelRequest::Exec { .. } => "exec",
|
||||
ChannelRequest::Subsystem { .. } => "subsystem",
|
||||
ChannelRequest::Env { .. } => "env",
|
||||
ChannelRequest::ExitStatus { .. } => "exit-status",
|
||||
},
|
||||
|
|
|
|||
10
lib/cluelessh-sftp-proto/Cargo.toml
Normal file
10
lib/cluelessh-sftp-proto/Cargo.toml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[package]
|
||||
name = "cluelessh-sftp-proto"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
cluelessh-transport = { path = "../cluelessh-transport" }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
1
lib/cluelessh-sftp-proto/src/lib.rs
Normal file
1
lib/cluelessh-sftp-proto/src/lib.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
|
||||
9
lib/cluelessh-sftp/Cargo.toml
Normal file
9
lib/cluelessh-sftp/Cargo.toml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "cluelessh-sftp"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
14
lib/cluelessh-sftp/src/lib.rs
Normal file
14
lib/cluelessh-sftp/src/lib.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
pub fn add(left: u64, right: u64) -> u64 {
|
||||
left + right
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue