summaryrefslogtreecommitdiff
path: root/src/libcharon/plugins/tnc_imv
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/plugins/tnc_imv')
-rw-r--r--src/libcharon/plugins/tnc_imv/Makefile.am10
-rw-r--r--src/libcharon/plugins/tnc_imv/Makefile.in157
-rw-r--r--src/libcharon/plugins/tnc_imv/tnc_imv.c82
-rw-r--r--src/libcharon/plugins/tnc_imv/tnc_imv.h26
-rw-r--r--src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c2
-rw-r--r--src/libcharon/plugins/tnc_imv/tnc_imv_manager.c121
-rw-r--r--src/libcharon/plugins/tnc_imv/tnc_imv_plugin.c3
-rw-r--r--src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.c114
-rw-r--r--src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.h2
9 files changed, 345 insertions, 172 deletions
diff --git a/src/libcharon/plugins/tnc_imv/Makefile.am b/src/libcharon/plugins/tnc_imv/Makefile.am
index eca3b377b..49efe3be4 100644
--- a/src/libcharon/plugins/tnc_imv/Makefile.am
+++ b/src/libcharon/plugins/tnc_imv/Makefile.am
@@ -1,12 +1,13 @@
-
-INCLUDES = \
+AM_CPPFLAGS = \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libhydra \
-I$(top_srcdir)/src/libcharon \
-I$(top_srcdir)/src/libtncif \
- -I$(top_srcdir)/src/libtnccs
+ -I$(top_srcdir)/src/libtnccs \
+ -I$(top_srcdir)/src/libtls
-AM_CFLAGS = -rdynamic
+AM_CFLAGS = \
+ -rdynamic
if MONOLITHIC
noinst_LTLIBRARIES = libstrongswan-tnc-imv.la
@@ -23,4 +24,3 @@ libstrongswan_tnc_imv_la_SOURCES = \
tnc_imv_recommendations.h tnc_imv_recommendations.c
libstrongswan_tnc_imv_la_LDFLAGS = -module -avoid-version
-
diff --git a/src/libcharon/plugins/tnc_imv/Makefile.in b/src/libcharon/plugins/tnc_imv/Makefile.in
index cf58f0dc3..118dd6d2d 100644
--- a/src/libcharon/plugins/tnc_imv/Makefile.in
+++ b/src/libcharon/plugins/tnc_imv/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -45,10 +62,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.m4 \
$(top_srcdir)/m4/macros/with.m4 \
$(top_srcdir)/m4/macros/enable-disable.m4 \
$(top_srcdir)/m4/macros/add-plugin.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -72,6 +90,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
am__installdirs = "$(DESTDIR)$(plugindir)"
LTLIBRARIES = $(noinst_LTLIBRARIES) $(plugin_LTLIBRARIES)
@MONOLITHIC_FALSE@libstrongswan_tnc_imv_la_DEPENDENCIES = \
@@ -82,48 +106,77 @@ am_libstrongswan_tnc_imv_la_OBJECTS = tnc_imv_plugin.lo tnc_imv.lo \
tnc_imv_recommendations.lo
libstrongswan_tnc_imv_la_OBJECTS = \
$(am_libstrongswan_tnc_imv_la_OBJECTS)
-libstrongswan_tnc_imv_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(libstrongswan_tnc_imv_la_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+libstrongswan_tnc_imv_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(libstrongswan_tnc_imv_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
@MONOLITHIC_FALSE@am_libstrongswan_tnc_imv_la_rpath = -rpath \
@MONOLITHIC_FALSE@ $(plugindir)
@MONOLITHIC_TRUE@am_libstrongswan_tnc_imv_la_rpath =
-DEFAULT_INCLUDES = -I.@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libstrongswan_tnc_imv_la_SOURCES)
DIST_SOURCES = $(libstrongswan_tnc_imv_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BFDLIB = @BFDLIB@
BTLIB = @BTLIB@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CHECK_CFLAGS = @CHECK_CFLAGS@
+CHECK_LIBS = @CHECK_LIBS@
+COVERAGE_CFLAGS = @COVERAGE_CFLAGS@
+COVERAGE_LDFLAGS = @COVERAGE_LDFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLIB = @DLLIB@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -132,13 +185,16 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+GENHTML = @GENHTML@
GPERF = @GPERF@
+GPRBUILD = @GPRBUILD@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LCOV = @LCOV@
LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
@@ -151,6 +207,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MYSQLCFLAG = @MYSQLCFLAG@
MYSQLCONFIG = @MYSQLCONFIG@
@@ -178,11 +235,13 @@ RANLIB = @RANLIB@
RTLIB = @RTLIB@
RUBY = @RUBY@
RUBYINCLUDE = @RUBYINCLUDE@
+RUBYLIB = @RUBYLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOCKLIB = @SOCKLIB@
STRIP = @STRIP@
+UNWINDLIB = @UNWINDLIB@
VERSION = @VERSION@
YACC = @YACC@
YFLAGS = @YFLAGS@
@@ -190,6 +249,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
@@ -198,8 +258,6 @@ am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
attest_plugins = @attest_plugins@
-axis2c_CFLAGS = @axis2c_CFLAGS@
-axis2c_LIBS = @axis2c_LIBS@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@@ -208,14 +266,19 @@ build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
c_plugins = @c_plugins@
+charon_natt_port = @charon_natt_port@
+charon_plugins = @charon_plugins@
+charon_udp_port = @charon_udp_port@
clearsilver_LIBS = @clearsilver_LIBS@
+cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
dbusservicedir = @dbusservicedir@
-default_pkcs11 = @default_pkcs11@
+dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+fips_mode = @fips_mode@
gtk_CFLAGS = @gtk_CFLAGS@
gtk_LIBS = @gtk_LIBS@
h_plugins = @h_plugins@
@@ -229,17 +292,17 @@ imcvdir = @imcvdir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
+ipsec_script = @ipsec_script@
+ipsec_script_upper = @ipsec_script_upper@
ipsecdir = @ipsecdir@
ipsecgroup = @ipsecgroup@
ipseclibdir = @ipseclibdir@
ipsecuser = @ipsecuser@
-libcharon_plugins = @libcharon_plugins@
libdir = @libdir@
libexecdir = @libexecdir@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
maemo_CFLAGS = @maemo_CFLAGS@
maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
@@ -249,16 +312,15 @@ mkdir_p = @mkdir_p@
nm_CFLAGS = @nm_CFLAGS@
nm_LIBS = @nm_LIBS@
nm_ca_dir = @nm_ca_dir@
+nm_plugins = @nm_plugins@
oldincludedir = @oldincludedir@
openac_plugins = @openac_plugins@
-p_plugins = @p_plugins@
pcsclite_CFLAGS = @pcsclite_CFLAGS@
pcsclite_LIBS = @pcsclite_LIBS@
pdfdir = @pdfdir@
piddir = @piddir@
pki_plugins = @pki_plugins@
plugindir = @plugindir@
-pluto_plugins = @pluto_plugins@
pool_plugins = @pool_plugins@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -286,14 +348,17 @@ top_srcdir = @top_srcdir@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
-INCLUDES = \
+AM_CPPFLAGS = \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libhydra \
-I$(top_srcdir)/src/libcharon \
-I$(top_srcdir)/src/libtncif \
- -I$(top_srcdir)/src/libtnccs
+ -I$(top_srcdir)/src/libtnccs \
+ -I$(top_srcdir)/src/libtls
+
+AM_CFLAGS = \
+ -rdynamic
-AM_CFLAGS = -rdynamic
@MONOLITHIC_TRUE@noinst_LTLIBRARIES = libstrongswan-tnc-imv.la
@MONOLITHIC_FALSE@plugin_LTLIBRARIES = libstrongswan-tnc-imv.la
@MONOLITHIC_FALSE@libstrongswan_tnc_imv_la_LIBADD = \
@@ -351,7 +416,6 @@ clean-noinstLTLIBRARIES:
done
install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)"
@list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@@ -359,6 +423,8 @@ install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
}
@@ -380,8 +446,8 @@ clean-pluginLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libstrongswan-tnc-imv.la: $(libstrongswan_tnc_imv_la_OBJECTS) $(libstrongswan_tnc_imv_la_DEPENDENCIES)
- $(libstrongswan_tnc_imv_la_LINK) $(am_libstrongswan_tnc_imv_la_rpath) $(libstrongswan_tnc_imv_la_OBJECTS) $(libstrongswan_tnc_imv_la_LIBADD) $(LIBS)
+libstrongswan-tnc-imv.la: $(libstrongswan_tnc_imv_la_OBJECTS) $(libstrongswan_tnc_imv_la_DEPENDENCIES) $(EXTRA_libstrongswan_tnc_imv_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libstrongswan_tnc_imv_la_LINK) $(am_libstrongswan_tnc_imv_la_rpath) $(libstrongswan_tnc_imv_la_OBJECTS) $(libstrongswan_tnc_imv_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -396,25 +462,25 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnc_imv_recommendations.Plo@am__quote@
.c.o:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
.c.obj:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
-@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@@ -521,10 +587,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv.c b/src/libcharon/plugins/tnc_imv/tnc_imv.c
index f0b150743..ef0387d70 100644
--- a/src/libcharon/plugins/tnc_imv/tnc_imv.c
+++ b/src/libcharon/plugins/tnc_imv/tnc_imv.c
@@ -20,9 +20,10 @@
#include <tncif_pa_subtypes.h>
-#include <debug.h>
+#include <utils/debug.h>
+#include <daemon.h>
#include <library.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
#include <threading/mutex.h>
typedef struct private_tnc_imv_t private_tnc_imv_t;
@@ -38,11 +39,6 @@ struct private_tnc_imv_t {
imv_t public;
/**
- * Path of loaded IMV
- */
- char *path;
-
- /**
* Name of loaded IMV
*/
char *name;
@@ -287,10 +283,10 @@ METHOD(imv_t, type_supported, bool,
for (i = 0; i < this->type_count; i++)
{
- vid = this->supported_vids[i];
- subtype = this->supported_subtypes[i];
+ vid = this->supported_vids[i];
+ subtype = this->supported_subtypes[i];
- if ((vid == TNC_VENDORID_ANY && subtype == TNC_SUBTYPE_ANY) ||
+ if ((vid == TNC_VENDORID_ANY && subtype == TNC_SUBTYPE_ANY) ||
(vid == msg_vid && (subtype == TNC_SUBTYPE_ANY ||
subtype == msg_subtype)))
{
@@ -303,20 +299,23 @@ METHOD(imv_t, type_supported, bool,
METHOD(imv_t, destroy, void,
private_tnc_imv_t *this)
{
- dlclose(this->handle);
+ if (this->handle && lib->settings->get_bool(lib->settings,
+ "%s.plugins.tnc-imv.dlclose", TRUE, charon->name))
+ {
+ dlclose(this->handle);
+ }
this->mutex->destroy(this->mutex);
this->additional_ids->destroy_function(this->additional_ids, free);
free(this->supported_vids);
free(this->supported_subtypes);
free(this->name);
- free(this->path);
free(this);
}
/**
- * Described in header.
+ * Generic constructor.
*/
-imv_t* tnc_imv_create(char *name, char *path)
+static private_tnc_imv_t* tnc_imv_create_empty(char *name)
{
private_tnc_imv_t *this;
@@ -332,17 +331,28 @@ imv_t* tnc_imv_create(char *name, char *path)
.type_supported = _type_supported,
.destroy = _destroy,
},
- .name = name,
- .path = path,
+ .name = strdup(name),
.additional_ids = linked_list_create(),
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
);
+ return this;
+}
+
+/**
+ * Described in header.
+ */
+imv_t* tnc_imv_create(char *name, char *path)
+{
+ private_tnc_imv_t *this;
+
+ this = tnc_imv_create_empty(name);
+
this->handle = dlopen(path, RTLD_LAZY);
if (!this->handle)
{
DBG1(DBG_TNC, "IMV \"%s\" failed to load: %s", name, dlerror());
- free(this);
+ destroy(this);
return NULL;
}
@@ -351,8 +361,7 @@ imv_t* tnc_imv_create(char *name, char *path)
{
DBG1(DBG_TNC, "could not resolve TNC_IMV_Initialize in %s: %s\n",
path, dlerror());
- dlclose(this->handle);
- free(this);
+ destroy(this);
return NULL;
}
this->public.notify_connection_change =
@@ -363,8 +372,7 @@ imv_t* tnc_imv_create(char *name, char *path)
{
DBG1(DBG_TNC, "could not resolve TNC_IMV_SolicitRecommendation in %s: %s\n",
path, dlerror());
- dlclose(this->handle);
- free(this);
+ destroy(this);
return NULL;
}
this->public.receive_message =
@@ -381,10 +389,38 @@ imv_t* tnc_imv_create(char *name, char *path)
{
DBG1(DBG_TNC, "could not resolve TNC_IMV_ProvideBindFunction in %s: %s\n",
path, dlerror());
- dlclose(this->handle);
- free(this);
+ destroy(this);
return NULL;
}
return &this->public;
}
+
+/**
+ * Described in header.
+ */
+imv_t* tnc_imv_create_from_functions(char *name,
+ TNC_IMV_InitializePointer initialize,
+ TNC_IMV_NotifyConnectionChangePointer notify_connection_change,
+ TNC_IMV_ReceiveMessagePointer receive_message,
+ TNC_IMV_ReceiveMessageLongPointer receive_message_long,
+ TNC_IMV_SolicitRecommendationPointer solicit_recommendation,
+ TNC_IMV_BatchEndingPointer batch_ending,
+ TNC_IMV_TerminatePointer terminate,
+ TNC_IMV_ProvideBindFunctionPointer provide_bind_function)
+{
+ private_tnc_imv_t *this;
+
+ this = tnc_imv_create_empty(name);
+
+ this->public.initialize = initialize;
+ this->public.notify_connection_change = notify_connection_change;
+ this->public.receive_message = receive_message;
+ this->public.receive_message_long = receive_message_long;
+ this->public.solicit_recommendation = solicit_recommendation;
+ this->public.batch_ending = batch_ending;
+ this->public.terminate = terminate;
+ this->public.provide_bind_function = provide_bind_function;
+
+ return &this->public;
+}
diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv.h b/src/libcharon/plugins/tnc_imv/tnc_imv.h
index 75939e54c..e7c7b8b4f 100644
--- a/src/libcharon/plugins/tnc_imv/tnc_imv.h
+++ b/src/libcharon/plugins/tnc_imv/tnc_imv.h
@@ -25,7 +25,7 @@
#include <tnc/imv/imv.h>
/**
- * Create an Integrity Measurement Verifier.
+ * Create an Integrity Measurement Verifier loaded from a library.
*
* @param name name of the IMV
* @param filename path to the dynamic IMV library
@@ -33,4 +33,28 @@
*/
imv_t* tnc_imv_create(char *name, char *filename);
+/**
+ * Create an Integrity Measurement Verifier from a set of IMV functions.
+ *
+ * @param name name of the IMV
+ * @param initialize TNC_IMV_InitializePointer
+ * @param notify_connection_change TNC_IMV_NotifyConnectionChangePointer
+ * @param receive_message TNC_IMV_ReceiveMessagePointer
+ * @param receive_message_long TNC_IMV_ReceiveMessageLongPointer
+ * @param solicit_recommendation TNC_IMV_SolicitRecommendationPointer
+ * @param batch_ending TNC_IMV_BatchEndingPointer
+ * @param terminate TNC_IMV_TerminatePointer
+ * @param provide_bind_function TNC_IMV_ProvideBindFunctionPointer
+ * @return instance of the imv_t interface
+ */
+imv_t* tnc_imv_create_from_functions(char *name,
+ TNC_IMV_InitializePointer initialize,
+ TNC_IMV_NotifyConnectionChangePointer notify_connection_change,
+ TNC_IMV_ReceiveMessagePointer receive_message,
+ TNC_IMV_ReceiveMessageLongPointer receive_message_long,
+ TNC_IMV_SolicitRecommendationPointer solicit_recommendation,
+ TNC_IMV_BatchEndingPointer batch_ending,
+ TNC_IMV_TerminatePointer terminate,
+ TNC_IMV_ProvideBindFunctionPointer provide_bind_function);
+
#endif /** TNC_IMV_H_ @}*/
diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c b/src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c
index dd11c5009..36cdb7fbb 100644
--- a/src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c
+++ b/src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c
@@ -18,7 +18,7 @@
#include <tnc/imv/imv_manager.h>
#include <tnc/tnccs/tnccs_manager.h>
-#include <debug.h>
+#include <utils/debug.h>
/**
* Called by the IMV to inform a TNCS about the set of message types the IMV
diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv_manager.c b/src/libcharon/plugins/tnc_imv/tnc_imv_manager.c
index b1da73156..b950e3119 100644
--- a/src/libcharon/plugins/tnc_imv/tnc_imv_manager.c
+++ b/src/libcharon/plugins/tnc_imv/tnc_imv_manager.c
@@ -29,13 +29,13 @@
#include <fcntl.h>
#include <daemon.h>
-#include <utils/lexparser.h>
-#include <debug.h>
+#include <utils/debug.h>
+#include <threading/rwlock.h>
#include <threading/mutex.h>
+#include <collections/linked_list.h>
typedef struct private_tnc_imv_manager_t private_tnc_imv_manager_t;
-
/**
* Private data of an imv_manager_t object.
*/
@@ -52,11 +52,21 @@ struct private_tnc_imv_manager_t {
linked_list_t *imvs;
/**
+ * Lock for IMV list
+ */
+ rwlock_t *lock;
+
+ /**
* Next IMV ID to be assigned
*/
TNC_IMVID next_imv_id;
/**
+ * Mutex to access next IMV ID
+ */
+ mutex_t *id_mutex;
+
+ /**
* Policy defining how to derive final recommendation from individual ones
*/
recommendation_policy_t policy;
@@ -66,27 +76,37 @@ METHOD(imv_manager_t, add, bool,
private_tnc_imv_manager_t *this, imv_t *imv)
{
TNC_Version version;
+ TNC_IMVID imv_id;
- /* Initialize the IMV module */
- imv->set_id(imv, this->next_imv_id);
- if (imv->initialize(imv->get_id(imv), TNC_IFIMV_VERSION_1,
- TNC_IFIMV_VERSION_1, &version) != TNC_RESULT_SUCCESS)
+ this->id_mutex->lock(this->id_mutex);
+ imv_id = this->next_imv_id++;
+ this->id_mutex->unlock(this->id_mutex);
+
+ imv->set_id(imv, imv_id);
+ if (imv->initialize(imv_id, TNC_IFIMV_VERSION_1,
+ TNC_IFIMV_VERSION_1, &version) != TNC_RESULT_SUCCESS)
{
DBG1(DBG_TNC, "IMV \"%s\" failed to initialize", imv->get_name(imv));
return FALSE;
}
+ this->lock->write_lock(this->lock);
this->imvs->insert_last(this->imvs, imv);
- this->next_imv_id++;
+ this->lock->unlock(this->lock);
- if (imv->provide_bind_function(imv->get_id(imv), TNC_TNCS_BindFunction)
- != TNC_RESULT_SUCCESS)
+ if (imv->provide_bind_function(imv->get_id(imv),
+ TNC_TNCS_BindFunction) != TNC_RESULT_SUCCESS)
{
- DBG1(DBG_TNC, "IMV \"%s\" could failed to obtain bind function",
- imv->get_name(imv));
+ if (imv->terminate)
+ {
+ imv->terminate(imv->get_id(imv));
+ }
+ DBG1(DBG_TNC, "IMV \"%s\" failed to obtain bind function",
+ imv->get_name(imv));
+ this->lock->write_lock(this->lock);
this->imvs->remove_last(this->imvs, (void**)&imv);
+ this->lock->unlock(this->lock);
return FALSE;
}
-
return TRUE;
}
@@ -96,6 +116,7 @@ METHOD(imv_manager_t, remove_, imv_t*,
enumerator_t *enumerator;
imv_t *imv, *removed_imv = NULL;
+ this->lock->write_lock(this->lock);
enumerator = this->imvs->create_enumerator(this->imvs);
while (enumerator->enumerate(enumerator, &imv))
{
@@ -107,6 +128,7 @@ METHOD(imv_manager_t, remove_, imv_t*,
}
}
enumerator->destroy(enumerator);
+ this->lock->unlock(this->lock);
return removed_imv;
}
@@ -119,18 +141,10 @@ METHOD(imv_manager_t, load, bool,
imv = tnc_imv_create(name, path);
if (!imv)
{
- free(name);
- free(path);
return FALSE;
}
if (!add(this, imv))
{
- if (imv->terminate &&
- imv->terminate(imv->get_id(imv)) != TNC_RESULT_SUCCESS)
- {
- DBG1(DBG_TNC, "IMV \"%s\" not terminated successfully",
- imv->get_name(imv));
- }
imv->destroy(imv);
return FALSE;
}
@@ -138,6 +152,37 @@ METHOD(imv_manager_t, load, bool,
return TRUE;
}
+METHOD(imv_manager_t, load_from_functions, bool,
+ private_tnc_imv_manager_t *this, char *name,
+ TNC_IMV_InitializePointer initialize,
+ TNC_IMV_NotifyConnectionChangePointer notify_connection_change,
+ TNC_IMV_ReceiveMessagePointer receive_message,
+ TNC_IMV_ReceiveMessageLongPointer receive_message_long,
+ TNC_IMV_SolicitRecommendationPointer solicit_recommendation,
+ TNC_IMV_BatchEndingPointer batch_ending,
+ TNC_IMV_TerminatePointer terminate,
+ TNC_IMV_ProvideBindFunctionPointer provide_bind_function)
+{
+ imv_t *imv;
+
+ imv = tnc_imv_create_from_functions(name,
+ initialize,notify_connection_change,
+ receive_message, receive_message_long,
+ solicit_recommendation, batch_ending,
+ terminate, provide_bind_function);
+ if (!imv)
+ {
+ return FALSE;
+ }
+ if (!add(this, imv))
+ {
+ imv->destroy(imv);
+ return FALSE;
+ }
+ DBG1(DBG_TNC, "IMV %u \"%s\" loaded", imv->get_id(imv), name);
+ return TRUE;
+}
+
METHOD(imv_manager_t, is_registered, bool,
private_tnc_imv_manager_t *this, TNC_IMVID id)
{
@@ -145,6 +190,7 @@ METHOD(imv_manager_t, is_registered, bool,
imv_t *imv;
bool found = FALSE;
+ this->lock->read_lock(this->lock);
enumerator = this->imvs->create_enumerator(this->imvs);
while (enumerator->enumerate(enumerator, &imv))
{
@@ -155,6 +201,7 @@ METHOD(imv_manager_t, is_registered, bool,
}
}
enumerator->destroy(enumerator);
+ this->lock->unlock(this->lock);
return found;
}
@@ -166,13 +213,16 @@ METHOD(imv_manager_t, reserve_id, bool,
imv_t *imv;
bool found = FALSE;
+ this->lock->read_lock(this->lock);
enumerator = this->imvs->create_enumerator(this->imvs);
while (enumerator->enumerate(enumerator, &imv))
{
- if (imv->get_id(imv))
+ if (id == imv->get_id(imv))
{
found = TRUE;
+ this->id_mutex->lock(this->id_mutex);
*new_id = this->next_imv_id++;
+ this->id_mutex->unlock(this->id_mutex);
imv->add_id(imv, *new_id);
DBG2(DBG_TNC, "additional ID %u reserved for IMV with primary ID %u",
*new_id, id);
@@ -180,6 +230,7 @@ METHOD(imv_manager_t, reserve_id, bool,
}
}
enumerator->destroy(enumerator);
+ this->lock->unlock(this->lock);
return found;
}
@@ -241,7 +292,7 @@ METHOD(imv_manager_t, enforce_recommendation, bool,
return FALSE;
}
else
- {
+ {
auth = ike_sa->get_auth_cfg(ike_sa, FALSE);
id = identification_create_from_string(group);
auth->add(auth, AUTH_RULE_GROUP, id);
@@ -259,6 +310,7 @@ METHOD(imv_manager_t, notify_connection_change, void,
enumerator_t *enumerator;
imv_t *imv;
+ this->lock->read_lock(this->lock);
enumerator = this->imvs->create_enumerator(this->imvs);
while (enumerator->enumerate(enumerator, &imv))
{
@@ -268,6 +320,7 @@ METHOD(imv_manager_t, notify_connection_change, void,
}
}
enumerator->destroy(enumerator);
+ this->lock->unlock(this->lock);
}
METHOD(imv_manager_t, set_message_types, TNC_Result,
@@ -279,6 +332,7 @@ METHOD(imv_manager_t, set_message_types, TNC_Result,
imv_t *imv;
TNC_Result result = TNC_RESULT_FATAL;
+ this->lock->read_lock(this->lock);
enumerator = this->imvs->create_enumerator(this->imvs);
while (enumerator->enumerate(enumerator, &imv))
{
@@ -290,6 +344,7 @@ METHOD(imv_manager_t, set_message_types, TNC_Result,
}
}
enumerator->destroy(enumerator);
+ this->lock->unlock(this->lock);
return result;
}
@@ -303,6 +358,7 @@ METHOD(imv_manager_t, set_message_types_long, TNC_Result,
imv_t *imv;
TNC_Result result = TNC_RESULT_FATAL;
+ this->lock->read_lock(this->lock);
enumerator = this->imvs->create_enumerator(this->imvs);
while (enumerator->enumerate(enumerator, &imv))
{
@@ -315,6 +371,7 @@ METHOD(imv_manager_t, set_message_types_long, TNC_Result,
}
}
enumerator->destroy(enumerator);
+ this->lock->unlock(this->lock);
return result;
}
@@ -324,12 +381,14 @@ METHOD(imv_manager_t, solicit_recommendation, void,
enumerator_t *enumerator;
imv_t *imv;
+ this->lock->read_lock(this->lock);
enumerator = this->imvs->create_enumerator(this->imvs);
while (enumerator->enumerate(enumerator, &imv))
{
imv->solicit_recommendation(imv->get_id(imv), id);
}
enumerator->destroy(enumerator);
+ this->lock->unlock(this->lock);
}
METHOD(imv_manager_t, receive_message, void,
@@ -350,11 +409,12 @@ METHOD(imv_manager_t, receive_message, void,
msg_type = (msg_vid << 8) | msg_subtype;
+ this->lock->read_lock(this->lock);
enumerator = this->imvs->create_enumerator(this->imvs);
while (enumerator->enumerate(enumerator, &imv))
{
if (imv->type_supported(imv, msg_vid, msg_subtype) &&
- (!excl || (excl && imv->has_id(imv, dst_imv_id)) ))
+ (!excl || (excl && imv->has_id(imv, dst_imv_id))))
{
if (imv->receive_message_long && src_imc_id)
{
@@ -376,6 +436,8 @@ METHOD(imv_manager_t, receive_message, void,
}
}
enumerator->destroy(enumerator);
+ this->lock->unlock(this->lock);
+
if (!type_supported)
{
DBG2(DBG_TNC, "message type 0x%06x/0x%08x not supported by any IMV",
@@ -389,6 +451,7 @@ METHOD(imv_manager_t, batch_ending, void,
enumerator_t *enumerator;
imv_t *imv;
+ this->lock->read_lock(this->lock);
enumerator = this->imvs->create_enumerator(this->imvs);
while (enumerator->enumerate(enumerator, &imv))
{
@@ -398,9 +461,9 @@ METHOD(imv_manager_t, batch_ending, void,
}
}
enumerator->destroy(enumerator);
+ this->lock->unlock(this->lock);
}
-
METHOD(imv_manager_t, destroy, void,
private_tnc_imv_manager_t *this)
{
@@ -417,6 +480,8 @@ METHOD(imv_manager_t, destroy, void,
imv->destroy(imv);
}
this->imvs->destroy(this->imvs);
+ this->lock->destroy(this->lock);
+ this->id_mutex->destroy(this->id_mutex);
free(this);
}
@@ -433,6 +498,7 @@ imv_manager_t* tnc_imv_manager_create(void)
.add = _add,
.remove = _remove_, /* avoid name conflict with stdio.h */
.load = _load,
+ .load_from_functions = _load_from_functions,
.is_registered = _is_registered,
.reserve_id = _reserve_id,
.get_recommendation_policy = _get_recommendation_policy,
@@ -447,12 +513,15 @@ imv_manager_t* tnc_imv_manager_create(void)
.destroy = _destroy,
},
.imvs = linked_list_create(),
+ .lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
+ .id_mutex = mutex_create(MUTEX_TYPE_DEFAULT),
.next_imv_id = 1,
);
policy = enum_from_name(recommendation_policy_names,
lib->settings->get_str(lib->settings,
- "charon.plugins.tnc-imv.recommendation_policy", "default"));
+ "%s.plugins.tnc-imv.recommendation_policy", "default",
+ charon->name));
this->policy = (policy != -1) ? policy : RECOMMENDATION_POLICY_DEFAULT;
DBG1(DBG_TNC, "TNC recommendation policy is '%N'",
recommendation_policy_names, this->policy);
diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv_plugin.c b/src/libcharon/plugins/tnc_imv/tnc_imv_plugin.c
index c16f6b9e1..d06c2fcaf 100644
--- a/src/libcharon/plugins/tnc_imv/tnc_imv_plugin.c
+++ b/src/libcharon/plugins/tnc_imv/tnc_imv_plugin.c
@@ -47,6 +47,9 @@ METHOD(plugin_t, get_features, int,
PLUGIN_CALLBACK(tnc_manager_register, tnc_imv_manager_create),
PLUGIN_PROVIDE(CUSTOM, "imv-manager"),
PLUGIN_DEPENDS(CUSTOM, "tnccs-manager"),
+ PLUGIN_SDEPEND(CERT_DECODE, CERT_X509),
+ PLUGIN_SDEPEND(CERT_DECODE, CERT_TRUSTED_PUBKEY),
+ PLUGIN_SDEPEND(DATABASE, DB_ANY),
};
*features = f;
return countof(f);
diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.c b/src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.c
index 7843293a1..a9dbb2b9f 100644
--- a/src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.c
+++ b/src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.c
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2010 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
+ * Copyright (C) 2010-2012 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -14,14 +15,15 @@
#include <tncifimv.h>
#include <tncif_names.h>
+#include <tncif_policy.h>
#include <tnc/tnc.h>
#include <tnc/imv/imv.h>
#include <tnc/imv/imv_manager.h>
#include <tnc/imv/imv_recommendations.h>
-#include <debug.h>
-#include <utils/linked_list.h>
+#include <utils/debug.h>
+#include <collections/linked_list.h>
typedef struct private_tnc_imv_recommendations_t private_tnc_imv_recommendations_t;
typedef struct recommendation_entry_t recommendation_entry_t;
@@ -123,8 +125,13 @@ METHOD(recommendations_t, have_recommendation, bool,
TNC_IMV_Evaluation_Result final_eval;
bool first = TRUE, incomplete = FALSE;
- *rec = final_rec = TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION;
- *eval = final_eval = TNC_IMV_EVALUATION_RESULT_DONT_KNOW;
+ final_rec = TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION;
+ final_eval = TNC_IMV_EVALUATION_RESULT_DONT_KNOW;
+ if (rec && eval)
+ {
+ *rec = final_rec;
+ *eval = final_eval;
+ }
if (this->recs->get_count(this->recs) == 0)
{
@@ -151,53 +158,10 @@ METHOD(recommendations_t, have_recommendation, bool,
switch (policy)
{
case RECOMMENDATION_POLICY_DEFAULT:
- switch (entry->rec)
- {
- case TNC_IMV_ACTION_RECOMMENDATION_NO_ACCESS:
- final_rec = entry->rec;
- break;
- case TNC_IMV_ACTION_RECOMMENDATION_ISOLATE:
- if (final_rec != TNC_IMV_ACTION_RECOMMENDATION_NO_ACCESS)
- {
- final_rec = entry->rec;
- };
- break;
- case TNC_IMV_ACTION_RECOMMENDATION_ALLOW:
- if (final_rec == TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION)
- {
- final_rec = entry->rec;
- };
- break;
- case TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION:
- break;
- }
- switch (entry->eval)
- {
- case TNC_IMV_EVALUATION_RESULT_ERROR:
- final_eval = entry->eval;
- break;
- case TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MAJOR:
- if (final_eval != TNC_IMV_EVALUATION_RESULT_ERROR)
- {
- final_eval = entry->eval;
- }
- break;
- case TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MINOR:
- if (final_eval != TNC_IMV_EVALUATION_RESULT_ERROR &&
- final_eval != TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MAJOR)
- {
- final_eval = entry->eval;
- }
- break;
- case TNC_IMV_EVALUATION_RESULT_COMPLIANT:
- if (final_eval == TNC_IMV_EVALUATION_RESULT_DONT_KNOW)
- {
- final_eval = entry->eval;
- }
- break;
- case TNC_IMV_EVALUATION_RESULT_DONT_KNOW:
- break;
- }
+ final_rec = tncif_policy_update_recommendation(final_rec,
+ entry->rec);
+ final_eval = tncif_policy_update_evaluation(final_eval,
+ entry->eval);
break;
case RECOMMENDATION_POLICY_ALL:
@@ -267,11 +231,32 @@ METHOD(recommendations_t, have_recommendation, bool,
{
return FALSE;
}
- *rec = final_rec;
- *eval = final_eval;
+ if (rec && eval)
+ {
+ *rec = final_rec;
+ *eval = final_eval;
+ }
return TRUE;
}
+METHOD(recommendations_t, clear_recommendation, void,
+ private_tnc_imv_recommendations_t *this)
+{
+ enumerator_t *enumerator;
+ recommendation_entry_t *entry;
+
+ enumerator = this->recs->create_enumerator(this->recs);
+ while (enumerator->enumerate(enumerator, &entry))
+ {
+ entry->have_recommendation = FALSE;
+ entry->rec = TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION;
+ entry->eval = TNC_IMV_EVALUATION_RESULT_DONT_KNOW;
+ chunk_clear(&entry->reason);
+ chunk_clear(&entry->reason_language);
+ }
+ enumerator->destroy(enumerator);
+}
+
METHOD(recommendations_t, get_preferred_language, chunk_t,
private_tnc_imv_recommendations_t *this)
{
@@ -293,7 +278,7 @@ METHOD(recommendations_t, set_reason_string, TNC_Result,
bool found = FALSE;
DBG2(DBG_TNC, "IMV %u is setting reason string to '%.*s'",
- id, reason.len, reason.ptr);
+ id, (int)reason.len, reason.ptr);
enumerator = this->recs->create_enumerator(this->recs);
while (enumerator->enumerate(enumerator, &entry))
@@ -318,7 +303,7 @@ METHOD(recommendations_t, set_reason_language, TNC_Result,
bool found = FALSE;
DBG2(DBG_TNC, "IMV %u is setting reason language to '%.*s'",
- id, reason_lang.len, reason_lang.ptr);
+ id, (int)reason_lang.len, reason_lang.ptr);
enumerator = this->recs->create_enumerator(this->recs);
while (enumerator->enumerate(enumerator, &entry))
@@ -362,21 +347,6 @@ METHOD(recommendations_t, create_reason_enumerator, enumerator_t*,
(void*)reason_filter, NULL, NULL);
}
-METHOD(recommendations_t, clear_reasons, void,
- private_tnc_imv_recommendations_t *this)
-{
- enumerator_t *enumerator;
- recommendation_entry_t *entry;
-
- enumerator = this->recs->create_enumerator(this->recs);
- while (enumerator->enumerate(enumerator, &entry))
- {
- chunk_clear(&entry->reason);
- chunk_clear(&entry->reason_language);
- }
- enumerator->destroy(enumerator);
-}
-
METHOD(recommendations_t, destroy, void,
private_tnc_imv_recommendations_t *this)
{
@@ -407,12 +377,12 @@ recommendations_t* tnc_imv_recommendations_create(linked_list_t *imv_list)
.public = {
.provide_recommendation = _provide_recommendation,
.have_recommendation = _have_recommendation,
+ .clear_recommendation = _clear_recommendation,
.get_preferred_language = _get_preferred_language,
.set_preferred_language = _set_preferred_language,
.set_reason_string = _set_reason_string,
.set_reason_language = _set_reason_language,
.create_reason_enumerator = _create_reason_enumerator,
- .clear_reasons = _clear_reasons,
.destroy = _destroy,
},
.recs = linked_list_create(),
diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.h b/src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.h
index 6d65a2521..66d03b2f8 100644
--- a/src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.h
+++ b/src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.h
@@ -23,7 +23,7 @@
#define TNC_IMV_RECOMMENDATIONS_H_
#include <tnc/imv/imv_recommendations.h>
-#include <utils/linked_list.h>
+#include <collections/linked_list.h>
/**
* Create an IMV empty recommendations instance