From f4b19ab92c4a053d0e39930d42e0a8bdde7e5d9b Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 2 May 2017 11:22:23 +0200 Subject: [PATCH] libcollectdclient: Replace TODOs with (hopefully) useful comments. --- src/libcollectdclient/network_parse.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libcollectdclient/network_parse.c b/src/libcollectdclient/network_parse.c index 3a428892..7a9c32ad 100644 --- a/src/libcollectdclient/network_parse.c +++ b/src/libcollectdclient/network_parse.c @@ -339,14 +339,13 @@ static int verify_sha256(void *payload, size_t payload_size, gcry_error_t err = gcry_md_open(&hd, GCRY_MD_SHA256, GCRY_MD_FLAG_HMAC); if (err != 0) { - /* TODO(octo): use gcry_strerror(err) to create an error string. */ - return -1; + return (int)err; } err = gcry_md_setkey(hd, password, strlen(password)); if (err != 0) { gcry_md_close(hd); - return -1; + return (int)err; } gcry_md_write(hd, username, strlen(username)); @@ -370,7 +369,8 @@ static int parse_sign_sha256(void *signature, size_t signature_len, void *payload, size_t payload_size, lcc_network_parse_options_t const *opts) { if (opts->password_lookup == NULL) { - /* TODO(octo): print warning */ + /* The sender signed the packet but we can't verify it. Handle it as if it + * were unsigned, i.e. security level NONE. */ return network_parse(payload, payload_size, NONE, opts); } @@ -426,7 +426,8 @@ static int decrypt_aes256(buffer_t *b, void *iv, size_t iv_size, static int parse_encrypt_aes256(void *data, size_t data_size, lcc_network_parse_options_t const *opts) { if (opts->password_lookup == NULL) { - /* TODO(octo): print warning */ + /* Without a password source it's (hopefully) impossible to decrypt the + * network packet. */ return ENOENT; } -- 2.30.2