]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Further improvements to plugin support:
authorAdriaan de Jong <dejong@fox-it.com>
Thu, 7 Jul 2011 08:05:32 +0000 (10:05 +0200)
committerDavid Sommerseth <davids@redhat.com>
Sat, 22 Oct 2011 15:22:51 +0000 (17:22 +0200)
 - Renamed struct entries to explicitly show them as disabled
 - Added a warning if USE_SSL is enabled, but neither ssl_verify_openssl.h or ssl_verify_polarssl.h is included
 - If neither of those files is included, disable ssl support for a plugin including openvpn-plugin.h

Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
openvpn-plugin.h
plugin.h
plugin/examples/log_v3.c

index 65a3ffd444084b8482c5ee059477bdcb63a25adc..474c9102b61a513e8a3471f52b887aaf66d84818 100644 (file)
 
 #ifndef OPENVPN_PLUGIN_H_
 #define OPENVPN_PLUGIN_H_
-
 #ifdef USE_SSL
-#if defined(USE_OPENSSL)
-#include "ssl_verify_openssl.h"
-#elif defined(USE_POLARSSL)
-#include "ssl_verify_polarssl.h"
-#else
-#error "Either USE_OPENSSL or USE_POLARSSL should be defined"
-#endif
+#  if defined(SSL_VERIFY_OPENSSL_H_) || defined(SSL_VERIFY_POLARSSL_H_)
+#    define ENABLE_SSL_PLUGIN
+#  else
+#    warning "Neither OpenSSL or PoLarSSL headers included, disabling plugin's SSL support"
+#  endif
 #endif /*USE_SSL*/
 
 #define OPENVPN_PLUGIN_VERSION 3
@@ -282,12 +279,12 @@ struct openvpn_plugin_args_func_in
   const char ** const envp;
   openvpn_plugin_handle_t handle;
   void *per_client_context;
-#ifdef USE_SSL
+#ifdef ENABLE_SSL_PLUGIN
   int current_cert_depth;
   x509_cert_t *current_cert;
 #else
-  int current_cert_depth; /* Unused, for compatibility purposes only */
-  void *current_cert; /* Unused, for compatibility purposes only */
+  int __current_cert_depth_disabled; /* Unused, for compatibility purposes only */
+  void *__current_cert_disabled; /* Unused, for compatibility purposes only */
 #endif
 };
 
index 8fa416872939ecefd16d77302817fb5d15b8610b..87827511e9e205f039cf18d59419c8d61a0e27c8 100644 (file)
--- a/plugin.h
+++ b/plugin.h
 #ifndef OPENVPN_PLUGIN_H
 #define OPENVPN_PLUGIN_H
 
+#ifdef USE_OPENSSL
+#include "ssl_verify_openssl.h"
+#endif
+#ifdef USE_POLARSSL
+#include "ssl_verify_polarssl.h"
+#endif
 #include "openvpn-plugin.h"
 
 #ifdef ENABLE_PLUGIN
index 2dff6a64b01f539664272046822cb2cbd3751980..187c5927535d2e96b3a397ebe64e1cf7ddf5fa6c 100644 (file)
@@ -38,6 +38,7 @@
 
 #define USE_SSL
 #define USE_OPENSSL
+#include "ssl_verify_openssl.h"
 
 #include "openvpn-plugin.h"