mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 13:13:44 +01:00
dirauth: Rename function for better clarity
Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
33414e5494
commit
7b4d9fabef
@ -67,7 +67,7 @@ add_trusted_dir_to_nodelist_addr_set(const dir_server_t *dir)
|
|||||||
/** Go over the trusted directory server list and add their address(es) to the
|
/** Go over the trusted directory server list and add their address(es) to the
|
||||||
* nodelist address set. This is called everytime a new consensus is set. */
|
* nodelist address set. This is called everytime a new consensus is set. */
|
||||||
MOCK_IMPL(void,
|
MOCK_IMPL(void,
|
||||||
dirlist_add_trusted_addresses, (void))
|
dirlist_add_trusted_dir_addresses, (void))
|
||||||
{
|
{
|
||||||
if (!trusted_dir_servers) {
|
if (!trusted_dir_servers) {
|
||||||
return;
|
return;
|
||||||
|
@ -44,6 +44,6 @@ void dir_server_add(dir_server_t *ent);
|
|||||||
void clear_dir_servers(void);
|
void clear_dir_servers(void);
|
||||||
void dirlist_free_all(void);
|
void dirlist_free_all(void);
|
||||||
|
|
||||||
MOCK_DECL(void, dirlist_add_trusted_addresses, (void));
|
MOCK_DECL(void, dirlist_add_trusted_dir_addresses, (void));
|
||||||
|
|
||||||
#endif /* !defined(TOR_DIRLIST_H) */
|
#endif /* !defined(TOR_DIRLIST_H) */
|
||||||
|
@ -691,7 +691,7 @@ nodelist_set_consensus(networkstatus_t *ns)
|
|||||||
} SMARTLIST_FOREACH_END(node);
|
} SMARTLIST_FOREACH_END(node);
|
||||||
/* Then, add all trusted configured directories. Some might not be in the
|
/* Then, add all trusted configured directories. Some might not be in the
|
||||||
* consensus so make sure we know them. */
|
* consensus so make sure we know them. */
|
||||||
dirlist_add_trusted_addresses();
|
dirlist_add_trusted_dir_addresses();
|
||||||
|
|
||||||
if (! authdir) {
|
if (! authdir) {
|
||||||
SMARTLIST_FOREACH_BEGIN(the_nodelist->nodes, node_t *, node) {
|
SMARTLIST_FOREACH_BEGIN(the_nodelist->nodes, node_t *, node) {
|
||||||
|
@ -33,7 +33,7 @@ mock_networkstatus_get_latest_consensus_by_flavor(consensus_flavor_t f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mock_dirlist_add_trusted_addresses(void)
|
mock_dirlist_add_trusted_dir_addresses(void)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -105,8 +105,8 @@ test_nodelist(void *arg)
|
|||||||
mock_networkstatus_get_latest_consensus_by_flavor);
|
mock_networkstatus_get_latest_consensus_by_flavor);
|
||||||
MOCK(get_estimated_address_per_node,
|
MOCK(get_estimated_address_per_node,
|
||||||
mock_get_estimated_address_per_node);
|
mock_get_estimated_address_per_node);
|
||||||
MOCK(dirlist_add_trusted_addresses,
|
MOCK(dirlist_add_trusted_dir_addresses,
|
||||||
mock_dirlist_add_trusted_addresses);
|
mock_dirlist_add_trusted_dir_addresses);
|
||||||
|
|
||||||
dummy_ns = tor_malloc_zero(sizeof(*dummy_ns));
|
dummy_ns = tor_malloc_zero(sizeof(*dummy_ns));
|
||||||
dummy_ns->flavor = FLAV_MICRODESC;
|
dummy_ns->flavor = FLAV_MICRODESC;
|
||||||
@ -123,8 +123,9 @@ test_nodelist(void *arg)
|
|||||||
addr_per_node = 1024;
|
addr_per_node = 1024;
|
||||||
|
|
||||||
/* No node no nothing. The lookups should be empty. We've mocked the
|
/* No node no nothing. The lookups should be empty. We've mocked the
|
||||||
* dirlist_add_trusted_addresses in order for _no_ authorities to be added
|
* dirlist_add_trusted_dir_addresses in order for _no_ authorities to be
|
||||||
* to the filter else it makes this test to trigger many false positive. */
|
* added to the filter else it makes this test to trigger many false
|
||||||
|
* positive. */
|
||||||
nodelist_set_consensus(dummy_ns);
|
nodelist_set_consensus(dummy_ns);
|
||||||
|
|
||||||
/* The address set should be empty. */
|
/* The address set should be empty. */
|
||||||
@ -178,7 +179,7 @@ test_nodelist(void *arg)
|
|||||||
UNMOCK(networkstatus_get_latest_consensus);
|
UNMOCK(networkstatus_get_latest_consensus);
|
||||||
UNMOCK(networkstatus_get_latest_consensus_by_flavor);
|
UNMOCK(networkstatus_get_latest_consensus_by_flavor);
|
||||||
UNMOCK(get_estimated_address_per_node);
|
UNMOCK(get_estimated_address_per_node);
|
||||||
UNMOCK(dirlist_add_trusted_addresses);
|
UNMOCK(dirlist_add_trusted_dir_addresses);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct testcase_t address_set_tests[] = {
|
struct testcase_t address_set_tests[] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user