Skip to content

SSH.Session.CheckHost

Andrew Lambert edited this page Nov 26, 2022 · 6 revisions

SSH.Session.CheckHost

Method Signature

 Function CheckHost(Hosts As SSH.KnownHosts, AddHost As Boolean) As Boolean

Parameters

Name Type Comment
Hosts KnownHosts The list of known hosts to check.
AddHost Boolean If True, the session will be added to the list.

Return value

Returns True if the host+key were found (or added). Check Session.LastError if it returns False.

Remarks

Compares the current session to a list of known hostkeys.

This table lists the various return value/LastError combinations for different values of the AddHost parameter:

AddHost Session.LastError Return value Comment
True or False 0 True The hostkey was found and matches the remote host.
True or False ERR_HOSTKEY_MISMATCH False The hostkey was found but does not match the remote host!
False ERR_HOSTKEY_NOTFOUND False The hostkey was not found.
True ERR_HOSTKEY_NOTFOUND True The hostkey was successfully added.
Clone this wiki locally