aboutsummaryrefslogtreecommitdiff
path: root/plugin.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-11-09 07:30:14 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-11-09 07:30:14 +0000
commiteadf16a660310162bcc3cadda26f44acd3b83077 (patch)
tree7d384ed3923bb28c553d57bf9ca760f5aba51703 /plugin.c
parentAdded ENABLE_INLINE_FILES feature. (diff)
downloadopenvpn-eadf16a660310162bcc3cadda26f44acd3b83077.tar.xz
Removed annoying 'i' variable from add_option.
Allow plugin and push directives to have multiple parameters specified instead of only 1 quoted parameter. Allow plugin and push directives to have multi-line parameter lists, such as: <plugin> my-plugin.so parm1 parm2 </plugin> git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@785 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'plugin.c')
-rw-r--r--plugin.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/plugin.c b/plugin.c
index 26d1d1b..190b2c0 100644
--- a/plugin.c
+++ b/plugin.c
@@ -127,13 +127,14 @@ plugin_option_list_new (struct gc_arena *gc)
}
bool
-plugin_option_list_add (struct plugin_option_list *list, const char *so_pathname, const char *args)
+plugin_option_list_add (struct plugin_option_list *list, char **p, struct gc_arena *gc)
{
if (list->n < MAX_PLUGINS)
{
struct plugin_option *o = &list->plugins[list->n++];
- o->so_pathname = so_pathname;
- o->args = args;
+ o->argv = make_extended_arg_array (p, gc);
+ if (o->argv[0])
+ o->so_pathname = o->argv[0];
return true;
}
else
@@ -145,11 +146,15 @@ void
plugin_option_list_print (const struct plugin_option_list *list, int msglevel)
{
int i;
+ struct gc_arena gc = gc_new ();
+
for (i = 0; i < list->n; ++i)
{
const struct plugin_option *o = &list->plugins[i];
- msg (msglevel, " plugin[%d] %s '%s'", i, o->so_pathname, o->args);
+ msg (msglevel, " plugin[%d] %s '%s'", i, o->so_pathname, print_argv (o->argv, &gc, PA_BRACKET));
}
+
+ gc_free (&gc);
}
#endif
@@ -256,24 +261,23 @@ plugin_open_item (struct plugin *p,
if (!p->plugin_handle && init_point == p->requested_initialization_point)
{
struct gc_arena gc = gc_new ();
- const char **argv = make_arg_array (o->so_pathname, o->args, &gc);
dmsg (D_PLUGIN_DEBUG, "PLUGIN_INIT: PRE");
- plugin_show_args_env (D_PLUGIN_DEBUG, argv, envp);
+ plugin_show_args_env (D_PLUGIN_DEBUG, o->argv, envp);
/*
* Call the plugin initialization
*/
if (p->open2)
- p->plugin_handle = (*p->open2)(&p->plugin_type_mask, argv, envp, retlist);
+ 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, argv, envp);
+ p->plugin_handle = (*p->open1)(&p->plugin_type_mask, o->argv, envp);
else
ASSERT (0);
msg (D_PLUGIN, "PLUGIN_INIT: POST %s '%s' intercepted=%s %s",
p->so_pathname,
- o->args ? o->args : "[NULL]",
+ print_argv (o->argv, &gc, PA_BRACKET),
plugin_mask_string (p->plugin_type_mask, &gc),
(retlist && *retlist) ? "[RETLIST]" : "");