| 1950 |
return; |
return; |
| 1951 |
} |
} |
| 1952 |
|
|
| 1953 |
|
static void client_global_hostkeys_private_confirm(PTInstVar pvar, int type, u_int32_t seq, void *_ctx) |
| 1954 |
|
{ |
| 1955 |
|
struct hostkeys_update_ctx *ctx = (struct hostkeys_update_ctx *)_ctx; |
| 1956 |
|
|
| 1957 |
|
update_known_hosts(pvar, ctx); |
| 1958 |
|
|
| 1959 |
|
hostkeys_update_ctx_free(ctx); |
| 1960 |
|
} |
| 1961 |
|
|
| 1962 |
// |
// |
| 1963 |
// SSHサーバホスト鍵(known_hosts)の自動更新(OpenSSH 6.8 or later: host key rotation support) |
// SSHサーバホスト鍵(known_hosts)の自動更新(OpenSSH 6.8 or later: host key rotation support) |
| 1964 |
// |
// |
| 1977 |
buffer_t *b = NULL; |
buffer_t *b = NULL; |
| 1978 |
struct hostkeys_update_ctx *ctx = NULL; |
struct hostkeys_update_ctx *ctx = NULL; |
| 1979 |
Key *key = NULL, **tmp; |
Key *key = NULL, **tmp; |
| 1980 |
|
unsigned char *outmsg; |
| 1981 |
|
|
| 1982 |
// Tera Termの設定で、当該機能のオンオフを制御できるようにする。 |
// Tera Termの設定で、当該機能のオンオフを制御できるようにする。 |
| 1983 |
if (pvar->settings.UpdateHostkeys == SSH_UPDATE_HOSTKEYS_NO) { |
if (pvar->settings.UpdateHostkeys == SSH_UPDATE_HOSTKEYS_NO) { |
| 2081 |
|
|
| 2082 |
} |
} |
| 2083 |
else if (ctx->nnew != 0) { // 新規追加するべき鍵が存在する。 |
else if (ctx->nnew != 0) { // 新規追加するべき鍵が存在する。 |
| 2084 |
// TODO: |
buffer_clear(b); |
| 2085 |
update_known_hosts(pvar, ctx); |
|
| 2086 |
|
buffer_put_cstring(b, "hostkeys-prove-00@openssh.com"); |
| 2087 |
|
buffer_put_char(b, 1); /* bool: want reply */ |
| 2088 |
|
|
| 2089 |
|
for (i = 0; i < ctx->nkeys; i++) { |
| 2090 |
|
if (ctx->keys_seen[i]) |
| 2091 |
|
continue; |
| 2092 |
|
key_to_blob(ctx->keys[i], &blob, &len); |
| 2093 |
|
buffer_put_string(b, blob, len); |
| 2094 |
|
free(blob); |
| 2095 |
|
blob = NULL; |
| 2096 |
|
} |
| 2097 |
|
|
| 2098 |
|
len = buffer_len(b); |
| 2099 |
|
outmsg = begin_send_packet(pvar, SSH2_MSG_GLOBAL_REQUEST, len); |
| 2100 |
|
memcpy(outmsg, buffer_ptr(b), len); |
| 2101 |
|
finish_send_packet(pvar); |
| 2102 |
|
|
| 2103 |
|
// SSH2_MSG_GLOBAL_REQUESTのレスポンスに対応するハンドラを登録する。 |
| 2104 |
|
client_register_global_confirm(client_global_hostkeys_private_confirm, ctx); |
| 2105 |
|
ctx = NULL; // callbackで解放するので、ここではNULLでつぶしておく。 |
| 2106 |
} |
} |
| 2107 |
|
|
| 2108 |
success = 1; |
success = 1; |