Skip to contentSkip to conversation

Remove erroneous limitation on max number of args for --plugin

PATCH In review Gert Doering 2 participants 3 messages May 18, 2017 – May 20, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove erroneous limitation on max number of args for --plugin

Commit 3d6a4cded2 introduced a maximum limit of possible arguments for most options, to error out on config lines with too-many args.

Commit 82acf21634 extended the limit for "--plugin" to accept "one mandatory, one optional" argument.

Both are wrong - "--plugin" can accept an arbitrary number of arguments, but this is not directly obvious from options.c, one needs to check plugins.c / plugin_option_list_add() and misc.c / make_extended_arg_array() to see that.

Thus, remove the max limit for "--plugin" completely.

(Reported by SviMik on IRC)

---
 src/openvpn/options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/options.c +1 -1
index f38abad..452087a 100644
@@ -5152,7 +5152,7 @@ add_option(struct options *options,
     }
 #endif /* ifdef ENABLE_MANAGEMENT */
 #ifdef ENABLE_PLUGIN
-    else if (streq(p[0], "plugin") && p[1] && !p[3])
+    else if (streq(p[0], "plugin") && p[1])
     {
         VERIFY_PERMISSION(OPT_P_PLUGIN);
         if (!options->plugin_list)
Signature · 1 line
2.10.2
#1 lore raw

Hi,

Quoted 26 lines · Gert Doering

Commit 3d6a4cded2 introduced a maximum limit of possible arguments for most options, to error out on config lines with too-many args.

Commit 82acf21634 extended the limit for "--plugin" to accept "one mandatory, one optional" argument.

Both are wrong - "--plugin" can accept an arbitrary number of arguments, but this is not directly obvious from options.c, one needs to check plugins.c / plugin_option_list_add() and misc.c / make_extended_arg_array() to see that.

Thus, remove the max limit for "--plugin" completely.

(Reported by SviMik on IRC)

---
 src/openvpn/options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/options.c +0 -0
index f38abad..452087a 100644

src/openvpn/options.c add_option(struct options *options, · line 5158

Quoted 8 lines
src/openvpn/options.c +1 -1
@@ -5152,7 +5152,7 @@ add_option(struct options *options,
     }
 #endif /* ifdef ENABLE_MANAGEMENT */
 #ifdef ENABLE_PLUGIN
-    else if (streq(p[0], "plugin") && p[1] && !p[3])
+    else if (streq(p[0], "plugin") && p[1])
     {
         VERIFY_PERMISSION(OPT_P_PLUGIN);
         if (!options->plugin_list)

ACK

-Steffan

#2 lore raw
In reply to Gert Doering

Patch has been applied to the master and release/2.4 branch.

commit 3f181eaa324892845e0857d80c154512d9e8c59c (master) commit a4d200a34617388e45837b7a9a8ccb25a7b1aa99 (release/2.4)

Author: Gert Doering
Date:   Thu May 18 21:13:11 2017 +0200
     Remove erroneous limitation on max number of args for --plugin

     Signed-off-by: Gert Doering <[email protected]...>
     Acked-by: Steffan Karger <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg14678.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering