From: W.C.A. Wijngaards Date: Fri, 20 Jun 2025 10:13:51 +0000 (+0200) Subject: - xfr-tsig, unit test for tsig_sign_query. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2c609b9a5b334606035695bf728f2f96800853e;p=thirdparty%2Funbound.git - xfr-tsig, unit test for tsig_sign_query. --- diff --git a/testcode/unitmain.c b/testcode/unitmain.c index 059206678..e88313ee7 100644 --- a/testcode/unitmain.c +++ b/testcode/unitmain.c @@ -1333,7 +1333,6 @@ main(int argc, char* argv[]) if(NSS_NoDB_Init(".") != SECSuccess) fatal_exit("could not init NSS"); #endif /* HAVE_SSL or HAVE_NSS*/ - tsig_test(); authzone_test(); neg_test(); rnd_test(); @@ -1363,6 +1362,7 @@ main(int argc, char* argv[]) #ifdef HAVE_NGTCP2 doq_test(); #endif /* HAVE_NGTCP2 */ + tsig_test(); if(log_get_lock()) { lock_basic_destroy((lock_basic_type*)log_get_lock()); } diff --git a/testcode/unittsig.c b/testcode/unittsig.c index 197623175..a352100c7 100644 --- a/testcode/unittsig.c +++ b/testcode/unittsig.c @@ -40,15 +40,18 @@ #include "config.h" #include "util/tsig.h" #include "util/config_file.h" +#include "util/net_help.h" #include "testcode/unitmain.h" +#include "sldns/parseutil.h" #include "sldns/sbuffer.h" +#include "sldns/wire2str.h" #include #define xstr(s) str(s) #define str(s) #s #define SRCDIRSTR xstr(SRCDIR) -/** verbosity for this file */ +/** verbosity for this file, 0 no, 1 print some, 2 print packet dumps */ static int vtest = 0; /** @@ -56,15 +59,28 @@ static int vtest = 0; * * The tsig test files have this syntax. It is made of lines, lines started * with # are a comment. empty lines are ignored. - * file_algorithm + * file-algorithm * The name is like md5, sha1, sha256 and if the algorithm is not * supported at the test run time, the file is skipped, silently. + * * tsig-key: * the following lines define name:, algorithm: and secret: * and it adds a tsig-key that can be used. * del-key * The tsig key is deleted, from the in-memory key table. * + * packet + * A packet in hex dump, on the following lines. Until 'endpacket'. + * It can be used to sign or verify. + * check-packet + * A packet in hex dump, on the following lines. Until 'endpacket'. + * It is compared to the packet buffer, and the test fails if not equal. + * + * tsig-sign-query