From a81a7365e671cf02d88448e6c536c678a5a9d67c Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 2 May 2017 11:21:48 +0200 Subject: [PATCH] libcollectdclient: Write only metrics with the requested security level. --- src/libcollectdclient/network_parse.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libcollectdclient/network_parse.c b/src/libcollectdclient/network_parse.c index 83a05d4f..3a428892 100644 --- a/src/libcollectdclient/network_parse.c +++ b/src/libcollectdclient/network_parse.c @@ -529,9 +529,11 @@ static int network_parse(void *data, size_t data_size, lcc_security_level_t sl, return EINVAL; } - /* TODO(octo): skip if current_security_level < required_security_level */ + int status = 0; - int status = opts->writer(&vl); + /* Write metrics if they have the required security level. */ + if (sl >= opts->security_level) + status = opts->writer(&vl); free(vl.values); free(vl.values_types); -- 2.30.2