2019-10-28 14:47:44 +01:00
|
|
|
/* Copyright (c) 2001 Matej Pfajfar.
|
|
|
|
* Copyright (c) 2001-2004, Roger Dingledine.
|
|
|
|
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
|
|
|
* Copyright (c) 2007-2019, The Tor Project, Inc. */
|
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file dirauth_config.h
|
|
|
|
* @brief Header for feature/dirauth/dirauth_config.c
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef TOR_FEATURE_DIRAUTH_DIRAUTH_CONFIG_H
|
|
|
|
#define TOR_FEATURE_DIRAUTH_DIRAUTH_CONFIG_H
|
|
|
|
|
2019-11-14 16:52:21 +01:00
|
|
|
struct or_options_t;
|
2019-10-28 14:47:44 +01:00
|
|
|
|
2019-10-28 15:29:00 +01:00
|
|
|
#ifdef HAVE_MODULE_DIRAUTH
|
|
|
|
|
2019-10-30 06:38:23 +01:00
|
|
|
#include "lib/cc/torint.h"
|
|
|
|
|
2019-11-14 16:52:21 +01:00
|
|
|
int options_validate_dirauth_mode(const struct or_options_t *old_options,
|
|
|
|
struct or_options_t *options,
|
2019-10-28 14:47:44 +01:00
|
|
|
char **msg);
|
|
|
|
|
2019-11-14 16:52:21 +01:00
|
|
|
int options_validate_dirauth_bandwidth(const struct or_options_t *old_options,
|
|
|
|
struct or_options_t *options,
|
2019-10-29 08:57:04 +01:00
|
|
|
char **msg);
|
|
|
|
|
2019-11-14 16:52:21 +01:00
|
|
|
int options_validate_dirauth_schedule(const struct or_options_t *old_options,
|
|
|
|
struct or_options_t *options,
|
2019-10-28 14:47:44 +01:00
|
|
|
char **msg);
|
|
|
|
|
2019-11-14 16:52:21 +01:00
|
|
|
int options_validate_dirauth_testing(const struct or_options_t *old_options,
|
|
|
|
struct or_options_t *options,
|
2019-10-28 14:47:44 +01:00
|
|
|
char **msg);
|
|
|
|
|
2019-11-14 16:52:21 +01:00
|
|
|
int options_act_dirauth(const struct or_options_t *old_options);
|
|
|
|
int options_act_dirauth_mtbf(const struct or_options_t *old_options);
|
|
|
|
int options_act_dirauth_stats(const struct or_options_t *old_options,
|
2019-10-30 06:38:23 +01:00
|
|
|
bool *print_notice_out);
|
2019-10-28 14:47:44 +01:00
|
|
|
|
2019-12-15 17:46:55 +01:00
|
|
|
extern const struct config_format_t dirauth_options_fmt;
|
|
|
|
|
2019-11-05 03:01:29 +01:00
|
|
|
#else /* !defined(HAVE_MODULE_DIRAUTH) */
|
2019-10-28 15:29:00 +01:00
|
|
|
|
|
|
|
/** When tor is compiled with the dirauth module disabled, it can't be
|
|
|
|
* configured as a directory authority.
|
|
|
|
*
|
|
|
|
* Returns -1 and sets msg to a newly allocated string, if AuthoritativeDir
|
|
|
|
* is set in options. Otherwise returns 0. */
|
|
|
|
static inline int
|
2019-11-14 16:52:21 +01:00
|
|
|
options_validate_dirauth_mode(const struct or_options_t *old_options,
|
|
|
|
struct or_options_t *options,
|
2019-10-28 15:29:00 +01:00
|
|
|
char **msg)
|
|
|
|
{
|
|
|
|
(void)old_options;
|
|
|
|
|
|
|
|
/* Only check the primary option for now, #29211 will disable more
|
|
|
|
* options. */
|
|
|
|
if (options->AuthoritativeDir) {
|
|
|
|
/* REJECT() this configuration */
|
|
|
|
*msg = tor_strdup("This tor was built with dirauth mode disabled. "
|
|
|
|
"It can not be configured with AuthoritativeDir 1.");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-10-29 08:57:04 +01:00
|
|
|
#define options_validate_dirauth_bandwidth(old_options, options, msg) \
|
|
|
|
(((void)(old_options)),((void)(options)),((void)(msg)),0)
|
2019-10-28 15:29:00 +01:00
|
|
|
#define options_validate_dirauth_schedule(old_options, options, msg) \
|
|
|
|
(((void)(old_options)),((void)(options)),((void)(msg)),0)
|
|
|
|
#define options_validate_dirauth_testing(old_options, options, msg) \
|
|
|
|
(((void)(old_options)),((void)(options)),((void)(msg)),0)
|
|
|
|
#define options_validate_dirauth_testing(old_options, options, msg) \
|
|
|
|
(((void)(old_options)),((void)(options)),((void)(msg)),0)
|
|
|
|
|
|
|
|
#define options_act_dirauth(old_options) \
|
|
|
|
(((void)(old_options)),0)
|
2019-10-30 06:38:23 +01:00
|
|
|
#define options_act_dirauth_mtbf(old_options) \
|
|
|
|
(((void)(old_options)),0)
|
|
|
|
|
|
|
|
#define options_act_dirauth_stats(old_options, print_notice_out) \
|
|
|
|
(((void)(old_options)),((void)(print_notice_out)),0)
|
|
|
|
|
2019-10-28 15:29:00 +01:00
|
|
|
#endif /* defined(HAVE_MODULE_DIRAUTH) */
|
|
|
|
|
2019-10-28 14:47:44 +01:00
|
|
|
#endif /* !defined(TOR_FEATURE_DIRAUTH_DIRAUTH_CONFIG_H) */
|