1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! SCP (Secure CoPy) protocol — the wire format spoken by `scp -t` /
//! `scp -f` between a local and a remote OpenSSH `scp` binary. The
//! protocol predates SFTP and is loosely specified (the closest thing to
//! a reference is OpenSSH's own `scp.c`); the encoding is line-headers +
//! raw payload + single-byte acks, transported over any `Read+Write`
//! stream — typically a [`crate::client::ClientChannelStream`] driving
//! the remote `scp -t`/`scp -f` helper.
//!
//! # Layering
//!
//! - [`protocol`] — pure encode/decode of the four header kinds
//! (`C`, `D`, `E`, `T`) and the three ack frames (`0x00`/`0x01`/`0x02`).
//! No I/O.
//! - [`sender`] — [`Sender`] walks the local filesystem and writes the
//! protocol to a stream. Used by the SCP client (`scp local: remote:`
//! upload, server-side `scp -f` download).
//! - [`receiver`] — [`Receiver`] consumes the protocol on a stream and
//! writes files into a base directory. Used by the SCP client
//! (`scp remote: local:` download, server-side `scp -t` upload).
//!
//! Both sides refuse names containing `\0`, `\n`, or a leading `-` —
//! matching OpenSSH's hardening for CVE-2020-15778-class shell-injection
//! holes. They also refuse paths that lexically escape the base path on
//! the receiving side.
//!
//! # Note
//!
//! OpenSSH 9.0+ deprecated SCP in favour of SFTP-over-SSH. New code
//! should prefer [`crate::sftp::SftpClient`]. SCP support here exists for
//! interop with legacy infrastructure and the OpenSSH `scp` CLI.
// Round-trip tests need `UnixStream::pair()`, so the module is gated to
// Unix. Pure-protocol tests for header parsing live alongside the parser
// in `protocol.rs` and stay portable.
pub use ;
pub use ;
pub use ;