OpenVPN
Macros | Functions | Variables
plugin.c File Reference
#include "syshead.h"
#include "buffer.h"
#include "error.h"
#include "misc.h"
#include "plugin.h"
#include "ssl_backend.h"
#include "base64.h"
#include "win32.h"
#include "memdbg.h"
Include dependency graph for plugin.c:

Go to the source code of this file.

Macros

#define PLUGIN_SYMBOL_REQUIRED   (1<<0)
 
#define PLUGIN_SYM(var, name, flags)   dll_resolve_symbol(p->module, (void *)&p->var, name, p->so_pathname, flags)
 
#define _OPENVPN_PATCH_LEVEL   OPENVPN_VERSION_PATCH
 

Functions

static void plugin_show_string_array (int msglevel, const char *name, const char *array[])
 
static void plugin_show_args_env (int msglevel, const char *argv[], const char *envp[])
 
static const char * plugin_type_name (const int type)
 
static const char * plugin_mask_string (const unsigned int type_mask, struct gc_arena *gc)
 
static unsigned int plugin_supported_types (void)
 
struct plugin_option_listplugin_option_list_new (struct gc_arena *gc)
 
bool plugin_option_list_add (struct plugin_option_list *list, char **p, struct gc_arena *gc)
 
void plugin_option_list_print (const struct plugin_option_list *list, int msglevel)
 
static void dll_resolve_symbol (HMODULE module, void **dest, const char *symbol, const char *plugin_name, const unsigned int flags)
 
static void plugin_init_item (struct plugin *p, const struct plugin_option *o)
 
static void plugin_vlog (openvpn_plugin_log_flags_t flags, const char *name, const char *format, va_list arglist)
 
static void plugin_log (openvpn_plugin_log_flags_t flags, const char *name, const char *format,...)
 
static void plugin_open_item (struct plugin *p, const struct plugin_option *o, struct openvpn_plugin_string_list **retlist, const char **envp, const int init_point)
 
static int plugin_call_item (const struct plugin *p, void *per_client_context, const int type, const struct argv *av, struct openvpn_plugin_string_list **retlist, const char **envp, int certdepth, openvpn_x509_cert_t *current_cert)
 
static void plugin_close_item (struct plugin *p)
 
static void plugin_abort_item (const struct plugin *p)
 
static void plugin_per_client_init (const struct plugin_common *pc, struct plugin_per_client *cli, const int init_point)
 
static void plugin_per_client_destroy (const struct plugin_common *pc, struct plugin_per_client *cli)
 
struct plugin_listplugin_list_inherit (const struct plugin_list *src)
 
static struct plugin_commonplugin_common_init (const struct plugin_option_list *list)
 
static void plugin_common_open (struct plugin_common *pc, const struct plugin_option_list *list, struct plugin_return *pr, const struct env_set *es, const int init_point)
 
static void plugin_common_close (struct plugin_common *pc)
 
struct plugin_listplugin_list_init (const struct plugin_option_list *list)
 
void plugin_list_open (struct plugin_list *pl, const struct plugin_option_list *list, struct plugin_return *pr, const struct env_set *es, const int init_point)
 
int plugin_call_ssl (const struct plugin_list *pl, const int type, const struct argv *av, struct plugin_return *pr, struct env_set *es, int certdepth, openvpn_x509_cert_t *current_cert)
 
void plugin_list_close (struct plugin_list *pl)
 
void plugin_abort (void)
 
bool plugin_defined (const struct plugin_list *pl, const int type)
 
static void openvpn_plugin_string_list_item_free (struct openvpn_plugin_string_list *l)
 
static void openvpn_plugin_string_list_free (struct openvpn_plugin_string_list *l)
 
static struct openvpn_plugin_string_listopenvpn_plugin_string_list_find (struct openvpn_plugin_string_list *l, const char *name)
 
void plugin_return_get_column (const struct plugin_return *src, struct plugin_return *dest, const char *colname)
 
void plugin_return_free (struct plugin_return *pr)
 

Variables

static struct plugin_commonstatic_plugin_common = NULL
 
static struct openvpn_plugin_callbacks callbacks
 

Macro Definition Documentation

◆ _OPENVPN_PATCH_LEVEL

#define _OPENVPN_PATCH_LEVEL   OPENVPN_VERSION_PATCH

Definition at line 425 of file plugin.c.

Referenced by plugin_open_item().

◆ PLUGIN_SYM

#define PLUGIN_SYM (   var,
  name,
  flags 
)    dll_resolve_symbol(p->module, (void *)&p->var, name, p->so_pathname, flags)

Referenced by plugin_init_item().

◆ PLUGIN_SYMBOL_REQUIRED

#define PLUGIN_SYMBOL_REQUIRED   (1<<0)

Definition at line 50 of file plugin.c.

Referenced by dll_resolve_symbol(), plugin_init_item(), and plugin_option_list_print().

Function Documentation

◆ dll_resolve_symbol()

static void dll_resolve_symbol ( HMODULE  module,
void **  dest,
const char *  symbol,
const char *  plugin_name,
const unsigned int  flags 
)
static

Definition at line 214 of file plugin.c.

References M_FATAL, msg, and PLUGIN_SYMBOL_REQUIRED.

◆ openvpn_plugin_string_list_find()

static struct openvpn_plugin_string_list* openvpn_plugin_string_list_find ( struct openvpn_plugin_string_list l,
const char *  name 
)
static

◆ openvpn_plugin_string_list_free()

static void openvpn_plugin_string_list_free ( struct openvpn_plugin_string_list l)
static

◆ openvpn_plugin_string_list_item_free()

static void openvpn_plugin_string_list_item_free ( struct openvpn_plugin_string_list l)
static

◆ plugin_abort()

void plugin_abort ( void  )

◆ plugin_abort_item()

static void plugin_abort_item ( const struct plugin p)
static

Definition at line 627 of file plugin.c.

References plugin::abort, and plugin::plugin_handle.

Referenced by plugin_abort().

◆ plugin_call_item()

static int plugin_call_item ( const struct plugin p,
void *  per_client_context,
const int  type,
const struct argv av,
struct openvpn_plugin_string_list **  retlist,
const char **  envp,
int  certdepth,
openvpn_x509_cert_t current_cert 
)
static

◆ plugin_call_ssl()

int plugin_call_ssl ( const struct plugin_list pl,
const int  type,
const struct argv av,
struct plugin_return pr,
struct env_set es,
int  certdepth,
openvpn_x509_cert_t current_cert 
)

◆ plugin_close_item()

static void plugin_close_item ( struct plugin p)
static

◆ plugin_common_close()

static void plugin_common_close ( struct plugin_common pc)
static

Definition at line 743 of file plugin.c.

References free, plugin_common::n, plugin_close_item(), and plugin_common::plugins.

Referenced by plugin_list_close().

◆ plugin_common_init()

static struct plugin_common* plugin_common_init ( const struct plugin_option_list list)
static

◆ plugin_common_open()

static void plugin_common_open ( struct plugin_common pc,
const struct plugin_option_list list,
struct plugin_return pr,
const struct env_set es,
const int  init_point 
)
static

◆ plugin_defined()

bool plugin_defined ( const struct plugin_list pl,
const int  type 
)

◆ plugin_init_item()

static void plugin_init_item ( struct plugin p,
const struct plugin_option o 
)
static

◆ plugin_list_close()

void plugin_list_close ( struct plugin_list pl)

◆ plugin_list_inherit()

struct plugin_list* plugin_list_inherit ( const struct plugin_list src)

◆ plugin_list_init()

struct plugin_list* plugin_list_init ( const struct plugin_option_list list)

Definition at line 759 of file plugin.c.

References ALLOC_OBJ_CLEAR, plugin_list::common, plugin_list::common_owned, and plugin_common_init().

Referenced by init_plugins().

◆ plugin_list_open()

void plugin_list_open ( struct plugin_list pl,
const struct plugin_option_list list,
struct plugin_return pr,
const struct env_set es,
const int  init_point 
)

◆ plugin_log()

static void plugin_log ( openvpn_plugin_log_flags_t  flags,
const char *  name,
const char *  format,
  ... 
)
static

Definition at line 403 of file plugin.c.

References plugin_vlog().

◆ plugin_mask_string()

static const char* plugin_mask_string ( const unsigned int  type_mask,
struct gc_arena gc 
)
static

◆ plugin_open_item()

static void plugin_open_item ( struct plugin p,
const struct plugin_option o,
struct openvpn_plugin_string_list **  retlist,
const char **  envp,
const int  init_point 
)
static

◆ plugin_option_list_add()

bool plugin_option_list_add ( struct plugin_option_list list,
char **  p,
struct gc_arena gc 
)

◆ plugin_option_list_new()

struct plugin_option_list* plugin_option_list_new ( struct gc_arena gc)

Definition at line 156 of file plugin.c.

References ALLOC_OBJ_CLEAR_GC.

Referenced by add_option().

◆ plugin_option_list_print()

void plugin_option_list_print ( const struct plugin_option_list list,
int  msglevel 
)

◆ plugin_per_client_destroy()

static void plugin_per_client_destroy ( const struct plugin_common pc,
struct plugin_per_client cli 
)
static

◆ plugin_per_client_init()

static void plugin_per_client_init ( const struct plugin_common pc,
struct plugin_per_client cli,
const int  init_point 
)
static

◆ plugin_return_free()

void plugin_return_free ( struct plugin_return pr)

◆ plugin_return_get_column()

void plugin_return_get_column ( const struct plugin_return src,
struct plugin_return dest,
const char *  colname 
)

◆ plugin_show_args_env()

static void plugin_show_args_env ( int  msglevel,
const char *  argv[],
const char *  envp[] 
)
static

Definition at line 69 of file plugin.c.

References check_debug_level(), and plugin_show_string_array().

Referenced by plugin_call_item(), and plugin_open_item().

◆ plugin_show_string_array()

static void plugin_show_string_array ( int  msglevel,
const char *  name,
const char *  array[] 
)
static

Definition at line 56 of file plugin.c.

References env_safe_to_print(), and msg.

Referenced by plugin_show_args_env().

◆ plugin_supported_types()

static unsigned int plugin_supported_types ( void  )
inlinestatic

Definition at line 150 of file plugin.c.

References OPENVPN_PLUGIN_N.

Referenced by plugin_init_item(), and plugin_open_item().

◆ plugin_type_name()

static const char* plugin_type_name ( const int  type)
static

◆ plugin_vlog()

static void plugin_vlog ( openvpn_plugin_log_flags_t  flags,
const char *  name,
const char *  format,
va_list  arglist 
)
static

Variable Documentation

◆ callbacks

struct openvpn_plugin_callbacks callbacks
static
Initial value:
= {
}
static void secure_memzero(void *data, size_t len)
Securely zeroise memory.
Definition: buffer.h:401
static void plugin_log(openvpn_plugin_log_flags_t flags, const char *name, const char *format,...)
Definition: plugin.c:403
static void plugin_vlog(openvpn_plugin_log_flags_t flags, const char *name, const char *format, va_list arglist)
Definition: plugin.c:344
int openvpn_base64_decode(const char *str, void *data, int size)
Definition: base64.c:160
int openvpn_base64_encode(const void *data, int size, char **str)
Definition: base64.c:54

Definition at line 411 of file plugin.c.

Referenced by plugin_open_item().

◆ static_plugin_common

struct plugin_common* static_plugin_common = NULL
static

Definition at line 53 of file plugin.c.

Referenced by plugin_abort().