version 1.28, 1999/11/15 00:42:01 |
version 1.29, 1999/11/15 20:53:25 |
|
|
int |
int |
try_agent_authentication() |
try_agent_authentication() |
{ |
{ |
int status, type, bits; |
int status, type; |
char *comment; |
char *comment; |
AuthenticationConnection *auth; |
AuthenticationConnection *auth; |
unsigned char response[16]; |
unsigned char response[16]; |
|
|
challenge = BN_new(); |
challenge = BN_new(); |
|
|
/* Loop through identities served by the agent. */ |
/* Loop through identities served by the agent. */ |
for (status = ssh_get_first_identity(auth, &bits, e, n, &comment); |
for (status = ssh_get_first_identity(auth, e, n, &comment); |
status; |
status; |
status = ssh_get_next_identity(auth, &bits, e, n, &comment)) |
status = ssh_get_next_identity(auth, e, n, &comment)) |
{ |
{ |
int plen, clen; |
int plen, clen; |
|
|
|
|
debug("Received RSA challenge from server."); |
debug("Received RSA challenge from server."); |
|
|
/* Ask the agent to decrypt the challenge. */ |
/* Ask the agent to decrypt the challenge. */ |
if (!ssh_decrypt_challenge(auth, bits, e, n, challenge, |
if (!ssh_decrypt_challenge(auth, e, n, challenge, |
session_id, 1, response)) |
session_id, 1, response)) |
{ |
{ |
/* The agent failed to authenticate this identifier although it |
/* The agent failed to authenticate this identifier although it |
|
|
SSH_SMSG_PUBLIC_KEY); |
SSH_SMSG_PUBLIC_KEY); |
|
|
/* Compute the session id. */ |
/* Compute the session id. */ |
compute_session_id(session_id, check_bytes, |
compute_session_id(session_id, check_bytes, host_key->n, public_key->n); |
BN_num_bits(host_key->n), host_key->n, |
|
BN_num_bits(public_key->n), public_key->n); |
|
|
|
/* Check if the host key is present in the user\'s list of known hosts |
/* Check if the host key is present in the user\'s list of known hosts |
or in the systemwide list. */ |
or in the systemwide list. */ |
host_status = check_host_in_hostfile(options.user_hostfile, |
host_status = check_host_in_hostfile(options.user_hostfile, host, |
host, BN_num_bits(host_key->n), |
|
host_key->e, host_key->n, |
host_key->e, host_key->n, |
file_key->e, file_key->n); |
file_key->e, file_key->n); |
if (host_status == HOST_NEW) |
if (host_status == HOST_NEW) |
host_status = check_host_in_hostfile(options.system_hostfile, host, |
host_status = check_host_in_hostfile(options.system_hostfile, host, |
BN_num_bits(host_key->n), |
|
host_key->e, host_key->n, |
host_key->e, host_key->n, |
file_key->e, file_key->n); |
file_key->e, file_key->n); |
/* Force accepting of the host key for localhost and 127.0.0.1. |
/* Force accepting of the host key for localhost and 127.0.0.1. |
|
|
ip_key->n = BN_new(); |
ip_key->n = BN_new(); |
ip_key->e = BN_new(); |
ip_key->e = BN_new(); |
ip_status = check_host_in_hostfile(options.user_hostfile, ip, |
ip_status = check_host_in_hostfile(options.user_hostfile, ip, |
BN_num_bits(host_key->n), |
|
host_key->e, host_key->n, |
host_key->e, host_key->n, |
ip_key->e, ip_key->n); |
ip_key->e, ip_key->n); |
|
|
if (ip_status == HOST_NEW) |
if (ip_status == HOST_NEW) |
ip_status = check_host_in_hostfile(options.system_hostfile, ip, |
ip_status = check_host_in_hostfile(options.system_hostfile, ip, |
BN_num_bits(host_key->n), |
|
host_key->e, host_key->n, |
host_key->e, host_key->n, |
ip_key->e, ip_key->n); |
ip_key->e, ip_key->n); |
if (host_status == HOST_CHANGED && |
if (host_status == HOST_CHANGED && |
|
|
if (options.check_host_ip) { |
if (options.check_host_ip) { |
if (ip_status == HOST_NEW) { |
if (ip_status == HOST_NEW) { |
if (!add_host_to_hostfile(options.user_hostfile, ip, |
if (!add_host_to_hostfile(options.user_hostfile, ip, |
BN_num_bits(host_key->n), |
|
host_key->e, host_key->n)) |
host_key->e, host_key->n)) |
log("Failed to add the host ip to the list of known hosts (%.30s).", |
log("Failed to add the host ip to the list of known hosts (%.30s).", |
options.user_hostfile); |
options.user_hostfile); |
|
|
/* If not in strict mode, add the key automatically to the local |
/* If not in strict mode, add the key automatically to the local |
known_hosts file. */ |
known_hosts file. */ |
if (!add_host_to_hostfile(options.user_hostfile, hostp, |
if (!add_host_to_hostfile(options.user_hostfile, hostp, |
BN_num_bits(host_key->n), |
|
host_key->e, host_key->n)) |
host_key->e, host_key->n)) |
log("Failed to add the host to the list of known hosts (%.500s).", |
log("Failed to add the host to the list of known hosts (%.500s).", |
options.user_hostfile); |
options.user_hostfile); |