OpenVPN
|
#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"
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_list * | plugin_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_list * | plugin_list_inherit (const struct plugin_list *src) |
static struct plugin_common * | plugin_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_list * | plugin_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_list * | openvpn_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_common * | static_plugin_common = NULL |
static struct openvpn_plugin_callbacks | callbacks |
#define _OPENVPN_PATCH_LEVEL OPENVPN_VERSION_PATCH |
#define PLUGIN_SYM | ( | var, | |
name, | |||
flags | |||
) | dll_resolve_symbol(p->module, (void *)&p->var, name, p->so_pathname, flags) |
|
static |
Definition at line 219 of file plugin.c.
References M_FATAL, msg, and PLUGIN_SYMBOL_REQUIRED.
|
static |
Definition at line 986 of file plugin.c.
References openvpn_plugin_string_list::name, and openvpn_plugin_string_list::next.
Referenced by plugin_return_get_column().
|
static |
Definition at line 974 of file plugin.c.
References openvpn_plugin_string_list::next, and openvpn_plugin_string_list_item_free().
Referenced by plugin_return_free().
|
static |
Definition at line 962 of file plugin.c.
References openvpn_plugin_string_list::name, string_clear(), and openvpn_plugin_string_list::value.
Referenced by openvpn_plugin_string_list_free().
void plugin_abort | ( | void | ) |
Definition at line 916 of file plugin.c.
References plugin_common::n, plugin_abort_item(), plugin_common::plugins, and static_plugin_common.
Referenced by openvpn_exit().
|
static |
Definition at line 644 of file plugin.c.
References plugin::abort, and plugin::plugin_handle.
Referenced by plugin_abort().
|
static |
Definition at line 535 of file plugin.c.
References argv::argv, argv_free(), argv_insert_head(), ASSERT, CLEAR, openvpn_plugin_args_func_in::current_cert, D_PLUGIN, D_PLUGIN_DEBUG, dmsg, openvpn_plugin_args_func_in::envp, plugin::func1, plugin::func2, plugin::func3, gc_free(), gc_new(), M_WARN, msg, OPENVPN_PLUGIN_FUNC_ERROR, OPENVPN_PLUGIN_FUNC_SUCCESS, OPENVPN_PLUGIN_MASK, OPENVPN_PLUGINv3_STRUCTVER, openvpn_plugin_args_func_in::per_client_context, plugin::plugin_handle, plugin_show_args_env(), plugin::plugin_type_mask, plugin_type_name(), openvpn_plugin_args_func_return::return_list, plugin::so_pathname, status, and openvpn_plugin_args_func_in::type.
Referenced by 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 | ||
) |
Definition at line 797 of file plugin.c.
References plugin_list::common, es, gc_free(), gc_new(), plugin_return::list, M_FATAL, make_env_array(), msg, plugin_return::n, OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY, OPENVPN_PLUGIN_FUNC_DEFERRED, OPENVPN_PLUGIN_FUNC_ERROR, OPENVPN_PLUGIN_FUNC_SUCCESS, plugin_list::per_client, plugin_per_client::per_client_context, plugin_call_item(), plugin_defined(), plugin_n(), plugin_return_init(), plugin_common::plugins, setenv_del(), and status.
Referenced by plugin_call(), and verify_cert_call_plugin().
|
static |
Definition at line 613 of file plugin.c.
References plugin::close, D_PLUGIN, plugin::initialized, M_WARN, plugin::module, msg, plugin::plugin_handle, and plugin::so_pathname.
Referenced by plugin_common_close().
|
static |
Definition at line 760 of file plugin.c.
References plugin_common::n, plugin_close_item(), plugin_common::plugins, and static_plugin_common.
Referenced by plugin_list_close().
|
static |
Definition at line 706 of file plugin.c.
References ALLOC_OBJ_CLEAR, plugin_option_list::n, plugin_common::n, plugin_init_item(), plugin_option_list::plugins, plugin_common::plugins, and static_plugin_common.
Referenced by plugin_list_init().
|
static |
Definition at line 725 of file plugin.c.
References es, gc_free(), gc_new(), plugin_return::list, gc_arena::list, make_env_array(), plugin_common::n, plugin_return::n, plugin_open_item(), plugin_return_init(), and plugin_common::plugins.
Referenced by plugin_list_open().
bool plugin_defined | ( | const struct plugin_list * | pl, |
const int | type | ||
) |
Definition at line 932 of file plugin.c.
References plugin_list::common, plugin_common::n, OPENVPN_PLUGIN_MASK, plugin::plugin_type_mask, and plugin_common::plugins.
Referenced by do_route(), key_method_2_read(), learn_address_script(), link_socket_connection_initiated(), multi_client_connect_call_plugin_v1(), multi_client_connect_call_plugin_v2(), multi_client_disconnect_script(), plugin_call_ssl(), run_up_down(), tls_session_user_pass_enabled(), verify_cert_call_plugin(), and verify_user_pass().
|
static |
Definition at line 231 of file plugin.c.
References plugin::func1, plugin::func2, plugin::func3, gc_free(), gc_new(), plugin::initialization_point, plugin::initialized, M_ERR, M_FATAL, M_WARN, plugin::min_version_required, plugin::module, msg, plugin::open1, plugin::open2, plugin::open3, OPENVPN_PLUGIN_INIT_PRE_DAEMON, OPENVPN_PLUGIN_VERSION, platform_absolute_pathname(), plugin_in_trusted_dir(), plugin_supported_types(), PLUGIN_SYM, PLUGIN_SYMBOL_REQUIRED, plugin::plugin_type_mask, plugin::requested_initialization_point, plugin_option::so_pathname, plugin::so_pathname, and wide_string().
Referenced by plugin_common_init().
void plugin_list_close | ( | struct plugin_list * | pl | ) |
Definition at line 897 of file plugin.c.
References plugin_list::common, plugin_list::common_owned, plugin_list::per_client, plugin_common_close(), and plugin_per_client_destroy().
Referenced by do_close_plugins().
struct plugin_list* plugin_list_inherit | ( | const struct plugin_list * | src | ) |
Definition at line 695 of file plugin.c.
References ALLOC_OBJ_CLEAR, ASSERT, plugin_list::common, plugin_list::per_client, and plugin_per_client_init().
Referenced by do_inherit_plugins().
struct plugin_list* plugin_list_init | ( | const struct plugin_option_list * | list | ) |
Definition at line 776 of file plugin.c.
References ALLOC_OBJ_CLEAR, plugin_list::common, plugin_list::common_owned, and plugin_common_init().
Referenced by init_plugins().
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 | ||
) |
Definition at line 786 of file plugin.c.
References plugin_list::common, es, plugin_list::per_client, plugin_common_open(), and plugin_per_client_init().
Referenced by open_plugins().
|
static |
Definition at line 420 of file plugin.c.
References plugin_vlog().
|
static |
Definition at line 132 of file plugin.c.
References alloc_buf_gc(), BSTR, buf_printf(), OPENVPN_PLUGIN_MASK, OPENVPN_PLUGIN_N, and plugin_type_name().
Referenced by plugin_open_item().
|
static |
Definition at line 448 of file plugin.c.
References _OPENVPN_PATCH_LEVEL, plugin_option::argv, ASSERT, callbacks, CLEAR, D_PLUGIN, D_PLUGIN_DEBUG, dmsg, openvpn_plugin_args_open_in::envp, gc_free(), gc_new(), openvpn_plugin_args_open_return::handle, plugin::initialized, M_FATAL, msg, plugin::open1, plugin::open2, plugin::open3, OPENVPN_PLUGIN_FUNC_SUCCESS, OPENVPN_PLUGINv3_STRUCTVER, OPENVPN_VERSION_MAJOR, OPENVPN_VERSION_MINOR, PA_BRACKET, PACKAGE_VERSION, plugin::plugin_handle, plugin_mask_string(), plugin_show_args_env(), plugin_supported_types(), plugin::plugin_type_mask, print_argv(), plugin::requested_initialization_point, openvpn_plugin_args_open_return::return_list, plugin::so_pathname, SSLAPI, and openvpn_plugin_args_open_return::type_mask.
Referenced by plugin_common_open().
bool plugin_option_list_add | ( | struct plugin_option_list * | list, |
char ** | p, | ||
struct gc_arena * | gc | ||
) |
Definition at line 168 of file plugin.c.
References plugin_option::argv, make_extended_arg_array(), MAX_PLUGINS, plugin_option_list::n, plugin_option_list::plugins, and plugin_option::so_pathname.
Referenced by add_option().
struct plugin_option_list* plugin_option_list_new | ( | struct gc_arena * | gc | ) |
void plugin_option_list_print | ( | const struct plugin_option_list * | list, |
int | msglevel | ||
) |
Definition at line 189 of file plugin.c.
References plugin_option::argv, gc_free(), gc_new(), gc_arena::list, msg, PA_BRACKET, plugin_option_list::plugins, print_argv(), and plugin_option::so_pathname.
Referenced by show_settings().
|
static |
Definition at line 676 of file plugin.c.
References CLEAR, plugin::client_destructor, plugin_common::n, plugin_per_client::per_client_context, plugin::plugin_handle, and plugin_common::plugins.
Referenced by plugin_list_close().
|
static |
Definition at line 656 of file plugin.c.
References plugin::client_constructor, plugin_common::n, plugin_per_client::per_client_context, plugin::plugin_handle, plugin_common::plugins, and plugin::requested_initialization_point.
Referenced by plugin_list_inherit(), and plugin_list_open().
void plugin_return_free | ( | struct plugin_return * | pr | ) |
Definition at line 1015 of file plugin.c.
References plugin_return::list, plugin_return::n, and openvpn_plugin_string_list_free().
Referenced by multi_client_connect_call_plugin_v2(), and open_plugins().
void plugin_return_get_column | ( | const struct plugin_return * | src, |
struct plugin_return * | dest, | ||
const char * | colname | ||
) |
Definition at line 1000 of file plugin.c.
References plugin_return::list, plugin_return::n, and openvpn_plugin_string_list_find().
Referenced by multi_client_connect_post_plugin(), and open_plugins().
|
static |
Definition at line 67 of file plugin.c.
References check_debug_level(), and plugin_show_string_array().
Referenced by plugin_call_item(), and plugin_open_item().
|
static |
Definition at line 54 of file plugin.c.
References env_safe_to_print(), and msg.
Referenced by plugin_show_args_env().
|
inlinestatic |
Definition at line 154 of file plugin.c.
References OPENVPN_PLUGIN_N.
Referenced by plugin_init_item(), and plugin_open_item().
|
static |
Definition at line 77 of file plugin.c.
References OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY, OPENVPN_PLUGIN_CLIENT_CONNECT, OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER, OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER_V2, OPENVPN_PLUGIN_CLIENT_CONNECT_V2, OPENVPN_PLUGIN_CLIENT_DISCONNECT, OPENVPN_PLUGIN_DOWN, OPENVPN_PLUGIN_IPCHANGE, OPENVPN_PLUGIN_LEARN_ADDRESS, OPENVPN_PLUGIN_ROUTE_PREDOWN, OPENVPN_PLUGIN_ROUTE_UP, OPENVPN_PLUGIN_TLS_FINAL, OPENVPN_PLUGIN_TLS_VERIFY, and OPENVPN_PLUGIN_UP.
Referenced by plugin_call_item(), and plugin_mask_string().
|
static |
Definition at line 361 of file plugin.c.
References D_PLUGIN_DEBUG, ERR_BUF_SIZE, gc_free(), gc_init(), gc_malloc(), M_ERRNO, M_INFO, M_NOIPREFIX, M_NOMUTE, M_NONFATAL, M_WARN, msg, msg_test(), PLOG_DEBUG, PLOG_ERR, PLOG_ERRNO, PLOG_NOMUTE, PLOG_NOTE, PLOG_WARN, and x_msg_va().
Referenced by plugin_log().
|
static |
Definition at line 428 of file plugin.c.
Referenced by plugin_open_item().
|
static |
Definition at line 51 of file plugin.c.
Referenced by plugin_abort(), plugin_common_close(), and plugin_common_init().