]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/blobdiff - src/tlsproxy.c
Fix compile with --enable-debug.
[tlsproxy/tlsproxy.git] / src / tlsproxy.c
index 91d91b95de828b845deb07706e8ff4ae013d997a..cfd240f3569a1460f7f11badb0690c9f0294bb00 100644 (file)
 #include <sys/types.h>
 #include <unistd.h>
 
+#if GNUTLS_VERSION_NUMBER <= 0x020b00
 /* Necessary for GnuTLS when used with threads. */
 #include <gcrypt.h>
 GCRY_THREAD_OPTION_PTHREAD_IMPL;
+#endif
 
 
 /* Size of ringbuffer. */
@@ -159,7 +161,7 @@ int main(int argc, char **argv) {
     }
 
     /* Fast rebinding for debug mode, could cause invalid packets. */
-    if (global_log_level >= LOG_DEBUG_LEVEL) {
+    if (global_log_level >= LOG_DEBUG1_LEVEL) {
         int socket_option = 1;
         setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR,
                    &socket_option, sizeof(socket_option));
@@ -187,7 +189,7 @@ int main(int argc, char **argv) {
         return EXIT_FAILURE;
     }
 
-    if (global_log_level >= LOG_DEBUG_LEVEL) {
+    if (global_log_level >= LOG_DEBUG1_LEVEL) {
         printf("tlsproxy %s\n", VERSION);
         printf("Listening for connections on port %d.\n", port);
 
@@ -256,7 +258,7 @@ static void parse_arguments(int argc, char **argv) {
     /* Default values. */
     thread_count = 10;
 #ifdef DEBUG
-    global_log_level = LOG_DEBUG_LEVEL;
+    global_log_level = LOG_DEBUG1_LEVEL;
 #else
     global_log_level = LOG_WARNING_LEVEL;
 #endif
@@ -364,6 +366,9 @@ static void print_usage(const char *argv) {
 
 static void initialize_gnutls(void) {
     int result;
+/* Recent versions of GnuTLS automatically initialize the cryptography layer
+ * in gnutls_global_init(). */
+#if GNUTLS_VERSION_NUMBER <= 0x020b00
     gcry_error_t error;
 
     /* Thread safe setup. Must be called before gnutls_global_init(). */
@@ -380,6 +385,7 @@ static void initialize_gnutls(void) {
                                                    gcry_strerror(error));
         exit(EXIT_FAILURE);
     }
+#endif
 
     /* Initialize GnuTLS. */
     result = gnutls_global_init();