OpenVPN
Functions
env_set.c File Reference
#include "syshead.h"
#include "env_set.h"
#include "run_command.h"
Include dependency graph for env_set.c:

Go to the source code of this file.

Functions

static char * construct_name_value (const char *name, const char *value, struct gc_arena *gc)
 
static bool env_string_equal (const char *s1, const char *s2)
 
static bool remove_env_item (const char *str, const bool do_free, struct env_item **list)
 
static void add_env_item (char *str, const bool do_alloc, struct env_item **list, struct gc_arena *gc)
 
static bool env_set_del_nolock (struct env_set *es, const char *str)
 
static void env_set_add_nolock (struct env_set *es, const char *str)
 
struct env_setenv_set_create (struct gc_arena *gc)
 
void env_set_destroy (struct env_set *es)
 
bool env_set_del (struct env_set *es, const char *str)
 
void env_set_add (struct env_set *es, const char *str)
 
const char * env_set_get (const struct env_set *es, const char *name)
 
void env_set_print (int msglevel, const struct env_set *es)
 
void env_set_inherit (struct env_set *es, const struct env_set *src)
 
void setenv_counter (struct env_set *es, const char *name, counter_type value)
 
void setenv_int (struct env_set *es, const char *name, int value)
 
void setenv_long_long (struct env_set *es, const char *name, long long value)
 
void setenv_str (struct env_set *es, const char *name, const char *value)
 
void setenv_str_safe (struct env_set *es, const char *name, const char *value)
 
void setenv_str_incr (struct env_set *es, const char *name, const char *value)
 Store the supplied name value pair in the env_set. More...
 
void setenv_del (struct env_set *es, const char *name)
 
void setenv_str_ex (struct env_set *es, const char *name, const char *value, const unsigned int name_include, const unsigned int name_exclude, const char name_replace, const unsigned int value_include, const unsigned int value_exclude, const char value_replace)
 
static const char * setenv_format_indexed_name (const char *name, const int i, struct gc_arena *gc)
 
void setenv_int_i (struct env_set *es, const char *name, const int value, const int i)
 
void setenv_str_i (struct env_set *es, const char *name, const char *value, const int i)
 
bool env_allowed (const char *str)
 
const char ** make_env_array (const struct env_set *es, const bool check_allowed, struct gc_arena *gc)
 

Function Documentation

◆ add_env_item()

static void add_env_item ( char *  str,
const bool  do_alloc,
struct env_item **  list,
struct gc_arena gc 
)
static

Definition at line 127 of file env_set.c.

References ALLOC_OBJ_GC, ASSERT, env_item::next, env_item::string, and string_alloc().

Referenced by env_set_add_nolock().

◆ construct_name_value()

static char* construct_name_value ( const char *  name,
const char *  value,
struct gc_arena gc 
)
static

Definition at line 48 of file env_set.c.

References alloc_buf_gc(), ASSERT, BSTR, and buf_printf().

Referenced by setenv_str_ex().

◆ env_allowed()

bool env_allowed ( const char *  str)

Definition at line 413 of file env_set.c.

References is_password_env_var(), script_security(), and SSEC_PW_ENV.

Referenced by env_block(), and make_env_array().

◆ env_set_add()

void env_set_add ( struct env_set es,
const char *  str 
)

Definition at line 193 of file env_set.c.

References ASSERT, env_set_add_nolock(), and es.

Referenced by do_ifconfig_ipv4(), do_ifconfig_ipv6(), output_peer_info_env(), and setenv_str_ex().

◆ env_set_add_nolock()

static void env_set_add_nolock ( struct env_set es,
const char *  str 
)
static

Definition at line 149 of file env_set.c.

References add_env_item(), es, env_set::gc, env_set::list, and remove_env_item().

Referenced by env_set_add(), and env_set_inherit().

◆ env_set_create()

struct env_set* env_set_create ( struct gc_arena gc)

◆ env_set_del()

bool env_set_del ( struct env_set es,
const char *  str 
)

Definition at line 183 of file env_set.c.

References ASSERT, env_set_del_nolock(), and es.

Referenced by setenv_str_ex(), tls_x509_clear_env(), and verify_cert_cert_delete_env().

◆ env_set_del_nolock()

static bool env_set_del_nolock ( struct env_set es,
const char *  str 
)
static

Definition at line 143 of file env_set.c.

References es, env_set::gc, env_set::list, and remove_env_item().

Referenced by env_set_del().

◆ env_set_destroy()

void env_set_destroy ( struct env_set es)

◆ env_set_get()

const char* env_set_get ( const struct env_set es,
const char *  name 
)

Definition at line 201 of file env_set.c.

References env_string_equal(), es, env_set::list, env_item::next, and env_item::string.

Referenced by setenv_str_incr().

◆ env_set_inherit()

void env_set_inherit ( struct env_set es,
const struct env_set src 
)

Definition at line 238 of file env_set.c.

References ASSERT, env_set_add_nolock(), es, env_set::list, env_item::next, and env_item::string.

Referenced by do_inherit_env().

◆ env_set_print()

void env_set_print ( int  msglevel,
const struct env_set es 
)

◆ env_string_equal()

static bool env_string_equal ( const char *  s1,
const char *  s2 
)
static

Definition at line 63 of file env_set.c.

References ASSERT.

Referenced by env_set_get(), and remove_env_item().

◆ make_env_array()

const char** make_env_array ( const struct env_set es,
const bool  check_allowed,
struct gc_arena gc 
)

◆ remove_env_item()

static bool remove_env_item ( const char *  str,
const bool  do_free,
struct env_item **  list 
)
static

◆ setenv_counter()

void setenv_counter ( struct env_set es,
const char *  name,
counter_type  value 
)

Definition at line 259 of file env_set.c.

References counter_format, es, and setenv_str().

Referenced by setenv_stats().

◆ setenv_del()

void setenv_del ( struct env_set es,
const char *  name 
)

◆ setenv_format_indexed_name()

static const char* setenv_format_indexed_name ( const char *  name,
const int  i,
struct gc_arena gc 
)
static

Definition at line 380 of file env_set.c.

References alloc_buf_gc(), BSTR, and buf_printf().

Referenced by setenv_int_i(), and setenv_str_i().

◆ setenv_int()

void setenv_int ( struct env_set es,
const char *  name,
int  value 
)

◆ setenv_int_i()

void setenv_int_i ( struct env_set es,
const char *  name,
const int  value,
const int  i 
)

Definition at line 395 of file env_set.c.

References es, gc_free(), gc_new(), setenv_format_indexed_name(), and setenv_int().

◆ setenv_long_long()

void setenv_long_long ( struct env_set es,
const char *  name,
long long  value 
)

Definition at line 275 of file env_set.c.

References es, and setenv_str().

Referenced by multi_client_connect_setenv(), multi_client_disconnect_setenv(), and setenv_settings().

◆ setenv_str()

void setenv_str ( struct env_set es,
const char *  name,
const char *  value 
)

◆ setenv_str_ex()

void setenv_str_ex ( struct env_set es,
const char *  name,
const char *  value,
const unsigned int  name_include,
const unsigned int  name_exclude,
const char  name_replace,
const unsigned int  value_include,
const unsigned int  value_exclude,
const char  value_replace 
)

◆ setenv_str_i()

void setenv_str_i ( struct env_set es,
const char *  name,
const char *  value,
const int  i 
)

Definition at line 404 of file env_set.c.

References es, gc_free(), gc_new(), setenv_format_indexed_name(), and setenv_str().

Referenced by setenv_connection_entry().

◆ setenv_str_incr()

void setenv_str_incr ( struct env_set es,
const char *  name,
const char *  value 
)

Store the supplied name value pair in the env_set.

If the variable with the supplied name already exists, append _N to the name, starting at N=1.

Definition at line 305 of file env_set.c.

References ASSERT, D_TLS_DEBUG_MED, env_set_get(), es, gc_malloc(), msg, and setenv_str().

Referenced by x509_setenv().

◆ setenv_str_safe()

void setenv_str_safe ( struct env_set es,
const char *  name,
const char *  value 
)

Definition at line 289 of file env_set.c.

References BSTR, buf_printf(), buf_set_write(), es, M_WARN, msg, and setenv_str().

Referenced by add_option().