diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2013-12-31 13:13:32 +0100 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2014-01-13 12:06:17 +0100 |
commit | 81d49c5cfd19d8cc0531f2ffec560852e3ae033d (patch) | |
tree | ebfc1121cf7b22816ee3711a858bb83923ac1e6e /src/libimcv | |
parent | 6009b6e0dd2ea3dbb033958b09448b5c602d6fc0 (diff) | |
download | strongswan-81d49c5cfd19d8cc0531f2ffec560852e3ae033d.tar.bz2 strongswan-81d49c5cfd19d8cc0531f2ffec560852e3ae033d.tar.xz |
Allow reason strings to be used as workitem result string
Diffstat (limited to 'src/libimcv')
-rw-r--r-- | src/libimcv/imv/imv_reason_string.c | 11 | ||||
-rw-r--r-- | src/libimcv/imv/imv_reason_string.h | 3 | ||||
-rw-r--r-- | src/libimcv/plugins/imv_os/imv_os_state.c | 2 | ||||
-rw-r--r-- | src/libimcv/plugins/imv_scanner/imv_scanner_state.c | 2 | ||||
-rw-r--r-- | src/libimcv/plugins/imv_test/imv_test_state.c | 2 |
5 files changed, 14 insertions, 6 deletions
diff --git a/src/libimcv/imv/imv_reason_string.c b/src/libimcv/imv/imv_reason_string.c index d1447ec35..c09b7bdba 100644 --- a/src/libimcv/imv/imv_reason_string.c +++ b/src/libimcv/imv/imv_reason_string.c @@ -35,6 +35,11 @@ struct private_imv_reason_string_t { char *lang; /** + * Separator concatenating multiple reasons + */ + char *separator; + + /** * Contains the concatenated reasons */ chunk_t reasons; @@ -51,7 +56,8 @@ METHOD(imv_reason_string_t, add_reason, void, if (this->reasons.len) { /* append any further reasons */ - this->reasons = chunk_cat("mcc", this->reasons, chunk_from_chars('\n'), + this->reasons = chunk_cat("mcc", this->reasons, + chunk_from_str(this->separator), chunk_create(s_reason, strlen(s_reason))); } else @@ -77,7 +83,7 @@ METHOD(imv_reason_string_t, destroy, void, /** * Described in header. */ -imv_reason_string_t *imv_reason_string_create(char *lang) +imv_reason_string_t *imv_reason_string_create(char *lang, char *separator) { private_imv_reason_string_t *this; @@ -88,6 +94,7 @@ imv_reason_string_t *imv_reason_string_create(char *lang) .destroy = _destroy, }, .lang = lang, + .separator = separator, ); return &this->public; diff --git a/src/libimcv/imv/imv_reason_string.h b/src/libimcv/imv/imv_reason_string.h index cb4c27f93..c35ec36cc 100644 --- a/src/libimcv/imv/imv_reason_string.h +++ b/src/libimcv/imv/imv_reason_string.h @@ -58,7 +58,8 @@ struct imv_reason_string_t { * Creates an Reason String object * * @param lang Preferred language + * @param separator String separating multiple reasons */ - imv_reason_string_t* imv_reason_string_create(char *lang); + imv_reason_string_t* imv_reason_string_create(char *lang, char *separator); #endif /** IMV_REASON_STRING_H_ @}*/ diff --git a/src/libimcv/plugins/imv_os/imv_os_state.c b/src/libimcv/plugins/imv_os/imv_os_state.c index f6d904c3c..f7e9a6bc6 100644 --- a/src/libimcv/plugins/imv_os/imv_os_state.c +++ b/src/libimcv/plugins/imv_os/imv_os_state.c @@ -421,7 +421,7 @@ METHOD(imv_state_t, get_reason_string, bool, /* Instantiate a TNC Reason String object */ DESTROY_IF(this->reason_string); - this->reason_string = imv_reason_string_create(*reason_language); + this->reason_string = imv_reason_string_create(*reason_language, "\n"); if (this->count_update || this->count_blacklist) { diff --git a/src/libimcv/plugins/imv_scanner/imv_scanner_state.c b/src/libimcv/plugins/imv_scanner/imv_scanner_state.c index 4c570c46a..6658683e6 100644 --- a/src/libimcv/plugins/imv_scanner/imv_scanner_state.c +++ b/src/libimcv/plugins/imv_scanner/imv_scanner_state.c @@ -281,7 +281,7 @@ METHOD(imv_state_t, get_reason_string, bool, /* Instantiate a TNC Reason String object */ DESTROY_IF(this->reason_string); - this->reason_string = imv_reason_string_create(*reason_language); + this->reason_string = imv_reason_string_create(*reason_language, "\n"); if (this->rec != TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION) { this->reason_string->add_reason(this->reason_string, reasons); diff --git a/src/libimcv/plugins/imv_test/imv_test_state.c b/src/libimcv/plugins/imv_test/imv_test_state.c index 0da09df67..f05db8027 100644 --- a/src/libimcv/plugins/imv_test/imv_test_state.c +++ b/src/libimcv/plugins/imv_test/imv_test_state.c @@ -228,7 +228,7 @@ METHOD(imv_state_t, get_reason_string, bool, /* Instantiate a TNC Reason String object */ DESTROY_IF(this->reason_string); - this->reason_string = imv_reason_string_create(*reason_language); + this->reason_string = imv_reason_string_create(*reason_language, "\n"); this->reason_string->add_reason(this->reason_string, reasons); *reason_string = this->reason_string->get_encoding(this->reason_string); |