Skip to main content

libunftp/server/controlchan/commands/
syst.rs

1//! The RFC 959 System (`SYST`) command
2//
3// This command is used to find out the type of operating
4// system at the server.  The reply shall have as its first
5// word one of the system names listed in the current version
6// of the Assigned Numbers document [4].
7//
8// This response is kind of like the User-Agent in http: very much mis-used to gauge
9// the capabilities of the other peer. D.J. Bernstein recommends to just respond with
10// `UNIX Type: L8` for greatest compatibility.
11
12use crate::{
13    auth::UserDetail,
14    server::controlchan::{
15        Reply, ReplyCode,
16        error::ControlChanError,
17        handler::{CommandContext, CommandHandler},
18    },
19    storage::{Metadata, StorageBackend},
20};
21use async_trait::async_trait;
22
23#[derive(Debug)]
24pub struct Syst;
25
26#[async_trait]
27impl<Storage, User> CommandHandler<Storage, User> for Syst
28where
29    User: UserDetail + 'static,
30    Storage: StorageBackend<User> + 'static,
31    Storage::Metadata: Metadata,
32{
33    #[tracing_attributes::instrument]
34    async fn handle(&self, _args: CommandContext<Storage, User>) -> Result<Reply, ControlChanError> {
35        Ok(Reply::new(ReplyCode::SystemType, "UNIX Type: L8")) // TODO change this for windows
36    }
37}