diff --git a/src/main.h b/src/main.h index c5817c6a..008fc29d 100644 --- a/src/main.h +++ b/src/main.h @@ -95,7 +95,7 @@ struct proc_st { * who re-uses it when it performs authentication in multiple * sessions. */ - uint8_t sid[MAX_SID_SIZE]; + uint8_t sid[SID_SIZE]; unsigned sid_size; /* acts as a flag if sid is set */ /* The DTLS session ID associated with the TLS session @@ -110,7 +110,9 @@ struct proc_st { char hostname[MAX_HOSTNAME_SIZE]; /* the requested hostname */ uint8_t cookie[COOKIE_SIZE]; /* the cookie associated with the session */ - char user_agent[MAX_AGENT_SIZE]; + /* the following are copied here from the worker process for reporting + * purposes (from main-ctl-handler). */ + char user_agent[MAX_AGENT_NAME]; char tls_ciphersuite[MAX_CIPHERSUITE_NAME]; char dtls_ciphersuite[MAX_DTLS_CIPHERSUITE_NAME]; diff --git a/src/vpn.h b/src/vpn.h index 4aea60e8..8d775504 100644 --- a/src/vpn.h +++ b/src/vpn.h @@ -79,7 +79,7 @@ extern int syslog_open; #define MAX_CIPHERSUITE_NAME 64 #define MAX_DTLS_CIPHERSUITE_NAME 24 #define MAX_MSG_SIZE 256 -#define MAX_SID_SIZE 12 +#define SID_SIZE 12 #define MAX_ZOMBIE_SECS 240 @@ -233,7 +233,7 @@ struct main_server_st; #define MAX_BANNER_SIZE 256 #define MAX_USERNAME_SIZE 64 -#define MAX_AGENT_SIZE 32 +#define MAX_AGENT_NAME 32 #define MAX_PASSWORD_SIZE 64 #define TLS_MASTER_SIZE 48 #define MAX_HOSTNAME_SIZE MAX_USERNAME_SIZE diff --git a/src/worker-auth.c b/src/worker-auth.c index 04c65079..e1f19ea7 100644 --- a/src/worker-auth.c +++ b/src/worker-auth.c @@ -93,7 +93,7 @@ int get_auth_handler2(worker_st * ws, unsigned http_ver, const char *pmsg) return -1; if (req->sid_cookie_set == 0) { - char context[BASE64_LENGTH(MAX_SID_SIZE)+1]; + char context[BASE64_LENGTH(SID_SIZE)+1]; size_t csize = sizeof(context); base64_encode((char*)ws->sid, sizeof(ws->sid), (char*)context, csize); diff --git a/src/worker-vpn.c b/src/worker-vpn.c index cc5de786..6dc8d04e 100644 --- a/src/worker-vpn.c +++ b/src/worker-vpn.c @@ -223,7 +223,7 @@ static void value_check(struct worker_st *ws, struct http_req_st *req) req->hostname[req->value.length] = 0; break; case HEADER_USER_AGENT: - if (req->value.length + 1 > MAX_AGENT_SIZE) { + if (req->value.length + 1 > MAX_AGENT_NAME) { req->user_agent[0] = 0; return; } diff --git a/src/worker.h b/src/worker.h index 7a153e0a..cca6e66b 100644 --- a/src/worker.h +++ b/src/worker.h @@ -75,7 +75,7 @@ struct http_req_st { unsigned int header_state; char hostname[MAX_HOSTNAME_SIZE]; - char user_agent[MAX_AGENT_SIZE]; + char user_agent[MAX_AGENT_NAME]; unsigned int next_header; unsigned char cookie[COOKIE_SIZE]; unsigned int cookie_set; @@ -108,7 +108,7 @@ typedef struct worker_st { gnutls_session_t dtls_session; /* inique session identifier */ - uint8_t sid[MAX_SID_SIZE]; + uint8_t sid[SID_SIZE]; int cmd_fd; int conn_fd;