From ae4ef84702cbecd4ca004349bcb4ff6cae6153fe Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 30 Mar 2009 13:11:47 +0000 Subject: Create a ssh_get_hexa function. This function converts a buffer into a colon separated hex string. git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@308 7dcaeef0-15fb-0310-b436-a5af3365683c --- sample.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sample.c') diff --git a/sample.c b/sample.c index fdff41dd..43a33db4 100644 --- a/sample.c +++ b/sample.c @@ -403,6 +403,7 @@ int main(int argc, char **argv){ int auth=0; char *password; char *banner; + char *hexa; int state; char buf[10]; unsigned char hash[MD5_DIGEST_LEN]; @@ -446,9 +447,11 @@ int main(int argc, char **argv){ ssh_finalize(); exit(-1); case SSH_SERVER_NOT_KNOWN: + ssh_get_pubkey_hash(session, hash); + hexa = ssh_get_hexa(hash, MD5_DIGEST_LEN); fprintf(stderr,"The server is unknown. Do you trust the host key ?\n"); - ssh_get_pubkey_hash(session,hash); - ssh_print_hexa("Public key hash",hash,MD5_DIGEST_LEN); + fprintf(stderr, "Public key hash: %s\n", hexa); + free(hexa); fgets(buf,sizeof(buf),stdin); if(strncasecmp(buf,"yes",3)!=0){ ssh_disconnect(session); -- cgit