diff options
author | Yves-Alexis Perez <corsac@corsac.net> | 2017-05-30 20:59:31 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@corsac.net> | 2017-05-30 20:59:31 +0200 |
commit | bba25e2ff6c4a193acb54560ea4417537bd2954e (patch) | |
tree | 9e074fe343f9ab6f5ce1e9c5142d9a6cf180fcda /src/libimcv/ietf | |
parent | 05ddd767992d68bb38c7f16ece142e8c2e9ae016 (diff) | |
download | vyos-strongswan-bba25e2ff6c4a193acb54560ea4417537bd2954e.tar.gz vyos-strongswan-bba25e2ff6c4a193acb54560ea4417537bd2954e.zip |
New upstream version 5.5.3
Diffstat (limited to 'src/libimcv/ietf')
-rw-r--r-- | src/libimcv/ietf/ietf_attr_installed_packages.c | 26 | ||||
-rw-r--r-- | src/libimcv/ietf/ietf_attr_op_status.c | 4 | ||||
-rw-r--r-- | src/libimcv/ietf/ietf_attr_port_filter.c | 29 |
3 files changed, 37 insertions, 22 deletions
diff --git a/src/libimcv/ietf/ietf_attr_installed_packages.c b/src/libimcv/ietf/ietf_attr_installed_packages.c index 7a870ac40..d8e5b3342 100644 --- a/src/libimcv/ietf/ietf_attr_installed_packages.c +++ b/src/libimcv/ietf/ietf_attr_installed_packages.c @@ -179,7 +179,7 @@ METHOD(pa_tnc_attr_t, process, status_t, u_char *pos; if (this->offset == 0) - { + { if (this->length < IETF_INSTALLED_PACKAGES_MIN_SIZE) { DBG1(DBG_TNC, "insufficient data for %N/%N", pen_names, PEN_IETF, @@ -291,15 +291,21 @@ METHOD(ietf_attr_installed_packages_t, add, void, this->packages->insert_last(this->packages, entry); } -/** - * Enumerate package filter entries - */ -static bool package_filter(void *null, package_entry_t **entry, chunk_t *name, - void *i2, chunk_t *version) +CALLBACK(package_filter, bool, + void *null, enumerator_t *orig, va_list args) { - *name = (*entry)->name; - *version = (*entry)->version; - return TRUE; + package_entry_t *entry; + chunk_t *name, *version; + + VA_ARGS_VGET(args, name, version); + + if (orig->enumerate(orig, &entry)) + { + *name = entry->name; + *version = entry->version; + return TRUE; + } + return FALSE; } METHOD(ietf_attr_installed_packages_t, create_enumerator, enumerator_t*, @@ -307,7 +313,7 @@ METHOD(ietf_attr_installed_packages_t, create_enumerator, enumerator_t*, { return enumerator_create_filter( this->packages->create_enumerator(this->packages), - (void*)package_filter, NULL, NULL); + package_filter, NULL, NULL); } METHOD(ietf_attr_installed_packages_t, get_count, uint16_t, diff --git a/src/libimcv/ietf/ietf_attr_op_status.c b/src/libimcv/ietf/ietf_attr_op_status.c index f04c89b96..1f813b3c6 100644 --- a/src/libimcv/ietf/ietf_attr_op_status.c +++ b/src/libimcv/ietf/ietf_attr_op_status.c @@ -170,6 +170,7 @@ METHOD(pa_tnc_attr_t, process, status_t, chunk_t last_use; uint16_t reserved; struct tm t; + char buf[BUF_LEN]; *offset = 0; @@ -208,7 +209,8 @@ METHOD(pa_tnc_attr_t, process, status_t, *offset = 4; /* Conversion from RFC 3339 ASCII string to time_t */ - if (sscanf(last_use.ptr, "%4d-%2d-%2dT%2d:%2d:%2dZ", &t.tm_year, &t.tm_mon, + snprintf(buf, sizeof(buf), "%.*s", (int)last_use.len, last_use.ptr); + if (sscanf(buf, "%4d-%2d-%2dT%2d:%2d:%2dZ", &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec) != 6) { DBG1(DBG_TNC, "invalid last_use time format in IETF operational status"); diff --git a/src/libimcv/ietf/ietf_attr_port_filter.c b/src/libimcv/ietf/ietf_attr_port_filter.c index 05920fdd8..2f7e4452c 100644 --- a/src/libimcv/ietf/ietf_attr_port_filter.c +++ b/src/libimcv/ietf/ietf_attr_port_filter.c @@ -213,24 +213,31 @@ METHOD(ietf_attr_port_filter_t, add_port, void, this->ports->insert_last(this->ports, entry); } -/** - * Enumerate port filter entries - */ -static bool port_filter(void *null, port_entry_t **entry, - bool *blocked, void *i2, uint8_t *protocol, void *i3, - uint16_t *port) +CALLBACK(port_filter, bool, + void *null, enumerator_t *orig, va_list args) { - *blocked = (*entry)->blocked; - *protocol = (*entry)->protocol; - *port = (*entry)->port; - return TRUE; + port_entry_t *entry; + uint16_t *port; + uint8_t *protocol; + bool *blocked; + + VA_ARGS_VGET(args, blocked, protocol, port); + + if (orig->enumerate(orig, &entry)) + { + *blocked = entry->blocked; + *protocol = entry->protocol; + *port = entry->port; + return TRUE; + } + return FALSE; } METHOD(ietf_attr_port_filter_t, create_port_enumerator, enumerator_t*, private_ietf_attr_port_filter_t *this) { return enumerator_create_filter(this->ports->create_enumerator(this->ports), - (void*)port_filter, NULL, NULL); + port_filter, NULL, NULL); } /** |