]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/blobdiff - src/connection.c
src/connection.c: Move path related defines to tlsproxy.h.
[tlsproxy/tlsproxy.git] / src / connection.c
index 7ea6eb24a7573dd14d5d21facf89a06dc2546c9d..26947ffdbfd60968e3c0b229b188161a2767ba8f 100644 (file)
  * should be a good limit to make processing simpler. */
 #define MAX_REQUEST_LINE 4096
 
-/* Paths to necessary TLS files: the CA and the server key. */
-#define PROXY_CA_FILE  "proxy-ca.pem"
-#define PROXY_KEY_FILE "proxy-key.pem"
-
 
 static int initialize_tls_session_client(int peer_socket,
         const char *hostname,
@@ -284,12 +280,9 @@ static int initialize_tls_session_client(int peer_socket,
         gnutls_certificate_credentials_t *x509_cred) {
     int result;
     char path[1024];
-    /* The server certificate for the given hostname is stored in
-     * "./certificate-hostname-proxy.pem". */
-#define PATH_FORMAT "./certificate-%s-proxy.pem"
 
     /* Hostname too long. */
-    if (sizeof(path) - strlen(PATH_FORMAT) <= strlen(hostname)) {
+    if (sizeof(path) - strlen(PROXY_SERVER_CERT_FORMAT) <= strlen(hostname)) {
         LOG(LOG_WARNING,
             "initialize_tls_session_client(): hostname too long: '%s'",
             hostname);
@@ -302,8 +295,7 @@ static int initialize_tls_session_client(int peer_socket,
             hostname);
         return -1;
     }
-    snprintf(path, sizeof(path), PATH_FORMAT, hostname);
-#undef PATH_FORMAT
+    snprintf(path, sizeof(path), PROXY_SERVER_CERT_FORMAT, hostname);
 
     result = gnutls_certificate_allocate_credentials(x509_cred);
     if (GNUTLS_E_SUCCESS != result) {