OpenVPN
proxy.c File Reference
#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 "memdbg.h"
#include "forward.h"
Include dependency graph for proxy.c:

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)
bool proxy_recv_char (uint8_t *c, const char *name, socket_descriptor_t sd, struct timeval *timeout, volatile int *signal_received)
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)
bool proxy_send (socket_descriptor_t sd, const void *buf, size_t len)
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 (const struct http_proxy_info *p, socket_descriptor_t sd, const char *host)
bool establish_http_proxy_passthru (struct http_proxy_info *p, socket_descriptor_t sd, const char *host, const char *port, const struct event_timeout *server_poll_timeout, struct buffer *lookahead, struct signal_info *sig_info)

Variables

static struct user_pass static_proxy_user_pass

Macro Definition Documentation

◆ UP_TYPE_PROXY

#define UP_TYPE_PROXY   "HTTP Proxy"

Definition at line 41 of file proxy.c.

Referenced by get_user_pass_http().

Function Documentation

◆ add_proxy_headers()

◆ clear_user_pass_http()

void clear_user_pass_http ( void )
static

Definition at line 246 of file proxy.c.

References purge_user_pass(), and static_proxy_user_pass.

Referenced by establish_http_proxy_passthru(), and get_user_pass_http().

◆ establish_http_proxy_passthru()

◆ get_key_value()

bool get_key_value ( const char * str,
char * key,
char * value,
int max_key_len,
int max_value_len,
const char ** endptr )
static

Definition at line 366 of file proxy.c.

Referenced by get_pa_var().

◆ get_pa_var()

char * get_pa_var ( const char * key,
const char * pa,
struct gc_arena * gc )
static

Definition at line 445 of file proxy.c.

References gc, get_key_value(), status, and string_alloc().

Referenced by establish_http_proxy_passthru().

◆ get_proxy_authenticate()

int get_proxy_authenticate ( socket_descriptor_t sd,
int timeout,
char ** data,
volatile int * signal_received )
static

◆ get_user_pass_http()

◆ http_proxy_close()

void http_proxy_close ( struct http_proxy_info * hp)

Definition at line 524 of file proxy.c.

Referenced by uninit_proxy_dowork().

◆ http_proxy_new()

◆ init_http_proxy_options_once()

struct http_proxy_options * init_http_proxy_options_once ( struct http_proxy_options ** hpo,
struct gc_arena * gc )

Definition at line 44 of file proxy.c.

References ALLOC_OBJ_CLEAR_GC, and gc.

Referenced by add_option(), and management_callback_proxy_cmd().

◆ make_base64_string()

uint8_t * make_base64_string ( const uint8_t * str,
struct gc_arena * gc )

Definition at line 229 of file proxy.c.

References gc, and make_base64_string2().

Referenced by username_password_as_base64().

◆ make_base64_string2()

uint8_t * make_base64_string2 ( const uint8_t * str,
int src_len,
struct gc_arena * gc )

Definition at line 218 of file proxy.c.

References ASSERT, gc, openvpn_base64_encode(), and string_alloc().

Referenced by establish_http_proxy_passthru(), and make_base64_string().

◆ proxy_recv_char()

bool proxy_recv_char ( uint8_t * c,
const char * name,
socket_descriptor_t sd,
struct timeval * timeout,
volatile int * signal_received )

◆ proxy_send()

bool proxy_send ( socket_descriptor_t sd,
const void * buf,
size_t len )

◆ recv_line()

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

◆ send_crlf()

bool send_crlf ( socket_descriptor_t sd)
static

Definition at line 212 of file proxy.c.

References send_line_crlf().

Referenced by establish_http_proxy_passthru().

◆ send_line_crlf()

bool send_line_crlf ( socket_descriptor_t sd,
const char * src )
static

◆ store_proxy_authenticate()

void store_proxy_authenticate ( struct http_proxy_info * p,
char * data )
static

Definition at line 355 of file proxy.c.

References buffer::data, and http_proxy_info::proxy_authenticate.

Referenced by establish_http_proxy_passthru().

◆ username_password_as_base64()

const char * username_password_as_base64 ( const struct http_proxy_info * p,
struct gc_arena * gc )
static

Variable Documentation

◆ static_proxy_user_pass

struct user_pass static_proxy_user_pass
static

Definition at line 57 of file proxy.c.

Referenced by clear_user_pass_http(), and get_user_pass_http().