Skip to content

Commit 74d845c

Browse files
mariotakuwez
authored andcommitted
added GlobalKnownHosts
1 parent c44d08b commit 74d845c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

libssh-rs/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,14 @@ impl Session {
663663
&value as *const _ as _,
664664
)
665665
},
666+
SshOption::GlobalKnownHosts(known_hosts) => unsafe {
667+
let known_hosts = opt_string_to_cstring(known_hosts);
668+
sys::ssh_options_set(
669+
**sess,
670+
sys::ssh_options_e::SSH_OPTIONS_GLOBAL_KNOWNHOSTS,
671+
opt_cstring_to_cstr(&known_hosts) as _,
672+
)
673+
},
666674
};
667675

668676
if res == 0 {
@@ -1339,6 +1347,10 @@ pub enum SshOption {
13391347
CiphersSC(String),
13401348
/// Set it to false to disable automatic processing of per-user and system-wide OpenSSH configuration files.
13411349
ProcessConfig(bool),
1350+
/// Set the global known hosts file name
1351+
/// If the value is None, the directory is set to the default known hosts file, normally /etc/ssh/ssh_known_hosts.
1352+
/// The known hosts file is used to certify remote hosts are genuine.
1353+
GlobalKnownHosts(Option<String>),
13421354
}
13431355

13441356
/// Indicates the state of known-host matching, an important set

0 commit comments

Comments
 (0)