X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=src%2Ftlsproxy.c;h=3d9e80fb532938679eab674ebe520b0cc9c599ee;hb=6c7e972612c7bd8f98308d08c4576064b7cbe4eb;hp=40729f08c8240938ea24dca75597a96115c2c474;hpb=4b64428fe11db22f70c304de1bc9f0cc95f1d189;p=tlsproxy%2Ftlsproxy.git diff --git a/src/tlsproxy.c b/src/tlsproxy.c index 40729f0..3d9e80f 100644 --- a/src/tlsproxy.c +++ b/src/tlsproxy.c @@ -75,7 +75,7 @@ static void sigint_handler(int signal); static void parse_arguments(int argc, char **argv); static void print_usage(const char *argv); -static char *slurp_file(const char *path); +static char *slurp_text_file(const char *path); static void initialize_gnutls(void); static void deinitialize_gnutls(void); @@ -258,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 @@ -267,7 +267,7 @@ static void parse_arguments(int argc, char **argv) { while ((option = getopt(argc, argv, "a:d:p:t:uh?")) != -1) { switch (option) { case 'a': { - http_digest_authorization = slurp_file(optarg); + http_digest_authorization = slurp_text_file(optarg); if (http_digest_authorization == NULL) { fprintf(stderr, "failed to open authorization file '%s': ", optarg); @@ -364,6 +364,13 @@ static void print_usage(const char *argv) { fprintf(stderr, " WARNING: might be a security problem!\n"); } +#if 0 +static void log_function_gnutls(int level, const char *string) { + (void)level; + fprintf(stderr, " => %s", string); +} +#endif + static void initialize_gnutls(void) { int result; /* Recent versions of GnuTLS automatically initialize the cryptography layer @@ -391,6 +398,11 @@ static void initialize_gnutls(void) { result = gnutls_global_init(); GNUTLS_ERROR_EXIT(result, "gnutls_global_init()"); +#if 0 + gnutls_global_set_log_level(10); + gnutls_global_set_log_function(log_function_gnutls); +#endif + /* Setup GnuTLS cipher suites. */ result = gnutls_priority_init(&global_tls_priority_cache, "NORMAL", NULL); GNUTLS_ERROR_EXIT(result, "gnutls_priority_init()"); @@ -433,7 +445,7 @@ static void *worker_thread(void *unused) { return NULL; } -static char *slurp_file(const char *path) { +static char *slurp_text_file(const char *path) { struct stat stat; size_t size_read; char *content = NULL;