version 1.21, 2020/08/27 01:06:18 |
version 1.22, 2020/10/18 11:32:02 |
|
|
if (sshbuf_len(banner) >= 4 && |
if (sshbuf_len(banner) >= 4 && |
memcmp(sshbuf_ptr(banner), "SSH-", 4) == 0) |
memcmp(sshbuf_ptr(banner), "SSH-", 4) == 0) |
break; |
break; |
debug("%s: %.*s", __func__, (int)sshbuf_len(banner), |
debug_f("%.*s", (int)sshbuf_len(banner), |
sshbuf_ptr(banner)); |
sshbuf_ptr(banner)); |
/* Accept lines before banner only on client */ |
/* Accept lines before banner only on client */ |
if (ssh->kex->server || ++n > SSH_MAX_PRE_BANNER_LINES) { |
if (ssh->kex->server || ++n > SSH_MAX_PRE_BANNER_LINES) { |
|
|
{ |
{ |
struct key_entry *k; |
struct key_entry *k; |
|
|
debug3("%s: need %d", __func__, type); |
debug3_f("need %d", type); |
TAILQ_FOREACH(k, &ssh->public_keys, next) { |
TAILQ_FOREACH(k, &ssh->public_keys, next) { |
debug3("%s: check %s", __func__, sshkey_type(k->key)); |
debug3_f("check %s", sshkey_type(k->key)); |
if (k->key->type == type && |
if (k->key->type == type && |
(type != KEY_ECDSA || k->key->ecdsa_nid == nid)) |
(type != KEY_ECDSA || k->key->ecdsa_nid == nid)) |
return (k->key); |
return (k->key); |
|
|
{ |
{ |
struct key_entry *k; |
struct key_entry *k; |
|
|
debug3("%s: need %d", __func__, type); |
debug3_f("need %d", type); |
TAILQ_FOREACH(k, &ssh->private_keys, next) { |
TAILQ_FOREACH(k, &ssh->private_keys, next) { |
debug3("%s: check %s", __func__, sshkey_type(k->key)); |
debug3_f("check %s", sshkey_type(k->key)); |
if (k->key->type == type && |
if (k->key->type == type && |
(type != KEY_ECDSA || k->key->ecdsa_nid == nid)) |
(type != KEY_ECDSA || k->key->ecdsa_nid == nid)) |
return (k->key); |
return (k->key); |
|
|
{ |
{ |
struct key_entry *k; |
struct key_entry *k; |
|
|
debug3("%s: need %s", __func__, sshkey_type(hostkey)); |
debug3_f("need %s", sshkey_type(hostkey)); |
TAILQ_FOREACH(k, &ssh->public_keys, next) { |
TAILQ_FOREACH(k, &ssh->public_keys, next) { |
debug3("%s: check %s", __func__, sshkey_type(k->key)); |
debug3_f("check %s", sshkey_type(k->key)); |
if (sshkey_equal_public(hostkey, k->key)) |
if (sshkey_equal_public(hostkey, k->key)) |
return (0); /* ok */ |
return (0); /* ok */ |
} |
} |
|
|
} |
} |
} |
} |
if (*replace != '\0') { |
if (*replace != '\0') { |
debug2("%s: orig/%d %s", __func__, ssh->kex->server, orig); |
debug2_f("orig/%d %s", ssh->kex->server, orig); |
debug2("%s: replace/%d %s", __func__, ssh->kex->server, replace); |
debug2_f("replace/%d %s", ssh->kex->server, replace); |
free(orig); |
free(orig); |
proposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = replace; |
proposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = replace; |
replace = NULL; /* owned by proposal */ |
replace = NULL; /* owned by proposal */ |