mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 14:51:11 +01:00
r14731@catbus: nickm | 2007-08-20 12:02:09 -0400
Clean up authdir_X functions a little. svn:r11220
This commit is contained in:
parent
9958dc8d53
commit
76d40372fc
2 changed files with 15 additions and 11 deletions
|
@ -3295,6 +3295,7 @@ int authdir_mode_handles_descs(or_options_t *options);
|
||||||
int authdir_mode_publishes_statuses(or_options_t *options);
|
int authdir_mode_publishes_statuses(or_options_t *options);
|
||||||
int authdir_mode_tests_reachability(or_options_t *options);
|
int authdir_mode_tests_reachability(or_options_t *options);
|
||||||
int authdir_mode_bridge(or_options_t *options);
|
int authdir_mode_bridge(or_options_t *options);
|
||||||
|
int authdir_mode_any_nonbridge(or_options_t *options);
|
||||||
int clique_mode(or_options_t *options);
|
int clique_mode(or_options_t *options);
|
||||||
int server_mode(or_options_t *options);
|
int server_mode(or_options_t *options);
|
||||||
int advertised_server_mode(void);
|
int advertised_server_mode(void);
|
||||||
|
|
|
@ -367,7 +367,7 @@ init_keys(void)
|
||||||
|
|
||||||
/* 1a. Read v3 directory authority key/cert information. */
|
/* 1a. Read v3 directory authority key/cert information. */
|
||||||
memset(v3_digest, 0, sizeof(v3_digest));
|
memset(v3_digest, 0, sizeof(v3_digest));
|
||||||
if (authdir_mode(options) && options->V3AuthoritativeDir) {
|
if (authdir_mode_v3(options)) {
|
||||||
init_v3_authority_keys(keydir);
|
init_v3_authority_keys(keydir);
|
||||||
if (get_my_v3_authority_cert()) {
|
if (get_my_v3_authority_cert()) {
|
||||||
crypto_pk_get_digest(get_my_v3_authority_cert()->identity_key,
|
crypto_pk_get_digest(get_my_v3_authority_cert()->identity_key,
|
||||||
|
@ -735,14 +735,23 @@ authdir_mode_v3(or_options_t *options)
|
||||||
{
|
{
|
||||||
return authdir_mode(options) && options->V3AuthoritativeDir != 0;
|
return authdir_mode(options) && options->V3AuthoritativeDir != 0;
|
||||||
}
|
}
|
||||||
|
/** DOCDOC */
|
||||||
|
int
|
||||||
|
authdir_mode_any_nonbridge(or_options_t *options)
|
||||||
|
{
|
||||||
|
return authdir_mode(options) &&
|
||||||
|
(options->V1AuthoritativeDir ||
|
||||||
|
options->V2AuthoritativeDir ||
|
||||||
|
options->V3AuthoritativeDir);
|
||||||
|
}
|
||||||
/** Return true iff we are an authoritative directory server that
|
/** Return true iff we are an authoritative directory server that
|
||||||
* is willing to receive or serve descriptors on its dirport.
|
* is willing to receive or serve descriptors on its dirport.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
authdir_mode_handles_descs(or_options_t *options)
|
authdir_mode_handles_descs(or_options_t *options)
|
||||||
{
|
{
|
||||||
return authdir_mode_v1(options) || authdir_mode_v2(options) ||
|
return authdir_mode_any_nonbridge(options) ||
|
||||||
authdir_mode_bridge(options);
|
authdir_mode_bridge(options);
|
||||||
}
|
}
|
||||||
/** Return true iff we are an authoritative directory server that
|
/** Return true iff we are an authoritative directory server that
|
||||||
* publishes its own network statuses.
|
* publishes its own network statuses.
|
||||||
|
@ -752,10 +761,7 @@ authdir_mode_publishes_statuses(or_options_t *options)
|
||||||
{
|
{
|
||||||
if (authdir_mode_bridge(options))
|
if (authdir_mode_bridge(options))
|
||||||
return 0;
|
return 0;
|
||||||
return authdir_mode(options) &&
|
return authdir_mode_any_nonbridge(options);
|
||||||
(options->V1AuthoritativeDir ||
|
|
||||||
options->V2AuthoritativeDir ||
|
|
||||||
options->V3AuthoritativeDir);
|
|
||||||
}
|
}
|
||||||
/** Return true iff we are an authoritative directory server that
|
/** Return true iff we are an authoritative directory server that
|
||||||
* tests reachability of the descriptors it learns about.
|
* tests reachability of the descriptors it learns about.
|
||||||
|
@ -763,10 +769,7 @@ authdir_mode_publishes_statuses(or_options_t *options)
|
||||||
int
|
int
|
||||||
authdir_mode_tests_reachability(or_options_t *options)
|
authdir_mode_tests_reachability(or_options_t *options)
|
||||||
{
|
{
|
||||||
return authdir_mode(options) &&
|
return authdir_mode_any_nonbridge(options);
|
||||||
(options->V1AuthoritativeDir ||
|
|
||||||
options->V2AuthoritativeDir ||
|
|
||||||
options->V3AuthoritativeDir);
|
|
||||||
}
|
}
|
||||||
/** Return true iff we believe ourselves to be a bridge authoritative
|
/** Return true iff we believe ourselves to be a bridge authoritative
|
||||||
* directory server.
|
* directory server.
|
||||||
|
|
Loading…
Add table
Reference in a new issue