diff options
Diffstat (limited to 'src/libimcv')
-rw-r--r-- | src/libimcv/plugins/imc_hcd/imc_hcd.c | 30 | ||||
-rw-r--r-- | src/libimcv/plugins/imv_hcd/imv_hcd_agent.c | 28 |
2 files changed, 32 insertions, 26 deletions
diff --git a/src/libimcv/plugins/imc_hcd/imc_hcd.c b/src/libimcv/plugins/imc_hcd/imc_hcd.c index 704383727..b631683ce 100644 --- a/src/libimcv/plugins/imc_hcd/imc_hcd.c +++ b/src/libimcv/plugins/imc_hcd/imc_hcd.c @@ -392,7 +392,8 @@ static void add_quadruple(imc_msg_t *msg, char *section, quadruple_t *quad) const size_t version_len = 16; char version[version_len]; char hex_version_default[] = "00000000000000000000000000000000"; - char *app, *name, *patches, *pos, *string_version, *hex_version; + char *app, *name, *patches, *string_version, *hex_version; + size_t len; chunk_t num_version; enumerator_t *enumerator; @@ -414,24 +415,6 @@ static void add_quadruple(imc_msg_t *msg, char *section, quadruple_t *quad) "%s.plugins.imc-hcd.subtypes.%s.%s.%s.version", hex_version_default, lib->ns, section, quad->section, app); - /* replace \n escape character by CRLF */ - pos = patches; - while (TRUE) - { - pos = strchr(pos, '\\'); - if (pos == NULL) - { - break; - } - if (pos[1] == 'n') - { - pos[0] = '\r'; - pos[1] = '\n'; - pos++; - } - pos++; - } - /* convert hex string into binary chunk */ if (strlen(hex_version) > 2 * version_len) { @@ -446,7 +429,14 @@ static void add_quadruple(imc_msg_t *msg, char *section, quadruple_t *quad) pen_type_create(PEN_PWG, quad->name_attr)); msg->add_attribute(msg, attr); - DBG2(DBG_IMC, " %N: %s", pwg_attr_names, quad->patches_attr, patches); + /* remove any trailing LF from patches string for logging */ + len = strlen(patches); + if (len && (patches[len - 1] == '\n')) + { + len--; + } + DBG2(DBG_IMC, " %N:%s%.*s", pwg_attr_names, quad->patches_attr, + len ? "\n" : " ", len, patches); attr = generic_attr_string_create(chunk_from_str(patches), pen_type_create(PEN_PWG, quad->patches_attr)); msg->add_attribute(msg, attr); diff --git a/src/libimcv/plugins/imv_hcd/imv_hcd_agent.c b/src/libimcv/plugins/imv_hcd/imv_hcd_agent.c index 5fce45d73..8cfa4d104 100644 --- a/src/libimcv/plugins/imv_hcd/imv_hcd_agent.c +++ b/src/libimcv/plugins/imv_hcd/imv_hcd_agent.c @@ -260,20 +260,36 @@ static TNC_Result receive_msg(private_imv_hcd_agent_t *this, imv_state_t *state, case PWG_HCD_VENDOR_NAME: case PWG_HCD_TIME_SOURCE: case PWG_HCD_FIRMWARE_NAME: - case PWG_HCD_FIRMWARE_PATCHES: case PWG_HCD_FIRMWARE_STRING_VERSION: case PWG_HCD_RESIDENT_APP_NAME: - case PWG_HCD_RESIDENT_APP_PATCHES: case PWG_HCD_RESIDENT_APP_STRING_VERSION: case PWG_HCD_USER_APP_NAME: - case PWG_HCD_USER_APP_PATCHES: case PWG_HCD_USER_APP_STRING_VERSION: { chunk_t value; value = attr->get_value(attr); DBG2(DBG_IMV, " %N: %.*s", pwg_attr_names, type.type, - value.len, value.ptr); + value.len, value.ptr); + break; + } + case PWG_HCD_FIRMWARE_PATCHES: + case PWG_HCD_RESIDENT_APP_PATCHES: + case PWG_HCD_USER_APP_PATCHES: + { + chunk_t value; + size_t len; + + value = attr->get_value(attr); + len = value.len; + + /* remove any trailing LF from patches string */ + if (len && (value.ptr[len - 1] == '\n')) + { + len--; + } + DBG2(DBG_IMV, " %N:%s%.*s", pwg_attr_names, type.type, + len ? "\n" : " ", len, value.ptr); break; } case PWG_HCD_FIRMWARE_VERSION: @@ -306,7 +322,7 @@ static TNC_Result receive_msg(private_imv_hcd_agent_t *this, imv_state_t *state, attr_cast = (generic_attr_bool_t*)attr; status = attr_cast->get_status(attr_cast); DBG2(DBG_IMV, " %N: %s", pwg_attr_names, type.type, - status ? "yes" : "no"); + status ? "yes" : "no"); if (type.type == PWG_HCD_USER_APP_ENABLED && !status) { @@ -323,7 +339,7 @@ static TNC_Result receive_msg(private_imv_hcd_agent_t *this, imv_state_t *state, attr_cast = (ietf_attr_fwd_enabled_t*)attr; fwd_status = attr_cast->get_status(attr_cast); DBG2(DBG_IMV, " %N: %N", pwg_attr_names, type.type, - os_fwd_status_names, fwd_status); + os_fwd_status_names, fwd_status); break; } |