Stub more functions in dirvote headers to fix more of 31552.

This commit is contained in:
Nick Mathewson 2019-08-29 11:18:42 -04:00
parent 4256ee0d37
commit fb0e8966f0
3 changed files with 94 additions and 16 deletions

View File

@ -11,10 +11,25 @@ int keypin_check_and_add(const uint8_t *rsa_id_digest,
const int replace_existing_entry); const int replace_existing_entry);
int keypin_check(const uint8_t *rsa_id_digest, int keypin_check(const uint8_t *rsa_id_digest,
const uint8_t *ed25519_id_key); const uint8_t *ed25519_id_key);
int keypin_open_journal(const char *fname);
int keypin_close_journal(void); int keypin_close_journal(void);
#ifdef HAVE_MODULE_DIRAUTH
int keypin_open_journal(const char *fname);
int keypin_load_journal(const char *fname); int keypin_load_journal(const char *fname);
#else
static inline int
keypin_open_journal(const char *fname)
{
(void)fname;
return 0;
}
static inline int
keypin_load_journal(const char *fname)
{
(void)fname;
return 0;
}
#endif
void keypin_clear(void); void keypin_clear(void);
int keypin_check_lone_rsa(const uint8_t *rsa_id_digest); int keypin_check_lone_rsa(const uint8_t *rsa_id_digest);
@ -44,4 +59,3 @@ MOCK_DECL(STATIC void, keypin_add_entry_to_map, (keypin_ent_t *ent));
#endif /* defined(KEYPIN_PRIVATE) */ #endif /* defined(KEYPIN_PRIVATE) */
#endif /* !defined(TOR_KEYPIN_H) */ #endif /* !defined(TOR_KEYPIN_H) */

View File

@ -12,10 +12,13 @@
#ifndef TOR_RECV_UPLOADS_H #ifndef TOR_RECV_UPLOADS_H
#define TOR_RECV_UPLOADS_H #define TOR_RECV_UPLOADS_H
int dirserv_load_fingerprint_file(void); // for was_router_added_t.
void dirserv_free_fingerprint_list(void); #include "feature/nodelist/routerlist.h"
int dirserv_add_own_fingerprint(crypto_pk_t *pk);
void dirserv_free_fingerprint_list(void);
#ifdef HAVE_MODULE_DIRAUTH
int dirserv_load_fingerprint_file(void);
enum was_router_added_t dirserv_add_multiple_descriptors( enum was_router_added_t dirserv_add_multiple_descriptors(
const char *desc, size_t desclen, const char *desc, size_t desclen,
uint8_t purpose, uint8_t purpose,
@ -25,19 +28,46 @@ enum was_router_added_t dirserv_add_descriptor(routerinfo_t *ri,
const char **msg, const char **msg,
const char *source); const char *source);
int dirserv_would_reject_router(const routerstatus_t *rs);
int authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
int complain,
int *valid_out);
int dirserv_add_own_fingerprint(crypto_pk_t *pk);
uint32_t dirserv_router_get_status(const routerinfo_t *router, uint32_t dirserv_router_get_status(const routerinfo_t *router,
const char **msg, const char **msg,
int severity); int severity);
void dirserv_set_node_flags_from_authoritative_status(node_t *node, void dirserv_set_node_flags_from_authoritative_status(node_t *node,
uint32_t authstatus); uint32_t authstatus);
#ifdef HAVE_MODULE_DIRAUTH
int dirserv_would_reject_router(const routerstatus_t *rs);
int authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
int complain,
int *valid_out);
#else #else
static inline int static inline int
dirserv_load_fingerprint_file(void)
{
return 0;
}
static inline enum was_router_added_t
dirserv_add_multiple_descriptors(const char *desc, size_t desclen,
uint8_t purpose,
const char *source,
const char **msg)
{
(void)desc;
(void)desclen;
(void)purpose;
(void)source;
(void)msg;
return (enum was_router_added_t)0;
}
static inline enum was_router_added_t
dirserv_add_descriptor(routerinfo_t *ri,
const char **msg,
const char *source)
{
(void)ri;
(void)msg;
(void)source;
return (enum was_router_added_t)0;
}
static inline int
dirserv_would_reject_router(const routerstatus_t *rs) dirserv_would_reject_router(const routerstatus_t *rs)
{ {
(void)rs; (void)rs;
@ -54,6 +84,29 @@ authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
(void)valid_out; (void)valid_out;
return 0; return 0;
} }
static inline int
dirserv_add_own_fingerprint(crypto_pk_t *pk)
{
(void)pk;
return 0;
}
static inline uint32_t
dirserv_router_get_status(const routerinfo_t *router,
const char **msg,
int severity)
{
(void)router;
(void)msg;
(void)severity;
return 0;
}
static inline void
dirserv_set_node_flags_from_authoritative_status(node_t *node,
uint32_t authstatus)
{
(void)node;
(void)authstatus;
}
#endif #endif
#endif /* !defined(TOR_RECV_UPLOADS_H) */ #endif /* !defined(TOR_RECV_UPLOADS_H) */

View File

@ -24,16 +24,16 @@
#define REACHABILITY_TEST_CYCLE_PERIOD \ #define REACHABILITY_TEST_CYCLE_PERIOD \
(REACHABILITY_TEST_INTERVAL*REACHABILITY_MODULO_PER_TEST) (REACHABILITY_TEST_INTERVAL*REACHABILITY_MODULO_PER_TEST)
void dirserv_orconn_tls_done(const tor_addr_t *addr,
uint16_t or_port,
const char *digest_rcvd,
const struct ed25519_public_key_t *ed_id_rcvd);
void dirserv_single_reachability_test(time_t now, routerinfo_t *router); void dirserv_single_reachability_test(time_t now, routerinfo_t *router);
void dirserv_test_reachability(time_t now); void dirserv_test_reachability(time_t now);
#ifdef HAVE_MODULE_DIRAUTH #ifdef HAVE_MODULE_DIRAUTH
int dirserv_should_launch_reachability_test(const routerinfo_t *ri, int dirserv_should_launch_reachability_test(const routerinfo_t *ri,
const routerinfo_t *ri_old); const routerinfo_t *ri_old);
void dirserv_orconn_tls_done(const tor_addr_t *addr,
uint16_t or_port,
const char *digest_rcvd,
const struct ed25519_public_key_t *ed_id_rcvd);
#else #else
static inline int static inline int
dirserv_should_launch_reachability_test(const routerinfo_t *ri, dirserv_should_launch_reachability_test(const routerinfo_t *ri,
@ -43,6 +43,17 @@ dirserv_should_launch_reachability_test(const routerinfo_t *ri,
(void)ri_old; (void)ri_old;
return 0; return 0;
} }
static inline void
dirserv_orconn_tls_done(const tor_addr_t *addr,
uint16_t or_port,
const char *digest_rcvd,
const struct ed25519_public_key_t *ed_id_rcvd)
{
(void)addr;
(void)or_port;
(void)digest_rcvd;
(void)ed_id_rcvd;
}
#endif #endif
#endif /* !defined(TOR_REACHABILITY_H) */ #endif /* !defined(TOR_REACHABILITY_H) */