Merge pull request #191 from atong-tcs/master

certstore: update verified certificates, be graceful on filesystem errors
This commit is contained in:
Marc-André Moreau 2011-10-28 08:54:51 -07:00
commit e2186b6732
2 changed files with 14 additions and 1 deletions

View File

@ -277,6 +277,8 @@ int tls_verify_certificate(CryptoCert cert, rdpSettings* settings, char* hostnam
if(!accept_certificate)
return 1;
cert_data_print(certstore);
}
else if (certstore->match == -1)
{

View File

@ -180,6 +180,9 @@ int cert_data_match(rdpCertStore* certstore)
fp = certstore->fp;
cert_data = certstore->certdata;
if (!fp)
return certstore->match;
fseek(fp, 0, SEEK_END);
size = ftell(fp);
fseek(fp, 0, SEEK_SET);
@ -223,6 +226,14 @@ int cert_data_match(rdpCertStore* certstore)
void cert_data_print(rdpCertStore* certstore)
{
fseek(certstore->fp, 0, SEEK_END);
FILE* fp;
/* reopen in append mode */
fp = fopen(certstore->file, "a");
if (!fp)
return;
fprintf(certstore->fp,"%s %s\n", certstore->certdata->hostname, certstore->certdata->fingerprint);
fclose(fp);
}