Fix check for presence of ECDSA public key for outgoing connections.

At this point, c->config_tree may or may not be NULL, but this does not tell us whether it is an
outgoing connection or not. For incoming connections, we do not know the peer's name yet,
so we always have to claim ECDSA support. For outgoing connections, we always need to check
whether we have the peer's ECDSA public key, so that if we don't, we correctly tell the peer that
we want to upgrade.
This commit is contained in:
Guus Sliepen 2013-05-11 14:04:39 +02:00
parent c83c2d080f
commit 3c163a3796
2 changed files with 7 additions and 1 deletions

View file

@ -110,6 +110,12 @@ bool read_ecdsa_public_key(connection_t *c) {
char *fname;
char *p;
if(!c->config_tree) {
init_configuration(&c->config_tree);
if(!read_host_config(c->config_tree, c->name))
return false;
}
/* First, check for simple ECDSAPublicKey statement */
if(get_config_string(lookup_config(c->config_tree, "ECDSAPublicKey"), &p)) {

View file

@ -133,7 +133,7 @@ bool send_id(connection_t *c) {
int minor = 0;
if(experimental) {
if(c->config_tree && !read_ecdsa_public_key(c))
if(c->outgoing && !read_ecdsa_public_key(c))
minor = 1;
else
minor = myself->connection->protocol_minor;