Fix host fingerprint lenght in know_hosts file
The fingerprint that was written to the known_hosts file was one byte to short. For hosts, already in know_hosts, a warning to update the hosts key in the know_hosts is printed. For new hosts the key is added with the right length. Based on 495aba9 fixes #1007
This commit is contained in:
parent
25260bd717
commit
a8ab91616c
@ -642,7 +642,22 @@ int certificate_data_match(rdpCertificateStore* certificate_store, rdpCertificat
|
||||
if (strcmp(pline, certificate_data->fingerprint) == 0)
|
||||
match = 0;
|
||||
else
|
||||
match = -1;
|
||||
{
|
||||
if (strlen(pline) == strlen(certificate_data->fingerprint)-3 && strcmp(pline, certificate_data->fingerprint+3) == 0)
|
||||
{
|
||||
printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
|
||||
printf("@ WARNING: OLD KEY FORMAT FOUND FOR HOST %s!\n", certificate_data->hostname);
|
||||
printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
|
||||
printf("Freerdps known_host file format was updated.\n");
|
||||
printf("The new key is : %s\n", certificate_data->fingerprint);
|
||||
printf("The old key was : %s\n", pline);
|
||||
printf("To be secure remove or update the line containing the hostname in ~/.freerdp/known_hosts\n");
|
||||
printf(" and reconnect\n");
|
||||
match = 0;
|
||||
}
|
||||
else
|
||||
match = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ char* crypto_cert_fingerprint(X509* xcert)
|
||||
for (i = 0; i < (int) (fp_len - 1); i++)
|
||||
{
|
||||
sprintf(p, "%02x:", fp[i]);
|
||||
p = &fp_buffer[i * 3];
|
||||
p = &fp_buffer[(i + 1) * 3];
|
||||
}
|
||||
sprintf(p, "%02x", fp[i]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user