mirror of
https://github.com/libssh2/libssh2.git
synced 2025-08-05 20:55:47 +03:00
example/ssh2_exec: drop conditional code for deprecated API
This commit is contained in:
committed by
Viktor Szakats
parent
6dc42e9d62
commit
f4f5841dd5
@@ -172,21 +172,11 @@ int main(int argc, char *argv[])
|
|||||||
fingerprint = libssh2_session_hostkey(session, &len, &type);
|
fingerprint = libssh2_session_hostkey(session, &len, &type);
|
||||||
if(fingerprint) {
|
if(fingerprint) {
|
||||||
struct libssh2_knownhost *host;
|
struct libssh2_knownhost *host;
|
||||||
#if LIBSSH2_VERSION_NUM >= 0x010206
|
|
||||||
/* introduced in 1.2.6 */
|
|
||||||
int check = libssh2_knownhost_checkp(nh, hostname, 22,
|
int check = libssh2_knownhost_checkp(nh, hostname, 22,
|
||||||
fingerprint, len,
|
fingerprint, len,
|
||||||
LIBSSH2_KNOWNHOST_TYPE_PLAIN|
|
LIBSSH2_KNOWNHOST_TYPE_PLAIN|
|
||||||
LIBSSH2_KNOWNHOST_KEYENC_RAW,
|
LIBSSH2_KNOWNHOST_KEYENC_RAW,
|
||||||
&host);
|
&host);
|
||||||
#else
|
|
||||||
/* 1.2.5 or older */
|
|
||||||
int check = libssh2_knownhost_check(nh, hostname,
|
|
||||||
fingerprint, len,
|
|
||||||
LIBSSH2_KNOWNHOST_TYPE_PLAIN|
|
|
||||||
LIBSSH2_KNOWNHOST_KEYENC_RAW,
|
|
||||||
&host);
|
|
||||||
#endif
|
|
||||||
fprintf(stderr, "Host check: %d, key: %s\n", check,
|
fprintf(stderr, "Host check: %d, key: %s\n", check,
|
||||||
(check <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH)?
|
(check <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH)?
|
||||||
host->key:"<none>");
|
host->key:"<none>");
|
||||||
|
Reference in New Issue
Block a user