]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix v3 plugins to support returning values back to OpenVPN.
authorKenneth Rose <ken+openvpn@surfeasy.com>
Mon, 1 Oct 2012 18:47:02 +0000 (14:47 -0400)
committerDavid Sommerseth <davids@redhat.com>
Mon, 15 Oct 2012 16:55:27 +0000 (18:55 +0200)
There's a small implementation issue with the V3 plugin API
implementation.  V3 plugins cannot return data back to OpenVPN using
openvpn_plugin_args_func_return since
openvpn_plugin_args_func_return.return_list is always NULL.

This patch makes the behaviour identical to the V2 API (return_list is
again a proper out parameter).

Signed-off-by: Kenneth Rose <ken+openvpn@surfeasy.com>
Acked-by: David Sommerseth <davids@redhat.com>
Message-Id: CAAUdgR8VZjaO0-thFPVoQkbZ1DNG3rx+gtYYLqyfocp3yns==w@mail.gmail.com
URL: http://article.gmane.org/gmane.network.openvpn.devel/7083
Signed-off-by: David Sommerseth <davids@redhat.com>
(cherry picked from commit e92255f58bcfaec157c3ef59e01c40cbd04b1d43)

src/openvpn/plugin.c

index d785daec46b9cd7cf29f79588940c60b91580e28..944d833b4b43511116f43088bd1c3d0baaed7920 100644 (file)
@@ -376,10 +376,10 @@ plugin_open_item (struct plugin *p,
         struct openvpn_plugin_args_open_return retargs;
 
         CLEAR(retargs);
+        retargs.return_list = retlist;
         if ((*p->open3)(OPENVPN_PLUGINv3_STRUCTVER, &args, &retargs) == OPENVPN_PLUGIN_FUNC_SUCCESS) {
           p->plugin_type_mask = retargs.type_mask;
           p->plugin_handle = retargs.handle;
-          retlist = retargs.return_list;
         } else {
           p->plugin_handle = NULL;
         }
@@ -458,8 +458,8 @@ plugin_call_item (const struct plugin *p,
         struct openvpn_plugin_args_func_return retargs;
 
         CLEAR(retargs);
+        retargs.return_list = retlist;
         status = (*p->func3)(OPENVPN_PLUGINv3_STRUCTVER, &args, &retargs);
-        retlist = retargs.return_list;
       } else if (p->func2)
        status = (*p->func2)(p->plugin_handle, type, (const char **)a.argv, envp, per_client_context, retlist);
       else if (p->func1)