From 3eebfbd0b124c034d57e9ddba051e82fe99ba05f Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 8 Aug 2013 21:07:03 +0200 Subject: [PATCH] Rename http_digest_authorization to global_http_digest_authorization. --- src/connection.c | 6 +++--- src/tlsproxy.c | 10 +++++----- src/tlsproxy.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/connection.c b/src/connection.c index aa42bfd..abd8975 100644 --- a/src/connection.c +++ b/src/connection.c @@ -542,14 +542,14 @@ static int read_http_request(FILE *client_fd, char *request, size_t length) { while (fgets(buffer, sizeof(buffer), client_fd) != NULL) { const char *authentication = "Proxy-Authorization: Basic "; - if (http_digest_authorization != NULL + if (global_http_digest_authorization != NULL && !strncmp(buffer, authentication, strlen(authentication))) { found_proxy_authorization = 1; /* Check if the passphrase matches. */ strtok(buffer, "\r\n"); if (strcmp(buffer + strlen(authentication), - http_digest_authorization)) { + global_http_digest_authorization)) { return -3; } } @@ -564,7 +564,7 @@ static int read_http_request(FILE *client_fd, char *request, size_t length) { return -1; } - if (http_digest_authorization != NULL && !found_proxy_authorization) { + if (global_http_digest_authorization != NULL && !found_proxy_authorization) { return -3; } diff --git a/src/tlsproxy.c b/src/tlsproxy.c index b391b73..ee65feb 100644 --- a/src/tlsproxy.c +++ b/src/tlsproxy.c @@ -237,7 +237,7 @@ int main(int argc, char **argv) { free(global_proxy_host); free(global_proxy_port); - free(http_digest_authorization); + free(global_http_digest_authorization); return EXIT_FAILURE; } @@ -265,20 +265,20 @@ 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_text_file(optarg); - if (http_digest_authorization == NULL) { + global_http_digest_authorization = slurp_text_file(optarg); + if (global_http_digest_authorization == NULL) { fprintf(stderr, "failed to open authorization file '%s': ", optarg); perror(""); exit(EXIT_FAILURE); - } else if (strlen(http_digest_authorization) == 0) { + } else if (strlen(global_http_digest_authorization) == 0) { fprintf(stderr, "empty authorization file '%s'\n", optarg); exit(EXIT_FAILURE); } /* Just in case the file has a trailing newline. */ - strtok(http_digest_authorization, "\r\n"); + strtok(global_http_digest_authorization, "\r\n"); break; } diff --git a/src/tlsproxy.h b/src/tlsproxy.h index d244b8d..5c0940c 100644 --- a/src/tlsproxy.h +++ b/src/tlsproxy.h @@ -55,7 +55,7 @@ char *global_proxy_host; char *global_proxy_port; /* Passphrase for authentication of this proxy. Used with the -a option. */ -char *http_digest_authorization; +char *global_http_digest_authorization; /* Log level, command line option. */ int global_log_level; -- 2.45.2