mirror of
https://github.com/monero-project/monero.git
synced 2025-05-02 11:26:11 -04:00
update unbound, fix unbound openssl issue on OS X
This commit is contained in:
parent
32a26332f8
commit
2d43ae8063
101 changed files with 4685 additions and 3057 deletions
25
external/unbound/testcode/checklocks.c
vendored
25
external/unbound/testcode/checklocks.c
vendored
|
@ -430,7 +430,7 @@ finish_acquire_lock(struct thr_check* thr, struct checked_lock* lock,
|
|||
* @param timedfunc: the pthread_mutex_timedlock or similar function.
|
||||
* Uses absolute timeout value.
|
||||
* @param arg: what to pass to tryfunc and timedlock.
|
||||
* @param exclusive: if lock must be exlusive (only one allowed).
|
||||
* @param exclusive: if lock must be exclusive (only one allowed).
|
||||
* @param getwr: if attempts to get writelock (or readlock) for rwlocks.
|
||||
*/
|
||||
static void
|
||||
|
@ -502,6 +502,8 @@ void
|
|||
checklock_rdlock(enum check_lock_type type, struct checked_lock* lock,
|
||||
const char* func, const char* file, int line)
|
||||
{
|
||||
if(key_deleted)
|
||||
return;
|
||||
|
||||
log_assert(type == check_lock_rwlock);
|
||||
checklock_lockit(type, lock, func, file, line,
|
||||
|
@ -520,6 +522,8 @@ void
|
|||
checklock_wrlock(enum check_lock_type type, struct checked_lock* lock,
|
||||
const char* func, const char* file, int line)
|
||||
{
|
||||
if(key_deleted)
|
||||
return;
|
||||
log_assert(type == check_lock_rwlock);
|
||||
checklock_lockit(type, lock, func, file, line,
|
||||
try_wr, timed_wr, &lock->u.rwlock, 0, 1);
|
||||
|
@ -555,6 +559,8 @@ void
|
|||
checklock_lock(enum check_lock_type type, struct checked_lock* lock,
|
||||
const char* func, const char* file, int line)
|
||||
{
|
||||
if(key_deleted)
|
||||
return;
|
||||
log_assert(type != check_lock_rwlock);
|
||||
switch(type) {
|
||||
case check_lock_mutex:
|
||||
|
@ -577,8 +583,10 @@ void
|
|||
checklock_unlock(enum check_lock_type type, struct checked_lock* lock,
|
||||
const char* func, const char* file, int line)
|
||||
{
|
||||
struct thr_check *thr = (struct thr_check*)pthread_getspecific(
|
||||
thr_debug_key);
|
||||
struct thr_check *thr;
|
||||
if(key_deleted)
|
||||
return;
|
||||
thr = (struct thr_check*)pthread_getspecific(thr_debug_key);
|
||||
checktype(type, lock, func, file, line);
|
||||
if(!thr) lock_error(lock, func, file, line, "no thread info");
|
||||
|
||||
|
@ -755,7 +763,8 @@ static void
|
|||
lock_debug_info(struct checked_lock* lock)
|
||||
{
|
||||
if(!lock) return;
|
||||
log_info("+++ Lock %x, %d %d create %s %s %d", (int)lock,
|
||||
log_info("+++ Lock %llx, %d %d create %s %s %d",
|
||||
(unsigned long long)(size_t)lock,
|
||||
lock->create_thread, lock->create_instance,
|
||||
lock->create_func, lock->create_file, lock->create_line);
|
||||
log_info("lock type: %s",
|
||||
|
@ -790,8 +799,9 @@ thread_debug_info(struct thr_check* thr)
|
|||
struct checked_lock* l = NULL;
|
||||
if(!thr) return;
|
||||
log_info("pthread id is %x", (int)thr->id);
|
||||
log_info("thread func is %x", (int)thr->func);
|
||||
log_info("thread arg is %x (%d)", (int)thr->arg,
|
||||
log_info("thread func is %llx", (unsigned long long)(size_t)thr->func);
|
||||
log_info("thread arg is %llx (%d)",
|
||||
(unsigned long long)(size_t)thr->arg,
|
||||
(thr->arg?*(int*)thr->arg:0));
|
||||
log_info("thread num is %d", thr->num);
|
||||
log_info("locks created %d", thr->locks_created);
|
||||
|
@ -801,7 +811,8 @@ thread_debug_info(struct thr_check* thr)
|
|||
w = thr->waiting;
|
||||
f = thr->holding_first;
|
||||
l = thr->holding_last;
|
||||
log_info("thread waiting for a lock: %s %x", w?"yes":"no", (int)w);
|
||||
log_info("thread waiting for a lock: %s %llx", w?"yes":"no",
|
||||
(unsigned long long)(size_t)w);
|
||||
lock_debug_info(w);
|
||||
log_info("thread holding first: %s, last: %s", f?"yes":"no",
|
||||
l?"yes":"no");
|
||||
|
|
2
external/unbound/testcode/fake_event.c
vendored
2
external/unbound/testcode/fake_event.c
vendored
|
@ -569,7 +569,7 @@ do_infra_rtt(struct replay_runtime* runtime)
|
|||
free(dp);
|
||||
}
|
||||
|
||||
/** perform exponential backoff on the timout */
|
||||
/** perform exponential backoff on the timeout */
|
||||
static void
|
||||
expon_timeout_backoff(struct replay_runtime* runtime)
|
||||
{
|
||||
|
|
3
external/unbound/testcode/lock_verify.c
vendored
3
external/unbound/testcode/lock_verify.c
vendored
|
@ -44,6 +44,9 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include "util/log.h"
|
||||
#include "util/rbtree.h"
|
||||
#include "util/locks.h"
|
||||
|
|
78
external/unbound/testcode/replay.c
vendored
78
external/unbound/testcode/replay.c
vendored
|
@ -499,8 +499,7 @@ replay_scenario_delete(struct replay_scenario* scen)
|
|||
struct replay_range* rng, *rngn;
|
||||
if(!scen)
|
||||
return;
|
||||
if(scen->title)
|
||||
free(scen->title);
|
||||
free(scen->title);
|
||||
mom = scen->mom_first;
|
||||
while(mom) {
|
||||
momn = mom->mom_next;
|
||||
|
@ -909,118 +908,127 @@ macro_assign(rbtree_t* store, char* name, char* value)
|
|||
return x->value != NULL;
|
||||
}
|
||||
|
||||
/* testbound assert function for selftest. counts the number of tests */
|
||||
#define tb_assert(x) \
|
||||
do { if(!(x)) fatal_exit("%s:%d: %s: assertion %s failed", \
|
||||
__FILE__, __LINE__, __func__, #x); \
|
||||
num_asserts++; \
|
||||
} while(0);
|
||||
|
||||
void testbound_selftest(void)
|
||||
{
|
||||
/* test the macro store */
|
||||
rbtree_t* store = macro_store_create();
|
||||
char* v;
|
||||
int r;
|
||||
log_assert(store);
|
||||
int num_asserts = 0;
|
||||
tb_assert(store);
|
||||
|
||||
v = macro_lookup(store, "bla");
|
||||
log_assert(strcmp(v, "") == 0);
|
||||
tb_assert(strcmp(v, "") == 0);
|
||||
free(v);
|
||||
|
||||
v = macro_lookup(store, "vlerk");
|
||||
log_assert(strcmp(v, "") == 0);
|
||||
tb_assert(strcmp(v, "") == 0);
|
||||
free(v);
|
||||
|
||||
r = macro_assign(store, "bla", "waarde1");
|
||||
log_assert(r);
|
||||
tb_assert(r);
|
||||
|
||||
v = macro_lookup(store, "vlerk");
|
||||
log_assert(strcmp(v, "") == 0);
|
||||
tb_assert(strcmp(v, "") == 0);
|
||||
free(v);
|
||||
|
||||
v = macro_lookup(store, "bla");
|
||||
log_assert(strcmp(v, "waarde1") == 0);
|
||||
tb_assert(strcmp(v, "waarde1") == 0);
|
||||
free(v);
|
||||
|
||||
r = macro_assign(store, "vlerk", "kanteel");
|
||||
log_assert(r);
|
||||
tb_assert(r);
|
||||
|
||||
v = macro_lookup(store, "bla");
|
||||
log_assert(strcmp(v, "waarde1") == 0);
|
||||
tb_assert(strcmp(v, "waarde1") == 0);
|
||||
free(v);
|
||||
|
||||
v = macro_lookup(store, "vlerk");
|
||||
log_assert(strcmp(v, "kanteel") == 0);
|
||||
tb_assert(strcmp(v, "kanteel") == 0);
|
||||
free(v);
|
||||
|
||||
r = macro_assign(store, "bla", "ww");
|
||||
log_assert(r);
|
||||
tb_assert(r);
|
||||
|
||||
v = macro_lookup(store, "bla");
|
||||
log_assert(strcmp(v, "ww") == 0);
|
||||
tb_assert(strcmp(v, "ww") == 0);
|
||||
free(v);
|
||||
|
||||
log_assert( macro_length("}") == 1);
|
||||
log_assert( macro_length("blabla}") == 7);
|
||||
log_assert( macro_length("bla${zoink}bla}") == 7+8);
|
||||
log_assert( macro_length("bla${zoink}${bla}bla}") == 7+8+6);
|
||||
tb_assert( macro_length("}") == 1);
|
||||
tb_assert( macro_length("blabla}") == 7);
|
||||
tb_assert( macro_length("bla${zoink}bla}") == 7+8);
|
||||
tb_assert( macro_length("bla${zoink}${bla}bla}") == 7+8+6);
|
||||
|
||||
v = macro_process(store, NULL, "");
|
||||
log_assert( v && strcmp(v, "") == 0);
|
||||
tb_assert( v && strcmp(v, "") == 0);
|
||||
free(v);
|
||||
|
||||
v = macro_process(store, NULL, "${}");
|
||||
log_assert( v && strcmp(v, "") == 0);
|
||||
tb_assert( v && strcmp(v, "") == 0);
|
||||
free(v);
|
||||
|
||||
v = macro_process(store, NULL, "blabla ${} dinges");
|
||||
log_assert( v && strcmp(v, "blabla dinges") == 0);
|
||||
tb_assert( v && strcmp(v, "blabla dinges") == 0);
|
||||
free(v);
|
||||
|
||||
v = macro_process(store, NULL, "1${$bla}2${$bla}3");
|
||||
log_assert( v && strcmp(v, "1ww2ww3") == 0);
|
||||
tb_assert( v && strcmp(v, "1ww2ww3") == 0);
|
||||
free(v);
|
||||
|
||||
v = macro_process(store, NULL, "it is ${ctime 123456}");
|
||||
log_assert( v && strcmp(v, "it is Fri Jan 2 10:17:36 1970") == 0);
|
||||
tb_assert( v && strcmp(v, "it is Fri Jan 2 10:17:36 1970") == 0);
|
||||
free(v);
|
||||
|
||||
r = macro_assign(store, "t1", "123456");
|
||||
log_assert(r);
|
||||
tb_assert(r);
|
||||
v = macro_process(store, NULL, "it is ${ctime ${$t1}}");
|
||||
log_assert( v && strcmp(v, "it is Fri Jan 2 10:17:36 1970") == 0);
|
||||
tb_assert( v && strcmp(v, "it is Fri Jan 2 10:17:36 1970") == 0);
|
||||
free(v);
|
||||
|
||||
v = macro_process(store, NULL, "it is ${ctime $t1}");
|
||||
log_assert( v && strcmp(v, "it is Fri Jan 2 10:17:36 1970") == 0);
|
||||
tb_assert( v && strcmp(v, "it is Fri Jan 2 10:17:36 1970") == 0);
|
||||
free(v);
|
||||
|
||||
r = macro_assign(store, "x", "1");
|
||||
log_assert(r);
|
||||
tb_assert(r);
|
||||
r = macro_assign(store, "y", "2");
|
||||
log_assert(r);
|
||||
tb_assert(r);
|
||||
v = macro_process(store, NULL, "${$x + $x}");
|
||||
log_assert( v && strcmp(v, "2") == 0);
|
||||
tb_assert( v && strcmp(v, "2") == 0);
|
||||
free(v);
|
||||
v = macro_process(store, NULL, "${$x - $x}");
|
||||
log_assert( v && strcmp(v, "0") == 0);
|
||||
tb_assert( v && strcmp(v, "0") == 0);
|
||||
free(v);
|
||||
v = macro_process(store, NULL, "${$y * $y}");
|
||||
log_assert( v && strcmp(v, "4") == 0);
|
||||
tb_assert( v && strcmp(v, "4") == 0);
|
||||
free(v);
|
||||
v = macro_process(store, NULL, "${32 / $y + $x + $y}");
|
||||
log_assert( v && strcmp(v, "19") == 0);
|
||||
tb_assert( v && strcmp(v, "19") == 0);
|
||||
free(v);
|
||||
|
||||
v = macro_process(store, NULL, "${32 / ${$y+$y} + ${${100*3}/3}}");
|
||||
log_assert( v && strcmp(v, "108") == 0);
|
||||
tb_assert( v && strcmp(v, "108") == 0);
|
||||
free(v);
|
||||
|
||||
v = macro_process(store, NULL, "${1 2 33 2 1}");
|
||||
log_assert( v && strcmp(v, "1 2 33 2 1") == 0);
|
||||
tb_assert( v && strcmp(v, "1 2 33 2 1") == 0);
|
||||
free(v);
|
||||
|
||||
v = macro_process(store, NULL, "${123 3 + 5}");
|
||||
log_assert( v && strcmp(v, "123 8") == 0);
|
||||
tb_assert( v && strcmp(v, "123 8") == 0);
|
||||
free(v);
|
||||
|
||||
v = macro_process(store, NULL, "${123 glug 3 + 5}");
|
||||
log_assert( v && strcmp(v, "123 glug 8") == 0);
|
||||
tb_assert( v && strcmp(v, "123 glug 8") == 0);
|
||||
free(v);
|
||||
|
||||
macro_store_delete(store);
|
||||
printf("selftest successful (%d checks).\n", num_asserts);
|
||||
}
|
||||
|
|
5
external/unbound/testcode/testbound.c
vendored
5
external/unbound/testcode/testbound.c
vendored
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
/**
|
||||
* \file
|
||||
* Exits with code 1 on a failure. 0 if all unit tests are successfull.
|
||||
* Exits with code 1 on a failure. 0 if all unit tests are successful.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -284,10 +284,9 @@ main(int argc, char* argv[])
|
|||
case 's':
|
||||
free(pass_argv[1]);
|
||||
testbound_selftest();
|
||||
printf("selftest successful\n");
|
||||
exit(0);
|
||||
case '2':
|
||||
#if (defined(HAVE_EVP_SHA256) || defined(HAVE_NSS)) && defined(USE_SHA2)
|
||||
#if (defined(HAVE_EVP_SHA256) || defined(HAVE_NSS) || defined(HAVE_NETTLE)) && defined(USE_SHA2)
|
||||
printf("SHA256 supported\n");
|
||||
exit(0);
|
||||
#else
|
||||
|
|
2
external/unbound/testcode/testpkts.h
vendored
2
external/unbound/testcode/testpkts.h
vendored
|
@ -214,7 +214,7 @@ void delete_entry(struct entry* list);
|
|||
* @param in: file to read from. Filepos must be at the start of a new line.
|
||||
* @param name: name of the file for prettier errors.
|
||||
* @param pstate: file parse state with lineno, default_ttl,
|
||||
* oirigin and prev_rr name.
|
||||
* origin and prev_rr name.
|
||||
* @param skip_whitespace: skip leftside whitespace.
|
||||
* @return: The entry read (malloced) or NULL if no entry could be read.
|
||||
*/
|
||||
|
|
2
external/unbound/testcode/unitlruhash.c
vendored
2
external/unbound/testcode/unitlruhash.c
vendored
|
@ -359,7 +359,7 @@ testlookup_unlim(struct lruhash* table, testdata_t** ref)
|
|||
static void
|
||||
test_long_table(struct lruhash* table)
|
||||
{
|
||||
/* assuming it all fits in the hastable, this check will work */
|
||||
/* assuming it all fits in the hashtable, this check will work */
|
||||
testdata_t* ref[HASHTESTMAX * 100];
|
||||
size_t i;
|
||||
memset(ref, 0, sizeof(ref));
|
||||
|
|
2
external/unbound/testcode/unitmain.c
vendored
2
external/unbound/testcode/unitmain.c
vendored
|
@ -36,7 +36,7 @@
|
|||
/**
|
||||
* \file
|
||||
* Unit test main program. Calls all the other unit tests.
|
||||
* Exits with code 1 on a failure. 0 if all unit tests are successfull.
|
||||
* Exits with code 1 on a failure. 0 if all unit tests are successful.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
2
external/unbound/testcode/unitslabhash.c
vendored
2
external/unbound/testcode/unitslabhash.c
vendored
|
@ -242,7 +242,7 @@ testlookup_unlim(struct slabhash* table, testdata_t** ref)
|
|||
static void
|
||||
test_long_table(struct slabhash* table)
|
||||
{
|
||||
/* assuming it all fits in the hastable, this check will work */
|
||||
/* assuming it all fits in the hashtable, this check will work */
|
||||
testdata_t* ref[HASHTESTMAX * 100];
|
||||
size_t i;
|
||||
memset(ref, 0, sizeof(ref));
|
||||
|
|
4
external/unbound/testcode/unitverify.c
vendored
4
external/unbound/testcode/unitverify.c
vendored
|
@ -504,12 +504,12 @@ verify_test(void)
|
|||
verifytest_file("testdata/test_signatures.6", "20080416005004");
|
||||
verifytest_file("testdata/test_signatures.7", "20070829144150");
|
||||
verifytest_file("testdata/test_signatures.8", "20070829144150");
|
||||
#if (defined(HAVE_EVP_SHA256) || defined(HAVE_NSS)) && defined(USE_SHA2)
|
||||
#if (defined(HAVE_EVP_SHA256) || defined(HAVE_NSS) || defined(HAVE_NETTLE)) && defined(USE_SHA2)
|
||||
verifytest_file("testdata/test_sigs.rsasha256", "20070829144150");
|
||||
verifytest_file("testdata/test_sigs.sha1_and_256", "20070829144150");
|
||||
verifytest_file("testdata/test_sigs.rsasha256_draft", "20090101000000");
|
||||
#endif
|
||||
#if (defined(HAVE_EVP_SHA512) || defined(HAVE_NSS)) && defined(USE_SHA2)
|
||||
#if (defined(HAVE_EVP_SHA512) || defined(HAVE_NSS) || defined(HAVE_NETTLE)) && defined(USE_SHA2)
|
||||
verifytest_file("testdata/test_sigs.rsasha512_draft", "20070829144150");
|
||||
#endif
|
||||
verifytest_file("testdata/test_sigs.hinfo", "20090107100022");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue