aboutsummaryrefslogtreecommitdiff
path: root/sample.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-03-30 13:11:47 +0000
committerAndreas Schneider <mail@cynapses.org>2009-03-30 13:11:47 +0000
commitae4ef84702cbecd4ca004349bcb4ff6cae6153fe (patch)
tree783a51217c96f5c3cb245ea1145bda425c2f819e /sample.c
parent1fd7a875beca36597e987729bd76928a9593cfd1 (diff)
downloadlibssh-ae4ef84702cbecd4ca004349bcb4ff6cae6153fe.tar.gz
libssh-ae4ef84702cbecd4ca004349bcb4ff6cae6153fe.tar.xz
libssh-ae4ef84702cbecd4ca004349bcb4ff6cae6153fe.zip
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
Diffstat (limited to 'sample.c')
-rw-r--r--sample.c7
1 files changed, 5 insertions, 2 deletions
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);