diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2015-08-04 21:43:49 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2015-08-18 21:25:39 +0200 |
commit | 627e4b965906a6226ebf384fedb18ca3e85c45aa (patch) | |
tree | d222cbcd2859f2df74b04b9cc3d8b4761a003115 /src/libimcv/plugins/imc_hcd/imc_hcd.c | |
parent | 6a3d035505906855cdffc4faf5b6c3ef4c6889af (diff) | |
download | strongswan-627e4b965906a6226ebf384fedb18ca3e85c45aa.tar.bz2 strongswan-627e4b965906a6226ebf384fedb18ca3e85c45aa.tar.xz |
Fixed patches format delimited by CR/LF
Diffstat (limited to 'src/libimcv/plugins/imc_hcd/imc_hcd.c')
-rw-r--r-- | src/libimcv/plugins/imc_hcd/imc_hcd.c | 30 |
1 files changed, 10 insertions, 20 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); |