summaryrefslogtreecommitdiff
path: root/src/libimcv/plugins/imv_os
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2015-10-22 11:43:58 +0200
committerYves-Alexis Perez <corsac@debian.org>2015-10-22 11:43:58 +0200
commit5dca9ea0e2931f0e2a056c7964d311bcc30a01b8 (patch)
tree037f1ec5bb860846938ddcf29771c24e9c529be0 /src/libimcv/plugins/imv_os
parentb238cf34df3fe4476ae6b7012e7cb3e9769d4d51 (diff)
downloadvyos-strongswan-5dca9ea0e2931f0e2a056c7964d311bcc30a01b8.tar.gz
vyos-strongswan-5dca9ea0e2931f0e2a056c7964d311bcc30a01b8.zip
Imported Upstream version 5.3.3
Diffstat (limited to 'src/libimcv/plugins/imv_os')
-rw-r--r--src/libimcv/plugins/imv_os/imv_os_agent.c19
-rw-r--r--src/libimcv/plugins/imv_os/pacman.c21
2 files changed, 27 insertions, 13 deletions
diff --git a/src/libimcv/plugins/imv_os/imv_os_agent.c b/src/libimcv/plugins/imv_os/imv_os_agent.c
index f0b1936ab..4bf6c7e21 100644
--- a/src/libimcv/plugins/imv_os/imv_os_agent.c
+++ b/src/libimcv/plugins/imv_os/imv_os_agent.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2014 Andreas Steffen
+ * Copyright (C) 2013-2015 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -23,10 +23,10 @@
#include <imcv.h>
#include <imv/imv_agent.h>
#include <imv/imv_msg.h>
+#include <generic/generic_attr_bool.h>
+#include <generic/generic_attr_string.h>
#include <ietf/ietf_attr.h>
#include <ietf/ietf_attr_attr_request.h>
-#include <ietf/ietf_attr_default_pwd_enabled.h>
-#include <ietf/ietf_attr_fwd_enabled.h>
#include <ietf/ietf_attr_installed_packages.h>
#include <ietf/ietf_attr_numeric_version.h>
#include <ietf/ietf_attr_op_status.h>
@@ -37,7 +37,6 @@
#include <ita/ita_attr.h>
#include <ita/ita_attr_get_settings.h>
#include <ita/ita_attr_settings.h>
-#include <ita/ita_attr_device_id.h>
#include "tcg/seg/tcg_seg_attr_max_size.h"
#include "tcg/seg/tcg_seg_attr_seg_env.h"
@@ -270,12 +269,12 @@ static TNC_Result receive_msg(private_imv_os_agent_t *this, imv_state_t *state,
}
case IETF_ATTR_FORWARDING_ENABLED:
{
- ietf_attr_fwd_enabled_t *attr_cast;
+ generic_attr_bool_t *attr_cast;
os_fwd_status_t fwd_status;
state->set_action_flags(state,
IMV_OS_ATTR_FORWARDING_ENABLED);
- attr_cast = (ietf_attr_fwd_enabled_t*)attr;
+ attr_cast = (generic_attr_bool_t*)attr;
fwd_status = attr_cast->get_status(attr_cast);
DBG1(DBG_IMV, "IPv4 forwarding is %N",
os_fwd_status_names, fwd_status);
@@ -288,12 +287,12 @@ static TNC_Result receive_msg(private_imv_os_agent_t *this, imv_state_t *state,
}
case IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED:
{
- ietf_attr_default_pwd_enabled_t *attr_cast;
+ generic_attr_bool_t *attr_cast;
bool default_pwd_status;
state->set_action_flags(state,
IMV_OS_ATTR_FACTORY_DEFAULT_PWD_ENABLED);
- attr_cast = (ietf_attr_default_pwd_enabled_t*)attr;
+ attr_cast = (generic_attr_bool_t*)attr;
default_pwd_status = attr_cast->get_status(attr_cast);
DBG1(DBG_IMV, "factory default password is %sabled",
default_pwd_status ? "en":"dis");
@@ -542,9 +541,7 @@ METHOD(imv_agent_if_t, batch_ending, TNC_Result,
max_seg_size = state->get_max_msg_len(state)
- PA_TNC_HEADER_SIZE
- PA_TNC_ATTR_HEADER_SIZE
- - TCG_SEG_ATTR_SEG_ENV_HEADER
- - PA_TNC_ATTR_HEADER_SIZE
- - TCG_SEG_ATTR_MAX_SIZE_SIZE;
+ - TCG_SEG_ATTR_SEG_ENV_HEADER;
/* Announce support of PA-TNC segmentation to IMC */
contract = seg_contract_create(msg_types[0], max_attr_size,
diff --git a/src/libimcv/plugins/imv_os/pacman.c b/src/libimcv/plugins/imv_os/pacman.c
index 019e2adb8..fbcab5eba 100644
--- a/src/libimcv/plugins/imv_os/pacman.c
+++ b/src/libimcv/plugins/imv_os/pacman.c
@@ -104,8 +104,14 @@ static void cleanup(void)
static void usage(void)
{
- printf("Usage:\n"
- "ipsec pacman --product <name> --file <filename> [--update]\n");
+ printf("Parses package information files from Debian/Ubuntu repositories and\n");
+ printf("stores the extracted information in the database used by the OS IMV.\n\n");
+ printf("ipsec pacman --product <name> --file <filename> [--security]\n\n");
+ printf(" --help print usage information\n");
+ printf(" --product <name> name of the Debian/Ubuntu release, as stored in the DB\n");
+ printf(" --file <filename> package information file to parse\n");
+ printf(" --security set this when parsing a file with security updates\n");
+ printf("\n");
}
/**
@@ -396,6 +402,17 @@ static void process_packages(char *filename, char *product, bool security)
pacman_state = PACMAN_STATE_BEGIN_PACKAGE;
}
}
+ switch (pacman_state)
+ {
+ case PACMAN_STATE_END_PACKAGE:
+ free(version);
+ /* fall-through */
+ case PACMAN_STATE_VERSION:
+ free(package);
+ break;
+ default:
+ break;
+ }
fclose(file);
db->destroy(db);