mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-14 15:23:27 +01:00
config validation: make the "old_options" argument const.
We can't do this with the "options" argument yet, since several places in the code change those right now.
This commit is contained in:
parent
3656fdae98
commit
6bc2b41e54
@ -843,7 +843,7 @@ static int parse_outbound_addresses(or_options_t *options, int validate_only,
|
|||||||
char **msg);
|
char **msg);
|
||||||
static void config_maybe_load_geoip_files_(const or_options_t *options,
|
static void config_maybe_load_geoip_files_(const or_options_t *options,
|
||||||
const or_options_t *old_options);
|
const or_options_t *old_options);
|
||||||
static int options_validate_cb(void *old_options, void *options,
|
static int options_validate_cb(const void *old_options, void *options,
|
||||||
char **msg);
|
char **msg);
|
||||||
static void cleanup_protocol_warning_severity_level(void);
|
static void cleanup_protocol_warning_severity_level(void);
|
||||||
static void set_protocol_warning_severity_level(int warning_severity);
|
static void set_protocol_warning_severity_level(int warning_severity);
|
||||||
@ -1227,7 +1227,8 @@ add_default_fallback_dir_servers,(void))
|
|||||||
* user if we changed any dangerous ones.
|
* user if we changed any dangerous ones.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
validate_dir_servers(or_options_t *options, or_options_t *old_options)
|
validate_dir_servers(const or_options_t *options,
|
||||||
|
const or_options_t *old_options)
|
||||||
{
|
{
|
||||||
config_line_t *cl;
|
config_line_t *cl;
|
||||||
|
|
||||||
@ -3230,7 +3231,7 @@ compute_publishserverdescriptor(or_options_t *options)
|
|||||||
#define RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT (10)
|
#define RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT (10)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
options_validate_cb(void *old_options, void *options, char **msg)
|
options_validate_cb(const void *old_options, void *options, char **msg)
|
||||||
{
|
{
|
||||||
in_option_validation = 1;
|
in_option_validation = 1;
|
||||||
int rv = options_validate(old_options, options, msg);
|
int rv = options_validate(old_options, options, msg);
|
||||||
@ -3430,7 +3431,7 @@ options_validate_single_onion(or_options_t *options, char **msg)
|
|||||||
* On error, tor_strdup an error explanation into *<b>msg</b>.
|
* On error, tor_strdup an error explanation into *<b>msg</b>.
|
||||||
*/
|
*/
|
||||||
STATIC int
|
STATIC int
|
||||||
options_validate(or_options_t *old_options, or_options_t *options,
|
options_validate(const or_options_t *old_options, or_options_t *options,
|
||||||
char **msg)
|
char **msg)
|
||||||
{
|
{
|
||||||
config_line_t *cl;
|
config_line_t *cl;
|
||||||
|
@ -277,7 +277,7 @@ STATIC void port_cfg_free_(port_cfg_t *port);
|
|||||||
STATIC void or_options_free_(or_options_t *options);
|
STATIC void or_options_free_(or_options_t *options);
|
||||||
STATIC int options_validate_single_onion(or_options_t *options,
|
STATIC int options_validate_single_onion(or_options_t *options,
|
||||||
char **msg);
|
char **msg);
|
||||||
STATIC int options_validate(or_options_t *old_options,
|
STATIC int options_validate(const or_options_t *old_options,
|
||||||
or_options_t *options,
|
or_options_t *options,
|
||||||
char **msg);
|
char **msg);
|
||||||
STATIC int parse_transport_line(const or_options_t *options,
|
STATIC int parse_transport_line(const or_options_t *options,
|
||||||
|
@ -141,7 +141,7 @@ static const config_var_t state_vars_[] = {
|
|||||||
|
|
||||||
static int or_state_validate(or_state_t *state, char **msg);
|
static int or_state_validate(or_state_t *state, char **msg);
|
||||||
|
|
||||||
static int or_state_validate_cb(void *old_options,
|
static int or_state_validate_cb(const void *old_options,
|
||||||
void *options, char **msg);
|
void *options, char **msg);
|
||||||
|
|
||||||
/** Magic value for or_state_t. */
|
/** Magic value for or_state_t. */
|
||||||
@ -268,7 +268,7 @@ validate_transports_in_state(or_state_t *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
or_state_validate_cb(void *old_state, void *state, char **msg)
|
or_state_validate_cb(const void *old_state, void *state, char **msg)
|
||||||
{
|
{
|
||||||
/* We don't use these; only options do. Still, we need to match that
|
/* We don't use these; only options do. Still, we need to match that
|
||||||
* signature. */
|
* signature. */
|
||||||
|
@ -60,7 +60,7 @@ DUMMY_TYPECHECK_INSTANCE(sr_disk_state_t);
|
|||||||
#define SR_DISK_STATE_MAGIC 0x98AB1254
|
#define SR_DISK_STATE_MAGIC 0x98AB1254
|
||||||
|
|
||||||
static int
|
static int
|
||||||
disk_state_validate_cb(void *old_state, void *state, char **msg);
|
disk_state_validate_cb(const void *old_state, void *state, char **msg);
|
||||||
|
|
||||||
/** Array of variables that are saved to disk as a persistent state. */
|
/** Array of variables that are saved to disk as a persistent state. */
|
||||||
static const config_var_t state_vars[] = {
|
static const config_var_t state_vars[] = {
|
||||||
@ -344,7 +344,7 @@ disk_state_validate(const sr_disk_state_t *state)
|
|||||||
|
|
||||||
/** Validate the disk state (NOP for now). */
|
/** Validate the disk state (NOP for now). */
|
||||||
static int
|
static int
|
||||||
disk_state_validate_cb(void *old_state, void *state, char **msg)
|
disk_state_validate_cb(const void *old_state, void *state, char **msg)
|
||||||
{
|
{
|
||||||
/* We don't use these; only options do. */
|
/* We don't use these; only options do. */
|
||||||
(void) old_state;
|
(void) old_state;
|
||||||
|
@ -68,7 +68,7 @@ typedef struct config_deprecation_t {
|
|||||||
* config_dump(); later in our refactoring, it will be cleaned up and used
|
* config_dump(); later in our refactoring, it will be cleaned up and used
|
||||||
* more generally.
|
* more generally.
|
||||||
*/
|
*/
|
||||||
typedef int (*validate_fn_t)(void *oldval,
|
typedef int (*validate_fn_t)(const void *oldval,
|
||||||
void *newval,
|
void *newval,
|
||||||
char **msg_out);
|
char **msg_out);
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ static config_deprecation_t test_deprecation_notes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
test_validate_cb(void *old_options, void *options, char **msg)
|
test_validate_cb(const void *old_options, void *options, char **msg)
|
||||||
{
|
{
|
||||||
(void)old_options;
|
(void)old_options;
|
||||||
(void)msg;
|
(void)msg;
|
||||||
|
Loading…
Reference in New Issue
Block a user