1
1

Added a call to libssh2_knownhost_writefile()

Updated to the slightly modified libssh2_knownhost_check() proto
Этот коммит содержится в:
Daniel Stenberg 2009-05-29 14:10:54 +02:00
родитель 8cd76af353
Коммит 517909d37a

Просмотреть файл

@ -133,15 +133,18 @@ int main(int argc, char *argv[])
return 2;
}
/* read all hosts from here */
libssh2_knownhost_readfile(nh, "known_hosts",
LIBSSH2_KNOWNHOST_FILE_OPENSSH);
/* store all known hosts to here */
libssh2_knownhost_writefile(nh, "dumpfile",
LIBSSH2_KNOWNHOST_FILE_OPENSSH);
fingerprint = libssh2_session_hostkey(session, &len);
if(fingerprint) {
struct libssh2_knownhost host;
int check;
check = libssh2_knownhost_check(nh, (char *)hostname,
struct libssh2_knownhost *host;
int check = libssh2_knownhost_check(nh, (char *)hostname,
(char *)fingerprint, len,
LIBSSH2_KNOWNHOST_TYPE_PLAIN|
LIBSSH2_KNOWNHOST_KEYENC_RAW,
@ -149,7 +152,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "Host check: %d, key: %s\n", check,
(check <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH)?
host.key:"<none>");
host->key:"<none>");
/*****
* At this point, we could verify that 'check' tells us the key is