X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=src%2Fverify.c;h=5de9d84d0517737daf5c07a2b73919bb37c14b86;hb=8fd61ea9f6e79de1d7c3943c9271511cf2827761;hp=f546fd42e2cb9d2982cea39a0c0a6fd8b112b6a0;hpb=580b6777a6a264dc18ecb1810b3472307d6106a4;p=tlsproxy%2Ftlsproxy.git diff --git a/src/verify.c b/src/verify.c index f546fd4..5de9d84 100644 --- a/src/verify.c +++ b/src/verify.c @@ -156,6 +156,21 @@ int verify_tls_connection(gnutls_session_t session, const char *hostname) { return -2; } + /* Check that the proxy certificate file exists and is readable for this + * domain. This ensures we send an "invalid" certificate even if the proxy + * certificate doesn't exist. */ + if (0 != proxy_certificate_path(hostname, path, sizeof(path))) { + return -1; + } + file = fopen(path, "r"); + if (NULL == file) { + LOG(LOG_WARNING, + "verify_tls_connection(): proxy certificate doesn't exist: '%s'", + path); + return -1; + } + fclose(file); + return 0; }