From 1876ccd012e9e2ca6f8e1cd9e7e9bb4bf24ccecb Mon Sep 17 00:00:00 2001 From: Adriaan de Jong Date: Thu, 7 Jul 2011 09:21:03 +0200 Subject: Fixes for the plugin system: - Removed the dependency on an SSL library for USE_SSL when creating non-SSL plugins - Fixed example plugin code to include USE_SSL when needed Signed-off-by: Adriaan de Jong Acked-by: James Yonan Signed-off-by: David Sommerseth --- plugin.c | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'plugin.c') diff --git a/plugin.c b/plugin.c index 6cbf6a0..737a868 100644 --- a/plugin.c +++ b/plugin.c @@ -345,9 +345,12 @@ plugin_call_item (const struct plugin *p, const int type, const struct argv *av, struct openvpn_plugin_string_list **retlist, - const char **envp, - int certdepth, - x509_cert_t *current_cert) + const char **envp +#ifdef USE_SSL + , int certdepth, + x509_cert_t *current_cert +#endif + ) { int status = OPENVPN_PLUGIN_FUNC_SUCCESS; @@ -372,8 +375,15 @@ plugin_call_item (const struct plugin *p, (const char ** const) envp, p->plugin_handle, per_client_context, - (current_cert ? certdepth : -1), - current_cert }; +#ifdef USE_SSL + (current_cert ? certdepth : -1), + current_cert +#else + -1, + NULL +#endif + }; + struct openvpn_plugin_args_func_return retargs; CLEAR(retargs); @@ -570,13 +580,16 @@ plugin_list_open (struct plugin_list *pl, } int -plugin_call (const struct plugin_list *pl, +plugin_call_ssl (const struct plugin_list *pl, const int type, const struct argv *av, struct plugin_return *pr, - struct env_set *es, - int certdepth, - x509_cert_t *current_cert) + struct env_set *es +#ifdef USE_SSL + , int certdepth, + x509_cert_t *current_cert +#endif + ) { if (pr) plugin_return_init (pr); @@ -601,8 +614,12 @@ plugin_call (const struct plugin_list *pl, type, av, pr ? &pr->list[i] : NULL, - envp, - certdepth, current_cert); + envp +#ifdef USE_SSL + ,certdepth, + current_cert +#endif + ); switch (status) { case OPENVPN_PLUGIN_FUNC_SUCCESS: -- cgit