Commit 4988209b authored by Jan Včelák's avatar Jan Včelák 🚀

TSIG: strip whitespaces from parsed configuration string

parent ce3f65c4
......@@ -21,6 +21,7 @@
#include "libknot/errcode.h"
#include "libknot/internal/getline.h"
#include "libknot/internal/macros.h"
#include "libknot/internal/mem.h"
#include "libknot/tsig.h"
_public_
......@@ -84,7 +85,7 @@ int knot_tsig_key_init_str(knot_tsig_key_t *key, const char *params)
return KNOT_EINVAL;
}
char *copy = strdup(params);
char *copy = strstrip(params);
if (!copy) {
return KNOT_ENOMEM;
}
......
......@@ -163,6 +163,16 @@ int main(int argc, char *argv[])
"hmac-sha512:django.two:UHJlcGFyZSB0byB"
"nZXQgd2luZ2VkIQ==");
}
{
static const knot_tsig_key_t key = {
.algorithm = DNSSEC_TSIG_HMAC_SHA1,
.name = (uint8_t *)"\x4""test",
.secret.size = 1,
.secret.data = (uint8_t *)"\x5a"
};
test_init_file_content("leading and trailing white spaces", &key,
"\thmac-sha1:test:Wg== \n");
}
// tsig key duplication
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment