Go to the documentation of this file.
54 get_env(
const char *name,
const char *envp[])
59 const int namelen = strlen(name);
60 for (i = 0; envp[i]; ++i)
62 if (!strncmp(envp[i], name, namelen))
64 const char *cp = envp[i] + namelen;
85 printf(
"log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");
91 printf(
"This plug-in can only be used against OpenVPN with OpenSSL\n");
96 printf(
"log_v3: OpenVPN %s (Major: %i, Minor: %i, Patch: %s)\n",
118 printf(
"PLUGIN: allocating memory for context failed\n");
133 show(
const int type,
const char *
argv[],
const char *envp[])
139 printf(
"OPENVPN_PLUGIN_UP\n");
143 printf(
"OPENVPN_PLUGIN_DOWN\n");
147 printf(
"OPENVPN_PLUGIN_ROUTE_UP\n");
151 printf(
"OPENVPN_PLUGIN_IPCHANGE\n");
155 printf(
"OPENVPN_PLUGIN_TLS_VERIFY\n");
159 printf(
"OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY\n");
163 printf(
"OPENVPN_PLUGIN_CLIENT_CONNECT_V2\n");
167 printf(
"OPENVPN_PLUGIN_CLIENT_DISCONNECT\n");
171 printf(
"OPENVPN_PLUGIN_LEARN_ADDRESS\n");
175 printf(
"OPENVPN_PLUGIN_TLS_FINAL\n");
179 printf(
"OPENVPN_PLUGIN_?\n");
184 for (i = 0;
argv[i] != NULL; ++i)
186 printf(
"%d '%s'\n", (
int)i,
argv[i]);
190 for (i = 0; envp[i] != NULL; ++i)
192 printf(
"%d '%s'\n", (
int)i, envp[i]);
203 X509_NAME *x509_name;
204 X509_NAME_ENTRY *ent;
206 unsigned char *buf = NULL;
208 x509_name = X509_get_subject_name(x509crt);
209 n = X509_NAME_entry_count(x509_name);
210 for (i = 0; i < n; ++i)
212 ent = X509_NAME_get_entry(x509_name, i);
217 fn = X509_NAME_ENTRY_get_object(ent);
222 val = X509_NAME_ENTRY_get_data(ent);
227 fn_nid = OBJ_obj2nid(fn);
228 if (fn_nid == NID_undef)
232 objbuf = OBJ_nid2sn(fn_nid);
237 if (ASN1_STRING_to_UTF8(&buf, val) < 0)
242 printf(
"X509 %s: %s\n", objbuf, (
char *)buf);
256 printf(
"\nopenvpn_plugin_func_v3() :::::>> ");
262 printf(
"---- X509 Subject information ----\n");
265 printf(
"----------------------------------\n");
#define OPENVPN_PLUGIN_CLIENT_CONNECT_V2
#define OPENVPN_PLUGIN_LEARN_ADDRESS
#define OPENVPN_PLUGIN_UP
#define OPENVPN_PLUGIN_DOWN
openvpn_plugin_handle_t handle
Arguments used to transport variables to the plug-in.
Contains all state information for one tunnel.
#define OPENVPN_PLUGINv3_STRUCTVER
Defines version of the v3 plugin argument structs.
#define OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY
void show(const int type, const char *argv[], const char *envp[])
#define OPENVPN_PLUGIN_MASK(x)
const char *const ovpn_version_patch
const unsigned int ovpn_version_major
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)
#define OPENVPN_PLUGIN_FUNC_ERROR
openvpn_x509_cert_t * current_cert
#define OPENVPN_PLUGIN_IPCHANGE
#define OPENVPN_PLUGIN_ROUTE_UP
static const char * get_env(const char *name, const char *envp[])
#define OPENVPN_PLUGIN_TLS_VERIFY
const char * ovpn_version
static void x509_print_info(X509 *x509crt)
Arguments used to transport variables to and from the plug-in.
OPENVPN_EXPORT int openvpn_plugin_func_v3(const int version, struct openvpn_plugin_args_func_in const *args, struct openvpn_plugin_args_func_return *retptr)
OPENVPN_EXPORT void openvpn_plugin_close_v1(openvpn_plugin_handle_t handle)
#define OPENVPN_PLUGIN_CLIENT_DISCONNECT
Arguments used to transport variables from the plug-in back to the OpenVPN process.
Arguments used to transport variables to and from the plug-in.
openvpn_plugin_handle_t handle
#define OPENVPN_PLUGIN_FUNC_SUCCESS
#define OPENVPN_PLUGIN_TLS_FINAL
void * openvpn_plugin_handle_t
const unsigned int ovpn_version_minor