31#define PLUGIN_NAME "base64.c"
58get_env(
const char *name,
const char *envp[])
63 const int namelen = strlen(name);
64 for (i = 0; envp[i]; ++i)
66 if (!strncmp(envp[i], name, namelen))
68 const char *cp = envp[i] + namelen;
58get_env(
const char *name,
const char *envp[]) {
…}
110 printf(
"base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");
120 ret->
handle = calloc(1, 1);
169 const char *clcert_cn =
get_env(
"X509_0_CN", envp);
183 char buf2[256] = {0};
189 r = strcmp(clcert_cn, buf2);
#define OPENVPN_PLUGIN_CLIENT_CONNECT_V2
void * openvpn_plugin_handle_t
#define OPENVPN_PLUGIN_MASK(x)
int(* plugin_base64_encode_t)(const void *data, int size, char **str)
Export of openvpn_base64_encode() to be used inside plug-ins.
#define OPENVPN_PLUGIN_TLS_VERIFY
void(* plugin_log_t)(openvpn_plugin_log_flags_t flags, const char *plugin_name, const char *format,...) _ovpn_chk_fmt(3
#define OPENVPN_PLUGIN_FUNC_SUCCESS
void(*) typedef void(* plugin_vlog_t)(openvpn_plugin_log_flags_t flags, const char *plugin_name, const char *format, va_list arglist) _ovpn_chk_fmt(3
#define OPENVPN_PLUGINv3_STRUCTVER
Defines version of the v3 plugin argument structs.
#define OPENVPN_PLUGIN_FUNC_ERROR
int(* plugin_base64_decode_t)(const char *str, void *data, int size)
Export of openvpn_base64_decode() to be used inside plug-ins.
OPENVPN_EXPORT int openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
This function is called by OpenVPN each time the OpenVPN reaches a point where plug-in calls should h...
OPENVPN_EXPORT void openvpn_plugin_close_v1(openvpn_plugin_handle_t handle)
This cleans up the last part of the plug-in, allows it to shut down cleanly and release the plug-in g...
plugin_log_t ovpn_log
Pointer to the OpenVPN log function.
plugin_base64_decode_t ovpn_base64_decode
Pointer to the openvpn_base64_decode () function.
plugin_base64_encode_t ovpn_base64_encode
Pointer to the openvpn_base64_encode () function.
plugin_vlog_t ovpn_vlog
Pointer to the OpenVPN vlog function.
static const char * get_env(const char *name, const char *envp[])
Search the environment pointer for a specific env var name.
OPENVPN_EXPORT int openvpn_plugin_open_v3(const int v3structver, struct openvpn_plugin_args_open_in const *args, struct openvpn_plugin_args_open_return *ret)
This function is called when OpenVPN loads the plug-in.
Contains all state information for one tunnel.
Arguments used to transport variables to the plug-in.
const char *const ovpn_version_patch
const unsigned int ovpn_version_major
const char * ovpn_version
const unsigned int ovpn_version_minor
struct openvpn_plugin_callbacks * callbacks
Arguments used to transport variables from the plug-in back to the OpenVPN process.
openvpn_plugin_handle_t handle
plugin_vlog_t plugin_vlog
plugin_base64_encode_t plugin_base64_encode
plugin_base64_decode_t plugin_base64_decode