]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/blobdiff - src/tlsproxy.c
src/Makefile.am: Distribute tlsproxy-setup.
[tlsproxy/tlsproxy.git] / src / tlsproxy.c
index 0e095689374b7cae7e4ce51546491d1e9ade25d4..b67e666ed6f9e57f79faba9c3d985b22a5f1b2ff 100644 (file)
@@ -1,5 +1,7 @@
 /*
- * tlsproxy is a transparent TLS proxy for HTTPS connections.
+ * tlsproxy is a TLS proxy for HTTPS which intercepts the connections and
+ * ensures the server certificate doesn't change. Normally this isn't detected
+ * if a trusted CA for the new server certificate is installed.
  *
  * Copyright (C) 2011  Simon Ruderich
  *
@@ -48,6 +50,14 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
 #define DH_SIZE 1024
 
 
+/* For gnutls_*() functions. */
+#define GNUTLS_ERROR_EXIT(error, message) \
+    if (GNUTLS_E_SUCCESS != error) { \
+        fprintf(stderr, "%s: %s\n", message, gnutls_strerror(error)); \
+        exit(EXIT_FAILURE); \
+    }
+
+
 /* Server should shut down. Set by SIGINT handler. */
 static volatile int done;
 
@@ -132,7 +142,8 @@ int main(int argc, char **argv) {
                                 (void * (*)(void *))&worker_thread,
                                 NULL);
         if (0 != result) {
-            printf("failed to create worker thread: %s\n", strerror(result));
+            fprintf(stderr, "failed to create worker thread: %s\n",
+                            strerror(result));
             return EXIT_FAILURE;
         }