MCPcopy Create free account
hub / github.com/PowerShell/DSC / get_default_sshd_config_path

Function get_default_sshd_config_path

resources/sshdconfig/src/util.rs:99–108  ·  view source on GitHub ↗

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>)

Source from the content-addressed store, hash-verified

97/// On Windows, uses the `ProgramData` environment variable and standard path.
98/// On Unix-like systems, uses the standard path.
99pub 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///

Callers 2

read_sshd_configFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected