#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. */
/* Server should shut down. Set by SIGINT handler. */
-static volatile int done = 0;
+static volatile int done; /* = 0 */
/* Number of threads. */
static size_t thread_count;
}
/* 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));
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);
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(). */
gcry_strerror(error));
exit(EXIT_FAILURE);
}
+#endif
/* Initialize GnuTLS. */
result = gnutls_global_init();