Removed an unnecessary include of a header that is not available on Mac OS X.
[strongswan.git] / src / libstrongswan / plugins / plugin_loader.c
index b2d4d66..47c244b 100644 (file)
@@ -11,8 +11,6 @@
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * for more details.
- *
- * $Id$
  */
 
 #define _GNU_SOURCE
@@ -24,6 +22,7 @@
 #include <stdio.h>
 
 #include <debug.h>
+#include <integrity_checker.h>
 #include <utils/linked_list.h>
 #include <plugins/plugin.h>
 
@@ -63,6 +62,12 @@ static plugin_t* load_plugin(private_plugin_loader_t *this,
        
        snprintf(file, sizeof(file), "%s/libstrongswan-%s.so", path, name);
        
+       if (lib->integrity &&
+               !lib->integrity->check_file(lib->integrity, name, file))
+       {
+               DBG1("file integrity test of plugin '%s' failed", name);
+               return NULL;
+       }
        handle = dlopen(file, RTLD_LAZY);
        if (handle == NULL)
        {
@@ -76,6 +81,13 @@ static plugin_t* load_plugin(private_plugin_loader_t *this,
                dlclose(handle);
                return NULL;
        }
+       if (lib->integrity &&
+               !lib->integrity->check_segment(lib->integrity, name, constructor))
+       {
+               DBG1("segment integrity test of plugin '%s' failed", name);
+               dlclose(handle);
+               return NULL;
+       }
        plugin = constructor();
        if (plugin == NULL)
        {