Let OpenVPN call the openvpn_plugin_open_v3() and
openvpn_plugin_func_v3() plug-in functions if they exist in the plug-in.

Signed-off-by: David Sommerseth <d...@users.sourceforge.net>
---
 plugin.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/plugin.c b/plugin.c
index dcc18fb..7d02c8b 100644
--- a/plugin.c
+++ b/plugin.c
@@ -298,7 +298,13 @@ plugin_open_item (struct plugin *p,
       /*
        * Call the plugin initialization
        */
-      if (p->open2)
+      if (p->open3) {
+        struct openvpn_plugin_args_open args = { .version   = 
OPENVPN_PLUGIN_ARGS_APIVER,
+                                                 .type_mask = 
&p->plugin_type_mask,
+                                                 .argv      = o->argv,
+                                                 .envp      = envp };
+        p->plugin_handle = (*p->open3)(&args, retlist);
+      } else if (p->open2)
        p->plugin_handle = (*p->open2)(&p->plugin_type_mask, o->argv, envp, 
retlist);
       else if (p->open1)
        p->plugin_handle = (*p->open1)(&p->plugin_type_mask, o->argv, envp);
@@ -350,7 +356,14 @@ plugin_call_item (const struct plugin *p,
       /*
        * Call the plugin work function
        */
-      if (p->func2)
+      if (p->func3) {
+        struct openvpn_plugin_args_func args = { .version = 
OPENVPN_PLUGIN_ARGS_APIVER,
+                                                 .type    = type,
+                                                 .argv    = (const char **) 
a.argv,
+                                                 .envp    = envp,
+                                                 .per_client_context = 
per_client_context };
+        status = (*p->func3)(&args, p->plugin_handle, retlist);
+      } else if (p->func2)
        status = (*p->func2)(p->plugin_handle, type, (const char **)a.argv, 
envp, per_client_context, retlist);
       else if (p->func1)
        status = (*p->func1)(p->plugin_handle, type, (const char **)a.argv, 
envp);
-- 
1.7.2.2


Reply via email to