version 1.2, 1999/09/28 04:45:36 |
version 1.3, 1999/10/03 21:50:03 |
|
|
HostStatus |
HostStatus |
check_host_in_hostfile(const char *filename, |
check_host_in_hostfile(const char *filename, |
const char *host, unsigned int bits, |
const char *host, unsigned int bits, |
BIGNUM *e, BIGNUM *n) |
BIGNUM *e, BIGNUM *n, |
|
BIGNUM *ke, BIGNUM *kn) |
{ |
{ |
FILE *f; |
FILE *f; |
char line[8192]; |
char line[8192]; |
|
|
char *cp, *cp2; |
char *cp, *cp2; |
HostStatus end_return; |
HostStatus end_return; |
struct stat st; |
struct stat st; |
BIGNUM *ke, *kn; |
|
|
|
/* Open the file containing the list of known hosts. */ |
/* Open the file containing the list of known hosts. */ |
f = fopen(filename, "r"); |
f = fopen(filename, "r"); |
|
|
return HOST_NEW; |
return HOST_NEW; |
} |
} |
|
|
/* Initialize mp-int variables. */ |
|
ke = BN_new(); |
|
kn = BN_new(); |
|
|
|
/* Cache the length of the host name. */ |
/* Cache the length of the host name. */ |
hostlen = strlen(host); |
hostlen = strlen(host); |
|
|
|
|
if (kbits == bits && BN_cmp(ke, e) == 0 && BN_cmp(kn, n) == 0) |
if (kbits == bits && BN_cmp(ke, e) == 0 && BN_cmp(kn, n) == 0) |
{ |
{ |
/* Ok, they match. */ |
/* Ok, they match. */ |
BN_clear_free(ke); |
|
BN_clear_free(kn); |
|
fclose(f); |
fclose(f); |
return HOST_OK; |
return HOST_OK; |
} |
} |
|
|
end_return = HOST_CHANGED; |
end_return = HOST_CHANGED; |
} |
} |
/* Clear variables and close the file. */ |
/* Clear variables and close the file. */ |
BN_clear_free(ke); |
|
BN_clear_free(kn); |
|
fclose(f); |
fclose(f); |
|
|
/* Return either HOST_NEW or HOST_CHANGED, depending on whether we saw a |
/* Return either HOST_NEW or HOST_CHANGED, depending on whether we saw a |