OpenVPN
|
#include "syshead.h"
#include "common.h"
#include "misc.h"
#include "crypto.h"
#include "win32.h"
#include "socket.h"
#include "fdmisc.h"
#include "proxy.h"
#include "base64.h"
#include "httpdigest.h"
#include "ntlm.h"
#include "memdbg.h"
#include "forward.h"
Go to the source code of this file.
Macros | |
#define | UP_TYPE_PROXY "HTTP Proxy" |
Functions | |
struct http_proxy_options * | init_http_proxy_options_once (struct http_proxy_options **hpo, struct gc_arena *gc) |
static bool | recv_line (socket_descriptor_t sd, char *buf, int len, const int timeout_sec, const bool verbose, struct buffer *lookahead, volatile int *signal_received) |
static bool | send_line (socket_descriptor_t sd, const char *buf) |
static bool | send_line_crlf (socket_descriptor_t sd, const char *src) |
static bool | send_crlf (socket_descriptor_t sd) |
uint8_t * | make_base64_string2 (const uint8_t *str, int src_len, struct gc_arena *gc) |
uint8_t * | make_base64_string (const uint8_t *str, struct gc_arena *gc) |
static const char * | username_password_as_base64 (const struct http_proxy_info *p, struct gc_arena *gc) |
static void | clear_user_pass_http (void) |
static void | get_user_pass_http (struct http_proxy_info *p, const bool force) |
static int | get_proxy_authenticate (socket_descriptor_t sd, int timeout, char **data, volatile int *signal_received) |
static void | store_proxy_authenticate (struct http_proxy_info *p, char *data) |
static bool | get_key_value (const char *str, char *key, char *value, int max_key_len, int max_value_len, const char **endptr) |
static char * | get_pa_var (const char *key, const char *pa, struct gc_arena *gc) |
struct http_proxy_info * | http_proxy_new (const struct http_proxy_options *o) |
void | http_proxy_close (struct http_proxy_info *hp) |
static bool | add_proxy_headers (struct http_proxy_info *p, socket_descriptor_t sd, const char *host, const char *port) |
bool | establish_http_proxy_passthru (struct http_proxy_info *p, socket_descriptor_t sd, const char *host, const char *port, struct event_timeout *server_poll_timeout, struct buffer *lookahead, struct signal_info *sig_info) |
Variables | |
static struct user_pass | static_proxy_user_pass |
|
static |
Definition at line 571 of file proxy.c.
References http_custom_header::content, http_proxy_options::custom_headers, D_PROXY, MAX_CUSTOM_HTTP_HEADER, msg, http_custom_header::name, http_proxy_info::options, send_line_crlf(), and http_proxy_options::user_agent.
Referenced by establish_http_proxy_passthru().
|
static |
Definition at line 254 of file proxy.c.
References purge_user_pass(), and static_proxy_user_pass.
Referenced by establish_http_proxy_passthru(), and get_user_pass_http().
bool establish_http_proxy_passthru | ( | struct http_proxy_info * | p, |
socket_descriptor_t | sd, | ||
const char * | host, | ||
const char * | port, | ||
struct event_timeout * | server_poll_timeout, | ||
struct buffer * | lookahead, | ||
struct signal_info * | sig_info | ||
) |
Definition at line 642 of file proxy.c.
References add_proxy_headers(), ASSERT, http_proxy_info::auth_method, http_proxy_options::auth_retry, BLEN, BPTR, chomp(), CLEAR, clear_user_pass_http(), D_LINK_ERRORS, D_PROXY, D_SHOW_KEYS, DigestCalcHA1(), DigestCalcResponse(), dmsg, format_hex(), gc_free(), gc_malloc(), gc_new(), get_pa_var(), get_proxy_authenticate(), get_server_poll_remaining_time(), get_user_pass_http(), HTTP_AUTH_BASIC, HTTP_AUTH_DIGEST, HTTP_AUTH_NONE, HTTP_AUTH_NTLM2, http_proxy_options::http_version, M_INFO, make_base64_string2(), msg, user_pass::nocache, ntlm_phase_1(), ntlm_phase_3(), http_proxy_info::options, PAR_NCT, user_pass::password, http_proxy_info::proxy_authenticate, http_proxy_info::queried_creds, rand_bytes(), recv_line(), register_signal(), send_crlf(), send_line_crlf(), http-client::session_key, signal_info::signal_received, status, store_proxy_authenticate(), http_proxy_info::up, user_pass::username, and username_password_as_base64().
Referenced by phase2_tcp_client().
|
static |
Definition at line 386 of file proxy.c.
Referenced by get_pa_var().
|
static |
Definition at line 467 of file proxy.c.
References get_key_value(), status, and string_alloc().
Referenced by establish_http_proxy_passthru().
|
static |
Definition at line 326 of file proxy.c.
References chomp(), D_PROXY, buffer::data, HTTP_AUTH_BASIC, HTTP_AUTH_DIGEST, HTTP_AUTH_NONE, HTTP_AUTH_NTLM2, msg, recv_line(), and string_alloc().
Referenced by establish_http_proxy_passthru().
|
static |
Definition at line 260 of file proxy.c.
References http_proxy_options::auth_file, http_proxy_options::auth_file_up, clear_user_pass_http(), user_pass::defined, get_user_pass(), GET_USER_PASS_INLINE_CREDS, GET_USER_PASS_MANAGEMENT, GET_USER_PASS_PREVIOUS_CREDS_FAILED, http_proxy_options::inline_creds, http_proxy_options::nocache, user_pass::nocache, http_proxy_info::options, http_proxy_info::queried_creds, static_proxy_user_pass, http_proxy_info::up, and UP_TYPE_PROXY.
Referenced by establish_http_proxy_passthru(), and http_proxy_new().
void http_proxy_close | ( | struct http_proxy_info * | hp | ) |
Definition at line 565 of file proxy.c.
Referenced by uninit_proxy_dowork().
struct http_proxy_info* http_proxy_new | ( | const struct http_proxy_options * | o | ) |
Definition at line 501 of file proxy.c.
References ALLOC_OBJ_CLEAR, ASSERT, http_proxy_info::auth_method, http_proxy_options::auth_method_string, http_proxy_info::defined, http_proxy_options::first_time, get_user_pass_http(), HTTP_AUTH_BASIC, HTTP_AUTH_NONE, HTTP_AUTH_NTLM2, M_FATAL, M_WARN, msg, http_proxy_info::options, PACKAGE_NAME, http_proxy_options::port, and http_proxy_options::server.
Referenced by init_proxy_dowork().
struct http_proxy_options* init_http_proxy_options_once | ( | struct http_proxy_options ** | hpo, |
struct gc_arena * | gc | ||
) |
Definition at line 46 of file proxy.c.
References ALLOC_OBJ_CLEAR_GC.
Referenced by add_option(), and management_callback_proxy_cmd().
uint8_t* make_base64_string | ( | const uint8_t * | str, |
struct gc_arena * | gc | ||
) |
Definition at line 238 of file proxy.c.
References make_base64_string2().
Referenced by username_password_as_base64().
uint8_t* make_base64_string2 | ( | const uint8_t * | str, |
int | src_len, | ||
struct gc_arena * | gc | ||
) |
Definition at line 227 of file proxy.c.
References ASSERT, openvpn_base64_encode(), and string_alloc().
Referenced by establish_http_proxy_passthru(), make_base64_string(), and ntlm_phase_3().
|
static |
Definition at line 63 of file proxy.c.
References ASSERT, buf_defined(), buf_init, buf_write_u8(), CLEAR, D_LINK_ERRORS, get_signal(), M_ERRNO, M_INFO, msg, MSG_NOSIGNAL, openvpn_fd_set(), and status.
Referenced by establish_http_proxy_passthru(), and get_proxy_authenticate().
|
static |
Definition at line 221 of file proxy.c.
References send_line_crlf().
Referenced by establish_http_proxy_passthru().
|
static |
Definition at line 194 of file proxy.c.
References D_LINK_ERRORS, M_ERRNO, msg, and MSG_NOSIGNAL.
Referenced by send_line_crlf().
|
static |
Definition at line 207 of file proxy.c.
References alloc_buf(), ASSERT, BSTR, buf_write(), free_buf(), and send_line().
Referenced by add_proxy_headers(), establish_http_proxy_passthru(), and send_crlf().
|
static |
Definition at line 375 of file proxy.c.
References buffer::data, and http_proxy_info::proxy_authenticate.
Referenced by establish_http_proxy_passthru().
|
static |
Definition at line 244 of file proxy.c.
References alloc_buf_gc(), ASSERT, BSTR, buf_printf(), make_base64_string(), user_pass::password, http_proxy_info::up, and user_pass::username.
Referenced by establish_http_proxy_passthru().
|
static |
Definition at line 60 of file proxy.c.
Referenced by clear_user_pass_http(), and get_user_pass_http().