Browse code

Fix sequence of events for async plugin v1 handler.

If multi_client_connect_call_plugin_v1() goes to "deferred mode",
*and* there is no OPENVPN_CLIENT_CONNECT_DEFER handler, we
would read the "client specific options" file after every
(succeeded-because-not-present) call to plugin_call().

Move this to "after we have checked the deferred-cc file, and we
know for sure that we have CC_RET_SUCCEEDED".

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20200727183436.6625-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20613.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Gert Doering authored on 2020/07/28 03:34:35
Showing 1 changed files
... ...
@@ -2065,8 +2065,6 @@ multi_client_connect_call_plugin_v1(struct multi_context *m,
2065 2065
                                    &argv, NULL, mi->context.c2.es);
2066 2066
         if (plug_ret == OPENVPN_PLUGIN_FUNC_SUCCESS)
2067 2067
         {
2068
-            multi_client_connect_post(m, mi, ccs->config_file,
2069
-                                      option_types_found);
2070 2068
             ret = CC_RET_SUCCEEDED;
2071 2069
         }
2072 2070
         else if (plug_ret == OPENVPN_PLUGIN_FUNC_DEFERRED)
... ...
@@ -2100,6 +2098,13 @@ multi_client_connect_call_plugin_v1(struct multi_context *m,
2100 2100
         {
2101 2101
             ret = CC_RET_DEFERRED;
2102 2102
         }
2103
+
2104
+        /* if we still think we have succeeded, do postprocessing */
2105
+        if (ret == CC_RET_SUCCEEDED)
2106
+        {
2107
+            multi_client_connect_post(m, mi, ccs->config_file,
2108
+                                      option_types_found);
2109
+        }
2103 2110
 cleanup:
2104 2111
         argv_free(&argv);
2105 2112