mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Whoops; make or_state_validate conform to validate_fn_t.
Bugfix on 1293835440
, which implemented
6752: Not in any released tor.
This commit is contained in:
parent
25a3ae922f
commit
ccbf1cfacd
@ -91,7 +91,10 @@ static config_var_t state_vars_[] = {
|
|||||||
#undef VAR
|
#undef VAR
|
||||||
#undef V
|
#undef V
|
||||||
|
|
||||||
static int or_state_validate(or_state_t *old_options, or_state_t *options,
|
static int or_state_validate(or_state_t *state, char **msg);
|
||||||
|
|
||||||
|
static int or_state_validate_cb(void *old_options, void *options,
|
||||||
|
void *default_options,
|
||||||
int from_setconf, char **msg);
|
int from_setconf, char **msg);
|
||||||
|
|
||||||
/** Magic value for or_state_t. */
|
/** Magic value for or_state_t. */
|
||||||
@ -110,7 +113,7 @@ static const config_format_t state_format = {
|
|||||||
STRUCT_OFFSET(or_state_t, magic_),
|
STRUCT_OFFSET(or_state_t, magic_),
|
||||||
state_abbrevs_,
|
state_abbrevs_,
|
||||||
state_vars_,
|
state_vars_,
|
||||||
(validate_fn_t)or_state_validate,
|
or_state_validate_cb,
|
||||||
&state_extra_var,
|
&state_extra_var,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -195,21 +198,27 @@ validate_transports_in_state(or_state_t *state)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return 0 if every setting in <b>state</b> is reasonable, and a
|
|
||||||
* permissible transition from <b>old_state</b>. Else warn and return -1.
|
|
||||||
* Should have no side effects, except for normalizing the contents of
|
|
||||||
* <b>state</b>.
|
|
||||||
*/
|
|
||||||
/* XXX from_setconf is here because of bug 238 */
|
|
||||||
static int
|
static int
|
||||||
or_state_validate(or_state_t *old_state, or_state_t *state,
|
or_state_validate_cb(void *old_state, void *state, void *default_state,
|
||||||
int from_setconf, char **msg)
|
int from_setconf, 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. */
|
||||||
(void) from_setconf;
|
(void) from_setconf;
|
||||||
|
(void) default_state;
|
||||||
(void) old_state;
|
(void) old_state;
|
||||||
|
|
||||||
|
return or_state_validate(state, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Return 0 if every setting in <b>state</b> is reasonable, and a
|
||||||
|
* permissible transition from <b>old_state</b>. Else warn and return -1.
|
||||||
|
* Should have no side effects, except for normalizing the contents of
|
||||||
|
* <b>state</b>.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
or_state_validate(or_state_t *state, char **msg)
|
||||||
|
{
|
||||||
if (entry_guards_parse_state(state, 0, msg)<0)
|
if (entry_guards_parse_state(state, 0, msg)<0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -324,7 +333,7 @@ or_state_load(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!badstate && or_state_validate(NULL, new_state, 1, &errmsg) < 0)
|
if (!badstate && or_state_validate(new_state, &errmsg) < 0)
|
||||||
badstate = 1;
|
badstate = 1;
|
||||||
|
|
||||||
if (errmsg) {
|
if (errmsg) {
|
||||||
|
Loading…
Reference in New Issue
Block a user