Go to the documentation of this file.
55 #include <sys/types.h>
86 snprintf(logid, 128,
"%s",
MODULE);
90 va_start(arglist, fmt);
107 #define OPENVPN_PLUGIN_VERSION_MIN 3
108 #define OPENVPN_PLUGIN_STRUCTVER_MIN 5
128 const int namelen = strlen(name);
129 for (i = 0; envp[i]; ++i)
131 if (!strncmp(envp[i], name, namelen))
133 const char *cp = envp[i] + namelen;
186 fprintf(stderr,
"%s: this plugin is incompatible with the running version of OpenVPN\n",
MODULE);
206 if ((args->
argv[4]) && !args->
argv[5])
219 if (
context->test_deferred_auth > 0)
247 "expect_user=%s, received_user=%s, expect_passw=%s, received_passw=%s",
259 "User/Password auth result: FAIL");
265 "User/Password auth result: PASS");
276 const char *
argv[],
const char *envp[])
282 if (!
context->test_deferred_auth)
290 const char *auth_control_file =
get_env(
"auth_control_file", envp);
294 if (!auth_control_file)
313 waitpid(p1, NULL, 0);
338 context->test_deferred_auth*1000);
339 usleep(
context->test_deferred_auth*1000);
342 int fd = open(auth_control_file, O_WRONLY);
346 "open('%s') failed", auth_control_file);
350 char result[2] =
"0\0";
356 if (
write(fd, result, 1) != 1)
373 fprintf(stderr,
"%s: this plugin is incompatible with the running version of OpenVPN\n",
MODULE);
377 const char **envp = args->
envp;
405 free(per_client_context);
openvpn_plugin_handle_t handle
OPENVPN_EXPORT void openvpn_plugin_client_destructor_v1(openvpn_plugin_handle_t handle, void *per_client_context)
Arguments used to transport variables to the plug-in.
Contains all state information for one tunnel.
#define OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY
#define OPENVPN_PLUGIN_STRUCTVER_MIN
static void plog(const struct plugin_context *ctx, int flags, char *fmt,...)
#define OPENVPN_PLUGIN_MASK(x)
OPENVPN_EXPORT void * openvpn_plugin_client_constructor_v1(openvpn_plugin_handle_t handle)
static const char * np(const char *str)
#define OPENVPN_PLUGIN_FUNC_ERROR
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_VERSION_MIN
static bool do_auth_user_pass(struct plugin_context *context, const char *username, const char *password)
static int atoi_null0(const char *str)
#define OPENVPN_PLUGIN_FUNC_DEFERRED
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
static const char * get_env(const char *name, const char *envp[])
void * per_client_context
static int auth_user_pass_verify(struct plugin_context *context, struct plugin_per_client_context *pcc, const char *argv[], const char *envp[])
plugin_vlog_t plugin_vlog
Arguments used to transport variables to and from the plug-in.
OPENVPN_EXPORT int openvpn_plugin_func_v3(const int v3structver, struct openvpn_plugin_args_func_in const *args, struct openvpn_plugin_args_func_return *ret)
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
static plugin_vlog_t _plugin_vlog_func
void * openvpn_plugin_handle_t
OPENVPN_EXPORT void openvpn_plugin_close_v1(openvpn_plugin_handle_t handle)
struct openvpn_plugin_callbacks * callbacks
OPENVPN_EXPORT int openvpn_plugin_min_version_required_v1()