OpenVPN
Macros | Functions | Variables
misc.c File Reference
#include "syshead.h"
#include "buffer.h"
#include "misc.h"
#include "base64.h"
#include "tun.h"
#include "error.h"
#include "otime.h"
#include "plugin.h"
#include "options.h"
#include "manage.h"
#include "crypto.h"
#include "route.h"
#include "console.h"
#include "win32.h"
#include "memdbg.h"
Include dependency graph for misc.c:

Go to the source code of this file.

Macros

#define n_rnd_bytes   6
 

Functions

void set_std_files_to_null (bool stdin_only)
 
void save_inetd_socket_descriptor (void)
 
const char * hostname_randomize (const char *hostname, struct gc_arena *gc)
 
bool get_user_pass_cr (struct user_pass *up, const char *auth_file, const char *prefix, const unsigned int flags, const char *auth_challenge)
 
struct auth_challenge_infoget_auth_challenge (const char *auth_challenge, struct gc_arena *gc)
 
void purge_user_pass (struct user_pass *up, const bool force)
 
void set_auth_token (struct user_pass *up, struct user_pass *tk, const char *token)
 
const char * safe_print (const char *str, struct gc_arena *gc)
 
const char ** make_arg_array (const char *first, const char *parms, struct gc_arena *gc)
 
static const char ** make_inline_array (const char *str, struct gc_arena *gc)
 
static const char ** make_arg_copy (char **p, struct gc_arena *gc)
 
const char ** make_extended_arg_array (char **p, struct gc_arena *gc)
 
const char * sanitize_control_message (const char *src, struct gc_arena *gc)
 
bool validate_peer_info_line (char *line)
 
void output_peer_info_env (struct env_set *es, const char *peer_info)
 

Variables

int inetd_socket_descriptor = SOCKET_UNDEFINED
 

Macro Definition Documentation

◆ n_rnd_bytes

#define n_rnd_bytes   6

Referenced by hostname_randomize().

Function Documentation

◆ get_auth_challenge()

struct auth_challenge_info* get_auth_challenge ( const char *  auth_challenge,
struct gc_arena gc 
)

◆ get_user_pass_cr()

bool get_user_pass_cr ( struct user_pass up,
const char *  auth_file,
const char *  prefix,
const unsigned int  flags,
const char *  auth_challenge 
)

◆ hostname_randomize()

const char* hostname_randomize ( const char *  hostname,
struct gc_arena gc 
)

Definition at line 104 of file misc.c.

References alloc_buf_gc(), BSTR, buf_printf(), format_hex_ex(), n_rnd_bytes, and prng_bytes().

Referenced by openvpn_getaddrinfo().

◆ make_arg_array()

const char** make_arg_array ( const char *  first,
const char *  parms,
struct gc_arena gc 
)

Definition at line 507 of file misc.c.

References ALLOC_ARRAY_CLEAR_GC, ASSERT, M_WARN, MAX_PARMS, parse_line(), and string_alloc().

Referenced by make_extended_arg_array().

◆ make_arg_copy()

static const char** make_arg_copy ( char **  p,
struct gc_arena gc 
)
static

Definition at line 565 of file misc.c.

References ALLOC_ARRAY_CLEAR_GC, buffer::len, and string_array_len().

Referenced by make_extended_arg_array().

◆ make_extended_arg_array()

const char** make_extended_arg_array ( char **  p,
struct gc_arena gc 
)

◆ make_inline_array()

static const char** make_inline_array ( const char *  str,
struct gc_arena gc 
)
static

◆ output_peer_info_env()

void output_peer_info_env ( struct env_set es,
const char *  peer_info 
)

◆ purge_user_pass()

void purge_user_pass ( struct user_pass up,
const bool  force 
)

◆ safe_print()

const char* safe_print ( const char *  str,
struct gc_arena gc 
)

Definition at line 501 of file misc.c.

References CC_CRLF, CC_PRINT, and string_mod_const().

Referenced by get_user_pass(), and options_warning_safe_scan2().

◆ sanitize_control_message()

const char* sanitize_control_message ( const char *  src,
struct gc_arena gc 
)

◆ save_inetd_socket_descriptor()

void save_inetd_socket_descriptor ( void  )

Definition at line 85 of file misc.c.

References INETD_SOCKET_DESCRIPTOR, inetd_socket_descriptor, M_ERR, msg, and set_std_files_to_null().

Referenced by add_option().

◆ set_auth_token()

void set_auth_token ( struct user_pass up,
struct user_pass tk,
const char *  token 
)

◆ set_std_files_to_null()

void set_std_files_to_null ( bool  stdin_only)

Definition at line 58 of file misc.c.

Referenced by open_syslog(), possibly_become_daemon(), and save_inetd_socket_descriptor().

◆ validate_peer_info_line()

bool validate_peer_info_line ( char *  line)

Definition at line 679 of file misc.c.

Referenced by get_user_pass(), management_notify_generic(), and output_peer_info_env().

Variable Documentation

◆ inetd_socket_descriptor

int inetd_socket_descriptor = SOCKET_UNDEFINED

Definition at line 82 of file misc.c.

Referenced by link_socket_init_phase1(), and save_inetd_socket_descriptor().