Get the `sshd_config` path Uses the input value, if provided. If input value not provided, get default path for the OS. On Windows, uses the `ProgramData` environment variable and standard path. On Unix-like systems, uses the standard path.
(input: Option<PathBuf>)
| 97 | /// On Windows, uses the `ProgramData` environment variable and standard path. |
| 98 | /// On Unix-like systems, uses the standard path. |
| 99 | pub fn get_default_sshd_config_path(input: Option<PathBuf>) -> Result<PathBuf, SshdConfigError> { |
| 100 | if let Some(path) = input { |
| 101 | Ok(path) |
| 102 | } else if cfg!(windows) { |
| 103 | let program_data = std::env::var("ProgramData")?; |
| 104 | Ok(PathBuf::from(format!("{program_data}{SSHD_CONFIG_DEFAULT_PATH_WINDOWS}"))) |
| 105 | } else { |
| 106 | Ok(PathBuf::from(SSHD_CONFIG_DEFAULT_PATH_UNIX)) |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | /// Invoke sshd -T. |
| 111 | /// |
no outgoing calls
no test coverage detected