/*
* Verify established TLS connections.
*
- * Copyright (C) 2011 Simon Ruderich
+ * Copyright (C) 2011-2013 Simon Ruderich
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
int verify_tls_connection(gnutls_session_t session, const char *hostname) {
int result;
- char path[1024];
+ char path[TLSPROXY_MAX_PATH_LENGTH];
size_t size;
unsigned int status;
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;
}