projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
While we're doing a hostkey reorg, store port numbers as well
[u/mdw/putty]
/
ssh.c
diff --git
a/ssh.c
b/ssh.c
index
cdb12bf
..
add4ae5
100644
(file)
--- a/
ssh.c
+++ b/
ssh.c
@@
-203,6
+203,7
@@
static struct ssh_hostkey *hostkey = NULL;
int (*ssh_get_password)(const char *prompt, char *str, int maxlen) = NULL;
static char *savedhost;
int (*ssh_get_password)(const char *prompt, char *str, int maxlen) = NULL;
static char *savedhost;
+static int savedport;
static int ssh_send_ok;
/*
static int ssh_send_ok;
/*
@@
-704,6
+705,7
@@
static char *connect_to_host(char *host, int port, char **realhost)
if (port < 0)
port = 22; /* default ssh port */
if (port < 0)
port = 22; /* default ssh port */
+ savedport = port;
#ifdef FWHACK
FWhost = host;
#ifdef FWHACK
FWhost = host;
@@
-1142,11
+1144,13
@@
static int do_ssh1_login(unsigned char *in, int inlen, int ispkt)
* First format the key into a string.
*/
int len = rsastr_len(&hostkey);
* First format the key into a string.
*/
int len = rsastr_len(&hostkey);
+ char fingerprint[100];
char *keystr = malloc(len);
if (!keystr)
fatalbox("Out of memory");
rsastr_fmt(keystr, &hostkey);
char *keystr = malloc(len);
if (!keystr)
fatalbox("Out of memory");
rsastr_fmt(keystr, &hostkey);
- verify_ssh_host_key(savedhost, keystr);
+ rsa_fingerprint(fingerprint, sizeof(fingerprint), &hostkey);
+ verify_ssh_host_key(savedhost, savedport, "rsa", keystr, fingerprint);
free(keystr);
}
free(keystr);
}
@@
-1824,7
+1828,7
@@
static int do_ssh2_transport(unsigned char *in, int inlen, int ispkt)
static struct ssh_mac *scmac_tobe = NULL;
static struct ssh_compress *cscomp_tobe = NULL;
static struct ssh_compress *sccomp_tobe = NULL;
static struct ssh_mac *scmac_tobe = NULL;
static struct ssh_compress *cscomp_tobe = NULL;
static struct ssh_compress *sccomp_tobe = NULL;
- static char *hostkeydata, *sigdata, *keystr;
+ static char *hostkeydata, *sigdata, *keystr
, *fingerprint
;
static int hostkeylen, siglen;
static unsigned char exchange_hash[20];
static unsigned char keyspace[40];
static int hostkeylen, siglen;
static unsigned char exchange_hash[20];
static unsigned char keyspace[40];
@@
-2053,7
+2057,12
@@
static int do_ssh2_transport(unsigned char *in, int inlen, int ispkt)
* checked the signature of the exchange hash.)
*/
keystr = hostkey->fmtkey();
* checked the signature of the exchange hash.)
*/
keystr = hostkey->fmtkey();
- verify_ssh_host_key(savedhost, keystr);
+ fingerprint = hostkey->fingerprint();
+ verify_ssh_host_key(savedhost, savedport, hostkey->keytype,
+ keystr, fingerprint);
+ logevent("Host key fingerprint is:");
+ logevent(fingerprint);
+ free(fingerprint);
free(keystr);
/*
free(keystr);
/*