loading default modules depending on configure options
authorMartin Willi <martin@strongswan.org>
Fri, 16 May 2008 08:52:32 +0000 (08:52 -0000)
committerMartin Willi <martin@strongswan.org>
Fri, 16 May 2008 08:52:32 +0000 (08:52 -0000)
12 files changed:
configure.in
scripts/key2keyid.c
src/charon/Makefile.am
src/charon/daemon.c
src/charon/plugins/sql/Makefile.am
src/charon/plugins/sql/pool.c
src/libstrongswan/plugins/plugin_loader.c
src/manager/Makefile.am
src/manager/main.c
src/openac/Makefile.am
src/openac/openac.c
src/strongswan.conf

index 6611330..143bfd4 100644 (file)
@@ -26,7 +26,6 @@ dnl =================================
 dnl  check --enable-xxx & --with-xxx
 dnl =================================
 
-
 AC_ARG_WITH(
        [default-pkcs11],
        AS_HELP_STRING([--with-default-pkcs11=lib],[set the default PKCS11 library other than "/usr/lib/opensc-pkcs11.so"]),
@@ -672,10 +671,75 @@ if test x$openssl = xtrue; then
        AC_CHECK_HEADER([openssl/evp.h],,[AC_MSG_ERROR([OpenSSL header openssl/evp.h not found!])])
 fi
 
+dnl ======================================
+dnl  collect all plugins for libstrongswan
+dnl ======================================
+
+libstrongswan_plugins=
+
+if test x$curl = xtrue; then
+       libstrongswan_plugins+=" curl"
+fi
+if test x$ldap = xtrue; then
+       libstrongswan_plugins+=" ldap"
+fi
+if test x$aes = xtrue; then
+       libstrongswan_plugins+=" aes"
+fi
+if test x$des = xtrue; then
+       libstrongswan_plugins+=" des"
+fi
+if test x$md5 = xtrue; then
+       libstrongswan_plugins+=" md5"
+fi
+if test x$sha1 = xtrue; then
+       libstrongswan_plugins+=" sha1"
+fi
+if test x$sha2 = xtrue; then
+       libstrongswan_plugins+=" sha2"
+fi
+if test x$fips_prf = xtrue; then
+       libstrongswan_plugins+=" fips-prf"
+fi
+if test x$gmp = xtrue; then
+       libstrongswan_plugins+=" gmp"
+fi
+if test x$random = xtrue; then
+       libstrongswan_plugins+=" random"
+fi
+if test x$x509 = xtrue; then
+       libstrongswan_plugins+=" x509"
+fi
+if test x$pubkey = xtrue; then
+       libstrongswan_plugins+=" pubkey"
+fi
+if test x$hmac = xtrue; then
+       libstrongswan_plugins+=" hmac"
+fi
+if test x$xcbc = xtrue; then
+       libstrongswan_plugins+=" xcbc"
+fi
+if test x$mysql = xtrue; then
+       libstrongswan_plugins+=" mysql"
+fi
+if test x$sqlite = xtrue; then
+       libstrongswan_plugins+=" sqlite"
+fi
+if test x$padlock = xtrue; then
+       libstrongswan_plugins+=" padlock"
+fi
+if test x$openssl = xtrue; then
+       libstrongswan_plugins+=" openssl"
+fi
+
+AC_SUBST(libstrongswan_plugins)
+
 dnl =========================
 dnl  set Makefile.am vars
 dnl =========================
 
+dnl libstrongswan plugins
+dnl =====================
 AM_CONDITIONAL(USE_CURL, test x$curl = xtrue)
 AM_CONDITIONAL(USE_LDAP, test x$ldap = xtrue)
 AM_CONDITIONAL(USE_AES, test x$aes = xtrue)
@@ -692,19 +756,27 @@ AM_CONDITIONAL(USE_HMAC, test x$hmac = xtrue)
 AM_CONDITIONAL(USE_XCBC, test x$xcbc = xtrue)
 AM_CONDITIONAL(USE_MYSQL, test x$mysql = xtrue)
 AM_CONDITIONAL(USE_SQLITE, test x$sqlite = xtrue)
+AM_CONDITIONAL(USE_PADLOCK, test x$padlock = xtrue)
+AM_CONDITIONAL(USE_OPENSSL, test x$openssl = xtrue)
+
+dnl charon plugins
+dnl ==============
 AM_CONDITIONAL(USE_STROKE, test x$stroke = xtrue)
 AM_CONDITIONAL(USE_MEDSRV, test x$medsrv = xtrue)
 AM_CONDITIONAL(USE_MEDCLI, test x$medcli = xtrue)
 AM_CONDITIONAL(USE_SMP, test x$smp = xtrue)
 AM_CONDITIONAL(USE_SQL, test x$sql = xtrue)
-AM_CONDITIONAL(USE_SMARTCARD, test x$smartcard = xtrue)
-AM_CONDITIONAL(USE_CISCO_QUIRKS, test x$cisco_quirks = xtrue)
-AM_CONDITIONAL(USE_LEAK_DETECTIVE, test x$leak_detective = xtrue)
 AM_CONDITIONAL(USE_UNIT_TESTS, test x$unittest = xtrue)
 AM_CONDITIONAL(USE_EAP_SIM, test x$eap_sim = xtrue)
 AM_CONDITIONAL(USE_EAP_IDENTITY, test x$eap_identity = xtrue)
 AM_CONDITIONAL(USE_EAP_MD5, test x$eap_md5 = xtrue)
 AM_CONDITIONAL(USE_EAP_AKA, test x$eap_aka = xtrue)
+
+dnl other options
+dnl =============
+AM_CONDITIONAL(USE_SMARTCARD, test x$smartcard = xtrue)
+AM_CONDITIONAL(USE_CISCO_QUIRKS, test x$cisco_quirks = xtrue)
+AM_CONDITIONAL(USE_LEAK_DETECTIVE, test x$leak_detective = xtrue)
 AM_CONDITIONAL(USE_NAT_TRANSPORT, test x$nat_transport = xtrue)
 AM_CONDITIONAL(USE_VENDORID, test x$vendor_id = xtrue)
 AM_CONDITIONAL(USE_XAUTH_VID, test x$xauth_vid = xtrue)
@@ -720,8 +792,6 @@ AM_CONDITIONAL(USE_TOOLS, test x$tools = xtrue)
 AM_CONDITIONAL(USE_PLUTO_OR_CHARON, test x$pluto = xtrue -o x$charon = xtrue)
 AM_CONDITIONAL(USE_LIBSTRONGSWAN, test x$charon = xtrue -o x$tools = xtrue)
 AM_CONDITIONAL(USE_FILE_CONFIG, test x$pluto = xtrue -o x$stroke = xtrue)
-AM_CONDITIONAL(USE_PADLOCK, test x$padlock = xtrue)
-AM_CONDITIONAL(USE_OPENSSL, test x$openssl = xtrue)
 
 dnl ==============================
 dnl  set global definitions
index cab5db7..3c488e5 100644 (file)
@@ -5,6 +5,7 @@
 
 static void dbg_stderr(int level, char *fmt, ...)
 {
+       
 }
 
 /**
@@ -18,10 +19,10 @@ int main(int argc, char *argv[])
        char buf[8096];
        int read;
        
-       dbg = dbg_stderr;
+       //dbg = dbg_stderr;
        
        library_init(NULL);
-       lib->plugins->load(lib->plugins, "/usr/local/libexec/ipsec/plugins", "libstrongswan-");
+       lib->plugins->load(lib->plugins, "/usr/local/libexec/ipsec/plugins", "gmp pubkey sha1");
        atexit(library_deinit);
 
        read = fread(buf, 1, sizeof(buf), stdin);
index 0f17c96..9d0e648 100644 (file)
@@ -129,44 +129,57 @@ endif
 ########################
 
 SUBDIRS = . 
+PLUGINS = ${libstrongswan_plugins}
 
 if USE_UNIT_TESTS
   SUBDIRS += plugins/unit_tester
+  PLUGINS += unit-tester
 endif
 
 if USE_STROKE
   SUBDIRS += plugins/stroke
+  PLUGINS += stroke
 endif
 
 if USE_SMP
   SUBDIRS += plugins/smp
+  PLUGINS += smb
 endif
 
 if USE_SQL
   SUBDIRS += plugins/sql
+  PLUGINS += sql
 endif
 
 if USE_EAP_IDENTITY
   SUBDIRS += plugins/eap_identity
+  PLUGINS += eap-identity
 endif
 
 if USE_EAP_SIM
   SUBDIRS += plugins/eap_sim
+  PLUGINS += eap-sim
 endif
 
 if USE_EAP_MD5
   SUBDIRS += plugins/eap_md5
+  PLUGINS += eap-md5
 endif
 
 if USE_EAP_AKA
   SUBDIRS += plugins/eap_aka
+  PLUGINS += eap-aka
 endif
 
 if USE_MEDSRV
   SUBDIRS += plugins/medsrv
+  PLUGINS += medsrv
 endif
 
 if USE_MEDCLI
   SUBDIRS += plugins/medcli
+  PLUGINS += medcli
 endif
 
+AM_CFLAGS += -DPLUGINS=\""${PLUGINS}\""
+
index 2eb0d2e..9406e89 100644 (file)
@@ -382,8 +382,7 @@ static bool initialize(private_daemon_t *this, bool syslog, level_t levels[])
        
        /* load plugins, further infrastructure may need it */
        lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, 
-               lib->settings->get_str(lib->settings, "charon.load", 
-                  "aes des gmp hmac md5 random sha1 sha2 pubkey x509 xcbc stroke"));
+               lib->settings->get_str(lib->settings, "charon.load", PLUGINS));
        
        this->public.ike_sa_manager = ike_sa_manager_create();
        if (this->public.ike_sa_manager == NULL)
index 7dc42c1..d412980 100644 (file)
@@ -1,7 +1,8 @@
 
 INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
 
-AM_CFLAGS = -rdynamic -DIPSEC_PLUGINDIR=\"${plugindir}\"
+AM_CFLAGS = -rdynamic \
+  -DIPSEC_PLUGINDIR=\"${plugindir}\" -DPLUGINS=\""${libstrongswan_plugins}\""
 
 plugin_LTLIBRARIES = libstrongswan-sql.la
 libstrongswan_sql_la_SOURCES = sql_plugin.h sql_plugin.c \
index 40ff6bc..43a4f33 100644 (file)
@@ -359,8 +359,7 @@ int main(int argc, char *argv[])
        library_init(STRONGSWAN_CONF);
        atexit(library_deinit);
        lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
-               lib->settings->get_str(lib->settings, "pool.load",
-                       "sqlite mysql"));
+               lib->settings->get_str(lib->settings, "pool.load", PLUGINS));
        
        uri = lib->settings->get_str(lib->settings, "charon.plugins.sql.database", NULL);
        if (!uri)
index 5734c90..6c25cfb 100644 (file)
@@ -100,7 +100,11 @@ static int load(private_plugin_loader_t *this, char *path, char *list)
                pos = strchr(list, ' ');
                if (pos)
                {
-                       *pos = '\0';
+                       *pos++ = '\0';
+                       while (*pos == ' ')
+                       {
+                               pos++;
+                       }
                }
                plugin = load_plugin(this, path, list);
                if (plugin)
@@ -112,7 +116,7 @@ static int load(private_plugin_loader_t *this, char *path, char *list)
                {
                        break;
                }
-               list = pos + 1;
+               list = pos;
        }
        return count;
 }
index 3e27d5c..bcf168f 100644 (file)
@@ -12,7 +12,7 @@ manager_fcgi_LDADD = $(top_builddir)/src/libfast/libfast.la ${xml_LIBS}
 
 INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libfast ${xml_CFLAGS}
 AM_CFLAGS = -rdynamic -DIPSECDIR=\"${ipsecdir}\" -DIPSEC_PIDDIR=\"${piddir}\" \
-  -DIPSEC_PLUGINDIR=\"${plugindir}\"
+  -DIPSEC_PLUGINDIR=\"${plugindir}\" -DPLUGINS=\""${libstrongswan_plugins}\""
 
 # Don't forget to add templates to EXTRA_DIST !!! How to automate?
 ipsec_templatesdir = ${ipsecdir}/templates
index 08f05e5..cfecc71 100644 (file)
@@ -38,8 +38,7 @@ int main (int arc, char *argv[])
 
        library_init(STRONGSWAN_CONF);
        lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
-               lib->settings->get_str(lib->settings, "manager.load",
-                       "random sha1 sqlite"));
+               lib->settings->get_str(lib->settings, "manager.load", PLUGINS));
        
        socket = lib->settings->get_str(lib->settings, "manager.socket", NULL);
        debug = lib->settings->get_bool(lib->settings, "manager.debug", FALSE);
index 84f2d64..2890c75 100644 (file)
@@ -4,6 +4,6 @@ dist_man_MANS = openac.8
 
 INCLUDES = -I$(top_srcdir)/src/libstrongswan
 AM_CFLAGS = -DIPSEC_CONFDIR=\"${confdir}\" \
-               -DIPSEC_PLUGINDIR=\"${plugindir}\"
+  -DIPSEC_PLUGINDIR=\"${plugindir}\" -DPLUGINS=\""${libstrongswan_plugins}\""
 openac_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la -lgmp
 
index 2ef8989..e0f07fb 100755 (executable)
@@ -268,8 +268,7 @@ int main(int argc, char **argv)
        /* initialize library */
        library_init(STRONGSWAN_CONF);
        lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, 
-               lib->settings->get_str(lib->settings, "openac.load", 
-                  "gmp hmac md5 random sha1 sha2 pubkey x509"));
+               lib->settings->get_str(lib->settings, "openac.load", PLUGINS));
 
        /* initialize optionsfrom */
        options_t *options = options_create();
index 5b6ecb7..661792a 100644 (file)
@@ -6,7 +6,7 @@ charon {
        threads = 16
        
        # plugins to load in charon
-       load = aes des gmp hmac md5 random sha1 sha2 pubkey xcbc stroke
+       # load = aes des gmp hmac md5 random sha1 sha2 pubkey xcbc x509 stroke
        
        plugins {
        
@@ -23,16 +23,3 @@ charon {
        
        # ...
 }
-
-pool {
-       # choose one
-       load = mysql sqlite
-}
-
-manager {
-       load = sha1 random sqlite
-}
-
-openac {
-       load = gmp hmac md5 random sha1 sha2 pubkey x509
-}