Commit f384c40b authored by Daniel Salzman's avatar Daniel Salzman

libknot/tsig: remove redundant newline stripping if key from file

parent cb8f9afd
......@@ -151,14 +151,6 @@ int knot_tsig_key_init_file(knot_tsig_key_t *key, const char *filename)
return KNOT_EMALF;
}
// strip trailing newline
assert(line);
if (read > 0 && line[read - 1] == '\n') {
line[read - 1] = '\0';
read -= 1;
}
int result = knot_tsig_key_init_str(key, line);
memset(line, 0, line_size);
......
......@@ -149,8 +149,8 @@ int main(int argc, char *argv[])
};
test_init_file_content("sha512", &key,
"hmac-sha512:django.one:V2hvJ3MgdGhhdCB"
"zdHVtYmxpbmcgYXJvdW5kIGluIHRoZSBkYXJrP"
"w==\n\n\n");
"zdHVtYmxpbmcgYXJvdW5kIGluIHRoZSBkYXJrP"
"w==\n\n\n");
}
{
static const knot_tsig_key_t key = {
......@@ -161,7 +161,7 @@ int main(int argc, char *argv[])
};
test_init_file_content("sha512 without newline", &key,
"hmac-sha512:django.two:UHJlcGFyZSB0byB"
"nZXQgd2luZ2VkIQ==");
"nZXQgd2luZ2VkIQ==");
}
{
static const knot_tsig_key_t key = {
......
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